From 357de6228f120de8072c482d04bd7577e4f5db0b Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 23 三月 2021 16:29:20 +0800
Subject: [PATCH] #

---
 src/main/resources/mapper/LocDetlMapper.xml |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/src/main/resources/mapper/LocDetlMapper.xml b/src/main/resources/mapper/LocDetlMapper.xml
index f30d2d9..d62caa9 100644
--- a/src/main/resources/mapper/LocDetlMapper.xml
+++ b/src/main/resources/mapper/LocDetlMapper.xml
@@ -91,6 +91,16 @@
     <update id="reduceStock">
         update man_loc_detl
         set anfme = anfme - #{anfme}
+        , update_time = getdate()
+        where 1=1
+        and node_id = #{nodeId}
+        and matnr = #{matnr}
+    </update>
+
+    <update id="incrementStock">
+        update man_loc_detl
+        set anfme = anfme + #{anfme}
+        , update_time = getdate()
         where 1=1
         and node_id = #{nodeId}
         and matnr = #{matnr}
@@ -107,7 +117,7 @@
         select
         mld.*
         from man_loc_detl mld
-        left join man_prior mp on mld.node_id = mp.node_id
+        left join man_prior mp on mld.node_id = mp.node_id and mld.matnr = mp.matnr
         where 1=1
         <if test="nodeId != null and nodeId != ''">
             and mld.node_id = #{nodeId}
@@ -120,4 +130,14 @@
         order by mp.prio desc, mld.create_time asc
     </select>
 
+    <select id="getLocDetlStatis" resultMap="BaseResultMap">
+        select
+        ROW_NUMBER() over (order by sum(a.anfme) desc) as row
+        , a.matnr
+        , sum(a.anfme) as anfme
+        from man_loc_detl a
+        where 1=1
+        group by a.matnr
+    </select>
+
 </mapper>

--
Gitblit v1.9.1