fix(pda): enforce sealed pallet contract and deduplicate activation refresh
This commit is contained in:
@@ -8,14 +8,20 @@ const state = await import(`data:text/javascript;base64,${Buffer.from(source).to
|
||||
const items = [{ id: 1 }, { id: 2 }, { id: 3 }]
|
||||
|
||||
test('sealed pallet matches its DP code and never accepts an individual carton', () => {
|
||||
const pallet = { id: '1', unitType: 'PALLET', indivisible: true, palletNo: 'DP-260909-0143', boxCodes: ['IN#2-1', 'IN#2-2'], qty: 2 }
|
||||
const pallet = { id: '1', unitType: 'SEALED_PALLET', indivisible: true, palletNo: 'DP-260909-0143', boxCodes: ['IN#2-1', 'IN#2-2'], qty: 2 }
|
||||
assert.equal(state.classifyScan([pallet], {}, 'IN#2-1').type, 'unknown')
|
||||
assert.equal(state.classifyScan([pallet], {}, pallet.palletNo).type, 'pending')
|
||||
assert.equal(state.classifyScan([pallet], { 1: state.ITEM_STATUS.PICKED }, pallet.palletNo).type, 'processed')
|
||||
})
|
||||
|
||||
test('only the authoritative sealed-pallet unit type selects pallet behavior', () => {
|
||||
assert.equal(state.isPalletItem({ unitType: 'SEALED_PALLET', indivisible: true }), true)
|
||||
assert.equal(state.isPalletItem({ unitType: 'PALLET', indivisible: true }), false)
|
||||
assert.equal(state.isPalletItem({ unitType: 'PACKAGE', indivisible: true }), false)
|
||||
})
|
||||
|
||||
test('mixed task keeps package scanning separate from sealed pallet scanning', () => {
|
||||
const mixed = [{ id: '1', unitType: 'PALLET', palletNo: 'DP-260909-0001', boxCodes: ['BOX-1'] }, { id: '2', unitType: 'PACKAGE', boxCodes: ['BOX-2'] }]
|
||||
const mixed = [{ id: '1', unitType: 'SEALED_PALLET', palletNo: 'DP-260909-0001', boxCodes: ['BOX-1'] }, { id: '2', unitType: 'PACKAGE', boxCodes: ['BOX-2'] }]
|
||||
assert.equal(state.classifyScan(mixed, {}, 'BOX-2').item.id, '2')
|
||||
assert.equal(state.classifyScan(mixed, {}, 'DP-260909-0001').item.id, '1')
|
||||
assert.equal(state.classifyScan(mixed, {}, 'BOX-1').type, 'unknown')
|
||||
|
||||
Reference in New Issue
Block a user