From a6f59f0908e5787d55c098c17f4eec365cf6477a Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期六, 23 十一月 2024 11:41:25 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml |   53 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 46 insertions(+), 7 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 675f6c9..54c7a66 100644
--- a/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
+++ b/north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -549,16 +549,36 @@
         delete from mm.material_outbound_detail where material_outbound_id=#{materialOutboundId}
     </delete>
 
+    <delete id="deleteMaterialLog" >
+        delete from mm.material_log where operation_order_number=#{materialOutboundId}
+    </delete>
+
     <delete id="deleteReturningWarehouseDetail" >
         delete from mm.returning_warehouse_detail where returning_id=#{returningId}
     </delete>
 
+    <delete id="deleteReturningWarehouse" >
+        delete from mm.returning_warehouse where returning_id=#{returningId}
+    </delete>
+
     <select id="getMaximum" >
-        select count(*) from mm.material_outbound where  date(create_time)=CURDATE()
+        select
+            ifnull(SUBSTR(max(right(material_outbound_id,8)) from 7),0)
+        from
+            mm.material_outbound as a
+        where
+            date(a.create_time) = curdate()
+
     </select>
 
     <select id="getMaximums" >
-        select count(*) from mm.returning_warehouse where  date(create_time)=CURDATE()
+        select
+            ifnull(SUBSTR(max(right(returning_id,8)) from 7),0)
+        from
+            mm.returning_warehouse as a
+        where
+            date(a.create_time) = curdate()
+
     </select>
 
     <select id="getMaterialOutboundCount" >
@@ -747,13 +767,19 @@
     <update id="updateMaterialInventory" >
         update mm.material_inventory set inventory_quantity=inventory_quantity+#{materialInventory.inventoryQuantity},
                                          available_quantity=available_quantity+#{materialInventory.inventoryQuantity},
-                                         total_area=total_area+#{totalArea}
+                                         total_area=single_piece_area*inventory_quantity
                                      where  material_code=#{materialCode} and date_of_manufacture=#{materialInventory.dateOfManufacture}
     </update>
 
+    <update id="updateMaterialInventoryNull" >
+        update mm.material_inventory set inventory_quantity=inventory_quantity+#{materialInventory.inventoryQuantity},
+                                         available_quantity=available_quantity+#{materialInventory.inventoryQuantity},
+                                         total_area=single_piece_area*inventory_quantity
+        where  material_code=#{materialCode}
+    </update>
+
     <update id="updateMaterialInventoryReturning" >
-        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity},
-                                         total_area=total_area+#{totalArea}
+        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity}
        where  material_code=#{materialCode} and
                 date_of_manufacture=#{returningWarehouseDetail.dateOfManufacture}
 
@@ -761,8 +787,7 @@
     </update>
 
     <update id="updateMaterialInventoryReturningNull" >
-        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity},
-                                         total_area=total_area+#{totalArea}
+        update mm.material_inventory set available_quantity=available_quantity+#{returningWarehouseDetail.returnQuantity}
         where  material_code=#{materialCode} and
             date_of_manufacture is null
 
@@ -1038,5 +1063,19 @@
 
     </select>
 
+    <select id="deleteMaterialInventory">
+        delete from
+        mm.material_inventory mi
+        <where>
+            <if test="ids != null and ids != ''">
+                and mi.id in
+                <foreach item="id" collection="ids" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+
+        </where>
+    </select>
+
 
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0