test(overseas): align relabel and pallet acceptance

This commit is contained in:
2026-09-09 03:02:36 +08:00
parent 71580da8d7
commit cda6521078
3 changed files with 21 additions and 13 deletions
@@ -50,6 +50,7 @@ test('P2 to P5 cover all frozen endpoints, replays and conflict boundaries witho
'chargeAmount: 0.01', 'cartonMark:', 'fbaCartonMark:',
'inventory-candidates', 'sourceInventoryBalanceId:', 'sourceInventoryPositionId:',
'sourceInboundOrderId:', 'operationWarehouseId:', 'relabelItemForUnit', 'sourceLines.map',
"operationType: changesCartonLabel ? 'CARTON_AND_SKU' : 'SKU_LABEL'", 'skuItems:',
'P5换标费用冻结后开放PDA作业', 'P5换标完成后钱包结算收敛']) {
assert.ok(source.includes(marker), marker)
}
@@ -386,18 +386,24 @@ async function verifyRelabel(context, token, merchantToken, fixture) {
labelDeadline: new Date(Date.now() + 7 * 86400000).toISOString().slice(0, 19),
contactName: 'PDA换标验收', contactPhone: '13800000006', chargeAmount: 0.01, remark: context.marker,
idempotencyKey: key(context, 'RELABEL-CREATE'),
items: sourceLines.map(({ source, position, packageCount }, index) => ({
sourceInventoryBalanceId: id(source.inventoryBalanceId),
sourceInventoryPositionId: id(position.positionId), sourceInboundOrderId: id(source.inboundOrderId),
skuCode: source.skuCode, productNameZh: source.productNameZh || inventory.productName || '本轮库存商品',
totalPackageCount: packageCount, notifiedPackageCount: packageCount,
shipmentNo: `SHIP-${context.marker}-${index + 1}`.slice(0, 128),
newSkuCode: `${source.skuCode}-NEW-${markerSuffix}-${index + 1}`.slice(0, 128),
labelRequirement: context.marker,
cartonMark: `CM-${String(context.marker).slice(-28)}-${index + 1}`,
fbaCartonMark: `FBA-${String(context.marker).slice(-27)}-${index + 1}`,
destinationFbaWarehouseCode: source.destinationFbaWarehouseCode,
})),
items: sourceLines.map(({ source, position, packageCount }, index) => {
const newSkuCode = `${source.skuCode}-NEW-${markerSuffix}-${index + 1}`.slice(0, 128)
const changesCartonLabel = nonBlank(source.destinationFbaWarehouseCode)
return {
sourceInventoryBalanceId: id(source.inventoryBalanceId),
sourceInventoryPositionId: id(position.positionId), sourceInboundOrderId: id(source.inboundOrderId),
skuCode: source.skuCode, productNameZh: source.productNameZh || inventory.productName || '本轮库存商品',
totalPackageCount: packageCount, notifiedPackageCount: packageCount,
shipmentNo: `SHIP-${context.marker}-${index + 1}`.slice(0, 128),
newSkuCode,
labelRequirement: context.marker,
cartonMark: `CM-${String(context.marker).slice(-28)}-${index + 1}`,
fbaCartonMark: changesCartonLabel ? `FBA-${String(context.marker).slice(-27)}-${index + 1}` : null,
destinationFbaWarehouseCode: changesCartonLabel ? source.destinationFbaWarehouseCode : null,
operationType: changesCartonLabel ? 'CARTON_AND_SKU' : 'SKU_LABEL',
skuItems: [{ skuCode: source.skuCode, newSkuCode, quantity: packageCount, remark: context.marker }],
}
}),
}
const createdResponse = await context.requestOverseas('POST',
query(relabelBase, { customerId }), createBody)
@@ -60,7 +60,8 @@ test('托盘汇总和拆柜成本验证总数、分摊及跨区金额守恒', ()
assert.match(source, /Number\(d\.totalCount\) === Number\(d\.idleCount\) \+ Number\(d\.occupiedCount\)/)
assert.match(source, /allocated === money\(fact\.expectedPalletCost\)/)
assert.match(source, /delivered\.reduce[\s\S]*fact\.expectedPalletCost/)
assert.match(pda, /unitPrice = Number\(\(1\.01 \+ index\)\.toFixed\(2\)\)/)
assert.match(pda, /unitPrice: Number\(pallet\?\.unitPrice \|\| 0\)/)
assert.match(pda, /Number\(stored\.unitPrice \|\| pallet\.unitPrice \|\| 0\)/)
assert.match(pda, /completedContainerFacts\.push/)
})