fix: retain scanned carton traceability in measurement drafts

This commit is contained in:
2026-09-02 17:57:35 +08:00
parent 2a0f942234
commit 6296f032f0
6 changed files with 155 additions and 12 deletions
+49 -5
View File
@@ -1276,7 +1276,25 @@ export class AcceptanceRun {
}
}
const orders = await import(new URL('./admin-test-env-modules/orders.mjs', import.meta.url))
await this.executeModule('orders-phase3-loading-fixture', () => orders.run(this))
// One-click dropship has a physically indivisible sealed pallet. The phase-three loading
// fixture normally creates four one-carton SKUs so it can exercise partial loading, but that
// would intentionally leave three cartons outside the sealed pallet and make the later
// cross-region handover invalid. Keep this producer variant to one carton only; the separate
// STANDARD incremental fixture below continues to cover SKIP/PARTIAL/dynamic mutations.
const primaryDropship = this.context.orderFulfillmentType === 'ONE_CLICK_DROPSHIP'
const hadWaitSplitVariant = Object.hasOwn(this.context, 'waitSplitVariant')
const savedWaitSplitVariant = this.context.waitSplitVariant
if (primaryDropship) {
this.context.waitSplitVariant = {
...(savedWaitSplitVariant || {}), skuCount: 1, packageCountPerSku: 1, packageCounts: [1],
}
}
try {
await this.executeModule('orders-phase3-loading-fixture', () => orders.run(this))
} finally {
if (hadWaitSplitVariant) this.context.waitSplitVariant = savedWaitSplitVariant
else delete this.context.waitSplitVariant
}
const fixtureInbound = this.createdResources.orders
const warehouseId = String(fixtureInbound?.receivingWarehouseId || '')
this.assert('phase3-loading-fixture', 'A0 隔离使用本轮订单收货仓', null,
@@ -1321,6 +1339,15 @@ export class AcceptanceRun {
delete this.context.measurementPalletOverride
this.context.phase3LoadingIncrementalPackageCount = 2
this.context.phase3LoadingIncrementalDetailCount = 4
// orders.mjs derives the actual SKU/package shape from waitSplitVariant. Override that
// shape for this mutation fixture as well, otherwise a one-carton dropship primary leaks
// into the STANDARD incremental order and removes the SKIP/PARTIAL coverage data.
const hadIncrementalWaitSplitVariant = Object.hasOwn(this.context, 'waitSplitVariant')
const savedIncrementalWaitSplitVariant = this.context.waitSplitVariant
this.context.waitSplitVariant = {
...(savedIncrementalWaitSplitVariant || {}), skuCount: 4, packageCountPerSku: 2,
packageCounts: [2, 2, 2, 2],
}
this.context.orderProfile = {
...(this.context.orderProfile || {}),
// The incremental order exercises partial/SKIP/PARTIAL mutations. Keep it STANDARD so a
@@ -1328,9 +1355,22 @@ export class AcceptanceRun {
fulfillmentType: 'STANDARD',
...(taxModes?.incremental ? { taxMode: taxModes.incremental } : {}),
}
await this.executeModule('orders-phase3-loading-incremental-fixture', () => orders.run(this))
const measurement = await import(new URL('./admin-test-env-modules/inbound-measurement.mjs', import.meta.url))
await this.executeModule('inbound-measurement-phase3-loading-incremental-fixture', () => measurement.run(this))
// orders.mjs reads this top-level context field rather than orderProfile. Switch it as well
// so this mutation fixture is genuinely STANDARD, then restore the producer variant before
// the enclosing phase-four workflow records its ONE_CLICK_DROPSHIP facts.
const hadOrderFulfillmentType = Object.hasOwn(this.context, 'orderFulfillmentType')
const savedOrderFulfillmentType = this.context.orderFulfillmentType
this.context.orderFulfillmentType = 'STANDARD'
try {
await this.executeModule('orders-phase3-loading-incremental-fixture', () => orders.run(this))
await this.executeModule('inbound-measurement-phase3-loading-incremental-fixture', () => measurement.run(this))
} finally {
if (hadOrderFulfillmentType) this.context.orderFulfillmentType = savedOrderFulfillmentType
else delete this.context.orderFulfillmentType
if (hadIncrementalWaitSplitVariant) this.context.waitSplitVariant = savedIncrementalWaitSplitVariant
else delete this.context.waitSplitVariant
}
const incrementalSource = this.createdResources.inboundMeasurement || this.createdResources.orders
const incrementalFixture = incrementalSource ? {
marker: originalMarker,
@@ -1392,7 +1432,10 @@ export class AcceptanceRun {
this.context.orderFulfillmentType = fulfillmentType
this.context.phase4ProducerMatrixMarker = matrixMarker
try {
restoreFixture = await this.preparePhase3LoadingFixture('', false)
// Every cross-region producer later verifies that a PDA inventory snapshot is invalidated
// after a real, public A0 rebind. Keep an isolated overflow occupancy for each variant;
// otherwise the OVERSEAS branch has only ordinary locations and cannot perform that check.
restoreFixture = await this.preparePhase3LoadingFixture('', true)
const loading = await import(new URL('./admin-test-env-modules/phase3-loading.mjs', import.meta.url))
await this.executeModule(`phase3-loading-phase4-${label}`, () => loading.run(this))
const finalize = await import(new URL('./admin-test-env-modules/phase3-loading-finalize.mjs', import.meta.url))
@@ -1618,7 +1661,8 @@ export class AcceptanceRun {
process.env.MERCHANT_TEST_PASSWORD = this.options.merchantPassword
}
if (this.options.waitSplitCount > 1 || this.options.waitSplitPackageCount > 0
|| this.options.orderProfileMode === 'randomized' || this.options.routeMode === 'random') {
|| this.options.orderProfileMode === 'randomized' || this.options.routeMode === 'random'
|| this.options.originWarehouseName || this.options.channelName || this.options.channelCode) {
this.applyWaitSplitVariant(this.options.waitSplitSequence || 1)
} else if (this.options.originWarehouseName || this.options.channelName || this.options.channelCode) {
this.context.waitSplitRoute = {