fix(firstleg): open declaration batch after broker execution

This commit is contained in:
2026-09-27 20:48:18 +08:00
parent 95da66c763
commit 4bec639a23
@@ -323,10 +323,9 @@ public class ContainerCustomsService {
CommandRow replay = claim(operatorId, action, key, requestHash);
if (replay != null) return declarationBatchView(mapper.declarationBatch(replay.resultId()));
ContainerRow container = mapper.lockContainer(planId);
if (container == null || !COMPLETED.equals(container.status())) throw conflict("报关完税文件未全部完成,不能创建正式申报批次");
if (container == null || !(DECLARING.equals(container.status()) || COMPLETED.equals(container.status()))) throw conflict("当前柜尚未进入报关行执行阶段,不能创建正式申报批次");
if (mapper.taxRefundCount(planId) == 0) throw conflict("全买单柜不创建退税正式申报批次");
if (mapper.missingFinalCount(container.id()) != 0 || mapper.unconfirmedReceiptCount(container.id()) != 0
|| mapper.brokerSubmittedAt(container.id()) == null) {
if (mapper.unconfirmedReceiptCount(container.id()) != 0 || mapper.brokerSubmittedAt(container.id()) == null) {
throw conflict("当前柜尚未完成退税资料、回执确认和报关行执行");
}
if (!Objects.equals(container.version(), request.expectedVersion())) throw concurrent();