From e51e45f2cabcc4628ce93e55c7c3806b1b760161 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期一, 11 八月 2025 16:26:23 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml |  219 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 215 insertions(+), 4 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 81be6d1..fe665f2 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml
@@ -746,7 +746,7 @@
         from pp.optimize_project as p
                  left join pp.optimize_admin as a on p.creater = a.Id
         where (`p`.`state` > 0)
-            and (tempering_state>0 or optimize_state>0)
+#             and (tempering_state>0 or optimize_state>0)
             and DATE (`p`.`create_time`) BETWEEN #{startSelectTime} AND #{endSelectTime}
         <if test="optimizeProjectMange.projectNumber != null and optimizeProjectMange.projectNumber != ''">
             and p.project_no regexp #{optimizeProjectMange.projectNumber}
@@ -1224,14 +1224,15 @@
             order_sort,
             stock_id,
             polys_id,
-            o_width,
-            o_height,
+            p_width,
+            p_height,
             width,
             height,
             x_axis,
             y_axis,
             patch_state,
             mark_icon,
+            isRotate,
             rack_no
             ) VALUES (
             #{projectId},
@@ -1249,6 +1250,7 @@
             #{glass.y},
             #{glass.patchState},
             #{glass.markIcon},
+            #{glass.isRotate},
             #{glass.rackNo}
             );
         </foreach>
@@ -1285,6 +1287,7 @@
             down_trim,
             left_trim,
             right_trim,
+            count,
             glass_count,
             glass_area,
             create_time
@@ -1299,7 +1302,8 @@
             #{glass.downTrim},
             #{glass.leftTrim},
             #{glass.rightTrim},
-            #{glass.glassCount},
+            #{glass.count},
+            #{glass.glassQuantity},
             #{glass.glassArea},
             now()
             );
@@ -1341,6 +1345,28 @@
             now()
             );
         </foreach>
+    </insert>
+    <insert id="addOptimizeOffcut">
+        INSERT INTO pp.optimize_offcut (
+        project_no,
+        stock_id,
+        width,
+        height,
+        x_axis,
+        y_axis,
+        model,
+        thickness
+        ) VALUES (
+        #{projectId},
+        #{map.stockSort},
+        #{map.width},
+        #{map.height},
+        #{map.x},
+        #{map.y},
+        #{glassType},
+        #{glassThickness}
+
+        )
     </insert>
 
 
@@ -1635,11 +1661,196 @@
         delete from pp.other_flow_card
         where project_no = #{projectNumber}
     </delete>
+    <delete id="deleteOptimizeOffcut">
+        DELETE
+        FROM
+            pp.optimize_offcut
+        WHERE
+            project_no = #{projectNumber}
+    </delete>
 
 
+    <select id="selectOptimizeProject">
+        select
+            project_no as engineerId,
+            project_name as engineerName,
+            avg_cut_pct as avgAvailability,
+            valid_cut_pct as validAvailability,
+            last_cut_pct as lastAvailability,
+            glass_total as glassTotal,
+            glass_total_area as glassTotalArea,
+            raw_stock_qty as planPatternTotal,
+            raw_stock_area as planPatternTotalArea,
+            glass_thickness as thickness,
+            glass_type as filmsId
+        from
+            pp.optimize_project
+        where
+            project_no = #{projectNo}
+    </select>
+
+    <select id="selectOptimizeLayout">
+        select
+            ol.project_no as engineeringId,
+            op.glass_type as filmsId,
+            ol.realwidth as rawGlassWidth,
+            ol.realheight as rawGlassHeight,
+            op.glass_thickness as rawGlassThickness,
+            ol.stock_id rawSequence
+        from
+            pp.optimize_layout ol
+                left join pp.optimize_project op on ol.project_no = op.project_no
+        where
+            ol.project_no = #{projectNo}
+        order by
+            ol.stock_id
+    </select>
 
 
+    <select id="selectOptimizeDetail">
+        select
+            opd.glass_id as glassId,
+            opd.project_no as engineerId,
+            opd.process_id as flowCardId,
+            opd.order_sort as orderNumber,
+            opd.o_width as width,
+            opd.o_height as height,
+            op.glass_thickness as thickness,
+            op.glass_type as filmsId,
+            opd.total_layer as totalLayer,
+            opd.layer,
+            opd.stock_id as rawSequence,
+            opd.p_width as edgWidth,
+            opd.p_height as edgHeight,
+            opd.x_axis as xAxis,
+            opd.y_axis as yAxis,
+            if(opd.o_width!=opd.width,1,0) as rawAngle,
+            opd.heat_layout_id as temperingLayoutId,
+            opd.heat_layout_sort as temperingFeedSequence,
+            ohd.x_axis as xCoordinate,
+            ohd.y_axis as yCoordinate,
+            ohd.rotate_angle as angle,
+            IF(LOCATE('涓┖', ogd.process ) > 0 or LOCATE('澶瑰眰', ogd.process ) > 0, 1, 0) as isMultiple,
+            od.width as maxWidth,
+            od.height as maxHeight,
+            opd.mark_icon as markIcon,
+            fc.`merge` as combine,
+            concat( opd.process_id, '/', opd.layer ) as flowCardSequence,
+            ogd.process
+        from
+            pp.optimize_detail opd
+                left join pp.optimize_project op on op.project_no = opd.project_no
+                left join pp.flow_card fc on opd.process_id = fc.process_id
+                and opd.layer = fc.technology_number
+                and opd.order_sort = order_number
+                left join sd.`order` o on fc.order_id = o.order_id
+                left join sd.order_detail od on fc.order_id = od.order_id
+                and fc.order_number = od.order_number
+                left join sd.order_glass_detail ogd on fc.order_id = ogd.order_id
+                and fc.order_number = ogd.order_number
+                and ogd.technology_number = fc.technology_number
+                left join pp.optimize_heat_detail ohd on ohd.layout_id = opd.heat_layout_id
+                and ohd.sort = opd.heat_layout_sort and ohd.project_no=opd.project_no
+        where
+            opd.project_no = #{projectNo}
+    </select>
 
+    <select id="selectFlowCardInfoList">
+        select
+            fc.process_id as flowCardId,
+            ogd.child_width as width,
+            ogd.child_height as height,
+            REPLACE (JSON_UNQUOTE( JSON_EXTRACT( pd.separation, '$.thickness' )), 'mm', '' ) as thickness,
+            JSON_UNQUOTE(JSON_EXTRACT( pd.separation, '$.color' )) as filmsId,
+            fc.layers_number as totalLayer,
+            fc.technology_number as layer,
+            fc.quantity as glassTotal,
+            od.order_number as orderNumber,
+            od.product_name as productName,
+            o.customer_name as customerName
+        from
+            pp.flow_card fc
+                left join sd.`order` o on fc.order_id = o.order_id
+                left join sd.order_detail od on fc.order_id = od.order_id
+                and fc.order_number = od.order_number
+                left join sd.order_glass_detail ogd on fc.order_id = ogd.order_id
+                and fc.order_number = ogd.order_number
+                and ogd.technology_number = fc.technology_number
+                left join sd.product p on od.product_id = p.id
+                left join sd.product_detail pd on od.product_id = pd.prod_id
+                and fc.technology_number = pd.glass_sort
+        where
+            project_no =#{projectNo}
+    </select>
+    <select id="getGlassInfo" resultType="java.util.Map">
+        select
+            project_no,
+            glass_type,
+            glass_thickness
+        from
+            pp.optimize_project
+        where
+            project_no = #{projectId}
+    </select>
+    <select id="getOptimizeLayoutsInfo" resultType="java.util.Map">
+        SELECT
+            width,
+            height,
+            stock_id AS stockId,
+            stock_code AS stockCode,
+            usage_rate AS usageRate,
+            up_trim AS upTrim,
+            down_trim AS downTrim,
+            left_trim AS leftTrim,
+            right_trim AS rightTrim,
+            count AS quantity,
+            glass_count AS glassQuantity
+        FROM
+            pp.optimize_layout
+        where
+            project_no = #{projectId}
+    </select>
+    <select id="getOptimizeDetailsInfo" resultType="java.util.Map">
+        SELECT
+            0 As isRemain,
+            width AS realWidth,
+            height AS realHeight,
+            p_width AS width,
+            p_height AS height,
+            process_id AS processId,
+            layer,
+            total_layer AS totalLayer,
+            order_sort As orderSort,
+            stock_id AS layoutId,
+            stock_number AS glassSort,
+            x_axis AS x,
+            y_axis AS y,
+            mark_icon AS markIcon,
+            isRotate,
+            rack_no As rackNo
+        FROM
+            pp.optimize_detail
+        WHERE
+            project_no = #{projectId}
+    </select>
+    <select id="getOptimizeOffsetsInfo" resultType="java.util.Map">
+        SELECT
+            1 AS isRemain,
+            0 AS isRotate,
+            width AS realWidth,
+            height AS realHeight,
+            width AS width,
+            height AS height,
+            stock_id AS stockSort,
+            x_axis AS x,
+            y_axis AS y,
+            model AS glassType,
+            thickness AS glassThickness
+        FROM
+            pp.optimize_offcut
+        WHERE
+            project_no = #{projectId}
+    </select>
 
 
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0