align transfer review fixtures with service states

This commit is contained in:
2026-09-23 20:58:57 +08:00
parent a29f4fc749
commit 2b71a00303
@@ -35,9 +35,9 @@ export async function verifyWarehouseTransferReview(context, token, customerId,
// Existing-stock approval must not be confused with inbound-transit PDA receipt.
const approved = await call('POST', reviewPath(transferNo), { decision: 'APPROVE', remark: context.marker })
context.addStep(MODULE, '已有库存转运通过为APPROVED且主单待分配', approved,
context.addStep(MODULE, '已有库存转运通过为APPROVED且主单进入入库计量', approved,
ok(approved) && approved.body.data?.status === 'APPROVED'
&& approved.body.data?.orderStatus === 'PENDING_ASSIGNMENT', evidence(approved), OPTIONS)
&& approved.body.data?.orderStatus === 'INBOUND_MEASURING', evidence(approved), OPTIONS)
if (!ok(approved)) return false
const replay = await call('POST', reviewPath(transferNo), { decision: 'APPROVE', remark: context.marker })
context.addStep(MODULE, '同决定重放不推进状态', replay,
@@ -54,12 +54,16 @@ export async function verifyWarehouseTransferReview(context, token, customerId,
idempotencyKey: `${context.marker}-TRANSIT-${decision}`.slice(0, 255) }
const created = await call('POST', MERCHANT, body, token)
const no = created.body?.data?.transferNo
if (ok(created) && no && created.body.data?.status === 'DRAFT') {
const submitted = await call('POST', `${MERCHANT}/${encodeURIComponent(no)}/submit`, undefined, token)
if (ok(submitted) && submitted.body?.data) created.body.data = submitted.body.data
}
context.addStep(MODULE, `创建本轮新到仓转运${decision}对照`, created,
ok(created) && Boolean(no) && created.body.data?.status === 'PENDING_REVIEW', evidence(created), OPTIONS)
if (!ok(created) || !no) return false
const result = await call('POST', reviewPath(no), { decision, remark: `${context.marker}-审核原因` })
const expected = decision === 'APPROVE' ? 'WAIT_PDA_RECEIVING' : 'REJECTED'
const expectedOrder = decision === 'APPROVE' ? 'WAIT_DELIVERY' : 'CANCELLED'
const expectedOrder = decision === 'APPROVE' ? 'INBOUND_MEASURING' : 'CANCELLED'
const detail = await call('GET', `${MERCHANT}/${encodeURIComponent(no)}`, undefined, token)
context.addStep(MODULE, `新到仓转运${decision}回查${expected}`, detail,
ok(result) && ok(detail) && detail.body.data?.status === expected
@@ -74,6 +78,10 @@ export async function verifyWarehouseTransferReview(context, token, customerId,
const reasonFixture = await call('POST', MERCHANT, { ...sourceBody, inboundCode: null, sourceLastlegOrderIds: [],
idempotencyKey: `${context.marker}-TRANSIT-REASON`.slice(0, 255) }, token)
const reasonNo = reasonFixture.body?.data?.transferNo
if (ok(reasonFixture) && reasonNo && reasonFixture.body.data?.status === 'DRAFT') {
const submitted = await call('POST', `${MERCHANT}/${encodeURIComponent(reasonNo)}/submit`, undefined, token)
if (ok(submitted) && submitted.body?.data) reasonFixture.body.data = submitted.body.data
}
context.addStep(MODULE, '创建空驳回原因独立反向票', reasonFixture, ok(reasonFixture) && Boolean(reasonNo), evidence(reasonFixture), OPTIONS)
if (!ok(reasonFixture) || !reasonNo) return false
const emptyReason = await call('POST', reviewPath(reasonNo), { decision: 'REJECT', remark: '' })