test(phase3): provision dispatch and handoff evidence

This commit is contained in:
2026-08-24 14:01:02 +08:00
parent f041cf524b
commit 506cc69808
3 changed files with 44 additions and 8 deletions
@@ -348,6 +348,14 @@ async function loadOneFragment(context, state) {
if (!taskId || !pickItem?.id) return null
context.createdResources.phase3OrderSplitting.retainedAuditRecordIds.push(taskId)
const labelResponse = await context.requestBinary('POST',
`/api/platform/inbounds/${encodeURIComponent(id(candidate.inboundId))}/carton-label-pdf?tenantId=${encodeURIComponent(tenantId)}`)
context.assert(MODULE, `${sourceOrderNo} 进入 LOADING 前生成可交接箱唛池`, labelResponse,
labelResponse.http === 200 && String(labelResponse.contentType || '').toLowerCase().includes('pdf')
&& Number(labelResponse.bytes?.length) > 0,
`HTTP=${labelResponse.http}, contentType=${labelResponse.contentType || 'missing'}, bytes=${labelResponse.bytes?.length ?? 0}`, OPTIONS)
if (labelResponse.http !== 200 || !Number(labelResponse.bytes?.length)) return null
const claim = await request(context, 'POST', `${PDA}/tasks/${taskId}/claim`, {
expectedAssignmentVersion: 0, operationId: `${operationBase}-claim`,
})
@@ -407,14 +415,6 @@ async function loadOneFragment(context, state) {
`HTTP=${differentReplay.http}, code=${codeOf(differentReplay)}, requestId=${differentReplay.requestId || 'missing'}, traceId=${differentReplay.traceId || 'missing'}`, OPTIONS)
}
const labelResponse = await context.requestBinary('POST',
`/api/platform/inbounds/${encodeURIComponent(id(candidate.inboundId))}/carton-label-pdf?tenantId=${encodeURIComponent(tenantId)}`)
context.assert(MODULE, `${sourceOrderNo} 完成前生成可交接箱唛池`, labelResponse,
labelResponse.http === 200 && String(labelResponse.contentType || '').toLowerCase().includes('pdf')
&& Number(labelResponse.bytes?.length) > 0,
`HTTP=${labelResponse.http}, contentType=${labelResponse.contentType || 'missing'}, bytes=${labelResponse.bytes?.length ?? 0}`, OPTIONS)
if (labelResponse.http !== 200 || !Number(labelResponse.bytes?.length)) return null
if (!await ensureCompletionEvidence(context, tenantId, id(candidate.inboundId), operationBase)) return null
const completePath = `${PDA}/tasks/${taskId}/complete`