整批提交原子性的方案

This commit is contained in:
2026-09-11 18:14:35 +08:00
parent 1b45a4f2ec
commit 28c574ae36
7 changed files with 114 additions and 19 deletions
+5 -2
View File
@@ -39,7 +39,7 @@ test('C02 identifiers and separate picking/inbound versions are normalized expli
assert.match(source, /pickingVersion: row\.pickingVersion \?\? row\.loading\?\.pickingVersion/)
assert.match(source, /pickingVersion: task\.pickingVersion \?\? task\.version/)
assert.match(page, /version: Number\(this\.pickingVersion\)/)
assert.match(page, /ITEM_STATUS, classifyScan, createItemStates, getPickSummary, submitStates/)
assert.match(page, /ITEM_STATUS, classifyScan, createItemStates, getPickSummary, isSealedPalletItem, submitStates/)
assert.match(page, /taskItemId: item\.id \?\? item\.itemId/)
assert.match(page, /submit\.batch/)
assert.match(page, /item\.itemStatus === 'PICKED'/)
@@ -117,7 +117,10 @@ test('PDA cabinet picking adapter claims online and submits one atomic batch', (
assert.match(source, /slice\(0, 128\)/)
assert.match(page, /claimContainerPickingTask\(/)
assert.match(page, /submitContainerPickingBatch\(/)
assert.match(page, /任务版本已变化,请刷新后重试/)
assert.match(source, /palletNo: action\.type === 'PICK_PALLET' \? action\.palletNo : null/)
assert.match(page, /type: 'PICK_PALLET'[\s\S]*?palletNo: item\.palletNo/)
assert.match(page, /扫描托盘码[\s\S]*?托内任一箱码/)
assert.match(page, /sanitizeUserMessage\(error\.message, '任务状态已变化,请刷新后重试'\)/)
assert.match(source, /data: \{ warehouseId, loadingPlanId: task\.loadingPlanId, containerBookingId: task\.containerBookingId, expectedVersion, inventorySnapshotToken, items \}/)
assert.doesNotMatch(source.match(/export async function submitContainerPickingBatch[\s\S]*?\n\}/)?.[0] || '', /releaseMode|locationIds|reservationIds/)
assert.doesNotMatch(source, /query\.push\(`containerNo=/)
+3 -2
View File
@@ -23,9 +23,10 @@ test('demo claim supports the PDA broadcast and normalized manual input without
assert.match(page, /result\.type === 'processed'[\s\S]*?重复扫描[\s\S]*?return/)
})
test('demo batch freezes inventory and submits PICK, SKIP and PARTIAL under one stable key', () => {
test('demo batch freezes inventory and submits carton or whole-pallet actions under one stable key', () => {
const submit = page.match(/async performSubmit\(incompleteReason = ''\) \{[\s\S]*?\n\t\t\t\},/)?.[0] || ''
for (const action of ['PICK', 'SKIP', 'PARTIAL']) assert.match(submit, new RegExp(`type: '${action}'`))
for (const action of ['PICK', 'SKIP', 'PARTIAL', 'PICK_PALLET']) assert.match(submit, new RegExp(`type: '${action}'`))
assert.match(submit, /palletNo: item\.palletNo/)
assert.match(submit, /const submitId = this\.submitId \|\| stableOperationId\('submit'/)
assert.match(submit, /this\.submitId = submitId/)
assert.match(submit, /const inventorySnapshot = await this\.refreshInventorySnapshot\(\)[\s\S]*?submitContainerPickingBatch/)
+28
View File
@@ -92,3 +92,31 @@ test('classifyScan distinguishes pending, repeated, and unknown carton codes', (
item: null,
})
})
test('sealed pallet resolves either its DP code or any member carton as one whole-pallet action', () => {
const pallet = {
id: 9,
unitType: 'SEALED_PALLET',
palletId: '2098348162978738179',
palletNo: 'DP-260911-0047',
indivisible: true,
boxCodes: ['BOX-001', 'BOX-002'],
}
assert.deepEqual(state.classifyScan([pallet], {}, 'DP-260911-0047'), {
type: 'pallet',
item: pallet,
})
assert.deepEqual(state.classifyScan([pallet], {}, 'BOX-001'), {
type: 'pallet',
item: pallet,
matchedBy: 'carton',
})
assert.deepEqual(state.classifyScan([pallet], {
9: state.ITEM_STATUS.PICKED,
}, 'DP-260911-0047', { 'DP-260911-0047': 9 }), {
type: 'processed',
item: pallet,
status: state.ITEM_STATUS.PICKED,
})
})