fix: preserve overseas pallet identity

This commit is contained in:
2026-08-25 08:12:58 +08:00
parent 73d206e3f3
commit 85a288e4f2
4 changed files with 72 additions and 10 deletions
@@ -154,9 +154,9 @@ async function verifyTransfer(context, token, orders) {
const created = await merchant(context, token, 'POST', '客户创建仓储转运申请', TRANSFER, body)
const transferNo = id(created.data?.transferNo)
context.assert(MODULE, '仓储转运申请进入合法待审核状态且绑定本轮来源订单', created.response,
Boolean(transferNo) && created.data?.status === 'PENDING_REVIEW'
Boolean(transferNo) && created.data?.orderStatus === 'PENDING_REVIEW'
&& created.data?.sourceOrders?.some((item) => id(item?.lastlegOrderId) === id(order.row.id)),
`transferNo=${transferNo || 'missing'}, status=${created.data?.status || 'missing'}; ${trace(created.response)}`, OPTIONS)
`transferNo=${transferNo || 'missing'}, status=${created.data?.orderStatus || 'missing'}; ${trace(created.response)}`, OPTIONS)
if (!transferNo) return false
const replay = await merchant(context, token, 'POST', '客户仓储转运申请幂等重放', TRANSFER, body)
context.assert(MODULE, '转运重放复用同一申请', replay.response,
@@ -170,9 +170,9 @@ async function verifyTransfer(context, token, orders) {
const detail = await merchant(context, token, 'GET', '客户查询自身仓储转运详情',
`${TRANSFER}/${encodeURIComponent(transferNo)}`)
context.assert(MODULE, '转运详情保持待审核且不产生出库履约事实', detail.response,
id(detail.data?.transferNo) === transferNo && detail.data?.status === 'PENDING_REVIEW'
id(detail.data?.transferNo) === transferNo && detail.data?.orderStatus === 'PENDING_REVIEW'
&& detail.data?.outboundAt == null && Array.isArray(detail.data?.allocations) && detail.data.allocations.length === 0,
`status=${detail.data?.status || 'missing'}, allocations=${detail.data?.allocations?.length ?? 'missing'}; ${trace(detail.response)}`, OPTIONS)
`status=${detail.data?.orderStatus || 'missing'}, allocations=${detail.data?.allocations?.length ?? 'missing'}; ${trace(detail.response)}`, OPTIONS)
context.createdResources.phase4OverseasClientServices.transferNo = transferNo
return true
}
@@ -44,11 +44,11 @@ async function inboundAdminLifecycle(context) {
const plan = await request(context, 'POST', '尾程入仓单转换为入仓计划', `${PLAN_BASE}/convert`, convertBody)
const replay = await request(context, 'POST', '重复转换返回同一入仓计划', `${PLAN_BASE}/convert`, convertBody)
context.assert(MODULE, '入仓计划转换天然幂等', null,
Boolean(plan?.plan?.planNo) && replay?.plan?.planNo === plan.plan.planNo,
`first=${plan?.plan?.planNo || 'missing'}, replay=${replay?.plan?.planNo || 'missing'}`, OPTIONS)
const planNo = plan?.plan?.planNo
const fbaLines = (plan?.lines || []).filter((line) => line?.destinationType === 'FBA'
&& line?.fbaWarehouseCode && line?.destinationWarehouseId)
Boolean(plan?.planNo) && replay?.planNo === plan.planNo,
`first=${plan?.planNo || 'missing'}, replay=${replay?.planNo || 'missing'}`, OPTIONS)
const planNo = plan?.planNo
const fbaLines = (plan?.lines || []).filter((line) => line?.fbaWarehouseCode
&& line?.destinationWarehouseId)
context.assert(MODULE, 'FBA入仓计划包含可预约明细', null,
Boolean(planNo) && fbaLines.length > 0,
`planNo=${planNo || 'missing'}, fbaLines=${fbaLines.length}`, OPTIONS)