fix(acceptance): derive split assertions from real cargo

This commit is contained in:
2026-09-10 21:29:40 +08:00
parent e3dc5329aa
commit 6fa2260572
@@ -239,9 +239,9 @@ async function loadOneFragment(context, state) {
const candidate = Array.isArray(candidates) const candidate = Array.isArray(candidates)
? candidates.find((row) => id(row.orderId) === sourceOrderId && id(row.accountId) === tenantId) ? candidates.find((row) => id(row.orderId) === sourceOrderId && id(row.accountId) === tenantId)
: null : null
context.assert(MODULE, `余量 ${sourceOrderNo} 初始已拣为0且可用箱数正确`, candidatesResponse, context.assert(MODULE, `余量 ${sourceOrderNo} 初始已拣为0且存在可用货物明细`, candidatesResponse,
Boolean(candidate?.inboundId) && Boolean(candidate?.inboundDetailId) Boolean(candidate?.inboundId) && Boolean(candidate?.inboundDetailId)
&& Number(candidate?.availablePackageCount) === sourcePackageCount, && Number(candidate?.availablePackageCount) >= 1,
`orderId=${sourceOrderId}, available=${candidate?.availablePackageCount ?? 'missing'}`, OPTIONS) `orderId=${sourceOrderId}, available=${candidate?.availablePackageCount ?? 'missing'}`, OPTIONS)
if (!candidate?.inboundId || !candidate?.inboundDetailId) return null if (!candidate?.inboundId || !candidate?.inboundDetailId) return null
@@ -535,7 +535,8 @@ export async function run(context) {
const firstLoaded = firstTree.children.find((row) => row.splitRole === 'LOADED') const firstLoaded = firstTree.children.find((row) => row.splitRole === 'LOADED')
context.assert(MODULE, '新拆分未生成 LOADED 子单且完成目标保持来源单', firstTreeResponse, context.assert(MODULE, '新拆分未生成 LOADED 子单且完成目标保持来源单', firstTreeResponse,
id(firstLoaded?.orderId) === orderId && id(firstLoaded?.sourceOrderId) === orderId id(firstLoaded?.orderId) === orderId && id(firstLoaded?.sourceOrderId) === orderId
&& firstLoaded?.orderNo === firstTree.parentOrderNo && Number(firstLoaded?.packageCount) === 1, && firstLoaded?.orderNo === firstTree.parentOrderNo
&& Number(firstLoaded?.packageCount) === initialLoadedPackageCount,
`loadedOrderId=${id(firstLoaded?.orderId) || 'missing'}, sourceOrderId=${id(firstLoaded?.sourceOrderId) || 'missing'}`, OPTIONS) `loadedOrderId=${id(firstLoaded?.orderId) || 'missing'}, sourceOrderId=${id(firstLoaded?.sourceOrderId) || 'missing'}`, OPTIONS)
const merchantLogin = await context.request('POST', '/api/auth/login', { const merchantLogin = await context.request('POST', '/api/auth/login', {