From 67e1e623bdd4b59ac5f1bdb16363a66a511ebdaa Mon Sep 17 00:00:00 2001
From: hongjli <3117313295@qq.com>
Date: 星期二, 20 五月 2025 12:31:41 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlatePlanMapper.xml |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlatePlanMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlatePlanMapper.xml
index 3a38efa..c075b48 100644
--- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlatePlanMapper.xml
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlate/ApsPlatePlanMapper.xml
@@ -277,15 +277,19 @@
     </update>
 
     <select id="selectPlatePlanByPlantMajor" parameterType="com.aps.core.domain.ApsPlate.ApsPlatePlan" resultMap="ApsPlatePlanResult">
-        select  id,document_number,main_part_number,item_number,plant,professional_affiliation,production_quantity,require_id,
-        unmatched_quantity,version, production_base,plan_end_day,order_create_time,low_order_code
-        from aps_plate_plan
-        <where>
-            <if test="plant != null "> and plant = #{plant} </if>
-            <if test="professionalAffiliation != null "> and professional_affiliation = 'main' </if>
-              and del_flag='0'
-        </where>
-        order by document_number asc,id asc
+        with rd as (
+            select doc_no,require_date   from aps_plate_require_date where del_flag=0
+        )
+        select
+            app.id,app.document_number,app.main_part_number,app.item_number,app.plant,app.professional_affiliation,app.production_quantity,app.require_id,
+            app.unmatched_quantity,app.version, app.production_base,app.order_create_time,app.low_order_code,
+            app.plan_end_day as orign_end_day,
+            COALESCE(rd.require_date,app.plan_end_day) as plan_end_day
+        from aps_plate_plan as  app
+        left join rd  on app.document_number=rd.doc_no
+        where app.del_flag='0'  and app.professional_affiliation = 'main'
+        <if test="plant != null "> and plant = #{plant} </if>
+        order by document_number ,id
     </select>
 
     <select id="selectUnMatchPlateSubPlan" parameterType="com.aps.core.domain.ApsPlate.ApsPlatePlan" resultMap="ApsPlatePlanResult">

--
Gitblit v1.9.3