fix(lastleg): refresh received pallets before delivery transfer

This commit is contained in:
2026-09-07 19:16:30 +08:00
parent e0bb7de0cf
commit df8610f458
2 changed files with 17 additions and 0 deletions
@@ -114,6 +114,7 @@ public class DeliveryTransferService {
if (Set.of("CANCELLED", "DEPARTED", "PARTIAL_DEPARTED", "COMPLETED").contains(dispatch.getStatus())) {
throw conflict("Dispatch cannot be transferred to delivery in its current status");
}
dispatchItems.bindReceivedPallets(customerId, dispatch.getId());
List<DispatchItem> items = dispatchItems.findByDispatchOrder(customerId, dispatch.getId());
if (items.isEmpty()) throw conflict("Dispatch has no pallets");
if (items.stream().anyMatch(item -> item.getWarehousePalletId() == null)) {