Merge origin/dev into release/test preserving current workflows

This commit is contained in:
2026-09-14 11:05:48 +08:00
17 changed files with 328 additions and 24 deletions
+24
View File
@@ -6,6 +6,30 @@ const source = await readFile(new URL('../api/pda-loading.js', import.meta.url),
const http = await readFile(new URL('../api/http.js', import.meta.url), 'utf8')
const page = await readFile(new URL('../pages/picking/picking.vue', import.meta.url), 'utf8')
test('sealed pallets use a single authoritative pallet command and prohibit partial picking', () => {
assert.match(source, /pallets\/pick/)
assert.match(page, /submitImmediateItemAction\(item, 'PICK_PALLET', \{ palletNo: item.palletNo \}\)/)
assert.match(page, /整托货物不能跳拣/)
assert.match(page, /整托货物不能部分拣货/)
assert.match(page, /expectedTaskVersion: Number\(this.pickingVersion\)/)
})
test('DP scan records success only after the atomic server command succeeds', async () => {
const method = page.match(/async pickScannedPallet\(item, palletNo\) \{[\s\S]*?\n\t\t\t\},/)?.[0]
assert.ok(method)
const behavior = new Function('ITEM_STATUS', 'return ({' + method + '})')({ PICKED: 'picked' })
const item = { id: '1', palletNo: 'DP-260914-0001', qty: 5 }
const calls = []
let succeeds = false
const context = { itemStates: {}, partialQuantities: {}, scannedBoxCodes: {}, async submitImmediateItemAction(...args) { calls.push(args); return succeeds }, recordScanResult() {}, showToast() {}, persistSession() {} }
assert.equal(await behavior.pickScannedPallet.call(context, item, item.palletNo), false)
assert.deepEqual(context.itemStates, {})
succeeds = true
assert.equal(await behavior.pickScannedPallet.call(context, item, item.palletNo), true)
assert.deepEqual(context.itemStates, { 1: 'picked' })
assert.deepEqual(calls[0], [item, 'PICK_PALLET', { palletNo: item.palletNo }])
assert.deepEqual(calls[0], calls[1])
})
test('PDA loading adapter uses only task-scoped cabinet evidence paths', () => {
for (const path of [
'/first-leg/pda-loading/tasks/pending'