fix(pda): stage sealed pallet scans for atomic batch picking

This commit is contained in:
2026-09-09 12:29:46 +08:00
parent 0745e9600c
commit b19cecb54f
10 changed files with 136 additions and 11 deletions
+14
View File
@@ -7,6 +7,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 }
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('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'] }]
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')
})
test('createItemStates initializes every item as pending', () => {
assert.deepEqual(state.createItemStates(items), {
1: state.ITEM_STATUS.PENDING,