fix(dropship): preserve carton quantities and shared pallet outbound ownership
This commit is contained in:
+10
-1
@@ -157,11 +157,20 @@ public record FirstLegLoadingPlanCompletedV2(
|
||||
/** 托盘下来源入库明细、SKU、箱数、数量及箱号冻结快照;同 SKU 多明细按 sourceInboundDetailId 精确区分。 */
|
||||
public record SkuPackageSnapshot(String sourceInboundDetailId, String skuCode, String productName,
|
||||
int packageCount, int productQuantity,
|
||||
List<String> cartonMarks) {
|
||||
List<String> cartonMarks, java.util.Map<String, Integer> cartonQuantities) {
|
||||
public SkuPackageSnapshot {
|
||||
if (sourceInboundDetailId == null || sourceInboundDetailId.isBlank()) {
|
||||
throw new IllegalArgumentException("sourceInboundDetailId is required for each pallet SKU snapshot");
|
||||
}
|
||||
if (cartonMarks == null || cartonQuantities == null || cartonMarks.size() != packageCount
|
||||
|| new java.util.HashSet<>(cartonMarks).size() != packageCount
|
||||
|| !cartonQuantities.keySet().equals(new java.util.HashSet<>(cartonMarks))
|
||||
|| cartonQuantities.values().stream().anyMatch(quantity -> quantity == null || quantity <= 0)
|
||||
|| cartonQuantities.values().stream().mapToLong(Integer::longValue).sum() != productQuantity) {
|
||||
throw new IllegalArgumentException("cartonQuantities must exactly cover cartonMarks and productQuantity");
|
||||
}
|
||||
cartonMarks = List.copyOf(cartonMarks);
|
||||
cartonQuantities = java.util.Map.copyOf(cartonQuantities);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user