fix(dispatch): confirm scanned loading without repeated measurements

This commit is contained in:
2026-10-21 18:44:26 +08:00
parent 6088ff10c2
commit 538a63c635
20 changed files with 105 additions and 73 deletions
@@ -143,9 +143,9 @@ function server(fault = '') {
}
assert.equal(detail.stage, 'LOADING'); assert.equal(detail.counts.pickedPackageCount, 3)
assert.equal(body.recordVersion, detail.recordVersion); assert.equal(body.manifestHash, 'REAL-MANIFEST')
assert.deepEqual(body.measurements, [{ warehousePalletId: PALLET, palletSpaces: 2, weightKg: '187.25', volumeCbm: '1.375', deliveryIndex: 1 }])
assert.equal('measurements' in body, false)
loadingActors.set(body.idempotencyKey, token ? 'PDA' : 'PLATFORM')
detail.stage = 'DELIVERING'; bump(); return remember('LOADING_COMPLETE', body, { confirmedLoad: { manifestHash: body.manifestHash, pallets: body.measurements } })
detail.stage = 'DELIVERING'; bump(); return remember('LOADING_COMPLETE', body, { confirmedLoad: { manifestHash: body.manifestHash, pallets: [{ warehousePalletId: PALLET, palletSpaces: 1, weightKg: '187.25', volumeCbm: '1.375', deliveryIndex: 1 }] } })
}
if (method === 'GET' && path.startsWith(`${F}/resource-occupancy?`)) {
const query = new URL(`https://unused.test${path}`).searchParams, kind = query.get('kind')
@@ -313,7 +313,7 @@ test('PDA original-actor replay restores loading while another platform actor is
assert.equal(proof.loadingCommand.platformPositiveLoading, 'PENDING_SEPARATE_SCENARIO')
assert.deepEqual(proof.loadingCommand.beforeReplay, proof.loadingCommand.afterReplay)
assert.equal(proof.loadingCommand.platformReplay, undefined)
assert.equal(writes[0].body.measurements[0].weightKg, '187.25')
assert.equal('measurements' in writes[0].body, false)
assert.ok(s.calls.every(c => !/\/fleet\/trips\/.*\/(?:assignment|loading-review|loading)$/.test(c.path)))
const count = s.calls.length
await assert.rejects(confirmFleetLoading(s.context, 'native', proof, 'PDA', receipt()), /已开始/)
@@ -347,10 +347,11 @@ for (const fault of ['edit-mutates-on-rejection', 'replay-new-version']) test(`l
if (fault === 'edit-mutates-on-rejection') assert.equal(s.calls.some(c => c.path.endsWith('/loading-complete')), false)
})
test('missing actual producer measurement blocks before any edit rejection or loading write', async () => {
const s = server(), proof = await prepare(s); s.pick(); const count = s.calls.length
await assert.rejects(confirmFleetLoading(s.context, 'native', proof, 'PDA'), /palletSpaces/)
assert.equal(s.calls.length, count + 1); assert.equal(s.calls.at(-1).method, 'GET')
test('scanned loading no longer requires the operator to supply a measurement receipt', async () => {
const s = server(), proof = await prepare(s); s.pick()
await confirmFleetLoading(s.context, 'native', proof, 'PDA')
assert.equal(proof.loadingCommand.result.stage, 'DELIVERING')
assert.equal('measurements' in proof.loadingCommand.body, false)
})
test('wrong-run producer receipt and unreconciled picking block loading without mutation', async () => {