优化
This commit is contained in:
@@ -4,7 +4,36 @@ import path from 'node:path'
|
||||
import test from 'node:test'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
import { expandOverseasCartonCandidates, resolveCartonFixtures, run, uniqueContainerProducer } from './phase4-overseas-pda.mjs'
|
||||
import { expandOverseasCartonCandidates, resolveCartonFixtures, run, uniqueContainerProducer,
|
||||
crossContainerCartonProbe } from './phase4-overseas-pda.mjs'
|
||||
|
||||
test('same-root FBA cross-container rejection uses explicit real receiving prefix while preserving original physical box code',() => {
|
||||
const current={containerNo:'ROOT-CABINET',inbounds:[{inboundCode:'ROOT'}]}
|
||||
const child={containerNo:'CHILD-CABINET',containerBookingId:'20',sourceOrderId:'101',sourceInboundId:'201',
|
||||
sourceStatus:'LOADED',inboundCode:'CHILD',destinationType:'FBA',fulfillmentType:'STANDARD',
|
||||
cartonMarks:['ROOT#2-1'],receivingCartonMarks:['CHILD#PDA-CONTRACT-1']}
|
||||
const before=JSON.stringify(child),probe=crossContainerCartonProbe([child],current)
|
||||
assert.equal(probe.cartonMark,'CHILD#PDA-CONTRACT-1')
|
||||
assert.equal(probe.mode,'FBA_RECEIVING_PREFIX');assert.equal(probe.sourceOrderId,'101')
|
||||
assert.equal(JSON.stringify(child),before)
|
||||
for(const fault of [
|
||||
{...child,receivingCartonMarks:undefined}, {...child,receivingCartonMarks:['ROOT#PDA-CONTRACT-1']},
|
||||
{...child,receivingCartonMarks:['CHILD#PDA-CONTRACT-']}, {...child,receivingCartonMarks:['CHILD#PDA-CONTRACT-0']},
|
||||
{...child,containerNo:'ROOT-CABINET'}, {...child,sourceOrderId:null}, {...child,sourceInboundId:null},
|
||||
{...child,containerBookingId:null}, {...child,sourceStatus:'WAIT_SPLIT'}, {...child,inboundCode:'ROOT'},
|
||||
])assert.equal(crossContainerCartonProbe([fault],current),null)
|
||||
assert.equal(crossContainerCartonProbe([],current),null)
|
||||
assert.equal(crossContainerCartonProbe([child],{containerNo:'ROOT-CABINET',inbounds:[]}),null)
|
||||
})
|
||||
test('physical OVERSEAS and dropship probes still require another real loaded producer and keep the exact sealed code',() => {
|
||||
const other={containerNo:'OTHER',containerBookingId:'20',sourceOrderId:'101',sourceInboundId:'201',
|
||||
sourceStatus:'LOADED',inboundCode:'OTHER-SOURCE',destinationType:'OVERSEAS',fulfillmentType:'STANDARD',
|
||||
cartonMarks:['ORIGINAL-PHYSICAL#2-1']}
|
||||
const current={containerNo:'CURRENT',inbounds:[{inboundCode:'CURRENT-SOURCE'}]}
|
||||
assert.equal(crossContainerCartonProbe([other],current).cartonMark,'ORIGINAL-PHYSICAL#2-1')
|
||||
assert.equal(crossContainerCartonProbe([other],current).mode,'PHYSICAL_CARTON')
|
||||
assert.equal(crossContainerCartonProbe([{...other,sourceInboundId:null}],current),null)
|
||||
})
|
||||
|
||||
test('receiving selects one current booking and supplies mandatory booking identity', () => {
|
||||
assert.match(source, /id\(item.sourceContainerBookingId\) === preferredBookingId/)
|
||||
|
||||
Reference in New Issue
Block a user