From 48bd9e20aa649145c9bf643e375c0cd86f7bb800 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期四, 04 九月 2025 08:28:52 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/pp/WordOrder.xml |   40 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/pp/WordOrder.xml b/north-glass-erp/src/main/resources/mapper/pp/WordOrder.xml
index 0317798..da82dde 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/WordOrder.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/WordOrder.xml
@@ -33,6 +33,16 @@
 
     </resultMap>
 
+    <resultMap id="addWordOrderMap" type="com.example.erp.entity.sd.OrderDetail">
+        <result column="order_id" property="orderId"/>
+        <result column="product_id" property="productId"/>
+        <result column="product_name" property="productName"/>
+        <result column="compute_gross_area" property="computeGrossArea"/>
+        <result column="quantity" property="quantity"/>
+        <result column="perimeter" property="perimeter"/>
+        <result column="process" property="orderGlassDetail.process"/>
+    </resultMap>
+
     <select id="selectWordOrder" resultMap="wordOrderMap">
         select
         o.order_id,
@@ -132,16 +142,21 @@
         order by od.id desc
     </select>
 
-    <select id="addWordOrder">
+    <select id="addWordOrder" resultMap="addWordOrderMap">
         select od.order_id,
         od.product_id,
         od.product_name,
         sum( od.quantity) as quantity,
         od.compute_gross_area,
-        od.perimeter
+        od.perimeter,
+        ogd.process
         from sd.order_detail as od
         left join sd.order as o
         on od.order_id =o.order_id
+        left join (
+        select order_id,order_number,process from
+               sd.order_glass_detail where FIND_IN_SET(order_id,#{orderId}) GROUP BY order_id,order_number
+        ) as ogd on ogd.order_id = o.order_id and ogd.order_number=od.order_number
         where FIND_IN_SET(od.order_id,#{orderId})    and o.production_order!=2
         <if test="orderDetail.orderId != null and orderDetail.orderId != ''">
             and od.order_id regexp #{orderDetail.orderId}
@@ -152,7 +167,7 @@
         <if test="orderDetail.productName != null and orderDetail.productName != ''">
             and od.product_name regexp #{orderDetail.productName}
         </if>
-        group by od.order_id, od.product_id, od.product_name
+        group by od.order_id, od.product_id, od.product_name,ogd.process
         ;
     </select>
 
@@ -173,6 +188,7 @@
         where od.order_id = #{orderId}
           and od.product_id = #{productId}
           and od.product_name = #{productName}
+          and ogd.process = #{process}
     </update>
 
     <!--    鍒犻櫎宸ュ崟-->
@@ -206,4 +222,22 @@
     <select id="selectProcessCard">
         select processing_card from sd.`order` where order_id = #{orderId}
     </select>
+
+    <update id="updateWorkIdMp">
+        UPDATE sd.order_glass_detail AS ogd
+            JOIN (
+            SELECT order_id, order_number, MAX(production_id) AS production_id
+            FROM sd.order_glass_detail
+            WHERE production_id IS NOT NULL
+            AND FIND_IN_SET(order_id, #{orderId})  
+            GROUP BY order_id, order_number
+            ) AS t
+        ON ogd.order_id = t.order_id AND ogd.order_number = t.order_number
+            SET ogd.production_id = t.production_id,
+                ogd.production_time = NOW(),
+                ogd.founder = #{userName}
+        WHERE ogd.production_id IS NULL
+          AND FIND_IN_SET(ogd.order_id, #{orderId})
+
+    </update>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0