保留待确认箱后的排队扫码并阻止提前结束收货

This commit is contained in:
2026-11-04 14:47:41 +08:00
parent a42ecf4a59
commit 8199234bd7
2 changed files with 43 additions and 3 deletions
+40
View File
@@ -88,6 +88,46 @@ test('queued pallet scan follows the current step while a pending carton require
assert.deepEqual(calls, [['pallet', 'PAL-A'], ['carton', 'IN-A#2']])
})
test('queued carton remains pending until the current carton receipt is confirmed', async t => {
store.resetReceivingSession(); store.setCurrentReceiving(sessionValue())
store.receiving.resolvedCarton = { inboundCode: 'IN-A', cartonMark: 'IN-A#1', destinationType: 'OVERSEAS' }
store.receiving.resolvedPallet = { palletCode: 'PAL-A', compatible: true }
const { vm } = page()
t.after(() => vm.suspendReceiving())
const parsed = []
vm.resolveCarton = value => parsed.push(value)
vm.palletInput = 'PAL-A'; vm.activeTarget = 'carton'
vm.scanQueue = [{ value: 'IN-A#2', target: 'carton' }]
vm.drainScanQueue()
assert.equal(vm.scanQueue.length, 1)
assert.deepEqual(parsed, [])
vm.clearReceiptContext()
await new Promise(resolve => setTimeout(resolve, 5))
assert.deepEqual(parsed, ['IN-A#2'])
assert.equal(vm.scanQueue.length, 0)
})
test('cannot finish a container while an overseas carton awaits receipt confirmation', async t => {
store.resetReceivingSession(); store.setCurrentReceiving(sessionValue())
store.receiving.resolvedCarton = { inboundCode: 'IN-A', cartonMark: 'IN-A#1', destinationType: 'OVERSEAS' }
store.receiving.resolvedPallet = { palletCode: 'PAL-A', compatible: true }
let completions = 0
const { vm } = page({ completeCurrentReceiving: async () => {
completions++
return sessionValue({ status: 'COMPLETED_WITH_DIFFERENCE' })
} })
t.after(() => vm.suspendReceiving())
vm.applyCurrentReceiving = async () => {}
vm.palletInput = 'PAL-A'; vm.activeTarget = 'carton'
await vm.completeContainer()
assert.equal(completions, 0)
vm.clearReceiptContext()
await vm.completeContainer()
assert.equal(completions, 1)
})
test('an incompatible pallet never reports success and a corrected scan can be validated normally', async t => {
store.resetReceivingSession(); store.setCurrentReceiving(sessionValue())
store.receiving.resolvedCarton = { inboundCode: 'IN-A', cartonMark: 'IN-A#22-1', destinationType: 'FBA' }