feat: enforce canonical container identity across regions
This commit is contained in:
@@ -126,7 +126,7 @@ async function readInbound(context, fixture) {
|
||||
|
||||
async function createConfirmedContainer(context, source, label) {
|
||||
const value = suffix(context, label)
|
||||
const containerNo = `MAN-${value}`.slice(0, 64)
|
||||
const containerNo = iso6346ContainerNumber(`${context.marker}-manual-${label}`)
|
||||
const summary = source.detail.summary
|
||||
const agentResponse = await context.request('GET',
|
||||
'/api/platform/v1/suppliers?tenantId=0&category=BOOKING&status=ACTIVE&page=1&size=20')
|
||||
@@ -201,18 +201,7 @@ async function createPlanTask(context, label) {
|
||||
expectedVersion: Number(plan.version), operationId: operationId(context, `${label}-assign`),
|
||||
})
|
||||
plan = context.apiSuccess(MODULE, `${label} 分配独立候选货物`, assignResponse, '', OPTIONS)
|
||||
const detailResponse = await context.request('GET', `${CONTAINERS}/${containerId}`)
|
||||
const container = context.apiSuccess(MODULE, `${label} 读取柜次`, detailResponse, '', OPTIONS)
|
||||
const containerNo = `MAN-${suffix(context, label)}`.slice(0, 64)
|
||||
const transportResponse = await context.request('PATCH', `${CONTAINERS}/${containerId}/transport`, {
|
||||
containerNo, voyageNo: `V-${suffix(context, label)}`.slice(0, 64), version: Number(container.version),
|
||||
reason: `${context.marker} 人工状态样本`,
|
||||
})
|
||||
const transported = context.apiSuccess(MODULE, `${label} 写入真实集装箱号并开放 PDA`, transportResponse, '', OPTIONS)
|
||||
if (transported?.containerNo !== containerNo || id(transported?.id) !== containerId
|
||||
|| transported?.cabinetNo !== container?.cabinetNo) {
|
||||
throw new Error(`${label} 真实集装箱号未绑定到稳定柜次`)
|
||||
}
|
||||
const containerNo = iso6346ContainerNumber(`${context.marker}-manual-${label}`)
|
||||
const pushResponse = await post(context, `${SMART}/plans/${plan.id}/push-preload`,
|
||||
{ expectedVersion: Number(plan.version) }, `${label}-push`)
|
||||
plan = context.apiSuccess(MODULE, `${label} 补真实柜号后推送预装`, pushResponse, '', OPTIONS)
|
||||
@@ -484,3 +473,4 @@ export async function run(context, matrix = context.createdResources.manualState
|
||||
|
||||
await completeSimpleDocuments(context, completed, matrix)
|
||||
}
|
||||
import { iso6346ContainerNumber } from './iso6346-container-number.mjs'
|
||||
|
||||
Reference in New Issue
Block a user