This commit is contained in:
2026-09-03 16:09:22 +08:00
parent 904b495613
commit dac02e5253
6 changed files with 63 additions and 38 deletions
+9 -9
View File
@@ -496,7 +496,7 @@ async function assertDimensionConfig(context, tenantId) {
&& Number(rule.innerWidthCm) === box.widthCm && Number(rule.innerHeightCm) === box.heightCm
&& Number(rule.edgeAdditionCm) === 2
})
context.assert(MODULE, '固定四箱型顺序、内径及每边加2cm正确', response,
context.assert(MODULE, '固定四箱型顺序、内径及各尺寸增加2cm正确', response,
rules.length === BOXES.length && exact,
`types=${rules.map((rule) => rule.boxType).join(',') || 'missing'}`, CONTRACT_OPTIONS)
}
@@ -684,8 +684,14 @@ export async function run(context) {
`/api/platform/v1/orders/first-leg/${encodeURIComponent(orderId)}/approve?tenantId=${encodeURIComponent(tenantId)}`)
context.apiSuccess(MODULE, 'Admin 审核通过本轮订单', approveResponse, `orderId=${orderId}`)
// The declaration API deliberately accepts APPROVED only. Do this before waiting for
// asynchronous inbound/task convergence, which may move the order into fulfilment.
// APPROVED declaration edits fail closed against the authoritative Firstleg projection.
// Wait for the approval outbox to create that projection before exercising the edit API.
const inboundResult = await waitForInbound(context, tenantId, orderId)
const inboundId = id(inboundResult.detail?.summary?.inboundId)
if (!inboundId || !inboundResult.task) {
throw new Error('订单审核后的入库单与履约任务未在30秒内收敛,无法修改申报并向 OCR/墨家模块交接')
}
const editableDetailResponse = await context.request('GET', firstLegDetailPath)
const editableDetail = context.apiSuccess(MODULE, 'Admin 读取审核后客户申报资料', editableDetailResponse)
const declarationDetail = editableDetail?.order?.order ? editableDetail.order : editableDetail
@@ -719,12 +725,6 @@ export async function run(context) {
staleDeclarationResponse.http === 200 && String(staleDeclarationResponse.body?.code) === 'A0409',
`code=${staleDeclarationResponse.body?.code ?? 'missing'}`, CONTRACT_OPTIONS)
const inboundResult = await waitForInbound(context, tenantId, orderId)
const inboundId = id(inboundResult.detail?.summary?.inboundId)
if (!inboundId || !inboundResult.task) {
throw new Error('订单审核后的入库单与履约任务未在30秒内收敛,无法向 OCR/墨家模块交接')
}
const inboundPath = `/api/platform/inbounds/${encodeURIComponent(inboundId)}?tenantId=${encodeURIComponent(tenantId)}`
const inboundResponse = await context.request('GET', inboundPath)
const inbound = context.apiSuccess(MODULE, 'Admin 查询本轮入库单详情', inboundResponse,