From 9a2b9c5d1161c748731a828197b5fc26dbd1eca9 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Wed, 23 Sep 2026 20:28:26 +0800 Subject: [PATCH] stabilize overseas admin acceptance fixtures --- scripts/admin-test-env-acceptance.mjs | 6 ++++++ .../phase4-overseas-client-services.mjs | 8 +++++++- .../phase4-overseas-inbound-operations.mjs | 17 ++++++++++++++++- .../phase4-overseas-pda.mjs | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/scripts/admin-test-env-acceptance.mjs b/scripts/admin-test-env-acceptance.mjs index b1032cd59..2bf29870d 100644 --- a/scripts/admin-test-env-acceptance.mjs +++ b/scripts/admin-test-env-acceptance.mjs @@ -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 diff --git a/scripts/admin-test-env-modules/phase4-overseas-client-services.mjs b/scripts/admin-test-env-modules/phase4-overseas-client-services.mjs index f0f864410..4cb4c659e 100644 --- a/scripts/admin-test-env-modules/phase4-overseas-client-services.mjs +++ b/scripts/admin-test-env-modules/phase4-overseas-client-services.mjs @@ -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) diff --git a/scripts/admin-test-env-modules/phase4-overseas-inbound-operations.mjs b/scripts/admin-test-env-modules/phase4-overseas-inbound-operations.mjs index 2341d9aea..da39febde 100644 --- a/scripts/admin-test-env-modules/phase4-overseas-inbound-operations.mjs +++ b/scripts/admin-test-env-modules/phase4-overseas-inbound-operations.mjs @@ -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') } diff --git a/scripts/admin-test-env-modules/phase4-overseas-pda.mjs b/scripts/admin-test-env-modules/phase4-overseas-pda.mjs index 81593dd47..855407158 100644 --- a/scripts/admin-test-env-modules/phase4-overseas-pda.mjs +++ b/scripts/admin-test-env-modules/phase4-overseas-pda.mjs @@ -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), }) }