From 775d4714ca9e650631659d7467f5c43dc021f931 Mon Sep 17 00:00:00 2001
From: 18516761980 <56479841@qq.com>
Date: 星期四, 16 六月 2022 17:16:20 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/luxiaotao1123/zy-asrs into hylyasrs

---
 src/main/resources/mapper/LocMastMapper.xml |   75 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/LocMastMapper.xml b/src/main/resources/mapper/LocMastMapper.xml
index a736a3b..621e466 100644
--- a/src/main/resources/mapper/LocMastMapper.xml
+++ b/src/main/resources/mapper/LocMastMapper.xml
@@ -104,8 +104,79 @@
          from asr_loc_mast
          where 1=1
          and loc_sts = 'O'
-         and row1 in (1,4,5,8,9,12,13,16,17,20)
+         and row1 in (1)
         )
-        and (loc_sts = 'F' or loc_sts = 'D')
+        and (loc_sts = 'F' or loc_sts = 'D') and crn_no=1
+    </select>
+
+    <select id="queryNeedMoveShallLocF" resultMap="BaseResultMap">
+        select * from asr_loc_mast
+        where 1=1
+        and loc_no in (
+         select
+         concat(
+         (
+         case
+         when left(loc_no, 2) = '01' then '02'
+         end)
+         , right(loc_no, 5)) as shallowLocNo
+         from asr_loc_mast
+         where 1=1
+         and loc_sts = 'D'
+         and row1 in (1)
+        )
+        and loc_sts = 'F' and crn_no=1
+    </select>
+
+    <select id="queryNeedMoveShallLocD" resultMap="BaseResultMap">
+        select * from asr_loc_mast
+        where 1=1
+        and loc_no in (
+         select
+         concat(
+         (
+         case
+         when left(loc_no, 2) = '01' then '02'
+         end)
+         , right(loc_no, 5)) as shallowLocNo
+         from asr_loc_mast
+         where 1=1
+         and loc_sts = 'F'
+         and row1 in (1)
+        )
+        and loc_sts = 'D' and crn_no=1
+    </select>
+
+    <select id="queryEmptyDeepLoc" resultMap="BaseResultMap">
+        select top 1 * from asr_loc_mast
+        where 1=1
+          and (loc_no in (
+            select
+                concat((case when left(loc_no, 2) = '02' then '01'end)
+                    , right(loc_no, 5)) as deepLocNo
+            from asr_loc_mast
+            where 1=1 and loc_sts = 'O' and row1 in (2)
+        ) or row1=3)
+          and loc_sts = 'O' and crn_no = 1
+        order by newid()
+    </select>
+
+    <select id="queryDeepLocDMast" resultMap="BaseResultMap">
+        select * from asr_loc_mast
+        where 1=1
+        and loc_no in (
+         select
+         concat(
+         (
+         case
+         when left(loc_no, 2) = '02' then '01'
+         end)
+         , right(loc_no, 5)) as deepLocNo
+         from asr_loc_mast
+         where 1=1
+         and loc_sts = 'O'
+         and row1 in (2)
+        )
+        and loc_sts = 'D' and crn_no=1
     </select>
 </mapper>

--
Gitblit v1.9.1