fix: reuse overseas receiving resources in acceptance

This commit is contained in:
2026-09-11 00:48:21 +08:00
parent 9abb0004dd
commit 7dff9b57ed
8 changed files with 107 additions and 85 deletions
@@ -5,7 +5,7 @@ import test from 'node:test'
import { fileURLToPath } from 'node:url'
import { normalizeModuleOrder } from '../admin-test-env-acceptance.mjs'
import { auxiliaryPalletFbaWarehouseCode, run } from './phase4-overseas-pda-operations.mjs'
import { run } from './phase4-overseas-pda-operations.mjs'
const here = path.dirname(fileURLToPath(import.meta.url))
const source = fs.readFileSync(path.join(here, 'phase4-overseas-pda-operations.mjs'), 'utf8')
@@ -54,6 +54,7 @@ test('P2 to P5 cover all frozen endpoints, replays and conflict boundaries witho
'id(candidate.itemId) !== id(item.itemId)', 'oldLabel: null',
'newLabel: item.fbaCartonMark || item.newSkuCode',
"operationType: changesCartonLabel ? 'CARTON_AND_SKU' : 'SKU_LABEL'", 'skuItems:',
"deliveryMethod: 'TRUCK'", 'printShippingLabel: false',
'P5换标费用冻结后开放PDA作业', 'P5换标完成后钱包结算收敛']) {
assert.ok(source.includes(marker), marker)
}
@@ -65,16 +66,16 @@ test('P2 to P5 cover all frozen endpoints, replays and conflict boundaries witho
assert.match(source, /traceId=/)
})
test('auxiliary pallets use the authoritative inbound FBA code and never the business destination fallback', () => {
assert.equal(auxiliaryPalletFbaWarehouseCode('FBA', ' ABE3 '), 'ABE3')
assert.equal(auxiliaryPalletFbaWarehouseCode('OVERSEAS', 'ABE3'), null)
assert.equal(auxiliaryPalletFbaWarehouseCode('FBA', ''), null)
test('PDA operations reuse received plan pallets and the public location without creating resources', () => {
assert.match(receivingSource,
/destinationType: inbound\.destinationType,[\s\S]*fbaWarehouseCode: inbound\.destinationType === 'FBA' \? inbound\.fbaWarehouseCode : null/)
assert.match(source, /fbaWarehouseCode,\s*\n\s*remark:/)
assert.match(source, /createLocation\(context, fixture\.overseasWarehouseId, `\$\{suffix\}-PALLET`\)/)
assert.match(source, /locationId: location\.locationId/)
assert.doesNotMatch(source, /createEmptyPallet\([^\n]*main\.destinationWarehouseCode/)
/auxiliaryPallets: generatedContainerPallets\.filter/)
assert.match(source, /resolvePublicLocation/)
assert.match(source, /resolveReusableAuxiliaryPallet/)
assert.match(source, /locationType === 'VIRTUAL'/)
assert.match(source, /P3托盘已在公共库位不重复移库/)
assert.doesNotMatch(source, /warehouse-admin[^'`]*\/locations`,\s*\{/)
assert.doesNotMatch(source, /warehouse-admin[^'`]*\/pallets`,\s*\{/)
assert.doesNotMatch(source, /createLocation|createEmptyPallet/)
})
test('fixture failure still disables both picker accounts and removes all transient tokens', async () => {