fix: complete overseas PDA inventory ledgers

This commit is contained in:
2026-09-02 01:47:00 +08:00
parent cc02037f78
commit 666add1cf9
8 changed files with 48 additions and 6 deletions
@@ -4,7 +4,7 @@ import path from 'node:path'
import test from 'node:test'
import { fileURLToPath } from 'node:url'
import { run } from './phase4-overseas-pda.mjs'
import { expandOverseasCartonCandidates, run } from './phase4-overseas-pda.mjs'
const here = path.dirname(fileURLToPath(import.meta.url))
const source = fs.readFileSync(path.join(here, 'phase4-overseas-pda.mjs'), 'utf8')
@@ -61,7 +61,8 @@ test('PDA module covers the container-number receiving contract and excludes out
assert.match(source, /const cartonCandidates =/)
assert.doesNotMatch(source, /current\/skus\/resolve/)
assert.doesNotMatch(source, /skuCode:/)
assert.match(source, /FBA和OVERSEAS箱码resolve都必须HTTP 200\/code 200并返回当前柜唯一入仓码/)
assert.match(source, /FBA箱码与OVERSEAS真实manifest箱码必须HTTP 200\/code 200并返回当前柜唯一入仓码/)
assert.match(source, /排除未实装箱码候选/)
assert.match(source, /const matches = inbounds\.filter/)
assert.match(source, /!Array\.isArray\(resolved\?\.inboundCode\)/)
assert.match(source, /matches\.length === 1/)
@@ -102,6 +103,19 @@ test('PDA module covers the container-number receiving contract and excludes out
assert.doesNotMatch(source, /awaitProducerCandidates/)
})
test('OVERSEAS carton discovery probes the frozen sequence and lets the server exclude skipped cartons', () => {
assert.deepEqual(expandOverseasCartonCandidates([
{ inboundCode: 'NYEXX2609020042', destinationType: 'OVERSEAS' },
{ inboundCode: 'FBA2609020001', destinationType: 'FBA' },
], ['NYEXX2609020042#8-5', 'NYEXX2609020042#8-2', 'NYEXX2609020042#8-1']), [
'NYEXX2609020042#8-1', 'NYEXX2609020042#8-2', 'NYEXX2609020042#8-3', 'NYEXX2609020042#8-4',
'NYEXX2609020042#8-5', 'NYEXX2609020042#8-6', 'NYEXX2609020042#8-7', 'NYEXX2609020042#8-8',
])
assert.deepEqual(expandOverseasCartonCandidates([
{ inboundCode: 'NYEXX2609020042', destinationType: 'OVERSEAS' },
], ['NYEXX2609020042#2001-1']), [])
})
test('real-device legacy FBA carton rejection is retained as regression evidence', () => {
const evidence = {
http: 200,