From ee4dc5d6c9d3bc8ae8e704f93fa6b233e8b42e8f Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期五, 31 五月 2024 11:49:55 +0800
Subject: [PATCH] 首页分成两张表格

---
 north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml |  204 +++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 158 insertions(+), 46 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
index 03079b9..da75f56 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -61,7 +61,46 @@
         sum(c.compute_gross_area) as compute_gross_area,
         a.founder,
         c.processing_note,
-        if(a.layout_status=0,"涓嶅彲鎺掔増",if(a.layout_status=1,"鍙帓鐗�","宸叉帓鐗�")) as layout_status
+        if(a.layout_status=0,'涓嶅彲鎺掔増',if(a.layout_status=1,'鍙帓鐗�','宸叉帓鐗�')) as layout_status
+        from (select  id,order_id,process_id,order_number, quantity,founder,layout_status,create_time from flow_card group by process_Id,order_number) 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.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}
+        </if>
+        <if test="flowCard.orderDetail.productName != null and flowCard.orderDetail.productName!= ''">
+            and c.product_name regexp #{flowCard.orderDetail.productName}
+        </if>
+
+        <if test="flowCard.order.project != null and flowCard.order.project!= ''">
+            and b.project regexp #{flowCard.order.project}
+        </if>
+        <if test="flowCard.layoutStatus != null and flowCard.layoutStatus != '' and  flowCard.layoutStatus == '涓嶅彲鎺掔増'">
+            and a.layout_status regexp 0
+        </if>
+        <if test="flowCard.layoutStatus != null and flowCard.layoutStatus != '' and  flowCard.layoutStatus == '鍙帓鐗�'">
+            and a.layout_status regexp 1
+        </if>
+        <if test="flowCard.layoutStatus != null and flowCard.layoutStatus != '' and  flowCard.layoutStatus == '宸叉帓鐗�'">
+            and a.layout_status regexp 2
+        </if>
+
+        group by a.process_Id
+        ORDER BY a.id desc
+        limit #{offset},#{pageSize};
+    </select>
+
+
+    <select id="getPageTotal">
+        select
+        CEILING(count(a.process_Id)/#{pageSize}) as 'pageTotal',
+        count(distinct a.process_Id) as 'total'
         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}
@@ -81,36 +120,14 @@
         <if test="flowCard.order.project != null and flowCard.order.project!= ''">
             and b.project regexp #{flowCard.order.project}
         </if>
-
-
-        group by a.process_Id
-        ORDER BY a.id desc
-        limit #{offset},#{pageSize};
-    </select>
-
-
-    <select id="getPageTotal">
-        select
-        CEILING(count(a.process_Id)/#{pageSize}) as 'pageTotal',
-        count(distinct a.process_Id) as 'total'
-        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 test="flowCard.layoutStatus != null and flowCard.layoutStatus != '' and  flowCard.layoutStatus == '涓嶅彲鎺掔増'">
+            and a.layout_status regexp 0
         </if>
-        <if test="flowCard.productionId != null and flowCard.productionId != ''">
-            and a.process_Id regexp #{flowCard.productionId}
+        <if test="flowCard.layoutStatus != null and flowCard.layoutStatus != '' and  flowCard.layoutStatus == '鍙帓鐗�'">
+            and a.layout_status regexp 1
         </if>
-        <if test="flowCard.orderDetail.productId != null and flowCard.orderDetail.productId != ''">
-            and c.product_id regexp #{flowCard.orderDetail.productId}
-        </if>
-        <if test="flowCard.orderDetail.productName != null and flowCard.orderDetail.productName!= ''">
-            and c.product_name regexp #{flowCard.orderDetail.productName}
-        </if>
-
-        <if test="flowCard.order.project != null and flowCard.order.project!= ''">
-            and b.project regexp #{flowCard.order.project}
+        <if test="flowCard.layoutStatus != null and flowCard.layoutStatus != '' and  flowCard.layoutStatus == '宸叉帓鐗�'">
+            and a.layout_status regexp 2
         </if>
 
         ORDER BY a.id desc
@@ -167,31 +184,20 @@
     </select>
 
     <!--    鍒嗘灦鏄庣粏鏌ヨ-->
-    <select id="detailsSelectMp" resultMap="flowCardMap">
+    <select id="detailsSelectMp">
         select od.order_id,
         ogd.production_id,
         od.product_id,
         od.product_name,
         SUM( od.quantity) as quantity,
         SUM(od.compute_gross_area) as compute_gross_area,
-        od.perimeter
+        sum(od.perimeter) as perimeter
         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.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}
-        </if>
-        <if test="flowCard.orderDetail.productId != null and flowCard.orderDetail.productId != ''">
-            and od.product_id regexp #{flowCard.orderDetail.productId}
-        </if>
-        <if test="flowCard.orderDetail.productName != null and flowCard.orderDetail.productName != ''">
-            and od.product_name regexp #{flowCard.orderDetail.productName}
-        </if>
+
         group by od.order_id, ogd.production_id
         order by od.id desc
     </select>
@@ -203,7 +209,7 @@
                 on ogd.order_id = fc.order_id and ogd.order_number = fc.order_number
         set ogd.splitting_status=0
         where ogd.order_id = #{orderId}
-          and fc.process_id = #{processId}
+          and ogd.production_id = left(#{processId},11)
 
     </update>
 
@@ -211,7 +217,7 @@
     <update id="deleteFlowCardMp">
         delete
         from flow_card as fc
-        where fc.process_id = #{processId}
+        where fc.production_id = left(#{processId},11)
     </update>
 
     <!--    鍒嗘灦鏂板鏄庣粏鏌ヨ-->
@@ -390,9 +396,13 @@
         select fc.order_id,
                fc.process_id,
                fc.order_number,
+               fc.technology_number,
                fc.quantity,
+               ogd.child_width,
+               ogd.child_height,
                round(ogd.child_width * ogd.child_height * fc.quantity / 1000000, 2) as area,
                od.product_name,
+               ogd.glass_child,
                fc.founder,
                date(fc.splitFrame_time) as splitFrame_time
         from flow_card as fc
@@ -401,6 +411,108 @@
                               fc.technology_number = ogd.technology_number
                  left join sd.order_detail as od on od.order_id = ogd.order_id and od.order_number = ogd.order_number
         where fc.process_id = #{processId}
-        GROUP BY fc.order_id, fc.process_id, fc.order_number
+        GROUP BY fc.order_id, fc.process_id, fc.order_number,fc.technology_number
+        order by fc.order_number,fc.technology_number
     </select>
+
+    <delete id="deleteReportingWork">
+        delete from sd.order_process_detail
+        where  left(process_id,11) = left(#{processId},11)
+    </delete>
+
+    <select id="selectPrintFlowCardMp">
+        select * from  sd.order where create_time between #{selectTime1} and #{selectTime2} and
+                                      position(#{orderId} in order_id ) and position(#{project} in project)
+        and processing_card=2
+    </select>
+
+    <select id="selectPrintMp">
+        select fc.id,
+               fc.order_id,
+               fc.process_id,
+               o.customer_name,
+               o.project,
+               ogd.technology_number,
+               ogd.glass_address,
+               od.quantity,
+               ogd.total_area,
+               od.product_name,
+               ogd.glass_child,
+               fc.founder,
+               date(fc.splitFrame_time) as splitFrame_time
+        from flow_card as fc
+                 left join sd.order_glass_detail as ogd
+                           on ogd.order_id = fc.order_id and ogd.order_number = fc.order_number and
+                              ogd.technology_number = fc.technology_number
+                 left join sd.order_detail as od on od.order_id = fc.order_id and od.order_number = fc.order_number
+                 left join sd.`order` as o on o.order_id = fc.order_id
+        where fc.order_id = #{orderId}
+        GROUP BY fc.process_id, ogd.technology_number
+        order by fc.process_id, ogd.technology_number
+
+    </select>
+
+    <select id="getPrimaryList">
+        select o.customer_name,
+               o.project,
+               ogd.process,
+               od.edging_type,
+               ogd.glass_child,
+               od.product_name,
+               o.processing_note,
+               fc.process_id,
+               SUM( od.quantity) as quantity,
+               SUM(ogd.total_area) as gross_area,
+               SUM(od.weight) as weight,
+               #{technologyNumber} as technologyNumber,
+               concat(fc.process_id,'/',#{technologyNumber}) as  processIdNumber
+        from flow_card as fc
+                 left join sd.order_glass_detail as ogd
+                           on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
+                              fc.technology_number = ogd.technology_number
+                 left join sd.order_detail as od on od.order_id = fc.order_id and od.order_number = fc.order_number
+                 left join sd.`order` as o on o.order_id = fc.order_id
+        where fc.process_id = #{processId}
+          and fc.technology_number = #{technologyNumber}
+        group by fc.process_id, fc.technology_number
+    </select>
+
+    <select id="getDetailList">
+        select fc.order_number,
+               concat(ogd.child_width, "*", ogd.child_height) as child_width,
+               od.quantity,
+               round(ogd.total_area,2) as total_area,
+               od.perimeter,
+               od.bend_radius,
+               od.remarks
+        from flow_card as fc
+                 left join sd.order_glass_detail as ogd
+                           on fc.order_id = ogd.order_id and fc.order_number = ogd.order_number and
+                              fc.technology_number = ogd.technology_number
+                 left join sd.order_detail as od on od.order_id = fc.order_id and od.order_number = fc.order_number
+        where fc.process_id = #{processId}
+          and fc.technology_number = #{technologyNumber}
+        group by fc.process_id, fc.order_number
+        order by fc.order_number
+    </select>
+
+    <select id="getProcessList">
+        select *
+        from sd.order_process_detail
+        where process_id = #{processId}
+          and technology_number = #{technologyNumber}
+        group by process
+    </select>
+
+    <update id="updateInventory">
+        update flow_card set inventory_quantity=#{completedQuantity}
+        where process_id = #{processId} and  order_number = #{orderNumber} and technology_number = #{technologyNumber}
+    </update>
+
+<!--    澶嶉�夋淇敼鎺掔増鐘舵��-->
+    <update id="updateComposing">
+        update flow_card as fc
+        set fc.layout_status=1
+        where fc.process_id = #{processId}
+    </update>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0