test(overseas): use authoritative fulfillment fixtures
This commit is contained in:
@@ -50,6 +50,8 @@ 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',
|
||||
'const packageCount = 1', 'oldLabel: item.cartonMark',
|
||||
'newLabel: item.fbaCartonMark || item.newSkuCode',
|
||||
"operationType: changesCartonLabel ? 'CARTON_AND_SKU' : 'SKU_LABEL'", 'skuItems:',
|
||||
'P5换标费用冻结后开放PDA作业', 'P5换标完成后钱包结算收敛']) {
|
||||
assert.ok(source.includes(marker), marker)
|
||||
|
||||
@@ -364,7 +364,7 @@ async function verifyRelabel(context, token, merchantToken, fixture) {
|
||||
if (!id(source?.inventoryBalanceId) || !id(source?.inboundOrderId)) continue
|
||||
for (const position of source?.positions || []) {
|
||||
if (!id(position?.positionId) || Number(position?.availablePackages) <= 0) continue
|
||||
const packageCount = Math.min(requiredPackages, Number(position.availablePackages))
|
||||
const packageCount = 1
|
||||
sourceLines.push({ source, position, packageCount })
|
||||
requiredPackages -= packageCount
|
||||
if (requiredPackages === 0) break
|
||||
@@ -444,7 +444,8 @@ async function verifyRelabel(context, token, merchantToken, fixture) {
|
||||
return false
|
||||
}
|
||||
const unitPath = `${pdaBase}/${encodeURIComponent(relabelNo)}/units`
|
||||
const scanBody = { itemId: id(item.itemId), oldLabel: `${context.marker}-OLD-1`, newLabel: item.newSkuCode,
|
||||
const scanBody = { itemId: id(item.itemId), oldLabel: item.cartonMark,
|
||||
newLabel: item.fbaCartonMark || item.newSkuCode,
|
||||
expectedVersion: Number(detail.version), idempotencyKey: key(context, 'RELABEL-NORMAL') }
|
||||
const scanned = await request(context, token, 'POST', 'P5正常换标一箱', unitPath, scanBody)
|
||||
const scanReplay = await request(context, token, 'POST', 'P5正常换标同键重放', unitPath, scanBody)
|
||||
@@ -456,7 +457,7 @@ async function verifyRelabel(context, token, merchantToken, fixture) {
|
||||
{ ...scanBody, oldLabel: `${context.marker}-OLD-STALE`, idempotencyKey: key(context, 'RELABEL-STALE') })
|
||||
detail = scanned.data
|
||||
const skipItem = relabelItemForUnit(detail, 1)
|
||||
const skipBody = { itemId: id(skipItem?.itemId), oldLabel: `${context.marker}-OLD-2`,
|
||||
const skipBody = { itemId: id(skipItem?.itemId), oldLabel: skipItem?.cartonMark,
|
||||
reason: `${context.marker}-skip`, expectedVersion: Number(detail.version),
|
||||
idempotencyKey: key(context, 'RELABEL-SKIP') }
|
||||
const skipped = await request(context, token, 'POST', 'P5跳过换标一箱', `${unitPath}/skip`, skipBody)
|
||||
@@ -465,7 +466,7 @@ async function verifyRelabel(context, token, merchantToken, fixture) {
|
||||
Number(skipReplay.data?.skippedPackages) === 1, trace(skipReplay.response), OPTIONS)
|
||||
detail = skipped.data
|
||||
const exceptionItem = relabelItemForUnit(detail, 2)
|
||||
const exceptionBody = { itemId: id(exceptionItem?.itemId), oldLabel: `${context.marker}-OLD-3`,
|
||||
const exceptionBody = { itemId: id(exceptionItem?.itemId), oldLabel: exceptionItem?.cartonMark,
|
||||
exceptionCode: 'DAMAGED', reason: `${context.marker}-damaged`, expectedVersion: Number(detail.version),
|
||||
idempotencyKey: key(context, 'RELABEL-EXCEPTION') }
|
||||
const exception = await request(context, token, 'POST', 'P5登记换标异常一箱',
|
||||
|
||||
@@ -59,6 +59,7 @@ test('phase-five module proves completion, customer visit, manual exception and
|
||||
"visitResult: 'SATISFIED'", '/exception-orders',
|
||||
'/return-inbound-options', '/mark-return', "returnDirection: 'OVERSEAS_WAREHOUSE'",
|
||||
'returnSources', 'outboundPalletItemId', 'inventoryPositionId',
|
||||
'value.returnSources.some', 'returnInbound?.deliveryNo === deliveryNo',
|
||||
"idempotencyKey: key(context, 'DELIVERY-RETURN')", '派送退回同键同载荷重放',
|
||||
'RETURN_PENDING_WITH_COMPLETED_VISIT',
|
||||
]) assert.ok(source.includes(token), token)
|
||||
|
||||
@@ -317,9 +317,12 @@ export async function run(context) {
|
||||
const returnOptions = await platform(context, 'GET', '查询派送退回可选入仓单',
|
||||
query(`${LASTLEG_BASE}/delivery-orders/${encodeURIComponent(deliveryNo)}/return-inbound-options`, { customerId }))
|
||||
const returnInbound = Array.isArray(returnOptions.data)
|
||||
? returnOptions.data.find((value) => id(value?.inboundOrderId) === id(inbound.inboundOrderId)) : null
|
||||
? returnOptions.data.find((value) => Array.isArray(value?.returnSources)
|
||||
&& value.returnSources.some((source) => id(source?.outboundPalletItemId)
|
||||
&& id(source?.inventoryPositionId) && Number(source?.maxReturnPackages) > 0)) : null
|
||||
context.assert(MODULE, '退回候选严格属于当前派送单', returnOptions.response,
|
||||
Boolean(returnInbound), `candidate=${Boolean(returnInbound)}; ${trace(returnOptions.response)}`, OPTIONS)
|
||||
id(returnInbound?.inboundOrderId) && returnInbound?.deliveryNo === deliveryNo && returnInbound?.outboundNo === outboundNo,
|
||||
`candidate=${Boolean(returnInbound)}; ${trace(returnOptions.response)}`, OPTIONS)
|
||||
if (!returnInbound) return
|
||||
const returnSource = Array.isArray(returnInbound.returnSources)
|
||||
? returnInbound.returnSources.find((value) => id(value?.outboundPalletItemId)
|
||||
|
||||
Reference in New Issue
Block a user