fix: count split picking facts in trip operations
This commit is contained in:
+10
-4
@@ -81,13 +81,19 @@ public class TripOperationsService {
|
||||
if(!pallets.add(pallet.warehousePalletId())) throw new IllegalStateException("发车实物托盘重复");
|
||||
spaces+=pallet.palletSpaces();
|
||||
}
|
||||
long own=0,external=0; var destinations=new TreeMap<String,String>(); var seen=new HashSet<String>();
|
||||
long own=0,external=0; var destinations=new TreeMap<String,String>();
|
||||
var cargoIdentity=new HashMap<String,List<String>>();
|
||||
var shippedByPallet=new HashMap<String,Long>();
|
||||
for(var cargo:load.cargo()) {
|
||||
if (!pallets.contains(cargo.warehousePalletId()) || !seen.add(cargo.dispatchNo()+":"+cargo.dispatchItemId()))
|
||||
throw new IllegalStateException("发车装载货物未核平或重复");
|
||||
shippedByPallet.merge(cargo.dispatchNo()+":"+cargo.customerId()+":"+cargo.warehousePalletId(),(long)cargo.packages(),Long::sum);
|
||||
if (!pallets.contains(cargo.warehousePalletId()) || cargo.packages()<=0
|
||||
|| cargo.dispatchNo()==null || cargo.dispatchItemId()==null || cargo.customerId()==null)
|
||||
throw new IllegalStateException("发车装载货物未核平");
|
||||
if(cargo.destinationKey()==null || cargo.destinationLabel()==null)throw new IllegalStateException("发车货物缺少目的地依据");
|
||||
// 装车快照按真实拣货来源逐段记录,同一排车明细可含多次拣货;逐段累加但归属不能漂移。
|
||||
var identity=List.of(cargo.customerId(),cargo.warehousePalletId(),cargo.destinationKey(),cargo.destinationLabel());
|
||||
var previous=cargoIdentity.putIfAbsent(cargo.dispatchNo()+":"+cargo.dispatchItemId(),identity);
|
||||
if(previous!=null && !previous.equals(identity))throw new IllegalStateException("发车装载明细归属不一致");
|
||||
shippedByPallet.merge(cargo.dispatchNo()+":"+cargo.customerId()+":"+cargo.warehousePalletId(),(long)cargo.packages(),Long::sum);
|
||||
destinations.put(cargo.destinationKey(),cargo.destinationLabel());
|
||||
}
|
||||
for(var entry:externalByPallet.entrySet()) if(entry.getValue()>shippedByPallet.getOrDefault(entry.getKey(),0L))throw new IllegalStateException("外接实收超过实际发车货量");
|
||||
|
||||
Reference in New Issue
Block a user