fix(test): align receiving pallets with FBA destinations
This commit is contained in:
@@ -95,13 +95,26 @@ async function createLocation(context, warehouseId, suffix) {
|
||||
return success(response) ? { locationId, locationCode } : null
|
||||
}
|
||||
|
||||
async function createEmptyPallet(context, token, fixture, suffix, destinationWarehouseCode) {
|
||||
export function auxiliaryPalletFbaWarehouseCode(destinationType, fbaWarehouseCode) {
|
||||
if (destinationType === 'OVERSEAS') return null
|
||||
if (destinationType === 'FBA' && nonBlank(fbaWarehouseCode)) return fbaWarehouseCode.trim()
|
||||
return null
|
||||
}
|
||||
|
||||
async function createEmptyPallet(context, token, fixture, suffix) {
|
||||
const fbaWarehouseCode = auxiliaryPalletFbaWarehouseCode(
|
||||
fixture.destinationType, fixture.fbaWarehouseCode)
|
||||
if (fixture.destinationType === 'FBA' && !fbaWarehouseCode) {
|
||||
blocker(context, `${suffix}辅助空托盘`,
|
||||
`当前FBA入仓码 ${fixture.inboundCode || 'missing'} 缺少权威fbaWarehouseCode`)
|
||||
return null
|
||||
}
|
||||
const palletCode = `PDAOPS-${context.marker}-${suffix}`.replace(/[^A-Za-z0-9_-]/g, '').slice(-120)
|
||||
const response = await context.requestOverseas('POST',
|
||||
`/api/platform/v1/warehouse-admin/${encodeURIComponent(fixture.overseasWarehouseId)}/pallets`, {
|
||||
palletCode, palletType: '木托盘', capacityCbm: 10, unitPrice: 0, status: 'IDLE',
|
||||
locationId: fixture.location.locationId,
|
||||
fbaWarehouseCode: destinationWarehouseCode || null,
|
||||
fbaWarehouseCode,
|
||||
remark: `${context.marker}-pda-operations-${suffix}`,
|
||||
})
|
||||
context.addStep(MODULE, `创建${suffix}辅助空托盘`, response, success(response), trace(response), OPTIONS)
|
||||
@@ -234,9 +247,9 @@ async function verifyPalletOperations(context, token, fixture) {
|
||||
'主托盘只有一箱可用库存,解绑会清空唯一业务托盘;必须由本轮生产矩阵提供至少两箱')
|
||||
return false
|
||||
}
|
||||
const swapTarget = await createEmptyPallet(context, token, fixture, 'SWAP', main.destinationWarehouseCode)
|
||||
const splitTarget = await createEmptyPallet(context, token, fixture, 'SPLIT', main.destinationWarehouseCode)
|
||||
const unbindTarget = await createEmptyPallet(context, token, fixture, 'UNBIND', main.destinationWarehouseCode)
|
||||
const swapTarget = await createEmptyPallet(context, token, fixture, 'SWAP')
|
||||
const splitTarget = await createEmptyPallet(context, token, fixture, 'SPLIT')
|
||||
const unbindTarget = await createEmptyPallet(context, token, fixture, 'UNBIND')
|
||||
if (!swapTarget || !splitTarget || !unbindTarget) {
|
||||
blocker(context, 'P4辅助实物托盘', '无法创建换托、拆托和解绑所需辅助托盘')
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user