fix(firstleg): reuse running preload lifecycle
This commit is contained in:
@@ -83,13 +83,20 @@ public class SplitPreloadService {
|
||||
}
|
||||
|
||||
private void ensureLoadingAllocationLifecycle(long tenantId, long inboundId, long operatorId,
|
||||
String operatorName, boolean allowConfirmed) {
|
||||
String operatorName, boolean running) {
|
||||
InboundSnapshot inbound = requireInbound(tenantId, inboundId);
|
||||
requireWaitingSplit(inbound, "仅待分柜订单可以建立智能装柜预装计划");
|
||||
PreloadPlanEntity plan = repository.findPlan(tenantId, inboundId);
|
||||
boolean waitingSplit = isWaitingSplit(inbound.processStatus());
|
||||
boolean loading = "LOADING".equals(inbound.processStatus());
|
||||
if (!waitingSplit && !(running && loading)) {
|
||||
throw new BizException(ResultCode.CONFLICT, "仅待分柜订单可以建立智能装柜预装计划");
|
||||
}
|
||||
if (loading && plan == null) {
|
||||
throw new BizException(ResultCode.CONFLICT, "装柜中的订单缺少既有预装计划,不能新增分配");
|
||||
}
|
||||
if (plan != null) {
|
||||
if (!PreloadStatus.PENDING.equals(plan.getStatus())
|
||||
&& !(allowConfirmed && PreloadStatus.CONFIRMED.equals(plan.getStatus()))) {
|
||||
&& !(running && PreloadStatus.CONFIRMED.equals(plan.getStatus()))) {
|
||||
throw new BizException(ResultCode.CONFLICT, "预装计划已进入确认流程,不能修改智能装柜分配");
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user