From e4ea838c20e94dff4fdbb4f82b542a8b5790fa9d Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 18 六月 2021 09:22:06 +0800
Subject: [PATCH] # 库存跳转上报erp

---
 src/main/resources/mapper/PriorMapper.xml |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/main/resources/mapper/PriorMapper.xml b/src/main/resources/mapper/PriorMapper.xml
index 625d5e3..23194bf 100644
--- a/src/main/resources/mapper/PriorMapper.xml
+++ b/src/main/resources/mapper/PriorMapper.xml
@@ -26,17 +26,11 @@
 
 
     <sql id="pageCondition">
-        <if test="loc_no != null and loc_no != ''">
-            and mld.loc_no like concat('%',#{loc_no},'%')
-        </if>
         <if test="matnr != null and matnr != ''">
-            and mld.matnr like concat('%',#{matnr},'%')
+            and mp.matnr like concat('%',#{matnr},'%')
         </if>
-        <if test="maktx != null and maktx != ''">
-            and mld.maktx like concat('%',#{maktx},'%')
-        </if>
-        <if test="startTime!=null and endTime!=null">
-            and mld.update_time between #{startTime} and #{endTime}
+        <if test="node_id != null and node_id != ''">
+            and mp.node_id like concat('%',#{node_id},'%')
         </if>
     </sql>
 
@@ -44,16 +38,21 @@
         select * from
         (
             select
-            ROW_NUMBER() over (order by mp.create_time desc) as row,
+            ROW_NUMBER() over (order by isnull(round((ls.amount/mp.safe_qua),2),0) asc) as row,
             mp.node_id,
             mp.node_name,
             mp.matnr,
             mp.maktx,
             mp.safe_qua,
-            ls.amount,
-            (cast(round((ls.amount/(mp.safe_qua*1.0))*100,2) as varchar)+'%') as progress
+            ISNULL(ls.amount, 0) as amount,
+            ISNULL((cast(round((ls.amount/(mp.safe_qua*1.0))*100,2) as varchar)+'%'), '0.00%') as progress,
+            case
+            when isnull(round((ls.amount/mp.safe_qua),2),0) > 1 then 1
+            when isnull(round((ls.amount/mp.safe_qua),2),0) > 0.75 then 2
+            else 3
+            end as status
             from man_prior mp
-            inner join
+            left join
             (
                 select
                 node_id,
@@ -71,7 +70,7 @@
         select
         count(1) as count
         from man_prior mp
-        inner join
+        left join
         (
         select
         node_id,

--
Gitblit v1.9.1