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)