From 7b8cc84950a3caeb8cae5e99a7aa99c1aafa6ac7 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期四, 22 二月 2024 14:18:17 +0800
Subject: [PATCH] 提交分架代码

---
 north-glass-erp/src/main/resources/mapper/pp/WordOrder.xml |  121 ++++++++++++++++++++++++----------------
 1 files changed, 73 insertions(+), 48 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 037e499..3eebdef 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/WordOrder.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/WordOrder.xml
@@ -30,39 +30,39 @@
     </resultMap>
     <select id="selectWordOrder" resultMap="wordOrderMap">
         select
-        a.order_id,
-        a.production_id,
-        c.batch,
-        b.product_name,
-        b.compute_area,
-        b.quantity,
-        b.compute_gross_area,
-        b.perimeter,
-        b.bend_radius,
-        b.processing_note
-        from order_glass_detail as a
-        LEFT JOIN order_detail as b on a.order_id=b.order_id and a.order_number=b.order_number LEFT JOIN
-        `order` as c on a.order_id=c.order_id
-        where isnull(a.production_id)
+        o.order_id,
+        ogd.production_id,
+        o.batch,
+        od.product_name,
+        od.compute_area,
+        od.quantity,
+        od.compute_gross_area,
+        od.perimeter,
+        od.bend_radius,
+        od.processing_note
+
+        from `order` as o left join order_detail as od on o.order_id=od.order_id
+        left join order_glass_detail as ogd on o.order_id=ogd.order_id and ogd.order_number=od.order_number
+        where isnull(ogd.production_id) and o.order_review=2 and o.production_order!=2
             <if test="orderGlassDetail.orderId != null and orderGlassDetail.orderId != ''">
-                and a.order_id regexp #{orderGlassDetail.orderId}
+                and o.order_id regexp #{orderGlassDetail.orderId}
             </if>
             <if test="orderGlassDetail.productionId != null and orderGlassDetail.productionId != ''">
-                and a.production_id regexp #{orderGlassDetail.productionId}
+                and ogd.production_id regexp #{orderGlassDetail.productionId}
             </if>
             <if test="orderGlassDetail.order.batch != null and orderGlassDetail.order.batch != ''">
-                and c.batch regexp #{orderGlassDetail.order.batch}
+                and o.batch regexp #{orderGlassDetail.order.batch}
             </if>
             <if test="orderGlassDetail.orderDetail.productName != null and orderGlassDetail.orderDetail.productName!= ''">
-                and b.product_name regexp #{orderGlassDetail.orderDetail.productName}
+                and od.product_name regexp #{orderGlassDetail.orderDetail.productName}
             </if>
 
             <if test="orderGlassDetail.createTime != ''">
-                and DATE_FORMAT((a.create_time),'%Y-%m-%d') BETWEEN #{ selectTime1 } AND #{ selectTime2 }
+                and DATE_FORMAT((ogd.create_time),'%Y-%m-%d') BETWEEN #{ selectTime1 } AND #{ selectTime2 }
             </if>
 
-        group by a.production_id,a.order_number
-        order by a.id desc
+        group by o.order_id
+        order by o.id desc
 
 
         ;
@@ -70,45 +70,45 @@
 
     <select id="selectWordOrderNo" resultMap="wordOrderMap">
         select
-        a.order_id,
-        a.production_id,
-        c.batch,
-        b.product_name,
-        b.compute_area,
-        b.quantity,
-        b.compute_gross_area,
-        b.perimeter,
-        b.bend_radius,
-        b.processing_note
-        from order_glass_detail as a
-        LEFT JOIN order_detail as b on a.order_id=b.order_id and a.order_number=b.order_number LEFT JOIN
-        `order` as c on a.order_id=c.order_id
-        where a.production_id IS NOT NULL
+        o.order_id,
+        ogd.production_id,
+        o.batch,
+        od.product_name,
+        od.compute_area,
+        od.quantity,
+        od.compute_gross_area,
+        od.perimeter,
+        od.bend_radius,
+        od.processing_note
+
+        from `order` as o left join order_detail as od on o.order_id=od.order_id
+        left join order_glass_detail as ogd on o.order_id=ogd.order_id and ogd.order_number=od.order_number
+        where ogd.production_id IS NOT NULL
         <if test="orderGlassDetail.orderId != null and orderGlassDetail.orderId != ''">
-            and a.order_id regexp #{orderGlassDetail.orderId}
+            and ogd.order_id regexp #{orderGlassDetail.orderId}
         </if>
         <if test="orderGlassDetail.productionId != null and orderGlassDetail.productionId != ''">
-            and a.production_id regexp #{orderGlassDetail.productionId}
+            and ogd.production_id regexp #{orderGlassDetail.productionId}
         </if>
         <if test="orderGlassDetail.order.batch != null and orderGlassDetail.order.batch != ''">
-            and c.batch regexp #{orderGlassDetail.order.batch}
+            and o.batch regexp #{orderGlassDetail.order.batch}
         </if>
         <if test="orderGlassDetail.orderDetail.productName != null and orderGlassDetail.orderDetail.productName!= ''">
-            and b.product_name regexp #{orderGlassDetail.orderDetail.productName}
+            and od.product_name regexp #{orderGlassDetail.orderDetail.productName}
         </if>
 
         <if test="orderGlassDetail.createTime != ''">
-            and DATE_FORMAT((a.create_time),'%Y-%m-%d') BETWEEN #{ selectTime1 } AND #{ selectTime2 }
+            and DATE_FORMAT((ogd.create_time),'%Y-%m-%d') BETWEEN #{ selectTime1 } AND #{ selectTime2 }
         </if>
 
-        group by a.production_id,a.order_number
-        order by a.id desc
+        group by ogd.production_id,ogd.order_number
+        order by ogd.id desc
 
 
         ;
     </select>
 
-    <select id="addWordOrder">
+    <select id="addWordOrder" >
         select od.order_id,
                od.product_id,
                od.product_name,
@@ -117,20 +117,28 @@
                od.perimeter
         from order_detail as od
                  left join sd.order_glass_detail as ogd
-                           on od.order_id = ogd.order_id and od.order_number = ogd.order_number
-        where od.order_id = #{orderId}
-          and ISNULL(ogd.production_id)
+                           on od.order_id = ogd.order_id
+        where od.order_id = #{orderId}  and ISNULL(ogd.production_id)
+        <if test="orderDetail.orderId != null and orderDetail.orderId != ''">
+            and od.order_id regexp #{orderDetail.orderId}
+        </if>
+        <if test="orderDetail.productId != null and orderDetail.productId != ''">
+            and od.product_id regexp #{orderDetail.productId}
+        </if>
+        <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
         ;
     </select>
 
-    <select id="SelectOrderNumber">
+    <select id="SelectOrderNumber" resultMap="wordOrderMap">
         select count(ogd.production_id)
         from sd.order_glass_detail as ogd
         where ogd.production_id = #{productIdVl}
     </select>
 
-    <update id="AddOrderWorkMp">
+    <update id="AddOrderWorkMp" >
         update sd.order_detail as od left join sd.order_glass_detail as ogd
             on od.order_id = ogd.order_id and od.order_number = ogd.order_number
 
@@ -152,4 +160,21 @@
         where od.order_id = #{orderId}
           and od.product_name = #{productName}
     </update>
+
+    <select id="SelectWorkCount">
+        select COUNT(distinct order_number)
+        from order_glass_detail
+        where ISNULL(production_id)
+          and order_id = #{orderId}
+    </select>
+
+    <select id="SelectYesWorkCount">
+        select COUNT(distinct order_number)
+        from order_glass_detail
+        where  order_id = #{orderId}
+    </select>
+
+    <update id="UpdateWorkType">
+        update sd.order as o set o.production_order=#{state} where o.order_id=#{orderId}
+    </update>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0