From 15f335a0553bbc56c23a1eea9548e53b8fdbcb87 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期一, 11 三月 2024 11:29:04 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/target/classes/mapper/pp/FolwCard.xml |   38 ++++++++++++++++++++++++--------------
 1 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/north-glass-erp/target/classes/mapper/pp/FolwCard.xml b/north-glass-erp/target/classes/mapper/pp/FolwCard.xml
index b840f47..5e28ebb 100644
--- a/north-glass-erp/target/classes/mapper/pp/FolwCard.xml
+++ b/north-glass-erp/target/classes/mapper/pp/FolwCard.xml
@@ -9,6 +9,7 @@
         <result column="quantity" property="quantity"/>
         <result column="founder" property="founder"/>
         <result column="create_time" property="createTime"/>
+        <result column="layout_status" property="layoutStatus"/>
         <!--鎺ユ敹鍏朵粬澶栭敭瀹炰綋绫绘暟鎹�-->
         <association property="order" javaType="com.example.erp.entity.sd.Order">
             <result column="project" property="project"/>
@@ -56,18 +57,19 @@
         c.product_id,
         c.product_name,
         b.project,
-        a.quantity,
-        c.compute_gross_area,
+        sum(a.quantity) as quantity,
+        sum(c.compute_gross_area) as compute_gross_area,
         a.founder,
-        c.processing_note
+        c.processing_note,
+        if(a.layout_status=0,"涓嶅彲鎺掔増",if(a.layout_status=1,"鍙帓鐗�","宸叉帓鐗�")) as layout_status
         from flow_card as a left join sd.`order` as b on a.order_Id=b.order_id
         left join sd.order_detail as c on a.order_Id=c.order_id and a.order_Number=c.order_number
         where a.create_time between #{selectTime1} and #{selectTime2}
                     <if test="flowCard.orderId != null and flowCard.orderId != ''">
                         and a.order_id regexp #{flowCard.orderId}
                     </if>
-                    <if test="flowCard.productionId != null and flowCard.productionId != ''">
-                        and a.process_Id regexp #{flowCard.productionId}
+                    <if test="flowCard.processId != null and flowCard.processId != ''">
+                        and a.process_Id regexp #{flowCard.processId}
                     </if>
                     <if test="flowCard.orderDetail.productId != null and flowCard.orderDetail.productId != ''">
                         and c.product_id regexp #{flowCard.orderDetail.productId}
@@ -111,7 +113,7 @@
             and b.project regexp #{flowCard.order.project}
         </if>
 
-
+        ORDER BY a.id desc
         limit #{offset},#{pageSize};
     </select>
 
@@ -158,6 +160,7 @@
             and o.salesman regexp #{flowCard.order.salesman}
         </if>
         group by o.order_id
+        order by o.id desc
 
         ;
     </select>
@@ -171,11 +174,13 @@
         SUM( od.quantity) as quantity,
         SUM(od.compute_gross_area) as compute_gross_area,
         od.perimeter
-        from  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
+        from  sd.order_detail as od left join
+        (select order_id,order_number,production_id,splitting_status from sd.order_glass_detail
+        GROUP BY order_id,order_number
+        ) as ogd on od.order_id=ogd.order_id and od.order_number=ogd.order_number
         where od.order_id = #{orderId} and ogd.splitting_status=0
-        <if test="flowCard.orderDetail.orderId != null and flowCard.orderDetail.orderId != ''">
-            and od.order_id regexp #{flowCard.orderDetail.orderId}
+        <if test="flowCard.orderId != null and flowCard.orderId != ''">
+            and od.order_id regexp #{flowCard.orderId}
         </if>
         <if test="flowCard.orderGlassDetail.productionId != null and flowCard.orderGlassDetail.productionId != ''">
             and ogd.production_id regexp #{flowCard.orderGlassDetail.productionId}
@@ -187,6 +192,7 @@
             and od.product_name regexp #{flowCard.orderDetail.productName}
         </if>
         group by od.order_id, ogd.production_id
+        order by od.id desc
     </select>
 
     <!--    鏇存柊鍒嗘灦鐘舵��-->
@@ -228,15 +234,15 @@
         left join sd.order_glass_detail as ogd on od.order_id=ogd.order_id and od.order_number=ogd.order_number
         left join sd.product as p on od.product_name=p.product_name
         where od.order_id=#{orderId} and ogd.production_id=#{productionId} and ogd.splitting_status=0
-        GROUP BY od.order_number;
-
+        GROUP BY od.order_number
+        order by od.id desc
 
     </select>
 
     <!--淇敼鎺掔増鐘舵��-->
     <update id="updateLayoutStatusMp">
         update flow_card as fc
-        set fc.layout_status=2
+        set fc.layout_status=#{state}
         where fc.process_id = #{processId}
     </update>
 
@@ -322,7 +328,7 @@
         from sd.order_detail as od left join sd.order as o on od.order_id=o.order_id
                                    left join production_scheduling as ps on ps.order_id=od.order_id and ps.order_number=od.order_number
         where od.order_id=#{orderId} and ps.processes=#{processes} and ps.scheduling_id IS NOT NULL
-
+        order by ps.id desc
     </select>
 <!--    鏌ヨ鏈帓鐗堟暟鎹�-->
     <select id="selectNoSchedulingMp">
@@ -349,4 +355,8 @@
         where ogd.production_id = #{productionId}
           and ogd.order_number=#{orderNumber}
     </select>
+<!--  鏌ヨ璇ヨ鍗曟祦绋嬪崱鏉℃暟  -->
+    <select id="selectFlowCardCount">
+        select COUNT(*) from flow_card where order_id=#{orderId}
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0