From d80dd0abcb56aacf30bc32e424ff398f7ccce730 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 26 三月 2021 13:17:00 +0800
Subject: [PATCH] #

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

diff --git a/src/main/resources/mapper/LocDetlMapper.xml b/src/main/resources/mapper/LocDetlMapper.xml
index f30d2d9..57207b4 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,22 @@
         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>
+
+    <select id="selectByNodeUuid" resultMap="BaseResultMap">
+        select * from man_loc_detl mld left join man_node mn on mld.node_id = mn.id
+        where 1=1
+        and mn.uuid = #{uuid}
+        and mld.status = 1
+        order by mld.create_time
+    </select>
+
 </mapper>

--
Gitblit v1.9.1