优化
This commit is contained in:
-2
@@ -61,7 +61,6 @@ public class FleetHandoverInspectionService {
|
||||
for (var binding : current) {
|
||||
var originalBinding = departedBindings.get(binding.getDispatchNo());
|
||||
if (!seen.add(binding.getDispatchNo()) || originalBinding == null
|
||||
|| !Objects.equals(originalBinding.customerId(), binding.getCustomerId())
|
||||
|| !Objects.equals(originalBinding.packageCount(), binding.getPackageCount()))
|
||||
throw conflict("客户排车归属或箱数与原始发车不一致");
|
||||
}
|
||||
@@ -69,7 +68,6 @@ public class FleetHandoverInspectionService {
|
||||
for (var binding : departedBindings.values()) {
|
||||
var fact = dispatches.transitEvidence(binding.dispatchNo(), lock);
|
||||
if (!Objects.equals(binding.dispatchNo(), fact.dispatchNo())
|
||||
|| !Objects.equals(binding.customerId(), fact.customerId())
|
||||
|| !trip.getWarehouseId().toString().equals(fact.warehouseId())
|
||||
|| binding.packageCount() != fact.shippedPackages())
|
||||
throw conflict("实际发运与车次客户、仓库或箱数不一致");
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ public class FleetHandoverPdaQuery {
|
||||
if (!List.of("IN_TRANSIT", "COMPLETED").contains(trip.getStatus()))
|
||||
throw new ResponseStatusException(HttpStatus.CONFLICT, "尚未发车,请按原拣货发车流程作业");
|
||||
var evidence = dispatches.transitEvidence(dispatchNo, false);
|
||||
if (!Objects.equals(evidence.customerId(), binding.getCustomerId()) || !Long.toString(warehouseId).equals(evidence.warehouseId())
|
||||
if (!Long.toString(warehouseId).equals(evidence.warehouseId())
|
||||
|| !dispatchNo.equals(evidence.dispatchNo()) || !Objects.equals(binding.getPackageCount(), evidence.shippedPackages())) throw notFound();
|
||||
var original = history.selectList(new LambdaQueryWrapper<FleetTripHistory>().eq(FleetTripHistory::getTripId, trip.getId())
|
||||
.eq(FleetTripHistory::getAction, "DEPART"));
|
||||
@@ -55,7 +55,7 @@ public class FleetHandoverPdaQuery {
|
||||
var rows = evidence.deliveries().stream().map(row -> new Delivery(row.cargo().deliveryNo(), row.status(), row.cargo().packages(),
|
||||
row.cargo().terminalAt() != null ? 0 : row.cargo().packages() - row.cargo().returnedCargo().stream().mapToInt(FleetHandoverPolicy.ReturnedCargo::packages).sum(),
|
||||
row.cargo().terminalAt(), row.transport())).toList();
|
||||
var latest = handovers.latestForCargo(trip.getId(), json.writeValueAsString(Map.of("customerId", binding.getCustomerId(), "dispatchNo", dispatchNo)));
|
||||
var latest = handovers.latestForCargo(trip.getId(), json.writeValueAsString(Map.of("dispatchNo", dispatchNo)));
|
||||
Handover handover = null;
|
||||
if (latest != null) {
|
||||
var snapshot = json.readValue(latest.snapshot(), FleetHandoverModels.Snapshot.class);
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ package com.baiyue.lastleg.fleet.exception;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** Internal port response. Identity always comes from the original customer dispatch. */
|
||||
public record FleetTransitEvidence(String dispatchNo, String customerId, String warehouseId,
|
||||
/** 整车发运事实;真实客户由每条Delivery.cargo携带。 */
|
||||
public record FleetTransitEvidence(String dispatchNo, String warehouseId,
|
||||
int shippedPackages, List<Delivery> deliveries) {
|
||||
public record Transport(String vehiclePlate, String driverName, String driverPhone) { }
|
||||
public record Delivery(FleetHandoverPolicy.Delivery cargo, String status, long recordVersion, Transport transport) { }
|
||||
|
||||
Reference in New Issue
Block a user