From 3067d24d5f5d20b5c69e626169227a07e1bf1f49 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期三, 23 四月 2025 09:46:29 +0800
Subject: [PATCH] 提交 app质检审核查询部分代码

---
 north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml |   77 +++++++++++++++++++++++++++++++++++---
 1 files changed, 71 insertions(+), 6 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 4ced3ea..e449f52 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml
@@ -286,6 +286,67 @@
             `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>
+
 
     <select id="materialStoreOptimizeUse">
         select ms.id AS id,
@@ -559,17 +620,21 @@
     <!--妯℃嫙璁$畻鏌ヨ娴佺▼鍗�-->
     <select id="selectProjectComputeMp">
         select
-            娴佺▼鍗″彿 as process_id,
-            灞� as technology_number,
-            鎬诲眰鏁� as TotalFloors,
+            娴佺▼鍗″彿 as processId,
+            灞� as technologyNumber,
+            鎬诲眰鏁� as total_layers,
             瑙勬牸 as TotalNumber,
-            鏁伴噺 as quantity,
+            鏁伴噺 as total_num,
             椤圭洰 as project,
             浜у搧鍚嶇О as glass_child,
-            闈㈢Н as area,
+            闈㈢Н as total_area,
             tempering as tempering,
             merge as merge,
-            patch_state as patch_state
+            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>
 

--
Gitblit v1.8.0