test(acceptance): verify native outbound ownership and exact relabel carton quantities
This commit is contained in:
@@ -137,13 +137,15 @@ async function prepareDraft(context, io, candidates) {
|
||||
'not-implemented', { blocking: false })
|
||||
return draft
|
||||
}
|
||||
async function createRelabel(context, io, proof) {
|
||||
export async function createPdaRelabelDispatch(context, io, proof) {
|
||||
const fixture = context.createdResources?.phase4OverseasRelabel
|
||||
if (fixture?.marker !== context.marker || fixture.status !== 'READY_FOR_OUTBOUND') return
|
||||
const page = await candidatePage(io, fixture.overseasWarehouseId, { orderNo: fixture.relabelNo, sourceStage: 'RELABEL' })
|
||||
const page = await candidatePage(io, fixture.overseasWarehouseId, { orderNo: fixture.relabelNo, sourceStage: 'RELABEL', planIds: [] })
|
||||
const candidates = page.filter(c => c.selection?.sourceType === 'RELABEL' && c.selection.relabelNo === fixture.relabelNo && id(c.customerId) === id(fixture.customerId)
|
||||
&& id(c.warehouseId) === id(fixture.overseasWarehouseId) && fixture.targetPalletIds?.map(id).includes(id(c.selection.warehousePalletId)))
|
||||
if (!candidates.length || candidates.length !== fixture.targetPalletIds.length) { proof.relabel = { status: 'NOT_RUN', reason: '没有本轮完整换标申请来源' }; return }
|
||||
io.check('PDA原换标目标托盘候选完整且唯一', null, candidates.length > 0 && candidates.length === fixture.targetPalletIds.length
|
||||
&& new Set(candidates.map(c => id(c.selection.warehousePalletId))).size === candidates.length)
|
||||
if (fixture.dispatchNo || proof.relabel) throw Error('PDA原换标排车已开始,保留原请求,不自动重建')
|
||||
const body = createBody(context.marker, 'RELABEL', candidates), created = await io.command('POST', BASE, body, '真实换标整单Create')
|
||||
await replay(io, BASE, body, created, '换标Create原键恢复')
|
||||
const current = await readDispatch(io, created.dispatchNo)
|
||||
@@ -225,7 +227,7 @@ export async function run(context) {
|
||||
finalStatus: current.data.status, stage: current.data.stage, data: current.data, items: current.items, route: current.route,
|
||||
sourceCandidates: selected, status: 'VERIFIED', loadingEvidenceStatus: 'NOT_RUN_MISSING_ACTUAL_MEASUREMENTS' })
|
||||
io.check('交接Detail真实来源键和目的地守恒', null, same(proof.sourceKeys, sorted(selected.map(c => c.sourceKey))) && proof.finalStatus === 'ACTIVE' && proof.stage === 'BEFORE_LOADING')
|
||||
await createRelabel(context, io, proof)
|
||||
await createPdaRelabelDispatch(context, io, proof)
|
||||
await createClientRelabelDispatch(context, io, proof)
|
||||
await context.checkpoint()
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user