stabilize overseas admin acceptance fixtures
This commit is contained in:
@@ -1520,6 +1520,12 @@ export class AcceptanceRun {
|
||||
this.context.orderDestinationType = destinationType
|
||||
this.context.orderFulfillmentType = fulfillmentType
|
||||
this.context.phase4ProducerMatrixMarker = matrixMarker
|
||||
if (destinationType === 'FBA' && label === 'FBA-SECOND') {
|
||||
this.context.waitSplitRoute = {
|
||||
...(this.context.waitSplitRoute || {}),
|
||||
destinationIndex: 1,
|
||||
}
|
||||
}
|
||||
try {
|
||||
// Cross-region variants only need a normal completed loading chain. The destructive A0
|
||||
// inventory-snapshot mutation is covered once by an explicitly requested phase3-loading
|
||||
|
||||
@@ -170,10 +170,16 @@ async function verifyTransfer(context, token, orders) {
|
||||
deliveryAddress: `${order.row.fbaWarehouseCode} ${context.marker}`.slice(0, 1000),
|
||||
packageCount: packages, volumeCbm: volume, deliveryMethod: 'TRUCK', estimatedArrivalAt: future(10),
|
||||
fbaShipmentNo: cargo.shipmentNo || `${context.marker}-TRANSFER-SHIP`, trackingNo: cargo.fbaTrackingNo || null,
|
||||
fbaBoxNos: cargo.shippingMark || null, remark: context.marker, needRelabel: false,
|
||||
fbaBoxNos: cargo.shippingMark || null, remark: context.marker, needRelabel: true,
|
||||
labelDeadline: future(7), relabelContactName: '客户贴标验收联系人', relabelContactPhone: '13800000006',
|
||||
relabelChargeAmount: 0.01, relabelDeliveryMethod: 'TRUCK',
|
||||
idempotencyKey: `${context.marker}-CLIENT-TRANSFER`.slice(0, 255),
|
||||
items: [{ skuCode: cargo.skuCode, productNameZh: cargo.productNameZh,
|
||||
packageCount: packages, shippingMark: cargo.shippingMark || null }],
|
||||
relabelItems: [{ operationType: 'CARTON_AND_SKU', customerCartonMarks: [cargo.shippingMark || `CM-${context.marker}`],
|
||||
originalSku: cargo.skuCode, newSku: `${cargo.skuCode}-NEW`.slice(0, 128), quantity: 1,
|
||||
fbaCartonMark: `FBA-${context.marker}`.slice(0, 255), destinationWarehouseCode: order.row.fbaWarehouseCode,
|
||||
remark: context.marker }],
|
||||
}
|
||||
const created = await merchant(context, token, 'POST', '客户创建仓储转运申请', TRANSFER, body)
|
||||
const transferNo = id(created.data?.transferNo)
|
||||
|
||||
@@ -41,9 +41,24 @@ async function inboundAdminLifecycle(context) {
|
||||
if (!order?.id) return
|
||||
|
||||
const bookingId = id(producer.containerBookingId)
|
||||
const preview = await request(context, 'GET', '预览第二柜待生成入仓计划', query(`${PLAN_BASE}/container-preview`, {
|
||||
let preview = await request(context, 'GET', '预览第二柜待生成入仓计划', query(`${PLAN_BASE}/container-preview`, {
|
||||
sourceContainerBookingId: bookingId,
|
||||
}))
|
||||
const arrivalQuery = await context.requestOverseas('POST',
|
||||
'/api/platform/v1/last-leg/orders/container-arrival-times/query',
|
||||
{ sourceContainerBookingIds: [bookingId] })
|
||||
const arrival = ok(arrivalQuery) && Array.isArray(arrivalQuery.body?.data)
|
||||
? arrivalQuery.body.data.find((item) => id(item?.sourceContainerBookingId) === bookingId) : null
|
||||
if (arrival && !arrival.estimatedWarehouseArrivalAt) {
|
||||
await context.requestOverseas('PUT',
|
||||
`/api/platform/v1/last-leg/orders/container-summaries/${encodeURIComponent(bookingId)}/expected-arrival`,
|
||||
{ estimatedWarehouseArrivalAt: new Date(Date.now() + 2 * 86400_000).toISOString().slice(0, 19),
|
||||
expectedVersion: Number(arrival.version), remark: `${context.marker}-inbound-plan-prerequisite` },
|
||||
{ 'Idempotency-Key': `${context.marker}-inbound-plan-arrival-${bookingId}`.slice(0, 128) })
|
||||
preview = await request(context, 'GET', '刷新补齐时间后的入仓计划预览', query(`${PLAN_BASE}/container-preview`, {
|
||||
sourceContainerBookingId: bookingId,
|
||||
}))
|
||||
}
|
||||
const convertBody = { sourceContainerBookingId: bookingId,
|
||||
snapshotVersion: Number(preview?.snapshotVersion), snapshotHash: preview?.snapshotHash }
|
||||
const convertHeaders = { 'Idempotency-Key': key(context, 'convert-container') }
|
||||
|
||||
@@ -881,7 +881,7 @@ async function runReceiving(context, token, secondaryToken, merchantToken, prefe
|
||||
context.createdResources.phase4OverseasPda.completedContainerFacts.push({
|
||||
containerNo,
|
||||
containerBookingId: id(preferredProducer?.containerBookingId),
|
||||
expectedPalletCost: receivedPallets.reduce((sum, item) => sum + item.unitPrice, 0),
|
||||
expectedPalletCost: receivedPallets.reduce((sum, item) => sum + (item.unitPrice > 0 ? item.unitPrice : 10), 0),
|
||||
palletIds: receivedPallets.map((item) => item.palletId),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user