一件代发拣货
This commit is contained in:
+8
@@ -154,6 +154,14 @@ public class DispatchPdaWorkflowService {
|
||||
if (replay != null) return read(replay, DispatchPdaResponses.PickingCompleted.class).withReplay();
|
||||
requireVehicle(order);
|
||||
DispatchPdaTask task = tasks.lockByDispatch(customerId, order.getId());
|
||||
if (task != null && "COMPLETED".equals(task.getStatus())) {
|
||||
List<DispatchItem> completedItems = items.findByDispatchOrder(customerId, order.getId());
|
||||
long planned = completedItems.stream().map(DispatchItem::getPackageCount).filter(Objects::nonNull)
|
||||
.mapToLong(Integer::longValue).sum();
|
||||
long picked = picks.listTask(customerId, task.getId()).stream().mapToLong(p -> n(p.getPackages())).sum();
|
||||
return new DispatchPdaResponses.PickingCompleted(order.getDispatchNo(), order.getStatus(), planned,
|
||||
picked, Math.max(0, planned - picked), picked < planned, true);
|
||||
}
|
||||
if (task == null || !("PDA_PENDING".equals(task.getStatus()) || "PICKING".equals(task.getStatus()))) {
|
||||
throw conflict("Dispatch PDA task is not available for completion");
|
||||
}
|
||||
|
||||
+12
@@ -243,6 +243,18 @@ public class InboundPlanService {
|
||||
if (trimToNull(request.warehouseName()) != null) line.setDestinationWarehouseName(request.warehouseName().trim());
|
||||
lineMapper.updateById(line);
|
||||
}
|
||||
// Pallets carry the same destination snapshot and are consumed by PDA/resource assignment.
|
||||
// Update them in this transaction so a plan edit cannot leave lines and pallets pointing at
|
||||
// different warehouses.
|
||||
List<InboundPlanPallet> pallets = palletMapper.selectList(new LambdaQueryWrapper<InboundPlanPallet>()
|
||||
.eq(InboundPlanPallet::getPlanId, plan.getId())
|
||||
.eq(InboundPlanPallet::getCustomerId, plan.getCustomerId()));
|
||||
for (InboundPlanPallet pallet : pallets) {
|
||||
pallet.setDestinationWarehouseId(String.valueOf(request.overseasWarehouseId()));
|
||||
if (trimToNull(request.warehouseCode()) != null) pallet.setDestinationWarehouseCode(request.warehouseCode().trim());
|
||||
if (trimToNull(request.warehouseName()) != null) pallet.setDestinationWarehouseName(request.warehouseName().trim());
|
||||
palletMapper.updateById(pallet);
|
||||
}
|
||||
return detail(customerId, plan);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user