fix(scripts): align dropship container acceptance

This commit is contained in:
2026-09-08 23:26:09 +08:00
parent 2121743753
commit 3e15ad6b5b
4 changed files with 13 additions and 6 deletions
@@ -240,13 +240,14 @@ export async function run(context) {
if (!loadingPlanId) return
const dropshipAssignment = source?.fulfillmentType === 'ONE_CLICK_DROPSHIP'
const initialAssignmentCount = dropshipAssignment
? inboundCandidates.reduce((total, item) => total + Number(item.availablePackageCount || 0), 0) : 1
? inboundCandidates.filter((item) => id(item.palletId) === id(candidate.palletId))
.reduce((total, item) => total + Number(item.availablePackageCount || 0), 0) : 1
const assignmentPath = dropshipAssignment
? `${smartLoadingBase}/plans/${loadingPlanId}/inbound-assignments`
? `${smartLoadingBase}/plans/${loadingPlanId}/pallet-assignments`
: `${smartLoadingBase}/plans/${loadingPlanId}/assignments`
const assignmentBody = dropshipAssignment
? { inboundId, packageCount: initialAssignmentCount, expectedVersion: Number(loadingPlan.version),
operationId: `${context.marker}-${loadingPlanId}-bridge-assign-inbound`.slice(0, 128) }
? { palletId: id(candidate.palletId), expectedVersion: Number(loadingPlan.version),
operationId: `${context.marker}-${loadingPlanId}-bridge-assign-pallet`.slice(0, 128) }
: { inboundId, inboundDetailId: id(candidate.inboundDetailId), packageCount: initialAssignmentCount,
expectedVersion: Number(loadingPlan.version), operationId: `${context.marker}-${loadingPlanId}-bridge-assign`.slice(0, 128) }
const assignmentResponse = await request(context, 'POST', assignmentPath, assignmentBody)
@@ -502,6 +502,9 @@ test('PDA completion acceptance verifies immutable BATCH and COMPLETE_LOADING au
assert.match(loading, new RegExp(key))
}
assert.match(loading, /expectedBatchOperationIds = dropshipWholePallet[\s\S]*\? \[batchKey\][\s\S]*: \[batchKey, skipBatchKey, partialBatchKey, dynamicBatchKey\]/)
assert.match(loading, /dropshipAssignment[\s\S]*pallet-assignments/)
assert.match(loading, /palletId: id\(candidate\.palletId\)/)
assert.doesNotMatch(loading, /bridge-assign-inbound/)
assert.match(loading, /skipBatchVerified, partialBatchVerified, dynamicIncrementVerified/)
assert.match(convergence, /expectedBatchCount = fixture\?\.fulfillmentType === 'ONE_CLICK_DROPSHIP' \? 1 : 4/)
assert.match(convergence, /expectedBatchOperationIds\.length === expectedBatchCount/)