fix(firstleg): allow preload confirmation after loading starts

This commit is contained in:
2026-08-11 15:25:49 +08:00
parent 16a2f83da6
commit a59f4634cd
2 changed files with 44 additions and 3 deletions
@@ -79,11 +79,18 @@ public class SplitPreloadService {
SplitActionResponse replay = claimOrReplay(tenantId, inboundId, operatorId, START_CONFIRMING, key);
if (replay != null) return replay;
InboundSnapshot inbound = requireInbound(tenantId, inboundId);
requireStatus(inbound, "INBOUNDED", "仅待分柜订单可以提交预装清单确认");
boolean loading = "LOADING".equals(inbound.processStatus());
if (loading) {
// Starting a real loading task advances the inbound before its preload
// confirmation is submitted; retain the linked-container hard gate.
loadingModelBridge.requireStarted(tenantId, inboundId);
} else {
requireStatus(inbound, "INBOUNDED", "仅待分柜订单可以提交预装清单确认");
}
PreloadPlanEntity plan = requirePlan(tenantId, inboundId);
if (PreloadStatus.CONFIRMING.equals(plan.getStatus())) {
return complete(tenantId, inboundId, operatorId, START_CONFIRMING, key,
new SplitActionResponse("INBOUNDED", response(plan)));
new SplitActionResponse(loading ? "LOADING" : "INBOUNDED", response(plan)));
}
if (!PreloadStatus.PENDING.equals(plan.getStatus())
|| repository.changePlanStatus(tenantId, inboundId, PreloadStatus.PENDING,
@@ -91,7 +98,8 @@ public class SplitPreloadService {
throw concurrent();
}
return complete(tenantId, inboundId, operatorId, START_CONFIRMING, key,
new SplitActionResponse("INBOUNDED", response(repository.findPlan(tenantId, inboundId))));
new SplitActionResponse(loading ? "LOADING" : "INBOUNDED",
response(repository.findPlan(tenantId, inboundId))));
}
@Transactional