From 1e1c416c6aa6596feb333b75d882ffeede73d3c9 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期二, 08 四月 2025 17:37:34 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml |   81 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 81 insertions(+), 0 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml b/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
index fc889c2..0a1965e 100644
--- a/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
+++ b/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -1149,5 +1149,86 @@
         select project_no from pp.optimize_use where id=#{useId};
     </select>
 
+    <select id="getOptimizeOutboundReport">
+        SELECT
+            ml.operation_order_number,
+            ml.project_no,
+            ml.inventory_id,
+            ml.material_name,
+            ml.unit,
+            ml.width,
+            ml.height,
+            ml.thickness,
+            ml.quantity,
+            round(ml.width*ml.height*ml.quantity/1000000,2) as area,
+            ou.use_count,
+            ou.not_use_count,
+            ml.operator,
+            ml.operate_time
 
+        FROM
+            mm.material_log AS ml
+                LEFT JOIN pp.optimize_use AS ou ON ou.project_no = ml.project_no
+                AND ou.raw_stock_code = ml.inventory_id
+        WHERE
+            ou.project_no IS NOT NULL
+            	AND date( ml.operate_time )>= #{startDate} and date(ml.operate_time) &lt;= #{endDate}
+            and ml.operate_type=#{type}
+
+        <if test="materialLog.operationOrderNumber != null and materialLog.operationOrderNumber != ''">
+            and ml.operation_order_number regexp #{materialLog.operationOrderNumber}
+        </if>
+        <if test="materialLog.useCount != null and materialLog.useCount != ''">
+            and ou.use_count regexp #{materialLog.useCount}
+        </if>
+        <if test="materialLog.quantity != null and materialLog.quantity != ''">
+            and ml.quantity regexp #{materialLog.quantity}
+        </if>
+        <if test="materialLog.width != null and materialLog.width != ''">
+            and  ml.width regexp  REGEXP_REPLACE(#{materialLog.width},'\\.0+$','')
+        </if>
+        <if test="materialLog.height != null and materialLog.height != ''">
+            and  ml.height regexp  REGEXP_REPLACE(#{materialLog.height},'\\.0+$','')
+        </if>
+        <if test="materialLog.thickness != null and materialLog.thickness != ''">
+            and  ml.thickness regexp  REGEXP_REPLACE(#{materialLog.thickness},'\\.0+$','')
+        </if>
+
+        <if test="materialLog.inventoryId != null and materialLog.inventoryId != ''">
+            and  ml.inventory_id regexp  #{materialLog.inventoryId}
+        </if>
+
+        <if test="materialLog.materialName != null and materialLog.materialName != ''">
+            and  ml.material_name regexp  #{materialLog.materialName}
+        </if>
+        <if test="materialLog.producer != null and materialLog.producer != ''">
+            and  ml.producer regexp  #{materialLog.producer}
+        </if>
+        <if test="materialLog.unit != null and materialLog.unit != ''">
+            and  ml.unit regexp  #{materialLog.unit}
+        </if>
+        <if test="materialLog.operator != null and materialLog.operator != ''">
+            and  ml.operator regexp  #{materialLog.operator}
+        </if>
+        <if test="materialLog.remarks != null and materialLog.remarks != ''">
+            and ml.remarks regexp #{materialLog.remarksr}
+        </if>
+        order by ml.id desc
+        limit #{offset},#{pageSize};
+    </select>
+
+    <select id="getOptimizeOutboundReportTotal">
+        SELECT
+            CEILING(count(ml.id)/#{pageSize}) as 'pageTotal',
+                count(ml.id) as 'total'
+
+        FROM
+            mm.material_log AS ml
+                LEFT JOIN pp.optimize_use AS ou ON ou.project_no = ml.project_no
+                AND ou.raw_stock_code = ml.inventory_id
+        WHERE
+            ou.project_no IS NOT NULL
+          AND date( ml.operate_time )>= #{startDate} and date(ml.operate_time) &lt;= #{endDate}
+          and ml.operate_type=#{type}
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0