fix(firstleg): normalize split carton label pools
This commit is contained in:
+15
-1
@@ -151,7 +151,10 @@ public interface InboundSplitSettlementMapper {
|
||||
|
||||
@Update("""
|
||||
UPDATE fl_inbound_carton_label
|
||||
SET inbound_id=#{childInboundId}, order_id=#{childOrderId}, inbound_code=#{childInboundCode}
|
||||
SET inbound_id=#{childInboundId}, order_id=#{childOrderId}, inbound_code=#{childInboundCode},
|
||||
carton_index=carton_index-#{loadedPackageCount},
|
||||
total_carton_count=#{remainingPackageCount},
|
||||
detail_package_count=LEAST(detail_package_count,#{remainingPackageCount})
|
||||
WHERE tenant_id=#{accountId} AND inbound_id=#{sourceInboundId} AND batch_status='ACTIVE'
|
||||
ORDER BY carton_index DESC
|
||||
LIMIT #{remainingPackageCount}
|
||||
@@ -161,8 +164,19 @@ public interface InboundSplitSettlementMapper {
|
||||
@Param("childInboundId") long childInboundId,
|
||||
@Param("childOrderId") long childOrderId,
|
||||
@Param("childInboundCode") String childInboundCode,
|
||||
@Param("loadedPackageCount") int loadedPackageCount,
|
||||
@Param("remainingPackageCount") int remainingPackageCount);
|
||||
|
||||
@Update("""
|
||||
UPDATE fl_inbound_carton_label
|
||||
SET total_carton_count=#{loadedPackageCount},
|
||||
detail_package_count=LEAST(detail_package_count,#{loadedPackageCount})
|
||||
WHERE tenant_id=#{accountId} AND inbound_id=#{sourceInboundId} AND batch_status='ACTIVE'
|
||||
""")
|
||||
int normalizeLoadedCartonLabels(@Param("accountId") long accountId,
|
||||
@Param("sourceInboundId") long sourceInboundId,
|
||||
@Param("loadedPackageCount") int loadedPackageCount);
|
||||
|
||||
@Update("""
|
||||
UPDATE fl_inbound_order
|
||||
SET package_count = GREATEST(COALESCE(package_count, total_package_count) - #{packageCount}, 0),
|
||||
|
||||
@@ -186,7 +186,8 @@ public class PdaPickSettlementService {
|
||||
orderSplit.remainderChild().orderId(), orderSplit.remainderChild().orderNo(),
|
||||
remainderChildCode, childPackageCount, sequence, "REMAINDER", operatorId, operatorName), "余量子入库单");
|
||||
splits.transferRemainingCartonLabels(parent.tenantId(), parentInboundId, remainderChildId,
|
||||
orderSplit.remainderChild().orderId(), remainderChildCode, childPackageCount);
|
||||
orderSplit.remainderChild().orderId(), remainderChildCode, pickedPackageCount, childPackageCount);
|
||||
splits.normalizeLoadedCartonLabels(parent.tenantId(), parentInboundId, pickedPackageCount);
|
||||
}
|
||||
requireAffected(splits.insertBatchWithChildren(batchId, parent.tenantId(), rootInboundId, operationId, parentInboundId,
|
||||
idempotencyKey, rootVersion, parentAvailable, null, remainderChildId == 0L ? null : remainderChildId,
|
||||
|
||||
Reference in New Issue
Block a user