From 413a7e27886bcc87bbd8aaf995f09dbe82cb17e7 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期二, 06 五月 2025 14:56:08 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml |  591 +++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 514 insertions(+), 77 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml b/north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml
index 6f27e16..f6f616d 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml
@@ -62,8 +62,8 @@
     <select id="projectInfoMp">
         SELECT
             f.order_number,
-            g.child_width ,
-            g.child_height ,
+            g.child_width as 'width',
+            g.child_height as 'height',
             f.quantity ,
             d.shape ,
             op.process_cards ,
@@ -91,13 +91,139 @@
             f.order_number;
     </select>
 
+    <!--绗竴娆′紭鍖栨煡璇�-->
+    <select id="firstOptimization">
+        ( SELECT
+              c.project_no,
+              d.child_width as 'width',
+              d.child_height as 'height',
+              c.quantity,
+              o.shape,
+              concat( c.process_id, '-', c.technology_number ) AS 'process_id',
+              c.technology_number,
+              d.glass_child,
+              o.product_name,
+              o.price,
+              o.remarks,
+              o.building_number,
+              round( d.area * c.quantity, 4 ) as 'area',
+              c.order_number,
+              d.icon,
+              op.project_name
+          FROM
+              pp.flow_card c
+                  LEFT JOIN sd.order_detail o ON c.order_id = o.order_id
+                  AND c.order_number = o.order_number
+                  LEFT JOIN sd.order_glass_detail d ON c.order_id = d.order_id
+                  AND c.order_number = d.order_number
+                  AND c.technology_number = d.technology_number
+                  INNER JOIN pp.optimize_project AS op ON op.project_no = c.project_no
+          WHERE
+              c.project_no IS NOT NULL
+            and c.project_no = #{projectNo}
+          ORDER BY
+              c.process_id,
+              c.order_number
+        ) union
+        (
+            SELECT
+                c.project_no,
+                d.child_width as 'width',
+                d.child_height as 'height',
+                c.patch_num as quantity,
+                o.shape,
+                concat( c.process_id, '-', c.technology_number ) AS 'process_id',
+                c.technology_number,
+                d.glass_child,
+                o.product_name,
+                o.price,
+                o.remarks,
+                o.building_number,
+                round( d.area * c.patch_num, 4 ) as 'area',
+                c.order_sort as order_number,
+                d.icon,
+                op.project_name
+            FROM
+                pp.patch_log c
+                    LEFT JOIN sd.order_detail o ON c.order_id = o.order_id
+                    AND c.order_sort = o.order_number
+                    LEFT JOIN sd.order_glass_detail d ON c.order_id = d.order_id
+                    AND c.order_sort = d.order_number
+                    AND c.technology_number = d.technology_number
+                    INNER JOIN pp.optimize_project AS op ON op.project_no = c.project_no
+            WHERE
+                c.project_no IS NOT NULL
+              and c.project_no = #{projectNo}
+            ORDER BY
+                c.process_id,
+                c.order_sort)
+    </select>
+
+
+    <!--绗竴娆′紭鍖栨煡璇�-->
+    <select id="analogComputationOptimization">
+        SELECT
+            h.project_no,
+            h.layout_id,
+            h.width AS width,
+            h.height AS height,
+            count( 1 ) AS quantity,
+            o.shape,
+            concat( h.process_id, '-', h.layer ) AS 'process_id',
+            h.layer,
+            d.glass_child,
+            o.product_name,
+            o.price,
+            o.remarks,
+            o.building_number,
+            round( d.area * count( 1 ), 4 ) AS 'area',
+            c.order_number,
+            d.icon,
+            o.price
+        from
+            pp.`optimize_heat_detail` h
+                LEFT JOIN pp.flow_card c ON h.process_id = c.process_id
+                AND h.layer = c.technology_number
+                AND h.order_sort = c.order_number
+                LEFT JOIN sd.order_detail o ON c.order_id = o.order_id
+                AND c.order_number = o.order_number
+                LEFT JOIN sd.order_glass_detail d ON c.order_id = d.order_id
+                AND c.order_number = d.order_number
+                AND c.technology_number = d.technology_number
+        WHERE
+            h.project_no = #{projectNo}
+        GROUP BY
+            h.project_no,
+            h.layout_id,
+            h.width,
+            h.height,
+            h.process_id,
+            h.layer,
+            d.area,
+            c.quantity,
+            d.child_width,
+            d.child_height,
+            o.shape,
+            d.glass_child,
+            o.product_name,
+            o.price,
+            o.remarks,
+            o.building_number,
+            c.order_number,
+            d.icon,
+            o.price
+        ORDER BY
+            LENGTH( h.layout_id ),
+            h.layout_id;
+    </select>
+
     <!--宸ョ▼淇℃伅娴佺▼鍗�-->
     <select id="getProcessCardMp">
         SELECT
             fc.process_id,
             fc.order_number,
             fc.quantity,
-            CONCAT(fc.technology_number, '/', COUNT(fc.technology_number)) AS layer,
+            CONCAT(fc.technology_number, '/', COUNT(fc.layers_number)) AS layer,
             so.project,
             CONCAT(sd.child_width, ' 脳 ', sd.child_height) AS sizes
         FROM
@@ -119,6 +245,15 @@
             pp.flow_card AS fc
         WHERE
             fc.project_no = #{projectNo}
+
+    </select>
+
+    <select id="getPatchLogList">
+        SELECT *
+        FROM
+            pp.patch_log
+        WHERE
+            project_no = #{projectNo}
 
     </select>
 
@@ -149,6 +284,67 @@
                 )
         ORDER BY
             `i`.`available_quantity` DESC ;
+    </select>
+
+    <!--浣欐枡淇℃伅-->
+    <select id="surplusMaterialsMp">
+        SELECT
+            i.id AS id,
+            '' AS producer,
+            i.quantity AS available_quantity,
+            i.width,
+            i.height,
+            i.thickness,
+            i.colour AS name,
+            i.colour
+        FROM  mm.surplus_materials as i
+        WHERE
+            i.quantity>0 and i.colour=#{model} and i.thickness=#{thickness}
+        ORDER BY
+            i.quantity DESC ;
+    </select>
+
+    <!--搴撳瓨浣欐枡淇℃伅-->
+    <select id="materialStoreSurplusMp">
+        (SELECT
+            i.id AS id,
+            i.producer AS producer,
+            i.available_quantity-i.plan_quantity AS available_quantity,
+            JSON_EXTRACT(s.json, '$.width') AS width,
+            JSON_EXTRACT(s.json, '$.height') AS height,
+            JSON_EXTRACT(s.json, '$.thickness') AS thickness,
+            JSON_EXTRACT(s.json, '$.name') AS name,
+            JSON_EXTRACT(s.json, '$.model') AS model
+        FROM  mm.material_inventory as `i`
+                  LEFT JOIN  mm.material_store  as s ON (
+            (
+                `i`.`material_code` = `s`.`id`
+                )
+            )
+        WHERE
+            (
+                    (`s`.`type` = '鍘熺墖')
+                    AND (`i`.`optimize_state` = 1)
+                    AND (`i`.`available_quantity`-i.plan_quantity > 0)
+                    AND JSON_EXTRACT(s.json, '$.thickness') = #{thickness}
+                    AND JSON_EXTRACT(s.json, '$.model') = #{model}
+                )
+        ORDER BY
+            `i`.`available_quantity` DESC) union
+        (SELECT
+            i.id AS id,
+            '' AS producer,
+            i.quantity AS available_quantity,
+            i.width,
+            i.height,
+            i.thickness,
+            i.colour AS name,
+            i.colour
+        FROM  mm.surplus_materials as i
+        WHERE
+            i.quantity>0 and i.colour=#{model} and i.thickness=#{thickness}
+        ORDER BY
+            i.quantity DESC );
     </select>
 
 
@@ -270,7 +466,8 @@
                椤圭洰 as project,
                鍗曠墖鍚嶇О as glass_child,
                闈㈢Н as area,
-               GlassType as glassType
+               GlassType as glassType,
+               patch_state
         FROM pp.v_optimize_process_whole where
                 CONCAT( JSON_UNQUOTE( JSON_EXTRACT( GlassType, '$.thickness' )), JSON_UNQUOTE( JSON_EXTRACT( GlassType, '$.color' )) )= #{optionVal}
     </select>
@@ -285,7 +482,8 @@
                椤圭洰 as project,
                鍗曠墖鍚嶇О as glass_child,
                闈㈢Н as area,
-               GlassType as glassType
+               GlassType as glassType,
+               patch_state
         FROM pp.v_optimize_process_normal where
                 CONCAT( JSON_UNQUOTE( JSON_EXTRACT( GlassType, '$.thickness' )), JSON_UNQUOTE( JSON_EXTRACT( GlassType, '$.color' )) )= #{optionVal}
     </select>
@@ -300,9 +498,28 @@
                椤圭洰 as project,
                鍗曠墖鍚嶇О as glass_child,
                闈㈢Н as area,
-               GlassType as glassType
+               GlassType as glassType,
+               patch_state
         FROM pp.v_optimize_process_patch where
                 CONCAT( JSON_UNQUOTE( JSON_EXTRACT( GlassType, '$.thickness' )), JSON_UNQUOTE( JSON_EXTRACT( GlassType, '$.color' )) )= #{optionVal}
+    </select>
+
+    <select id="getFlowCardListModify">
+        SELECT 娴佺▼鍗″彿 as process_id,
+               灞� as technology_number,
+               鎬诲眰鏁� as TotalFloors,
+               瑙勬牸 as TotalNumber,
+               鏁伴噺 as quantity,
+               褰㈢姸 as shape,
+               椤圭洰 as project,
+               浜у搧鍚嶇О as glass_child,
+               闈㈢Н as area,
+               GlassType as glassType,
+               patch_state,
+               鍗犵敤 as occupyState
+        FROM pp.v_optimize_porject_modify_merg where
+            GlassType  REGEXP #{type} and GlassType  REGEXP #{thickness}
+                                            and (宸ョ▼鍙� is null or 宸ョ▼鍙� = #{projectNO}) order by 鍗犵敤,patch_state,娴佺▼鍗″彿
     </select>
 
         <!--宸ョ▼绠$悊-->
@@ -332,7 +549,7 @@
                `p`.`update_time`                     AS `Modify time`
         from pp.optimize_project as p
                  left join pp.optimize_admin as a on p.creater = a.Id
-        where (`p`.`state` > -(1))
+        where (`p`.`state` > 1)
             and DATE (`p`.`create_time`) BETWEEN #{startSelectTime} AND #{endSelectTime}
         <if test="optimizeProjectMange.projectNumber != null and optimizeProjectMange.projectNumber != ''">
             and p.project_no regexp #{optimizeProjectMange.projectNumber}
@@ -370,6 +587,17 @@
         where project_no = #{projectNumber}
     </delete>
 
+    <select id="selectOptimizeDetailById">
+        select * from pp.optimize_detail
+        where project_no = #{projectNumber} and process_id= #{processId} and layer= #{layer} and order_sort= #{orderSort}
+          and heat_layout_id is null limit 0,1;
+    </select>
+
+    <select id="selectOptimizeHeatDetail">
+        select * from pp.optimize_heat_detail
+        where project_no = #{projectNumber}
+    </select>
+
     <select id="getProjectListMp">
         SELECT
             p.id,
@@ -402,43 +630,23 @@
 
     <!--妯℃嫙璁$畻鏌ヨ娴佺▼鍗�-->
     <select id="selectProjectComputeMp">
-        SELECT
-            fc.process_id,
-            fc.technology_number,
-            fc.project_no,
-            fcss.TotalFloors,
-            COUNT(fc.order_number)                                      AS TotalNumber,
-            SUM(fc.quantity)                                            AS quantity,
-            ROUND(SUM(od.width * od.height * fc.quantity / 1000000), 2) AS area,
-            o.project,
-            ogd.glass_child,
-            od.shape,
-            SUBSTRING(glass_child, 1, LOCATE('mm', glass_child) - 1) as thickness,
-            SUBSTRING(glass_child, LOCATE('mm', glass_child) + 2) as glassType
-        FROM
-            pp.flow_card AS fc
-                LEFT JOIN sd.`order` AS o ON fc.order_id = o.order_id
-                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_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 (
-                SELECT
-                    fcs.process_id,
-                    fcs.order_number,
-                    COUNT(DISTINCT fcs.technology_number) AS TotalFloors
-                FROM
-                    pp.flow_card AS fcs
-                GROUP BY
-                    fcs.process_id, fcs.order_number
-            ) AS fcss
-                          ON fcss.process_id = fc.process_id AND fcss.order_number = fc.order_number
-        WHERE
-            fc.project_no = #{projectNo}
-        GROUP BY
-            fc.process_id, fc.technology_number
-        ORDER BY
-            fc.process_id, fc.technology_number;
+        select
+            娴佺▼鍗″彿 as processId,
+            灞� as technologyNumber,
+            鎬诲眰鏁� as total_layers,
+            瑙勬牸 as TotalNumber,
+            鏁伴噺 as total_num,
+            椤圭洰 as project,
+            浜у搧鍚嶇О as glass_child,
+            闈㈢Н as total_area,
+            tempering as tempering,
+            merge as merge,
+            patch_state as patch_state,
+            0 as allow_rotate,
+            0 as curtain_wall,
+            0 as priority_level,
+            1 as is_must
+        from pp.v_optimize_init_project_process_summary where project_no = #{projectNo}
     </select>
 
     <select id="selectProjectCount">
@@ -471,35 +679,81 @@
 
     <!--妯℃嫙璁$畻娴佺▼鍗¤鎯�2-->
     <select id="selectComputeDetailMp">
-        SELECT
-            d.width AS width,
-            d.height AS height,
-            f.quantity AS quantity,
-            d.building_number AS `Storey Number`,
-            d.shape AS shape,
-            round(g.area * f.quantity, 4) AS area,
-            g.icon AS `Label type`,
-            dal.patch_status,
-            g.technology_number,
-            g.order_number,
-            fl.layers_number,
-            g.child_width,
-            g.child_height,
-            fl.process_id
+        select `f`.`order_id`                               AS order_id,
+               `f`.`order_number`                           AS order_number,
+               `d`.`width`                                  AS maxwidth,
+               `d`.`height`                                 AS maxheight,
+               `g`.`child_width`                            AS width,
+               `g`.`child_height`                           AS height,
+               `f`.`process_id`                             AS process_id,
+               sum(`f`.`quantity`)                          AS quantity,
+               `f`.`technology_number`                      AS technology_number,
+               `d`.`building_number`                        AS building_number,
+               `d`.`shape`                                  AS shape,
+               sum(round((`g`.`area` * `f`.`quantity`), 4)) AS area,
+               `g`.`icon`                                   AS icon
+        from ((
+            `pp`.`flow_card` `f`
+            left join `sd`.`order_detail` `d` on (((`f`.`order_id` = `d`.`order_id`)
+                and (`f`.`order_number` = `d`.`order_number`))))
+            left join `sd`.`order_glass_detail` `g` on (((`f`.`order_id` = `g`.`order_id`)
+                and (`f`.`order_number` = `g`.`order_number`)
+                and (`f`.`technology_number` = `g`.`technology_number`))))
+        where (`f`.`layout_status` != 0)
+          and f.process_id = #{processId}
+          and f.technology_number = #{technologyNumber}
+        group by `f`.`process_id`,
+                 `f`.`technology_number`,
+                 `f`.`order_id`,
+                 `f`.`order_number`,
+                 `d`.`width`,
+                 `d`.`height`,
+                 `g`.`child_width`,
+                 `g`.`child_height`,
+                 `f`.`quantity`,
+                 `d`.`building_number`,
+                 `d`.`shape`,
+                 `g`.`area`,
+                 `g`.`icon`
+    </select>
 
-        FROM
-            pp.flow_card f
-                LEFT JOIN pp.optimize_project p ON f.project_no = p.project_no
-                LEFT JOIN sd.order o ON f.order_id = o.order_id
-                LEFT JOIN sd.order_detail d ON f.order_id = d.order_id AND f.order_number = d.order_number
-                LEFT JOIN sd.order_glass_detail g ON f.order_id = g.order_id AND f.order_number = g.order_number AND f.technology_number = g.technology_number
-                LEFT JOIN sd.product_detail p2 ON d.product_id = p2.prod_id AND f.technology_number = p2.glass_sort
-                LEFT JOIN pp.optimize_project j ON f.project_no = j.project_no
-                LEFT JOIN pp.damage_details dal ON  dal.order_number = g.order_number AND dal.technology_number = g.technology_number and f.process_id=dal.process_id
-                LEFT JOIN pp.flow_card fl ON fl.order_id = g.order_id AND fl.order_number = g.order_number AND fl.technology_number = g.technology_number
-        WHERE
-            p.state IN (1, 2) and
-          f.process_id = #{processId}
+    <select id="selectComputeDetailMpPatchState">
+        select `l`.`order_id`                           AS order_id,
+               `l`.`order_sort`                         AS order_number,
+               `d`.`width`                              AS maxwidth,
+               `d`.`height`                             AS maxheight,
+               `g`.`child_width`                        AS width,
+               `g`.`child_height`                       AS height,
+               `l`.`process_id`                         AS process_id,
+               `l`.`patch_num`                          AS quantity,
+               `l`.`technology_number`                  AS technology_number,
+               `d`.`building_number`                    AS building_number,
+               `d`.`shape`                              AS shape,
+               round((`g`.`area` * `l`.`patch_num`), 4) AS area,
+               `g`.`icon`                               AS icon
+        from (((
+            `pp`.`patch_log` `l`
+                left join (select `pp`.`optimize_project`.`project_no` AS `project_no`
+                           from `pp`.`optimize_project`
+                           where ((`optimize_project`.`state` = 1)or (`optimize_project`.`state` = 2))) `p` on ((`l`.`project_no` = `p`.`project_no`)))
+            left join `sd`.`order_detail` `d` on (((`l`.`order_id` = `d`.`order_id`)and (`l`.`order_sort` = `d`.`order_number`))))
+            left join `sd`.`order_glass_detail` `g` on (((`l`.`order_id` = `g`.`order_id`)and (`l`.`order_sort` = `g`.`order_number`)
+                                                             and (`l`.`technology_number` = `g`.`technology_number`))))
+        where `l`.process_id = #{processId}
+          and `l`.technology_number = #{technologyNumber}
+        group by `l`.`process_id`,
+                 `l`.`technology_number`,
+                 `l`.`order_id`,
+                 `l`.`order_sort`,
+                 `d`.`width`,
+                 `d`.`height`,
+                 `g`.`child_width`,
+                 `g`.`child_height`,
+                 `l`.`patch_num`,
+                 `d`.`building_number`,
+                 `d`.`shape`,
+                 `g`.`area`,
+                 `g`.`icon`
     </select>
 
     <select id="getProcessCardDetailmMp">
@@ -554,9 +808,19 @@
                              where process_id=#{processId} and technology_number=#{technologyNumber}
     </update>
 
+    <update id="updatePatchLogProject">
+        UPDATE pp.patch_log set project_no=#{projectId}
+        where process_id=#{processId} and technology_number=#{technologyNumber}
+    </update>
+
     <update id="updateFlowCardProjectReturn">
         UPDATE pp.flow_card set project_no=null,layout_status=1
-        where process_id=#{processId} and technology_number=#{technologyNumber}
+        where process_id=#{processId} and technology_number=#{technologyNumber} and project_no=#{projectId}
+    </update>
+
+    <update id="updatePatchLogProjectReturn">
+        UPDATE pp.patch_log set project_no=null
+        where process_id=#{processId} and technology_number=#{technologyNumber} and project_no=#{projectId}
     </update>
 
     <select id="getSelectArea">
@@ -572,6 +836,19 @@
         group by fc.process_id,fc.technology_number
     </select>
 
+    <select id="getSelectAreaPatchLog">
+        select
+            sum(patch_area)
+        from pp.patch_log
+        where process_id=#{processId} and technology_number=#{technologyNumber}
+        group by process_id,technology_number
+    </select>
+
+    <update id="updateProjectMp">
+        update pp.optimize_project set project_name=#{projectNmae},glass_total=#{sumQuantity},glass_total_area= #{sumArea},
+                                       type=#{type},process_qty=#{processIdCount},process_cards=#{processId} where project_no=#{projectId}
+    </update>
+
     <insert id="addProjectMp">
         insert into pp.optimize_project (project_no, project_name, order_glass_type, order_glass_thickness,glass_type, glass_thickness,
                                          glass_total,glass_total_area,type,state,process_qty,process_cards)
@@ -581,7 +858,7 @@
 
 
     <insert id="addSimulation" parameterType="map">
-        <foreach collection="projectdetail.data[0].glass_details" item="glass">
+        <foreach collection="projectdetail" item="glass">
             INSERT INTO pp.optimize_heat_detail (
             project_no,
             process_id,
@@ -629,7 +906,7 @@
     </insert>
     <!--妯℃嫙璁$畻缁撴灉淇濆瓨-->
     <insert id="addratioResult" parameterType="map">
-        <foreach collection="projectdetail.data[0].ratioResult" item="glass">
+        <foreach collection="ratioResult" item="glass">
             INSERT INTO pp.optimize_heat_layout (
             project_no,
             layout_id,
@@ -659,6 +936,8 @@
         UPDATE pp.optimize_project
         SET
             state = 10,
+            furnaces_qty=#{resultSum[0]},
+            load_rate=#{resultSum[1]},
             chaos_pct = #{inputValues.chaos_pct},
             max_load_pct = #{inputValues.max_load_pct},
             max_area=#{inputValues.max_area},
@@ -666,8 +945,7 @@
             load_width=#{inputValues.load_width},
             load_length=#{inputValues.load_length},
             x_space=#{inputValues.x_space},
-            y_space=#{inputValues.y_space},
-            load_rate=#{inputValues.load_rate}
+            y_space=#{inputValues.y_space}
         WHERE
             project_no = #{inputValues.project_no}
 
@@ -682,6 +960,12 @@
         update pp.optimize_project_file as u
         set u.content = #{jsonString}
         where  u.project_no=#{processId} and type='浼樺寲缁撴灉'
+    </update>
+
+    <update id="updateOptimizeDetail">
+        update pp.optimize_detail
+        set heat_layout_id=#{layoutId},heat_layout_sort=#{sort},glass_id=concat(process_id,'|',#{layoutId},'|',#{sort})
+        where id=#{id};
     </update>
 
 
@@ -728,4 +1012,157 @@
         UPDATE pp.optimize_config set config_detail=#{json},create_time=now()
         where config_type=#{type}
     </update>
+
+    <select id="simulatedTypesettingUsingOpt">
+        SELECT
+              c.project_no,
+              d.child_width as 'width',
+              d.child_height as 'height',
+              c.quantity,
+              o.shape,
+              concat( c.process_id, '-', c.technology_number ) AS 'process_id',
+              c.technology_number,
+              d.glass_child,
+              o.product_name,
+              o.price,
+              o.remarks,
+              o.building_number,
+              round( d.area * c.quantity, 4 ) as 'area',
+              c.order_number,
+              d.icon,
+              op.project_name
+          FROM
+              pp.flow_card c
+                  LEFT JOIN sd.order_detail o ON c.order_id = o.order_id
+                  AND c.order_number = o.order_number
+                  LEFT JOIN sd.order_glass_detail d ON c.order_id = d.order_id
+                  AND c.order_number = d.order_number
+                  AND c.technology_number = d.technology_number
+                  INNER JOIN pp.optimize_project AS op ON op.project_no = c.project_no
+          WHERE
+              c.project_no IS NOT NULL
+            and c.process_id IN
+            <foreach item="item" index="index" collection="processId" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            and c.technology_number IN
+            <foreach item="item" index="index" collection="technologyNumber" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+          ORDER BY
+              c.process_id,
+              c.order_number
+    </select>
+
+
+
+
+
+
+
+    <!--妯℃嫙璁$畻鏌ヨ娴佺▼鍗$涓夋柟-->
+    <select id="selectProjectComputeMpThirdParty">
+        select
+            process_id as processId,
+            layer as technologyNumber,
+            total_layer as total_layers,
+            filmsid as TotalNumber,
+            sum(glass_total) as total_num,
+            product_name as glass_child,
+            0 as tempering,
+            0 as allow_rotate,
+            0 as curtain_wall,
+            0 as priority_level,
+            1 as is_must
+        from pp.other_flow_card where project_no = #{projectNo} group by process_id,layer
+    </select>
+
+    <!--妯℃嫙璁$畻娴佺▼鍗¤鎯呯涓夋柟-->
+    <select id="selectComputeDetailMpThirdParty">
+        select
+            process_id as process_id,
+            width as width,
+            height as height,
+            width as maxwidth,
+            height as maxheight,
+            order_number as order_number,
+            glass_total as quantity,
+            layer as technology_number,
+            0 as patch_state
+        from pp.other_flow_card where process_id = #{processId} and layer=#{technologyNumber}
+    </select>
+
+    <!--绗竴娆′紭鍖栨煡璇�-->
+    <select id="firstOptimizationThirdParty">
+        select
+            project_no,
+            concat( process_id, '-', layer ) AS process_id,
+            width,
+            height,
+            layer,
+            glass_total as quantity,
+            product_name,
+            order_number
+        from pp.other_flow_card where project_no = #{projectNo}
+    </select>
+
+    <select id="analogComputationOptimizationThirdParty">
+        SELECT
+            h.project_no,
+            h.layout_id,
+            h.width AS width,
+            h.height AS height,
+            count( 1 ) AS quantity,
+            concat( h.process_id, '-', h.layer ) AS 'process_id',
+            h.layer,
+            c.order_number
+        from
+            pp.`optimize_heat_detail` h
+                LEFT JOIN pp.other_flow_card c ON h.process_id = c.process_id
+                AND h.layer = c.technology_number
+                AND h.order_sort = c.order_number
+        WHERE
+            h.project_no = #{projectNo}
+        GROUP BY
+            h.project_no,
+            h.layout_id,
+            h.width,
+            h.height,
+            h.process_id,
+            h.layer,
+            c.quantity,
+            c.order_number
+        ORDER BY
+            LENGTH( h.layout_id ),
+            h.layout_id;
+    </select>
+
+    <!--宸ョ▼淇℃伅娴佺▼鍗�-->
+    <select id="getProcessCardMpThirdParty">
+        SELECT
+            fc.process_id,
+            fc.order_number,
+            fc.glass_total as quantity,
+            CONCAT(fc.layer, '/', COUNT(fc.total_layer)) AS layer,
+            CONCAT(fc.width, ' 脳 ', fc.height) AS sizes
+        FROM
+            pp.other_flow_card AS fc
+        WHERE
+            fc.project_no = #{projectNo}
+        GROUP BY
+            fc.layer,
+            fc.order_number
+    </select>
+
+    <delete id="deleteOptimizeDetailThirdParty">
+        delete from pp.other_flow_card
+        where project_no = #{projectNumber}
+    </delete>
+
+
+
+
+
+
+
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0