From 2ad08ea181d8ec1e2b4b90bd1ddd40a2ba595b59 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期四, 07 三月 2024 08:08:25 +0800
Subject: [PATCH] 提交更新

---
 north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml |  233 +++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 167 insertions(+), 66 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 abdc806..9d82870 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -6,7 +6,7 @@
     <resultMap id="flowCardMap" type="com.example.erp.entity.pp.FlowCard">
         <result column="order_id" property="orderId"/>
         <result column="process_Id" property="processId"/>
-        <result column="binning_quantity" property="binningQuantity"/>
+        <result column="quantity" property="quantity"/>
         <result column="founder" property="founder"/>
         <result column="create_time" property="createTime"/>
         <!--鎺ユ敹鍏朵粬澶栭敭瀹炰綋绫绘暟鎹�-->
@@ -56,7 +56,7 @@
         c.product_id,
         c.product_name,
         b.project,
-        a.binning_quantity,
+        a.quantity,
         c.compute_gross_area,
         a.founder,
         c.processing_note
@@ -97,100 +97,106 @@
         o.processing_note,
         o.delivery_address
         from sd.`order` as o
-        where o.production_order=2 and o.create_time between #{selectTime1} and #{selectTime2}
-        <!--        <where>-->
-        <!--            <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>-->
-        <!--            <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>-->
+        left join sd.order_glass_detail ogd on o.order_id = ogd.order_id
+        where o.production_order=2 and ogd.splitting_status=0 and o.create_time between #{selectTime1} and #{selectTime2}
 
-        <!--            <if test="flowCard.order.project != null and flowCard.order.project!= ''">-->
-        <!--                and b.project regexp #{flowCard.order.project}-->
-        <!--            </if>-->
+        <if test="flowCard.order.orderId != null and flowCard.order.orderId != ''">
+            and o.order_id regexp #{flowCard.order.orderId}
+        </if>
+        <if test="flowCard.order.customerName != null and flowCard.order.customerName != ''">
+            and o.customer_name regexp #{flowCard.order.customerName}
+        </if>
+        <if test="flowCard.order.project != null and flowCard.order.project != ''">
+            and o.project regexp #{flowCard.order.project}
+        </if>
+        <if test="flowCard.order.batch != null and flowCard.order.batch!= ''">
+            and o.batch regexp #{flowCard.order.batch}
+        </if>
 
+        <if test="flowCard.order.otherRemarks != null and flowCard.order.otherRemarks!= ''">
+            and o.other_remarks regexp #{flowCard.order.otherRemarks}
+        </if>
 
-        <!--        </where>-->
+        <if test="flowCard.order.icon != null and flowCard.order.icon!= ''">
+            and o.icon regexp #{flowCard.order.icon}
+        </if>
+        <if test="flowCard.order.orderType != null and flowCard.order.orderType!= ''">
+            and o.order_type regexp #{flowCard.order.orderType}
+        </if>
+        <if test="flowCard.order.salesman != null and flowCard.order.salesman!= ''">
+            and o.salesman regexp #{flowCard.order.salesman}
+        </if>
+        group by o.order_id
+
         ;
     </select>
 
 <!--    鍒嗘灦鏄庣粏鏌ヨ-->
     <select id="DetailsSelectMp" resultMap="flowCardMap">
         select od.order_id,
-               ogd.production_id,
-               od.product_id,
-               od.product_name,
-               od.quantity,
-               od.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
-        where od.order_id = #{orderId}
-<!--        <if test="orderDetail.orderId != null and orderDetail.orderId != ''">-->
-<!--            and od.order_id regexp #{orderDetail.orderId}-->
-<!--        </if>-->
-<!--        <if test="flowCard.orderGlassDetail.productionId != null and flowCard.orderGlassDetail.productionId != ''">-->
-<!--            and ogd.production_id regexp #{flowCard.orderGlassDetail.productionId}-->
-<!--        </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>-->
+        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
+        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
+        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>
+        <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
     </select>
 
+    <!--    鏇存柊鍒嗘灦鐘舵��-->
+    <update id="UpdateDeleteState">
+        update
+            sd.order_glass_detail as ogd left join flow_card as fc
+                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}
 
-    <!--    鍒犻櫎宸ュ崟-->
+    </update>
+
+    <!--    鍒犻櫎娴佺▼鍗�-->
     <update id="DeleteFlowCardMp">
-        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
-        set ogd.production_id=null,
-            ogd.production_time=null,
-            ogd.founder=null
-        where od.order_id = #{orderId}
-          and od.product_name = #{productName}
+        delete from flow_card as fc where fc.process_id=#{processId}
     </update>
 
     <!--    鍒嗘灦鏂板鏄庣粏鏌ヨ-->
-    <select id="SelectNoCardMp" resultMap="flowCardMap">
+
+    <!--resultMap="flowCardMap"-->
+    <select id="SelectNoCardMp" >
+
         select
         od.order_number,
+        od.order_number AS 'orderNumber',
         od.width,
         od.height,
         od.shape,
         od.quantity,
         od.compute_gross_area,
         p.total_thickness,
+        od.quantity as baiscQuantity,
+        od.compute_gross_area as 'computeGrossArea',
+        p.total_thickness AS 'totalThickness',
         p.thickness,
         od.weight
         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
         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
-        <if test="flowCard.orderDetail.orderNumber != null and flowCard.orderDetail.orderNumber != ''">
-            and od.order_number regexp #{flowCard.orderDetail.orderNumber}
-        </if>
-        <if test="flowCard.orderDetail.width != null and flowCard.orderDetail.width != ''">
-            and od.width regexp #{flowCard.orderDetail.width}
-        </if>
-        <if test="flowCard.orderDetail.height != null and flowCard.orderDetail.height != ''">
-            and od.height regexp #{flowCard.orderDetail.height}
-        </if>
-        <if test="flowCard.orderDetail.shape != null and flowCard.orderDetail.shape != ''">
-            and od.shape regexp #{flowCard.orderDetail.shape}
-
-        </if>
+        where od.order_id=#{orderId} and ogd.production_id=#{productionId} and ogd.splitting_status=0
         GROUP BY od.order_number;
 
 
@@ -199,7 +205,7 @@
     <!--淇敼鎺掔増鐘舵��-->
     <update id="UpdateLayoutStatusMp">
         update flow_card as fc
-        set fc.layout_status=1
+        set fc.layout_status=2
         where fc.process_id = #{processId}
     </update>
 
@@ -217,4 +223,99 @@
         from reporting_work as rw
         where rw.process_id = #{processId}
     </select>
+<!--    鎻掑叆Flow_card琛�-->
+    <insert id="AddFlowCardMp">
+        insert into
+            flow_card (
+            order_id,
+            production_id,
+            process_id,
+            landing_sequence,
+            order_number,
+            technology_number,
+            quantity,
+            founder,
+            layers_number,
+            splitFrame_time,
+            create_time
+        )
+        select
+            ogd.order_id,
+            ogd.production_id,
+            #{processId},
+            #{landingSequence},
+            ogd.order_number,
+            ogd.technology_number,
+            #{quantity},
+            #{userName},
+            #{layer},
+            NOW(),
+            NOW()
+
+
+
+        from sd.order_glass_detail as ogd
+        where ogd.production_id=#{productionId} and ogd.order_number=#{orderNumber}
+        GROUP BY ogd.technology_number
+    </insert>
+
+<!--    鏇存柊鍒嗘灦鐘舵��-->
+    <update id="UpdateFlowState">
+        update sd.order_glass_detail as ogd
+        set ogd.splitting_status=1
+        where ogd.production_id=#{productionId} and ogd.order_number=#{orderNumber}
+    </update>
+<!--    鏌ヨ鏈垎鏋剁殑鏉℃暟-->
+    <select id="SelectFlowCount">
+        select COUNT(*)
+        from sd.order_glass_detail as ogd
+        where ogd.order_id = left(#{productionId},10)
+          and ogd.splitting_status = 0
+    </select>
+<!--   淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬�-->
+    <update id="UpdateProcessingCard">
+        update sd.`order` as o
+        set o.processing_card=#{state}
+        where o.order_id=left(#{productionId},10)
+    </update>
+
+<!--    鏌ヨ宸叉帓鐗堟暟鎹�-->
+    <select id="SelectOkSchedulingMp">
+        select od.order_id,o.customer_name,o.project,od.order_number,od.width,od.height,od.quantity,
+               round(od.width*od.height*od.quantity/1000000,2),
+               (od.quantity-IFNULL(ps.scheduling_quantity,0)),
+               round(od.width*od.height*(od.quantity-IFNULL(ps.scheduling_quantity,0))/1000000,2),
+               IFNULL(ps.scheduling_quantity,0),
+               round(od.width*od.height*(IFNULL(ps.scheduling_quantity,0))/1000000,2),
+               od.product_name,od.shape
+        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
+
+    </select>
+<!--    鏌ヨ鏈帓鐗堟暟鎹�-->
+    <select id="SelectNoSchedulingMp">
+
+    </select>
+<!--    棣栨鏌ヨ鎺掔増鏁版嵁-->
+    <select id="selectLastSchedulingMp">
+        select od.order_id,o.customer_name,o.project,od.order_number,od.width,od.height,od.quantity,
+               round(od.width*od.height*od.quantity/1000000,2) as area,
+               (od.quantity-IFNULL(ps.scheduling_quantity,0)) as pendingProductionQuantity,
+               round(od.width*od.height*(od.quantity-IFNULL(ps.scheduling_quantity,0))/1000000,2) as pendingProductionArea,
+               IFNULL(ps.scheduling_quantity,0) as productionScheduledQuantity,
+               round(od.width*od.height*(IFNULL(ps.scheduling_quantity,0))/1000000,2) as productionScheduledArea,
+               od.product_name,od.shape
+        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.create_time between #{selectTime1} and #{selectTime2}
+    </select>
+
+<!--   鏌ヨ瀵瑰簲搴忓彿鐨勫眰鏁�-->
+    <select id="SelectLayer">
+        select COUNT(ogd.order_number)
+        from sd.order_glass_detail as ogd
+        where ogd.production_id = #{productionId}
+          and ogd.order_number=#{orderNumber}
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0