fix: complete pallet code cross-region flow

This commit is contained in:
2026-09-09 19:14:47 +08:00
parent 7678fd85ff
commit e30255ff58
9 changed files with 175 additions and 9 deletions
@@ -350,6 +350,24 @@ async function convertReceivingContainers(context, producers) {
&& convertedInboundCodes.size === inboundCodes,
`plans=${plans.length}, inboundCodes=${convertedInboundCodes.size}, expected=${inboundCodes}; ${trace(convertedResponse)}`, OPTIONS)
if (plans.length !== inboundCodes) return false
const actualPalletCodes = plans.flatMap((item) => Array.isArray(item?.pallets) ? item.pallets : [])
.map((pallet) => id(pallet?.palletNo)).filter(nonBlank).sort()
const expectedPalletCodes = (producer?.palletLabelManifest?.groups || [])
.flatMap((group) => group?.labels || []).map((label) => id(label?.palletCode)).filter(nonBlank).sort()
if (producer?.destinationType === 'FBA' && producer?.fulfillmentType !== 'ONE_CLICK_DROPSHIP') {
context.assert(MODULE, `头程 FBA 散货托盘码跨区原样用于实体托盘 ${containerNo}`, convertedResponse,
expectedPalletCodes.length > 0
&& JSON.stringify(actualPalletCodes) === JSON.stringify(expectedPalletCodes),
`source=${expectedPalletCodes.join(',') || 'missing'}, overseas=${actualPalletCodes.join(',') || 'missing'}`,
OPTIONS)
}
if (producer?.destinationType === 'OVERSEAS' && producer?.fulfillmentType !== 'ONE_CLICK_DROPSHIP') {
context.assert(MODULE, `标准海外仓订单由海外仓生成本地实体托盘码 ${containerNo}`, convertedResponse,
expectedPalletCodes.length === 0 && actualPalletCodes.length > 0
&& actualPalletCodes.every((code) => code.startsWith('PLT-')),
`sourceCount=${expectedPalletCodes.length}, overseas=${actualPalletCodes.join(',') || 'missing'}`,
OPTIONS)
}
rememberGeneratedPlans(context, plans)
const replayResponse = await context.requestOverseas('POST',
'/api/platform/v1/last-leg/inbound-plans/convert-container', body,