From b25ccda9d61fd7e902fd99ff7e85bfe9e0971d83 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期二, 23 七月 2024 09:15:47 +0800
Subject: [PATCH] 分架界面修改

---
 north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml | 1349 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 1,274 insertions(+), 75 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 4bf7021..fb4669b 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -4,104 +4,1303 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.example.erp.mapper.pp.FlowCardMapper">
     <resultMap id="flowCardMap" type="com.example.erp.entity.pp.FlowCard">
-
         <result column="order_id" property="orderId"/>
-        <result column="production_id" property="productionId"/>
-        <result column="splitting_status" property="splittingStatus"/>
+        <result column="process_Id" property="processId"/>
+        <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"/>
+            <result column="order_id" property="orderId"/>
+            <result column="customer_name" property="customerName"/>
             <result column="batch" property="batch"/>
+            <result column="other_remarks" property="otherRemarks"/>
+            <result column="icon" property="icon"/>
+            <result column="order_type" property="orderType"/>
+            <result column="salesman" property="salesman"/>
+            <result column="processing_note" property="processingNote"/>
+            <result column="delivery_address" property="deliveryAddress"/>
         </association>
         <association property="orderDetail" javaType="com.example.erp.entity.sd.OrderDetail">
+            <result column="product_id" property="productId"/>
             <result column="product_name" property="productName"/>
-            <result column="compute_area" property="computeArea"/>
+            <result column="compute_gross_area" property="computeGrossArea"/>
+            <result column="processing_note" property="processingNote"/>
             <result column="quantity" property="quantity"/>
             <result column="compute_gross_area" property="computeGrossArea"/>
             <result column="perimeter" property="perimeter"/>
-            <result column="bend_radius" property="bendRadius"/>
-            <result column="processing_note" property="processingNote"/>
+            <result column="order_number" property="orderNumber"/>
+            <result column="width" property="width"/>
+            <result column="height" property="height"/>
+            <result column="shape" property="shape"/>
+            <result column="weight" property="weight"/>
+        </association>
+        <association property="orderGlassDetail" javaType="com.example.erp.entity.sd.OrderGlassDetail">
+            <result column="production_id" property="productionId"/>
+        </association>
+        <association property="product" javaType="com.example.erp.entity.sd.Product">
+            <result column="total_thickness" property="totalThickness"/>
+            <result column="thickness" property="thickness"/>
         </association>
 
         <!--<result column="g_typeId" property="glassTypes.typeId"/>
         <result column="g_type" property="glassTypes.type"/>-->
 
     </resultMap>
+
+
+    <!--    娴佺▼鍗$鐞嗘煡璇�-->
     <select id="selectFlowCard" resultMap="flowCardMap">
         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>
-            <if test="orderGlassDetail.orderId != null and orderGlassDetail.orderId != ''">
-                and a.order_id regexp #{orderGlassDetail.orderId}
-            </if>
-            <if test="orderGlassDetail.productionId != null and orderGlassDetail.productionId != ''">
-                and a.production_id regexp #{orderGlassDetail.productionId}
-            </if>
-            <if test="orderGlassDetail.order.batch != null and orderGlassDetail.order.batch != ''">
-                and c.batch regexp #{orderGlassDetail.order.batch}
-            </if>
-            <if test="orderGlassDetail.orderDetail.productName != null and orderGlassDetail.orderDetail.productName!= ''">
-                and b.product_name regexp #{orderGlassDetail.orderDetail.productName}
-            </if>
-            <if test="orderGlassDetail.splittingStatus=0 " >
-                and a.splitting_status regexp #{state}
-            </if>
-            <if test="orderGlassDetail.splittingStatus=1">
-                and a.splitting_status regexp #{state}
-            </if>
-            <if test="orderGlassDetail.createTime != ''">
-                and DATE_FORMAT((a.create_time),'%Y-%m-%d')  BETWEEN #{ selectTime1 } AND #{ selectTime2 }
-            </if>
-        </where>
-        group by a.production_id,a.order_number
-        order by a.id desc
+        a.order_Id,
+        a.process_Id,
+        c.product_id,
+        c.product_name,
+        b.project,
+        sum(a.quantity) as quantity,
+        sum(c.compute_gross_area) as compute_gross_area,
+        a.founder,
+        c.processing_note,
+        b.customer_name,
+        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>
+        <if test="flowCard.order.customerName != null and flowCard.order.customerName!= ''">
+            and b.customer_name regexp #{flowCard.order.customerName}
+        </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>
+        <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>
+
+        ORDER BY a.id desc
+        limit #{offset},#{pageSize};
+    </select>
+
+    <!--鍒嗘灦鏌ヨ-->
+    <select id="selectFlowCardMp" resultMap="flowCardMap">
+        select o.order_id,
+        o.customer_name,
+        o.project,
+        o.batch,
+        o.other_remarks,
+        o.icon,
+        o.order_type,
+        o.salesman,
+        o.processing_note,
+        o.delivery_address
+        from sd.`order` as o
+        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.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>
+
+        <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
+        order by o.id desc
 
         ;
     </select>
 
-    <!--    <select id="getPageTotal" >-->
-    <!--        select-->
-    <!--        CEILING(count(a.id)/#{pageSize})-->
-    <!--        from product as a-->
-    <!--        left join basic_glass_type bgt on bgt.type_id = a.type_id-->
-    <!--        <where>-->
-    <!--            <if test="glassTypeId != null and glassTypeId != ''">-->
-    <!--                and a.type_id regexp #{glassTypeId}-->
-    <!--            </if>-->
-    <!--            <if test="product.id != null and product.id != ''">-->
-    <!--                and a.id regexp #{product.id}-->
-    <!--            </if>-->
-    <!--            <if test="product.productName != null and product.productName != ''">-->
-    <!--                and a.product_name regexp #{product.productName}-->
-    <!--            </if>-->
-    <!--            <if test="product.basicGlassType.typeName != null and product.basicGlassType.typeName!= ''">-->
-    <!--                and bgt.type_name regexp #{product.basicGlassType.typeName}-->
-    <!--            </if>-->
-    <!--            <if test="product.query != null and product.query != ''">-->
-    <!--                and a.query regexp #{product.query}-->
-    <!--            </if>-->
-    <!--            <if test="product.creator != null and product.creator != ''">-->
-    <!--                and a.creator regexp #{product.creator}-->
-    <!--            </if>-->
-    <!--            <if test="product.createTime != null and product.createTime != ''">-->
-    <!--                and date(a.create_time) regexp #{product.createTime}-->
-    <!--            </if>-->
-    <!--        </where>-->
+    <!--    鍒嗘灦鏄庣粏鏌ヨ-->
+    <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,
+               round(sum(od.perimeter), 2) 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
 
-    <!--        order by a.id desc-->
-    <!--        ;-->
-    <!--    </select>-->
+        group by od.order_id, ogd.production_id
+        order by od.id desc
+    </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}
+
+    </update>
+
+    <!--    鍒犻櫎娴佺▼鍗�-->
+    <update id="deleteFlowCardMp">
+        delete
+        from flow_card as fc
+        where fc.order_id = left(#{processId}, 10)
+    </update>
+
+    <!--    鍒嗘灦鏂板鏄庣粏鏌ヨ-->
+
+    <!--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,
+               od.remarks,
+               ods.S01,
+               ods.S02,
+               ods.S03,
+               ods.S04,
+               ods.S05
+        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
+                 left join (
+            SELECT
+                order_id,
+                order_number,
+                JSON_UNQUOTE( JSON_EXTRACT( other_columns, '$.S01' )) AS S01,
+                JSON_UNQUOTE( JSON_EXTRACT( other_columns, '$.S02' )) AS S02,
+                JSON_UNQUOTE( JSON_EXTRACT( other_columns, '$.S03' )) AS S03,
+                JSON_UNQUOTE( JSON_EXTRACT( other_columns, '$.S04' )) AS S04,
+                JSON_UNQUOTE( JSON_EXTRACT( other_columns, '$.S05' )) AS S05
+            FROM
+                sd.order_detail
+            WHERE
+                order_id = #{orderId}
+        ) as ods on ods.order_id=od.order_id and ods.order_number=od.order_number
+        where od.order_id = #{orderId}
+          and ogd.production_id = #{productionId}
+          and ogd.splitting_status = 0
+        GROUP BY od.order_number
+        order by od.id
+
+    </select>
+
+    <!--淇敼鎺掔増鐘舵��-->
+    <update id="updateLayoutStatusMp">
+        update flow_card as fc
+        set fc.layout_status=#{state}
+        where fc.process_id = #{processId}
+    </update>
+
+    <!--    鏌ヨ瀵瑰簲娴佺▼鍗″彿鎺掔増鐘舵��-->
+    <select id="selectLayoutStatus">
+        select fc.layout_status
+        from flow_card as fc
+        where fc.process_id = #{processId}
+        LIMIT 1
+    </select>
+
+    <!--    鏌ヨ鎶ュ伐琛ㄥ唴鏄惁鏈夊搴旀祦绋嬪崱-->
+    <select id="reportingWorkCount">
+        select COUNT(rw.process_id)
+        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
+        order by ps.id desc
+    </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>
+    <!--  鏌ヨ璇ヨ鍗曟祦绋嬪崱鏉℃暟  -->
+    <select id="selectFlowCardCount">
+        select COUNT(*)
+        from flow_card
+        where order_id = #{orderId}
+    </select>
+
+    <select id="flowCardDetailMp">
+        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
+                 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 = 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, fc.technology_number
+        order by fc.order_number, fc.technology_number
+    </select>
+
+    <delete id="deleteReportingWork">
+        delete
+        from sd.order_process_detail
+        where order_id = left(#{processId}, 10)
+    </delete>
+
+    <select id="selectPrintFlowCardMp">
+        select order_id,project,customer_name,quantity,area,order_type,pack_type,batch
+        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
+        order by create_time desc
+    </select>
+
+    <select id="selectPrintFlowCard">
+        select *
+        from pp.optimize_project
+        where create_time between #{selectTime1} and #{selectTime2}
+          and state >= 20
+        order by create_time desc
+    </select>
+
+    <select id="selectPrintMp">
+        select fc.id,
+               fc.order_id,
+               fc.process_id,
+               o.customer_name,
+               o.project,
+               fc.order_number,
+               ogd.technology_number,
+               ogd.glass_address,
+               sum(od.quantity)         as quantity,
+               sum(ogd.total_area)      as total_area,
+               od.product_name,
+               ogd.glass_child,
+               fc.founder,
+               date(fc.splitFrame_time) as splitFrame_time,
+              /* if(fc.print_status=0,'鏈墦鍗�','宸叉墦鍗�') as  print_status*/
+        fc.print_status
+        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,
+               round(SUM(ogd.total_area), 2)                   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
+                 left join sd.product as p on p.id=od.product_id
+                 left join (
+            select         ogd.order_id,
+                           ogd.order_number,
+                           ogd.technology_number,
+                           ogd.glass_child,
+                           GROUP_CONCAT(glass_child SEPARATOR ' ') AS concatenated_glass_child
+            from sd.order_glass_detail as ogd
+            where ogd.order_id = left(#{processId},10)
+              and position(ogd.technology_number in #{technologyNumber})
+            GROUP BY order_id, order_number
+        ) as ogdc on ogdc.order_id=ogd.order_id and ogdc.order_number=ogd.order_number and ogdc.technology_number=ogd.technology_number
+        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(round(ogd.child_width), "*", round(ogd.child_height)) as child_width,
+               od.quantity,
+               round(ogd.total_area, 2)                                     as total_area,
+               od.perimeter,
+               od.bend_radius,
+               concat(od.processing_note,od.remarks) as remarks,
+               od.other_columns,
+               round(ogd.child_width) as width,
+               round(ogd.child_height) as height,
+               pd.separation,
+               fc.technology_number
+        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.product_detail as pd on pd.prod_id=od.product_id and pd.glass_sort=ogd.technology_number
+        where fc.process_id = #{processId}
+          and fc.technology_number = #{technologyNumber}
+        group by fc.process_id, fc.order_number
+        order by IF(sort != NULL || sort != '', sort, 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>
+
+    <select id="getPrintLabel">
+        select o.order_id,
+               c.customer_abbreviation as customer_name,
+               o.project,
+               od.building_number,
+               od.processing_note,
+               ogd.child_width as width,
+               ogd.child_height as height,
+               ogd.glass_child,
+               ogd.process,
+               e.type_name,
+               opd.stock_id,
+               od.quantity,
+               od.other_columns,
+               od.bend_radius
+        from pp.optimize_detail opd
+                 left join sd.`order` o on SUBSTR(opd.process_id, 1, 10) = o.order_id
+                 left join sd.order_detail od
+                           on SUBSTR(opd.process_id, 1, 10) = od.order_id and opd.order_sort = od.order_number
+                 left join sd.order_glass_detail ogd
+                           on SUBSTR(opd.process_id, 1, 10) = ogd.order_id and opd.order_sort = ogd.order_number and opd.layer=ogd.technology_number
+                 left join sd.product p on od.product_id = p.id
+                 left join sd.basic_glass_type e on e.type_id = p.type_id
+        left join sd.customer c on c.id=o.customer_id
+        where opd.project_no = #{projectNo}
+        order by opd.stock_id
+    </select>
+
+    <select id="getPrintLabel1">
+        select o.order_id ,
+               o.project,
+               o.customer_id ,
+               ogd.child_width as width,
+               ogd.child_height as height,
+               od.quantity,
+               od.order_number as orderNumber,
+               fc.technology_number as technologyNumber,
+               ogd.glass_child,
+               ogd.process,
+               c.customer_abbreviation as customer_name,
+               ifnull(od.processing_note,'') as processing_note,
+               bgt.type_name,
+               od.other_columns,
+               od.building_number,
+               od.bend_radius
+        from sd.order as o
+                 left join sd.order_detail as od on o.order_id = od.order_id
+                 left join sd.order_glass_detail as ogd on ogd.order_id=od.order_id and ogd.order_number=od.order_number
+                 left join pp.flow_card as fc on o.order_id = fc.order_id and
+                                                 od.order_number = fc.order_number and fc.technology_number=ogd.technology_number
+                 left join sd.product pt on pt.id=od.product_id
+                 left join sd.customer c on c.id=o.customer_id
+                 left join sd.basic_glass_type bgt on bgt.type_id=pt.type_id
+        where fc.process_id = #{processId}
+          and fc.technology_number=#{technologyNumber}
+        group by od.order_number,od.width,od.height
+    </select>
+
+    <select id="printFlowCardDetailsMp">
+        SELECT fc.process_id,
+               fc.order_number,
+               fc.technology_number,
+               ogd.glass_address,
+               ogd.child_width,
+               ogd.child_height,
+               fc.quantity,
+               ROUND(ogd.child_width * ogd.child_height * fc.quantity / 1000000, 2) as area,
+               fc.sort
+        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
+        where fc.process_id = #{processId}
+          and fc.technology_number = #{technologyNumber}
+        order by IF(fc.sort != NULL || fc.sort != '', fc.sort, fc.order_number)
+    </select>
+
+    <update id="printSortMp">
+        update flow_card
+        set sort = #{sort}
+        where process_id = #{processId}
+          and order_number = #{orderNumber}
+          and technology_number = #{technologyNumber}
+    </update>
+
+    <select id="selectType">
+        select *
+        from pp.tag_style
+    </select>
+    <select id="getPrintTitle">
+        select value
+        from pp.tag_style as a
+        where a.name = #{type}
+    </select>
+
+    <select id="getCustomLabelDetailMp">
+        select #{name}
+        from #{form}
+        where order_id = #{id}
+    </select>
+
+    <resultMap id="orderDetial" type="com.example.erp.entity.sd.OrderDetail">
+        <result column="width" property="width"/>
+        <result column="height" property="height"/>
+        <result column="order_id" property="order.orderId"/>
+        <result column="project" property="order.project"/>
+        <result column="customer_id" property="order.customerId"/>
+        <result column="customer_name" property="order.customerName"/>
+        <result column="order_type" property="order.orderType"/>
+        <result column="order_classify" property="order.orderClassify"/>
+        <result column="batch" property="order.batch"/>
+        <result column="icon" property="order.icon"/>
+        <result column="pack_type" property="order.packType"/>
+        <result column="delivery_date" property="order.deliveryDate"/>
+        <result column="al_type" property="order.alType"/>
+        <result column="money" property="order.money"/>
+        <result column="contract_id" property="order.contractId"/>
+        <result column="customer_batch" property="order.customerBatch"/>
+        <result column="contacts" property="order.contacts"/>
+        <result column="delivery_address" property="order.deliveryAddress"/>
+        <result column="processing_note" property="processingNote"/>
+        <result column="quantity" property="quantity"/>
+        <result column="edging_type" property="edgingType"/>
+        <result column="product_name" property="productName"/>
+        <result column="building_number" property="buildingNumber"/>
+    </resultMap>
+
+    <select id="getPrintCustomData">
+        select o.order_id           as orderId,
+               project,
+               customer_id          as customerId,
+               o.customer_name        as customerName,
+               order_type           as orderType,
+               order_classify       as orderClassify,
+               batch,
+               o.icon,
+               pack_type            as packType,
+               delivery_date        as deliveryDate,
+               al_type              as alType,
+               money,
+               contract_id          as contractId,
+               customer_batch          customerBatch,
+               contacts,
+               delivery_address     as deliveryAddress,
+               od.processing_note   as processingNote,
+               width,
+               height,
+               od.quantity,
+               od.order_number      as orderNumber,
+               fc.technology_number as technologyNumber,
+               od.building_number   as buildingNumber,
+               od.product_name      as productName,
+               od.edging_type       as edgingType,
+               p.remarks,
+               c.customer_abbreviation as customerAbbreviation,
+               p.product_abbreviation as productAbbreviation,
+               fc.process_id as processId,
+               o.create_time as createTime,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS glassNumber,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S02' )) AS figureNumber,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S03' )) AS colourCeramicGlaze,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S04' )) AS remarks1,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S05' )) AS remarks2,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S06' )) AS remarks3,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S07' )) AS remarks4,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S08' )) AS remarks5,
+                p.remarks as filmNumber,
+                od.bend_radius as bendRadius
+        from sd.order as o
+                 left join sd.order_detail as od on o.order_id = od.order_id
+                 left join flow_card as fc on o.order_id = fc.order_id and
+                                              od.order_number = fc.order_number
+                 left join sd.product as p on p.id=od.product_id
+                 left join sd.customer as c on c.id = o.customer_id
+        left join sd.product_detail as pd  on pd.prod_id=p.id and pd.sort_num=od.order_number
+        where fc.process_id = #{processId}
+          and fc.technology_number = #{technologyNumber}
+        group by od.order_number, width, height
+        order by IF(fc.sort != NULL || fc.sort != '', fc.sort, fc.order_number)
+    </select>
+
+    <select id="selectReplenishPrintMp">
+        select fc.id,
+               fc.order_id,
+               fc.process_id,
+               o.customer_name,
+               o.project,
+               fc.order_number,
+               ogd.technology_number,
+               ogd.glass_address,
+               pl.patch_num,
+               pl.patch_area,
+               pl.responsible_team,
+               pl.responsible_equipment,
+               pl.responsible_personnel,
+               pl.patch_type,
+               pl.patch_reason,
+               pl.patch_processes,
+               od.product_name,
+               ogd.glass_child,
+               fc.print_status,
+               pl.reporting_work_id
+        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
+                 left join patch_log as pl on pl.order_id = fc.order_id and pl.process_id = fc.process_id and
+                                              pl.order_sort = fc.order_number and
+                                              pl.technology_number = fc.technology_number
+        where pl.create_time between #{selectTime1} and #{selectTime2} and pl.review_status>0
+        GROUP BY pl.id,fc.process_id, ogd.technology_number
+        order by pl.id desc,fc.process_id, ogd.technology_number
+    </select>
+
+    <select id="getRepairPrintCustomData">
+        select o.order_id           as orderId,
+               project,
+               customer_id          as customerId,
+               customer_name        as customerName,
+               order_type           as orderType,
+               order_classify       as orderClassify,
+               batch,
+               o.icon,
+               pack_type            as packType,
+               delivery_date        as deliveryDate,
+               al_type              as alType,
+               money,
+               contract_id          as contractId,
+               customer_batch          customerBatch,
+               contacts,
+               delivery_address     as deliveryAddress,
+               od.processing_note   as processingNote,
+               width,
+               height,
+               pl.patch_num         as quantity,
+               pl.order_sort        as orderNumber,
+               pl.technology_number as technologyNumber,
+               od.building_number   as buildingNumber,
+               od.product_name      as productName,
+               od.edging_type       as edgingType
+
+        from sd.order as o
+                 left join sd.order_detail as od on o.order_id = od.order_id
+                 left join flow_card as fc on o.order_id = fc.order_id and
+                                              od.order_number = fc.order_number
+                 left join patch_log as pl on pl.process_id = fc.process_id and pl.order_sort = fc.order_number and
+                                              pl.technology_number = fc.technology_number
+        where pl.process_id = #{processId}
+          and pl.technology_number = #{technologyNumber}
+        group by od.order_number, width, height
+        order by IF(fc.sort != NULL || fc.sort != '', fc.sort, pl.order_sort)
+    </select>
+
+    <select id="getGlassNumber">
+        select other_columns
+        from sd.order_detail as od
+                 left join flow_card as fc on od.order_id = fc.order_id and od.order_number = fc.order_number
+        where fc.process_id = #{processId}
+          and fc.technology_number = #{technologyNumber}
+        order by IF(fc.sort != NULL || fc.sort != '', fc.sort, fc.order_number)
+    </select>
+
+    <update id="updatePrintStateMp">
+        update  pp.flow_card
+        set print_status = print_status+1
+        where process_id = #{processId} and technology_number = #{technologyNumber}
+    </update>
+
+    <select id="printFlowCardOrderSortMp">
+        SELECT fc.process_id,
+               fc.order_number,
+               fc.technology_number,
+               ogd.glass_address,
+               ogd.child_width,
+               ogd.child_height,
+               fc.quantity,
+               ROUND(ogd.child_width * ogd.child_height * fc.quantity / 1000000, 2) as area,
+               fc.sort
+        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
+        where fc.order_id=#{orderId}
+        order by IF(fc.sort != NULL || fc.sort != '', fc.sort, fc.technology_number)
+    </select>
+
+    <update id="printOrderSortMp">
+        update flow_card
+        set sort = #{sort}
+        where process_id = #{processId}
+          and order_number = #{orderNumber}
+          and technology_number = #{technologyNumber}
+    </update>
+
+    <select id="getPrimaryListMerge">
+        select o.customer_name,
+               o.project,
+               ogd.process,
+               od.edging_type,
+               ogdc.concatenated_glass_child as glass_child,
+               od.product_name,
+               o.processing_note,
+               fc.process_id,
+               SUM(od.quantity)                                as quantity,
+               round(SUM(ogd.total_area), 2)                   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
+                 left join sd.product as p on p.id=od.product_id
+                 left join (
+            select         ogd.order_id,
+                           ogd.order_number,
+                           ogd.technology_number,
+                           ogd.glass_child,
+                           GROUP_CONCAT(glass_child SEPARATOR ' ') AS concatenated_glass_child
+            from sd.order_glass_detail as ogd
+            where ogd.order_id = left(#{processId},10)
+              and position(ogd.technology_number in #{technologyNumber})
+            GROUP BY order_id, order_number
+        ) as ogdc on ogdc.order_id=ogd.order_id and ogdc.order_number=ogd.order_number and ogdc.technology_number=ogd.technology_number
+        where fc.process_id = #{processId}
+          and position(fc.technology_number in #{technologyNumber}) and ogdc.concatenated_glass_child is NOT null
+        group by fc.process_id, fc.technology_number
+    </select>
+
+    <select id="selectorderOtherMoney">
+        select * from sd.basic_other_money where id between 21 and 35
+    </select>
+
+    <select id="selectReworkPrintMp">
+        select fc.id,
+               fc.order_id,
+               fc.process_id,
+               o.customer_name,
+               o.project,
+               fc.order_number,
+               ogd.technology_number,
+               ogd.glass_address,
+               pl.rework_num,
+               pl.rework_area,
+               pl.rework_team,
+               pl.responsible_equipment,
+               pl.responsible_personnel,
+               pl.rework_type,
+               pl.rework_reason,
+               pl.rework_processes,
+               od.product_name,
+               ogd.glass_child,
+               pl.reporting_work_id
+        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
+                 left join rework as pl on pl.order_id = fc.order_id and pl.process_id = fc.process_id and
+                                           pl.order_sort = fc.order_number and
+                                           pl.technology_number = fc.technology_number
+        where pl.create_time between #{selectTime1} and #{selectTime2}
+        GROUP BY fc.process_id, ogd.technology_number,pl.reporting_work_id
+        order by pl.id desc,fc.process_id, ogd.technology_number
+    </select>
+
+    <select id="getDetailListLike">
+        select fc.order_number,
+               concat(round(ogd.child_width), "*", round(ogd.child_height)) as child_width,
+               od.quantity,
+               round(ogd.total_area, 2)                                     as total_area,
+               od.perimeter,
+               od.bend_radius,
+               concat(od.processing_note,od.remarks) as remarks,
+               od.other_columns,
+               round(ogd.child_width) as width,
+               round(ogd.child_height) as height,
+               pd.separation,
+               fc.technology_number
+        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.product_detail as pd on pd.prod_id=od.product_id and pd.glass_sort=ogd.technology_number
+        where fc.process_id = #{processId}
+          and position(fc.technology_number in #{technologyNumber})
+        group by fc.process_id, fc.order_number,fc.technology_number
+        order by IF(sort != NULL || sort != '', sort, fc.order_number)
+    </select>
+
+    <select id="getPrimaryListMergeRefund">
+        select o.customer_name,
+               o.project,
+               ogd.process,
+               od.edging_type,
+               ogdc.concatenated_glass_child as glass_child,
+               od.product_name,
+               o.processing_note,
+               fc.process_id,
+               pl.patch_num                                as quantity,
+               round(SUM(ogd.total_area), 2)                   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
+                 left join sd.product as p on p.id=od.product_id
+                 left join (
+            select         ogd.order_id,
+                           ogd.order_number,
+                           ogd.technology_number,
+                           ogd.glass_child,
+                           GROUP_CONCAT(glass_child SEPARATOR ' ') AS concatenated_glass_child
+            from sd.order_glass_detail as ogd
+            where ogd.order_id = left(#{processId},10)
+              and ogd.order_number=#{orderNumber}
+              and position(ogd.technology_number in #{technologyNumber})
+            GROUP BY order_id, order_number
+        ) as ogdc on ogdc.order_id=ogd.order_id and ogdc.order_number=ogd.order_number and ogdc.technology_number=ogd.technology_number
+                 left join patch_log as pl on pl.process_id=fc.process_id and pl.order_sort=fc.order_number and pl.technology_number=fc.technology_number
+        where fc.process_id = #{processId} and fc.order_number=#{orderNumber}
+          and position(fc.technology_number in #{technologyNumber}) and ogdc.concatenated_glass_child is NOT null
+        group by fc.process_id, fc.technology_number
+    </select>
+
+    <select id="getDetailListRefund">
+        select fc.order_number,
+               concat(round(ogd.child_width), "*", round(ogd.child_height)) as child_width,
+               (pl.patch_num) as quantity,
+               round(ogd.total_area, 2)                                     as total_area,
+               od.perimeter,
+               od.bend_radius,
+               concat(od.processing_note,od.remarks) as remarks,
+               od.other_columns,
+               round(ogd.child_width) as width,
+               round(ogd.child_height) as height,
+               pd.separation,
+               fc.technology_number
+        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.product_detail as pd on pd.prod_id=od.product_id and pd.glass_sort=ogd.technology_number
+                 left join patch_log as pl on pl.process_id=fc.process_id and pl.order_sort=fc.order_number and pl.technology_number=fc.technology_number
+        where fc.process_id = #{processId}
+          and fc.order_number = #{orderNumber}
+          and position(fc.technology_number in #{technologyNumber})
+        and pl.reporting_work_id=#{reportingWorkId}
+        group by fc.process_id, fc.order_number,fc.technology_number
+        order by IF(sort != NULL || sort != '', sort, fc.order_number)
+    </select>
+
+    <select id="getPrimaryListRefund">
+        select o.customer_name,
+               o.project,
+               ogd.process,
+               od.edging_type,
+               ogd.glass_child,
+               od.product_name,
+               o.processing_note,
+               fc.process_id,
+               pl.patch_num                                as quantity,
+               round(SUM(ogd.total_area), 2)                   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
+                 left join sd.product as p on p.id=od.product_id
+                 left join (
+            select         ogd.order_id,
+                           ogd.order_number,
+                           ogd.technology_number,
+                           ogd.glass_child,
+                           GROUP_CONCAT(glass_child SEPARATOR ' ') AS concatenated_glass_child
+            from sd.order_glass_detail as ogd
+            where ogd.order_id = left(#{processId},10)
+              and ogd.order_number = #{orderNumber}
+              and position(ogd.technology_number in #{technologyNumber})
+            GROUP BY order_id, order_number
+        ) as ogdc on ogdc.order_id=ogd.order_id and ogdc.order_number=ogd.order_number and ogdc.technology_number=ogd.technology_number
+                 left join patch_log as pl on pl.process_id=fc.process_id and pl.order_sort=fc.order_number and pl.technology_number=fc.technology_number
+        where fc.process_id = #{processId}
+          and fc.order_number = #{orderNumber}
+          and fc.technology_number = #{technologyNumber}
+        group by fc.process_id, fc.technology_number
+    </select>
+
+    <select id="getDetailListLikeRefund">
+        select fc.order_number,
+               concat(round(ogd.child_width), "*", round(ogd.child_height)) as child_width,
+               pl.patch_num as quantity,
+               round(ogd.total_area, 2)                                     as total_area,
+               od.perimeter,
+               od.bend_radius,
+               concat(od.processing_note,od.remarks) as remarks,
+               od.other_columns,
+               round(ogd.child_width) as width,
+               round(ogd.child_height) as height,
+               pd.separation,
+               fc.technology_number
+        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.product_detail as pd on pd.prod_id=od.product_id and pd.glass_sort=ogd.technology_number
+                 left join patch_log as pl on pl.process_id=fc.process_id and pl.order_sort=fc.order_number and pl.technology_number=fc.technology_number
+        where fc.process_id = #{processId}
+          and fc.order_number = #{orderNumber}
+          and position(fc.technology_number in #{technologyNumber})
+          and pl.reporting_work_id=#{reportingWorkId}
+        group by fc.process_id, fc.order_number,fc.technology_number
+        order by IF(sort != NULL || sort != '', sort, fc.order_number)
+    </select>
+
+    <select id="getPrimaryListRework">
+        select o.customer_name,
+               o.project,
+               ogd.process,
+               od.edging_type,
+               ogd.glass_child,
+               od.product_name,
+               o.processing_note,
+               fc.process_id,
+               pl.rework_num                                as quantity,
+               round(SUM(ogd.total_area), 2)                   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
+                 left join sd.product as p on p.id=od.product_id
+                 left join (
+            select         ogd.order_id,
+                           ogd.order_number,
+                           ogd.technology_number,
+                           ogd.glass_child,
+                           GROUP_CONCAT(glass_child SEPARATOR ' ') AS concatenated_glass_child
+            from sd.order_glass_detail as ogd
+            where ogd.order_id = left(#{processId},10)
+              and ogd.order_number = #{orderNumber}
+              and position(ogd.technology_number in #{technologyNumber})
+            GROUP BY order_id, order_number
+        ) as ogdc on ogdc.order_id=ogd.order_id and ogdc.order_number=ogd.order_number and ogdc.technology_number=ogd.technology_number
+                 left join rework as pl on pl.process_id=fc.process_id and pl.order_sort=fc.order_number and pl.technology_number=fc.technology_number
+        where fc.process_id = #{processId}
+          and fc.order_number = #{orderNumber}
+          and fc.technology_number = #{technologyNumber}
+        group by fc.process_id, fc.technology_number
+    </select>
+
+    <select id="getDetailListRework">
+        select fc.order_number,
+               concat(round(ogd.child_width), "*", round(ogd.child_height)) as child_width,
+               (pl.rework_num) as quantity,
+               round(ogd.total_area, 2)                                     as total_area,
+               od.perimeter,
+               od.bend_radius,
+               concat(od.processing_note,od.remarks) as remarks,
+               od.other_columns,
+               round(ogd.child_width) as width,
+               round(ogd.child_height) as height,
+               pd.separation,
+               fc.technology_number
+        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.product_detail as pd on pd.prod_id=od.product_id and pd.glass_sort=ogd.technology_number
+                 left join rework as pl on pl.process_id=fc.process_id and pl.order_sort=fc.order_number and pl.technology_number=fc.technology_number
+        where fc.process_id = #{processId}
+          and fc.order_number = #{orderNumber}
+          and position(fc.technology_number in #{technologyNumber})
+          and pl.reporting_work_id=#{reportingWorkId}
+        group by fc.process_id, fc.order_number,fc.technology_number
+        order by IF(sort != NULL || sort != '', sort, fc.order_number)
+    </select>
+
+    <select id="getPrimaryListMergeRework">
+        select o.customer_name,
+               o.project,
+               ogd.process,
+               od.edging_type,
+               ogdc.concatenated_glass_child as glass_child,
+               od.product_name,
+               o.processing_note,
+               fc.process_id,
+               pl.rework_num                                as quantity,
+               round(SUM(ogd.total_area), 2)                   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
+                 left join sd.product as p on p.id=od.product_id
+                 left join (
+            select         ogd.order_id,
+                           ogd.order_number,
+                           ogd.technology_number,
+                           ogd.glass_child,
+                           GROUP_CONCAT(glass_child SEPARATOR ' ') AS concatenated_glass_child
+            from sd.order_glass_detail as ogd
+            where ogd.order_id = left(#{processId},10)
+              and ogd.order_number=#{orderNumber}
+              and position(ogd.technology_number in #{technologyNumber})
+            GROUP BY order_id, order_number
+        ) as ogdc on ogdc.order_id=ogd.order_id and ogdc.order_number=ogd.order_number and ogdc.technology_number=ogd.technology_number
+                 left join rework as pl on pl.process_id=fc.process_id and pl.order_sort=fc.order_number and pl.technology_number=fc.technology_number
+        where fc.process_id = #{processId} and fc.order_number=#{orderNumber}
+          and position(fc.technology_number in #{technologyNumber}) and ogdc.concatenated_glass_child is NOT null
+        group by fc.process_id, fc.technology_number
+    </select>
+
+    <select id="getDetailListLikeRework">
+        select fc.order_number,
+               concat(round(ogd.child_width), "*", round(ogd.child_height)) as child_width,
+               pl.rework_num as quantity,
+               round(ogd.total_area, 2)                                     as total_area,
+               od.perimeter,
+               od.bend_radius,
+               concat(od.processing_note,od.remarks) as remarks,
+               od.other_columns,
+               round(ogd.child_width) as width,
+               round(ogd.child_height) as height,
+               pd.separation,
+               fc.technology_number
+        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.product_detail as pd on pd.prod_id=od.product_id and pd.glass_sort=ogd.technology_number
+                 left join rework as pl on pl.process_id=fc.process_id and pl.order_sort=fc.order_number and pl.technology_number=fc.technology_number
+        where fc.process_id = #{processId}
+          and fc.order_number = #{orderNumber}
+          and position(fc.technology_number in #{technologyNumber})
+          and pl.reporting_work_id=#{reportingWorkId}
+        group by fc.process_id, fc.order_number,fc.technology_number
+        order by IF(sort != NULL || sort != '', sort, fc.order_number)
+    </select>
+
+    <select id="getPrintCustomDataSemi">
+        select o.order_id           as orderId,
+               project,
+               customer_id          as customerId,
+               o.customer_name        as customerName,
+               order_type           as orderType,
+               order_classify       as orderClassify,
+               batch,
+               o.icon,
+               pack_type            as packType,
+               delivery_date        as deliveryDate,
+               al_type              as alType,
+               money,
+               contract_id          as contractId,
+               customer_batch          customerBatch,
+               contacts,
+               delivery_address     as deliveryAddress,
+               od.processing_note   as processingNote,
+               width,
+               height,
+               od.quantity,
+               od.order_number      as orderNumber,
+               fc.technology_number as technologyNumber,
+               od.building_number   as buildingNumber,
+               od.product_name      as productName,
+               od.edging_type       as edgingType,
+               p.remarks,
+               c.customer_abbreviation as customerAbbreviation,
+               p.product_abbreviation as productAbbreviation,
+               fc.process_id as processId,
+               o.create_time as createTime,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS glassNumber,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S02' )) AS figureNumber,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S03' )) AS colourCeramicGlaze,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S04' )) AS remarks1,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S05' )) AS remarks2,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S06' )) AS remarks3,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S07' )) AS remarks4,
+               JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S08' )) AS remarks5,
+               p.remarks as filmNumber,
+               od.bend_radius as bendRadius,
+               ogd.glass_child as glassChild,
+               ogd.glass_address as glassAddress
+        from sd.order as o
+                 left join sd.order_detail as od on o.order_id = od.order_id
+                 left join flow_card as fc on o.order_id = fc.order_id and
+                                              od.order_number = fc.order_number
+                 left join sd.product as p on p.id=od.product_id
+                 left join sd.customer as c on c.id = o.customer_id
+                 left join sd.product_detail as pd  on pd.prod_id=p.id and pd.sort_num=od.order_number
+        left join sd.order_glass_detail ogd on ogd.order_id=o.order_id and ogd.order_number=od.order_number and ogd.technology_number=fc.technology_number
+        where fc.process_id = #{processId}
+          and fc.technology_number = #{technologyNumber}
+        group by od.order_number,ogd.technology_number, width, height
+        order by IF(fc.sort != NULL || fc.sort != '', fc.sort, fc.order_number)
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0