fix(firstleg): transfer carton labels to remainder inbound

This commit is contained in:
2026-08-24 14:08:17 +08:00
parent 506cc69808
commit 8e61cfd202
6 changed files with 41 additions and 6 deletions
@@ -149,6 +149,20 @@ public interface InboundSplitSettlementMapper {
@Param("childMeasurementItemId") long childMeasurementItemId,
@Param("lineNo") int lineNo, @Param("packageCount") int packageCount);
@Update("""
UPDATE fl_inbound_carton_label
SET inbound_id=#{childInboundId}, order_id=#{childOrderId}, inbound_code=#{childInboundCode}
WHERE tenant_id=#{accountId} AND inbound_id=#{sourceInboundId} AND batch_status='ACTIVE'
ORDER BY carton_index DESC
LIMIT #{remainingPackageCount}
""")
int transferRemainingCartonLabels(@Param("accountId") long accountId,
@Param("sourceInboundId") long sourceInboundId,
@Param("childInboundId") long childInboundId,
@Param("childOrderId") long childOrderId,
@Param("childInboundCode") String childInboundCode,
@Param("remainingPackageCount") int remainingPackageCount);
@Update("""
UPDATE fl_inbound_order
SET package_count = GREATEST(COALESCE(package_count, total_package_count) - #{packageCount}, 0),
@@ -185,6 +185,8 @@ public class PdaPickSettlementService {
requireAffected(splits.cloneChildWithPurpose(parent.tenantId(), parentInboundId, rootInboundId, remainderChildId,
orderSplit.remainderChild().orderId(), orderSplit.remainderChild().orderNo(),
remainderChildCode, childPackageCount, sequence, "REMAINDER", operatorId, operatorName), "余量子入库单");
splits.transferRemainingCartonLabels(parent.tenantId(), parentInboundId, remainderChildId,
orderSplit.remainderChild().orderId(), remainderChildCode, childPackageCount);
}
requireAffected(splits.insertBatchWithChildren(batchId, parent.tenantId(), rootInboundId, operationId, parentInboundId,
idempotencyKey, rootVersion, parentAvailable, null, remainderChildId == 0L ? null : remainderChildId,