优化
This commit is contained in:
@@ -4,7 +4,7 @@ import test from 'node:test'
|
||||
|
||||
import { selectCustomsFlow } from './phase3-customs.mjs'
|
||||
import { buildFinalizeResource } from './phase3-loading-finalize.mjs'
|
||||
import { selectContainerLoadingFixture } from './phase3-container-loading.mjs'
|
||||
import { selectContainerLoadingFixture, selectPlatformChannelIsolationPair } from './phase3-container-loading.mjs'
|
||||
import { AcceptanceRun, normalizeModuleOrder, parseArguments } from '../admin-test-env-acceptance.mjs'
|
||||
|
||||
function source(name) {
|
||||
@@ -141,7 +141,8 @@ test('container loading creates and confirms booking before scoped candidates',
|
||||
"const planResponse = await request(context, 'POST', `${SMART}/plans`",
|
||||
"const assignResponse = await request",
|
||||
])
|
||||
assert.match(value, /channelCode: channelCode/)
|
||||
assert.match(value, /channelCode, warehouseId, warehouseName/)
|
||||
assert.match(value, /publishPlatformLogisticsChannels\(context, warehouseId, MODULE\)/)
|
||||
assert.match(value, /warehouseId, warehouseName/)
|
||||
const draft = value.slice(value.indexOf('const bookingDraft = {'), value.indexOf('context.assert(MODULE, \'订舱渠道与仓库快照完整\''))
|
||||
assert.doesNotMatch(draft, /billOfLadingNo|vesselName|voyageNo|estimatedSailingAt|estimatedArrivalAt/)
|
||||
@@ -182,12 +183,46 @@ test('container loading keeps an unmatched candidate so marker failure stays obs
|
||||
assert.equal(selected.marker, 'ADMIN-RUN-CAB')
|
||||
})
|
||||
|
||||
test('channel isolation accepts only two active channels from the current platform warehouse catalog', () => {
|
||||
const selected = selectPlatformChannelIsolationPair({
|
||||
marker: 'ADMIN-RUN-AUTO1', originWarehouseId: '41',
|
||||
sourcePath: '/api/platform/v1/frozen-channel-contract?originWarehouseId=41',
|
||||
channels: [
|
||||
{ channelCode: 'SEA-A', channelName: '海运 A', status: 'ACTIVE' },
|
||||
{ channelCode: 'SEA-B', channelName: '海运 B', status: 'ACTIVE' },
|
||||
{ channelCode: 'SEA-C', channelName: '海运 C', status: 'DISABLED' },
|
||||
],
|
||||
}, 'ADMIN-RUN-AUTO1', '41', 'SEA-A')
|
||||
assert.deepEqual(selected.pair, {
|
||||
primary: { channelCode: 'SEA-A', channelName: '海运 A' },
|
||||
foreign: { channelCode: 'SEA-B', channelName: '海运 B' },
|
||||
})
|
||||
assert.equal(selected.reason, null)
|
||||
})
|
||||
|
||||
test('channel isolation reports BLOCKED_FIXTURE instead of inventing a second channel', () => {
|
||||
for (const catalog of [
|
||||
{ marker: 'OLD-RUN', originWarehouseId: '41', sourcePath: '/api/platform/v1/channels', channels: [] },
|
||||
{ marker: 'ADMIN-RUN-AUTO1', originWarehouseId: '42', sourcePath: '/api/platform/v1/channels', channels: [] },
|
||||
{ marker: 'ADMIN-RUN-AUTO1', originWarehouseId: '41', sourcePath: '/api/merchant/v1/first-leg/pricing/channels', channels: [] },
|
||||
{ marker: 'ADMIN-RUN-AUTO1', originWarehouseId: '41', sourcePath: '/api/platform/v1/channels',
|
||||
channels: [{ channelCode: 'SEA-A', channelName: '海运 A', status: 'ACTIVE' }] },
|
||||
]) {
|
||||
const selected = selectPlatformChannelIsolationPair(catalog, 'ADMIN-RUN-AUTO1', '41', 'SEA-A')
|
||||
assert.equal(selected.pair, null)
|
||||
assert.match(selected.reason, /^BLOCKED_FIXTURE:/)
|
||||
}
|
||||
const value = source('./phase3-container-loading.mjs')
|
||||
assert.doesNotMatch(value, /foreignChannelCode|\$\{channelCode\}-OTHER|异渠道-\$\{suffix\}/)
|
||||
assert.match(value, /context\.createdResources\?\.platformLogisticsChannels/)
|
||||
})
|
||||
|
||||
test('container loading enforces channel isolation and stable PDA identity across container number changes', () => {
|
||||
const value = source('./phase3-container-loading.mjs')
|
||||
assertOrder(value, [
|
||||
'确认订舱并自动生成真实柜次',
|
||||
'创建异渠道隔离订舱',
|
||||
'异渠道入库单拒绝装入当前柜次',
|
||||
'创建真实异渠道隔离订舱',
|
||||
'两个真实有效渠道之间拒绝跨渠道装柜',
|
||||
'无真实柜号时计划可排柜但 PDA 任务不开放',
|
||||
'在放舱前绑定本轮真实箱号',
|
||||
'订舱 CONFIRMED 即使已有真实柜号也不开放 PDA 任务',
|
||||
|
||||
Reference in New Issue
Block a user