fix(firstleg): execute loading completion gate SQL

This commit is contained in:
2026-08-11 14:13:28 +08:00
parent df0f05c74d
commit bf7c214908
4 changed files with 7 additions and 5 deletions
@@ -25,7 +25,7 @@ public interface LoadingCompletionGateMapper {
AND c.status='CLEARANCE_COMPLETED' AND r.receipt_type='RELEASED' AND r.file_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM fl_customs_receipt newer
WHERE newer.submission_batch_id=r.submission_batch_id
AND newer.receipt_type=r.receipt_type AND newer.receipt_version>r.receipt_version))
AND newer.receipt_type=r.receipt_type AND newer.receipt_version>r.receipt_version))
THEN 1 ELSE 0 END),0) customsReady
FROM fl_preload_loading_plan_link l
JOIN fl_loading_plan p ON p.id=l.loading_plan_id
@@ -59,7 +59,7 @@ public interface LoadingInboundMapper {
LEFT JOIN fl_inbound_order loaded
ON loaded.tenant_id=root.tenant_id AND loaded.parent_inbound_id=root.id
AND loaded.inbound_role='CHILD' AND loaded.split_purpose='LOADED'
AND loaded.process_status<>'LOADED' AND loaded.deleted=0
AND loaded.process_status<>'LOADED' AND loaded.deleted=0
SET root.process_status='LOADED', root.updated_by=#{operatorId}, root.version=root.version+1
WHERE root.tenant_id=#{tenantId} AND root.id=#{rootInboundId} AND root.deleted=0
AND root.inbound_role='MASTER' AND root.process_status IN ('INBOUNDED','LOADING')
@@ -24,7 +24,8 @@ class LoadingCompletionGateSqlContractTest {
.contains("c.status='CLEARANCE_COMPLETED'")
.contains("r.receipt_type='RELEASED'")
.contains("r.file_id IS NOT NULL")
.contains("newer.receipt_version&gt;r.receipt_version")
.contains("l.tenant_id=#{tenantId} AND l.inbound_id=#{inboundId}");
.contains("newer.receipt_version>r.receipt_version")
.contains("l.tenant_id=#{tenantId} AND l.inbound_id=#{inboundId}")
.doesNotContain("&lt;", "&gt;");
}
}
@@ -33,8 +33,9 @@ class LoadingFulfillmentCompletionMapperContractTest {
.contains("remainder.split_purpose='REMAINDER'")
.contains("remainder.split_status='NOT_SPLIT'")
.contains("loaded.split_purpose='LOADED'")
.contains("loaded.process_status&lt;&gt;'LOADED'")
.contains("loaded.process_status<>'LOADED'")
.contains("remainder.id IS NULL AND loaded.id IS NULL")
.doesNotContain("&lt;", "&gt;")
.doesNotContain("NOT EXISTS")
.doesNotContain("SELECT 1 FROM fl_inbound_order");
}