fix: complete pallet code cross-region flow
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user