From e08c30f6a36a15be4e019b5e0d631f32f6d06029 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期一, 24 十一月 2025 14:51:09 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject

---
 hangzhoumesParent/common/servicebase/src/main/resources/mapper/OrderMapper.xml |  126 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 123 insertions(+), 3 deletions(-)

diff --git a/hangzhoumesParent/common/servicebase/src/main/resources/mapper/OrderMapper.xml b/hangzhoumesParent/common/servicebase/src/main/resources/mapper/OrderMapper.xml
index 7eafcca..26b158e 100644
--- a/hangzhoumesParent/common/servicebase/src/main/resources/mapper/OrderMapper.xml
+++ b/hangzhoumesParent/common/servicebase/src/main/resources/mapper/OrderMapper.xml
@@ -10,6 +10,14 @@
         <result column="create_time" property="createTime"/>
         <result column="percent" property="percent"/>
     </resultMap>
+    <resultMap id="baseMapHollowDetail" type="com.mes.order.entity.HollowGlassDetailsDTO">
+        <result column="process_id" property="flowCardId"/>
+        <result column="child_width" property="width"/>
+        <result column="child_height" property="height"/>
+        <result column="order_number" property="orderSort"/>
+        <result column="technology_number" property="layer"/>
+        <result column="quantity" property="quantity"/>
+    </resultMap>
     <select id="selectOrderPercent" resultMap="baseMap">
         SELECT a.order_id,
                a.customer_name,
@@ -17,8 +25,7 @@
                a.area,
                a.quantity,
                a.create_time,
-               round(ifnull(d.finishNum, 0) / a.quantity * 100) as 'percent',
-                ifnull(d.finishNum, 0)
+               round(ifnull(d.finishNum, 0) / a.quantity * 100) as 'percent', ifnull(d.finishNum, 0)
         from sd.`order` as a
                  LEFT JOIN (
             SELECT sum(c.reporting_work_num) as 'finishNum',order_id
@@ -30,6 +37,119 @@
         ) as d
                            on a.order_id = d.order_id
         where a.warehousing != 2 and a.warehousing >= 0
-        ORDER BY  a.order_id desc
+        ORDER BY a.order_id desc
+    </select>
+    <select id="queryOrderByFlowCardId" resultType="com.mes.order.entity.HollowOrderDTO">
+        select t1.*
+        from pp.flow_card t
+                 inner join sd.order t1 on t.order_id = t1.order_id
+        where t.process_id = #{flowCardId} limit 1
+    </select>
+    <select id="queryFlowCardIdMaxLayerGlassInfo" resultMap="baseMapHollowDetail">
+        with temp_flow as (SELECT t.process_id,
+                                  t.order_id,
+                                  t.order_number,
+                                  t.technology_number,
+                                  t.quantity,
+                                  t1.child_width,
+                                  t1.child_height
+
+                           from pp.flow_card t
+                                    LEFT JOIN sd.order_glass_detail t1
+                                              on t.order_id = t1.order_id
+                                                  and t.order_number = t1.order_number
+                                                  and t.technology_number = t1.technology_number
+                           where t.process_id = #{flowCardId}),
+             glass_info_temp as (
+                 select process_id,
+                        order_id,
+                        GREATEST(child_width, child_height) as first_length,
+                        least(child_width, child_height)    as second_length,
+                        child_width,
+                        child_height,
+                        order_number,
+                        technology_number,
+                        quantity
+                 from temp_flow
+                 where technology_number = #{totalLayer}
+             )
+        select row_number() over (order by second_length desc,first_length desc) as rn, t.*
+        from glass_info_temp t
+    </select>
+    <select id="queryFlowCardIdLayerGlassInfo" resultMap="baseMapHollowDetail">
+        with temp_flow as (SELECT t.process_id,
+                                  t.order_id,
+                                  t.order_number,
+                                  t.technology_number,
+                                  t.quantity,
+                                  t1.child_width,
+                                  t1.child_height
+                           from pp.flow_card t
+                                    LEFT JOIN sd.order_glass_detail t1
+                                              on t.order_id = t1.order_id
+                                                  and t.order_number = t1.order_number
+                                                  and t.technology_number = t1.technology_number
+                           where t.process_id = #{flowCardId}),
+             glass_info_max_layer_temp as (
+                 select process_id,
+                        order_id,
+                        GREATEST(child_width, child_height) as first_length,
+                        least(child_width, child_height)    as second_length,
+                        child_width,
+                        child_height,
+                        order_number,
+                        technology_number,
+                        quantity
+                 from temp_flow
+                 where technology_number = #{totalLayer}
+             ),
+             glass_info_layer_temp as (
+                 select process_id,
+                        order_id,
+                        GREATEST(child_width, child_height) as first_length,
+                        least(child_width, child_height)    as second_length,
+                        child_width,
+                        child_height,
+                        order_number,
+                        technology_number,
+                        quantity
+                 from temp_flow
+                 where technology_number = #{layer}
+             ),
+             max_layer_sequence as (
+                 select row_number() over (order by second_length desc,first_length desc) as rn, t.order_number
+                 from glass_info_max_layer_temp t
+             ),
+             result as (select t.*
+                        from glass_info_layer_temp t
+                                 INNER join max_layer_sequence t1 on t.order_number = t1.order_number
+                        order by t1.rn)
+        select *
+        from result
+    </select>
+    <select id="queryProductNameByFlowCardId" resultType="com.mes.order.entity.OrderDetailsDTO">
+        select t.product_name, t1.customer_name
+        from sd.order_detail t
+                 inner join sd.order t1 on t.order_id = t1.order_id
+        where (t.order_id, t.order_number) = (
+            select min(order_id) as order_id, min(order_number) as order_number
+            from pp.flow_card
+            where process_id = #{flowCardId}
+        ) limit 1
+    </select>
+    <select id="queryLackByERP" resultType="com.mes.order.entity.ProcessCardReport">
+        select a.*,
+               (b.quantity - b.termination_quantity) as 'quantity',
+                (b.quantity - b.termination_quantity - reporting_work_num) as 'lack_quantity'
+        from order_process_detail as a
+                 inner join pp.flow_card as b
+                            on a.order_id = b.order_id
+                                and a.process_id = b.process_id
+                                and a.order_number = b.order_number
+                                and a.technology_number = b.technology_number
+        where termination_status = 0
+          and a.process_id = #{flowCardId}
+          and a.process = "涓┖"
+          and (b.quantity - b.termination_quantity) > reporting_work_num
     </select>
 </mapper>

--
Gitblit v1.8.0