From 4ee53f8b43e850d2b35d5b1eb979d7b0bc2fbcd4 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期四, 30 五月 2024 10:52:26 +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 |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 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 ba35622..dc5c9b6 100644
--- a/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
+++ b/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -82,7 +82,7 @@
         select
         ou.id as useId,
         ou.project_no as projectNo,
-        ou.use_count AS inventoryQuantity,
+        mi.inventory_quantity AS inventoryQuantity,
         mi.plan_quantity AS availableQuantity,
         mi.plan_quantity AS planQuantity,
         mi.id,
@@ -98,9 +98,10 @@
         mi.dead_stock AS deadStock,
         mi.remarks,
         date(mi.create_time) AS createTime,
-        ms.json from pp.optimize_use ou left join mm.material_inventory mi on ou.stock_code=mi.id left join mm.material_store ms on mi.material_code=ms.id
+        ms.json from pp.optimize_use ou left join mm.material_inventory mi on ou.raw_stock_code=mi.id left join mm.material_store ms on mi.material_code=ms.id
+        left join pp.optimize_project op on op.project_no=ou.project_no
         <where>
-            ou.not_use_count>0 and ou.state=1 and
+            mi.plan_quantity>0 and op.state>=100 and
             date(ou.create_time)>=#{startDate} and date(ou.create_time) &lt;= #{endDate}
 
         </where>
@@ -144,7 +145,10 @@
         from mm.material_inventory mi left join mm.material_store ms on mi.material_code=ms.id
         <where>
             <if test="materialInventory.stockId != null and materialInventory.stockId != ''">
-                and mi.id regexp #{materialInventory.stockId}
+                and mi.id in
+                <foreach item="id" collection="ids" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
             </if>
 
         </where>
@@ -171,7 +175,7 @@
         select
         ou.id as useId,
         ou.project_no as projectNo,
-        ou.use_count AS inventoryQuantity,
+        mi.inventory_quantity AS inventoryQuantity,
         mi.plan_quantity AS availableQuantity,
         mi.plan_quantity AS planQuantity,
         mi.id,
@@ -187,11 +191,14 @@
         mi.dead_stock AS deadStock,
         mi.remarks,
         date(mi.create_time) AS createTime,
-        ms.json from pp.optimize_use ou left join mm.material_inventory mi on ou.stock_code=mi.id left join mm.material_store ms on mi.material_code=ms.id
+        ms.json from pp.optimize_use ou left join mm.material_inventory mi on ou.raw_stock_code=mi.id left join mm.material_store ms on mi.material_code=ms.id
 
         <where>
             <if test="optimizeUse.rawStockCode != null and optimizeUse.rawStockCode != ''">
-                and ou.id regexp #{optimizeUse.rawStockCode}
+                and ou.id in
+                <foreach item="id" collection="ids" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
             </if>
 
         </where>
@@ -207,7 +214,10 @@
         pp.optimize_use ou
         <where>
             <if test="optimizeUse.rawStockCode != null and optimizeUse.rawStockCode != ''">
-                and ou.id regexp #{optimizeUse.rawStockCode}
+                and ou.id in
+                <foreach item="id" collection="ids" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
             </if>
 
         </where>

--
Gitblit v1.8.0