fix: prefer pending pallet for carton scan

This commit is contained in:
2026-09-20 16:10:48 +08:00
parent 117431a4fb
commit 1e171ec81c
2 changed files with 16 additions and 1 deletions
+11
View File
@@ -149,3 +149,14 @@ test('sealed pallet resolves either its DP code or any member carton as one whol
status: state.ITEM_STATUS.PICKED,
})
})
test('a carton duplicated by a stale task payload selects the remaining sealed pallet', () => {
const picked = { id: 1, unitType: 'SEALED_PALLET', palletNo: 'DP-260920-0001', boxCodes: ['EXXHWK2809191198#20-01'] }
const pending = { id: 2, unitType: 'SEALED_PALLET', palletNo: 'DP-260920-0002', boxCodes: ['EXXHWK2809191198#20-01', 'EXXHWK2809191198#20-19'] }
assert.deepEqual(state.classifyScan([picked, pending], {
1: state.ITEM_STATUS.PICKED,
2: state.ITEM_STATUS.PENDING,
}, 'EXXHWK2809191198#20-19'), {
type: 'pallet', item: pending, matchedBy: 'carton',
})
})