Merge remote-tracking branch 'origin/test' into dev

This commit is contained in:
2026-09-04 15:16:16 +08:00
8 changed files with 149 additions and 5 deletions
@@ -1326,6 +1326,38 @@ export async function run(context) {
reassignedPlanItems.length === 1
&& id(reassignedPlanItem?.inboundDetailId) === id(dynamicCandidate.inboundDetailId),
`inboundId=${incrementalInboundId}, inboundDetailId=${id(dynamicCandidate.inboundDetailId)}, matches=${reassignedPlanItems.length}, planItemId=${id(reassignedPlanItem?.id) || 'missing'}`, OPTIONS)
const authoritativeTotal = Number(reassignedPlanItem?.totalPackageCount)
const assignedPackageCount = Number(reassignedPlanItem?.packageCount)
const authoritativeRemaining = Number(reassignedPlanItem?.remainingPackageCount)
context.assert(MODULE, '计划详情由服务端返回权威总箱数和剩余箱数', reassignResponse,
Number.isInteger(authoritativeTotal) && authoritativeTotal >= assignedPackageCount
&& authoritativeRemaining === authoritativeTotal - assignedPackageCount,
`totalPackageCount=${reassignedPlanItem?.totalPackageCount ?? 'missing'}, packageCount=${reassignedPlanItem?.packageCount ?? 'missing'}, remainingPackageCount=${reassignedPlanItem?.remainingPackageCount ?? 'missing'}`,
OPTIONS)
if (reassignedPlanItem?.id && Number.isInteger(authoritativeTotal) && authoritativeTotal > 0) {
const overAuthorityResponse = await request(context, 'PATCH',
`${smartLoadingBase}/plans/${loadingPlanId}/items/${encodeURIComponent(id(reassignedPlanItem.id))}`, {
packageCount: authoritativeTotal + 1, expectedPlanVersion: Number(reassignedPlan?.version),
expectedItemVersion: Number(reassignedPlanItem.version),
operationId: `${context.marker}-dynamic-over-authority`.slice(0, 128),
})
context.addStep(MODULE, '调整箱数超过服务端权威总箱数返回A0400', overAuthorityResponse,
overAuthorityResponse.http === 200 && codeOf(overAuthorityResponse) === 'A0400',
responseEvidence(overAuthorityResponse), OPTIONS)
const afterOverAuthorityResponse = await context.request('GET', `${smartLoadingBase}/plans/${loadingPlanId}`)
const afterOverAuthority = context.apiSuccess(MODULE, '超权威总箱数失败后回查计划',
afterOverAuthorityResponse, '', OPTIONS)
const afterOverAuthorityItem = afterOverAuthority?.items?.find?.((item) =>
id(item?.id) === id(reassignedPlanItem.id))
context.assert(MODULE, '超权威总箱数失败后计划和明细零写入', afterOverAuthorityResponse,
Number(afterOverAuthority?.version) === Number(reassignedPlan?.version)
&& Number(afterOverAuthorityItem?.version) === Number(reassignedPlanItem.version)
&& Number(afterOverAuthorityItem?.packageCount) === assignedPackageCount
&& Number(afterOverAuthorityItem?.totalPackageCount) === authoritativeTotal
&& Number(afterOverAuthorityItem?.remainingPackageCount) === authoritativeRemaining,
`planVersion=${afterOverAuthority?.version ?? 'missing'}, itemVersion=${afterOverAuthorityItem?.version ?? 'missing'}, packageCount=${afterOverAuthorityItem?.packageCount ?? 'missing'}`,
OPTIONS)
}
context.assert(MODULE, '动态增量 fixture 至少保留两件可用数量供调整与最小已拣门禁', dynamicCandidatesResponse,
Number(dynamicCandidate?.availablePackageCount) >= 2,
`availablePackageCount=${dynamicCandidate?.availablePackageCount ?? 'missing'}`, OPTIONS)