diff --git a/deploy/sql/头程数据库统一增量-MySQL8.sql b/deploy/sql/头程数据库统一增量-MySQL8.sql index 38bc2ad99..e12f34fa8 100644 --- a/deploy/sql/头程数据库统一增量-MySQL8.sql +++ b/deploy/sql/头程数据库统一增量-MySQL8.sql @@ -7587,7 +7587,7 @@ BEGIN WHERE plan_item.loading_plan_id = plan.id AND plan_item.account_id = NEW.tenant_id AND plan_item.inbound_id = NEW.source_inbound_id - AND plan_item.deleted = 0))) + AND plan_item.deleted = 0)))) OR NOT EXISTS ( SELECT 1 FROM fl_inbound_order parent_order WHERE parent_order.id = NEW.parent_inbound_id diff --git a/firstleg/src/main/resources/db/phase3-inbound-parent-child-schema.sql b/firstleg/src/main/resources/db/phase3-inbound-parent-child-schema.sql index 584e2b12c..29a28a25c 100644 --- a/firstleg/src/main/resources/db/phase3-inbound-parent-child-schema.sql +++ b/firstleg/src/main/resources/db/phase3-inbound-parent-child-schema.sql @@ -580,7 +580,7 @@ BEGIN WHERE plan_item.loading_plan_id = plan.id AND plan_item.account_id = NEW.tenant_id AND plan_item.inbound_id = NEW.source_inbound_id - AND plan_item.deleted = 0))) + AND plan_item.deleted = 0)))) OR NOT EXISTS ( SELECT 1 FROM fl_inbound_order parent_order WHERE parent_order.id = NEW.parent_inbound_id diff --git a/firstleg/src/test/java/com/baiyue/firstleg/repository/InboundParentChildSqlContractTest.java b/firstleg/src/test/java/com/baiyue/firstleg/repository/InboundParentChildSqlContractTest.java index cfc838e8b..aab61f43a 100644 --- a/firstleg/src/test/java/com/baiyue/firstleg/repository/InboundParentChildSqlContractTest.java +++ b/firstleg/src/test/java/com/baiyue/firstleg/repository/InboundParentChildSqlContractTest.java @@ -61,6 +61,7 @@ class InboundParentChildSqlContractTest { .contains("NEW.loaded_package_count") .contains("NEW.remaining_package_count") .contains("NEW.loaded_package_count + NEW.remaining_package_count <> NEW.package_count") + .contains("AND plan_item.deleted = 0))))\n OR NOT EXISTS (") .contains("source_batch.inbound_id = COALESCE(batch.source_inbound_id, batch.parent_inbound_id)") .contains("拆分批次来源必须是箱数匹配且未消费的根主单或余量子单") .contains("SUM(split_item.package_count) > source_item.package_count")