fix(dispatch): expose PDA departure gate
This commit is contained in:
+2
@@ -14,6 +14,8 @@ public interface OutboundOrderMapper extends BaseMapper<OutboundOrder> {
|
||||
OutboundOrder findGlobalByNo(@Param("outboundNo") String outboundNo);
|
||||
@Select("SELECT * FROM ll_outbound_order WHERE customer_id=#{customerId} AND idempotency_key=#{key} LIMIT 1")
|
||||
OutboundOrder findByIdempotency(@Param("customerId") String customerId, @Param("key") String key);
|
||||
@Select("SELECT * FROM ll_outbound_order WHERE customer_id=#{customerId} AND dispatch_order_id=#{dispatchOrderId} LIMIT 1")
|
||||
OutboundOrder findByDispatch(@Param("customerId") String customerId, @Param("dispatchOrderId") Long dispatchOrderId);
|
||||
@Select("SELECT * FROM ll_outbound_order WHERE customer_id=#{customerId} AND dispatch_order_id=#{dispatchOrderId} LIMIT 1 FOR UPDATE")
|
||||
OutboundOrder lockByDispatch(@Param("customerId") String customerId, @Param("dispatchOrderId") Long dispatchOrderId);
|
||||
@Select("SELECT * FROM ll_outbound_order WHERE customer_id=#{customerId} AND outbound_no=#{outboundNo} LIMIT 1 FOR UPDATE")
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import java.util.List;
|
||||
public final class DispatchPdaResponses {
|
||||
private DispatchPdaResponses() {}
|
||||
public record Task(Long id, String taskNo, String dispatchNo, String vehiclePlate, String warehouseId, String status,
|
||||
List<Item> items) {}
|
||||
boolean canDepart, String departBlockReason, List<Item> items) {}
|
||||
public record Item(Long dispatchItemId, String palletNo, String destinationWarehouseCode,
|
||||
String destinationWarehouseName, String fbaWarehouseCode, String warehouseRouteLabel,
|
||||
int scheduledPackages,
|
||||
|
||||
+17
-1
@@ -242,7 +242,23 @@ public class DispatchPdaWorkflowService {
|
||||
new DispatchPdaResponses.Position(p.getId(), p.getBalanceId(), n(p.getAvailablePackages()),
|
||||
n(p.getAllocatedPackages()), n(p.getPickedPackages()))).toList()));
|
||||
}
|
||||
return new DispatchPdaResponses.Task(task.getId(), task.getTaskNo(), order.getDispatchNo(), order.getVehiclePlate(), task.getWarehouseId(), task.getStatus(), values);
|
||||
OutboundOrder outbound = outboundOrders.findByDispatch(customerId, order.getId());
|
||||
String departBlockReason = departBlockReason(order, task, source, outbound);
|
||||
return new DispatchPdaResponses.Task(task.getId(), task.getTaskNo(), order.getDispatchNo(), order.getVehiclePlate(),
|
||||
task.getWarehouseId(), task.getStatus(), departBlockReason == null, departBlockReason, values);
|
||||
}
|
||||
|
||||
private String departBlockReason(DispatchOrder order, DispatchPdaTask task, List<DispatchItem> source,
|
||||
OutboundOrder outbound) {
|
||||
if ("DEPARTED".equals(order.getStatus())) return "该排车已发车,不可重复提交。";
|
||||
if (trim(order.getVehiclePlate()) == null) return "请先在平台维护车辆信息。";
|
||||
if (!"COMPLETED".equals(task.getStatus()) || !"READY_TO_DEPART".equals(order.getStatus())
|
||||
|| !allPicked(order.getCustomerId(), task.getId(), source)) {
|
||||
return "请先完成排车拣货并核平全部箱数。";
|
||||
}
|
||||
if (outbound == null) return "请先在平台完成“转派送”,生成待出库单后才能发车。";
|
||||
if (!"WAIT_OUTBOUND".equals(outbound.getStatus())) return "关联出库单不是待出库状态,暂不可发车。";
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean allPicked(String customerId, Long taskId, List<DispatchItem> source) {
|
||||
|
||||
Reference in New Issue
Block a user