fix(acceptance): reuse initialized pallet fixtures
This commit is contained in:
@@ -1317,7 +1317,7 @@ export class AcceptanceRun {
|
||||
const createdKeys = ['orders', 'ocrInbound', 'testInbound', 'inboundMeasurement']
|
||||
const contextKeys = ['inboundWeightOcr', 'ocrInbound', 'testInbound', 'createdInbound',
|
||||
'phase3LoadingRequireSharedOverflow', 'phase3LoadingIncrementalPackageCount',
|
||||
'phase3LoadingIncrementalDetailCount', 'orderProfile', 'measurementPalletOverride']
|
||||
'phase3LoadingIncrementalDetailCount', 'orderProfile']
|
||||
const createdSnapshot = new Map(createdKeys.map((key) => [key, {
|
||||
present: Object.hasOwn(this.createdResources, key), value: this.createdResources[key],
|
||||
}]))
|
||||
@@ -1362,9 +1362,6 @@ export class AcceptanceRun {
|
||||
: { forced: false, disabled: [] }
|
||||
this.context.phase3LoadingRequireSharedOverflow = requireSharedOverflow
|
||||
try {
|
||||
if (requireSharedOverflow) {
|
||||
this.context.measurementPalletOverride = await this.createPhase3FreshMeasurementPallet(warehouseId)
|
||||
}
|
||||
const measurement = await import(new URL('./admin-test-env-modules/inbound-measurement.mjs', import.meta.url))
|
||||
await this.executeModule('inbound-measurement-phase3-loading-fixture', () => measurement.run(this))
|
||||
} finally {
|
||||
@@ -1397,7 +1394,6 @@ export class AcceptanceRun {
|
||||
const incrementalMarker = `${originalMarker}-LOAD${suffix}-INC`
|
||||
this.marker = incrementalMarker
|
||||
this.context.phase3LoadingRequireSharedOverflow = false
|
||||
delete this.context.measurementPalletOverride
|
||||
this.context.phase3LoadingIncrementalPackageCount = 2
|
||||
this.context.phase3LoadingIncrementalDetailCount = 4
|
||||
// orders.mjs derives the actual SKU/package shape from waitSplitVariant. Override that
|
||||
@@ -1609,37 +1605,6 @@ export class AcceptanceRun {
|
||||
{ scenario: 'phase3-phase4-producer-fixture', deploymentBlocker: true })
|
||||
}
|
||||
|
||||
async createPhase3FreshMeasurementPallet(warehouseId) {
|
||||
const module = 'phase3-loading-fixture'
|
||||
const options = { scenario: 'phase3-loading-a0-fixture', deploymentBlocker: true }
|
||||
const payload = {
|
||||
warehouseId, palletType: 'STANDARD', capacityCbm: 1.5, weightKg: 25,
|
||||
color: 'ORANGE', remark: `${this.marker}-inventory-snapshot-a0`,
|
||||
}
|
||||
const createResponse = await this.request('POST', '/api/platform/v1/pallets?tenantId=0', payload)
|
||||
const palletId = String(this.apiSuccess(module, '创建本轮库存快照专用称重托盘', createResponse,
|
||||
`warehouseId=${warehouseId}`, options) || '')
|
||||
if (!palletId) return null
|
||||
|
||||
const detailResponse = await this.request('GET',
|
||||
`/api/platform/v1/pallets/${encodeURIComponent(palletId)}?tenantId=0&warehouseId=${encodeURIComponent(warehouseId)}`)
|
||||
const pallet = this.apiSuccess(module, '回读本轮库存快照专用称重托盘', detailResponse,
|
||||
`palletId=${palletId}`, options)
|
||||
const valid = String(pallet?.id || '') === palletId
|
||||
&& String(pallet?.warehouseId || '') === String(warehouseId)
|
||||
&& Boolean(String(pallet?.palletCode || '').trim())
|
||||
this.assert(module, '本轮专用称重托盘尚未复用历史占用身份', detailResponse, valid,
|
||||
`palletId=${palletId}, palletCode=${pallet?.palletCode || 'missing'}`, options)
|
||||
if (!valid) return null
|
||||
|
||||
const fixture = {
|
||||
id: palletId, code: String(pallet.palletCode), warehouseId: String(warehouseId),
|
||||
marker: this.marker, retainedReason: '测量审核后成为正式库存占用,保留为开发验收证据',
|
||||
}
|
||||
this.createdResources.phase3LoadingFreshMeasurementPallet = fixture
|
||||
return fixture
|
||||
}
|
||||
|
||||
async listAvailableLocationsForA0(warehouseId, module, options) {
|
||||
const locations = []
|
||||
const seen = new Set()
|
||||
|
||||
Reference in New Issue
Block a user