From b00eeab31bd13ba34a03301aa441b0751d6a93e4 Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期五, 19 十二月 2025 17:00:51 +0800
Subject: [PATCH] 第六排成品可以放第七排原材料

---
 src/main/resources/mapper/LocMastMapper.xml |  173 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 173 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/LocMastMapper.xml b/src/main/resources/mapper/LocMastMapper.xml
index b28a165..e4fa529 100644
--- a/src/main/resources/mapper/LocMastMapper.xml
+++ b/src/main/resources/mapper/LocMastMapper.xml
@@ -54,4 +54,177 @@
 <!--        </if>-->
         order by loc_sts desc ,lev1 asc,bay1 asc
     </select>
+
+    <select id="queryFreeLocMastIncludeFirst" resultMap="BaseResultMap">
+        select top 1 *
+        from asr_loc_mast
+        where row1=#{row}
+        and bay1 = 1
+        and loc_sts='O'
+        <if test="locType1 != null">
+            and loc_type1 = #{locType1}
+        </if>
+        <!--        <if test="locType2 != null">-->
+        <!--            and loc_type2 = #{locType2}-->
+        <!--        </if>-->
+        <!--        <if test="locType3 != null">-->
+        <!--            and loc_type3 = #{locType3}-->
+        <!--        </if>-->
+        order by loc_sts desc ,lev1 asc,bay1 asc
+    </select>
+    <select id="queryFreeLocMastExceptFirst" resultMap="BaseResultMap">
+        select top 1 *
+        from asr_loc_mast
+        where row1=#{row}
+        and bay1 > 1
+        and loc_sts='O'
+        <if test="locType1 != null">
+            and loc_type1 = #{locType1}
+        </if>
+        <!--        <if test="locType2 != null">-->
+        <!--            and loc_type2 = #{locType2}-->
+        <!--        </if>-->
+        <!--        <if test="locType3 != null">-->
+        <!--            and loc_type3 = #{locType3}-->
+        <!--        </if>-->
+        order by loc_sts desc ,lev1 asc,bay1 asc
+    </select>
+
+    <select id="queryShallowLocFMast" 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 = 'O'
+         and row1 in (1)
+        )
+        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>
+    <select id="queryEmptyLocNoByStaNo" resultType="com.zy.asrs.entity.LocMast">
+        SELECT TOP 1 loc_no AS locNo,crn_no AS crnNo FROM asr_loc_mast
+        where loc_sts = 'O'
+        <if test="crnNo == 1">
+            and row1 in(1,2,3)
+        </if>
+        <if test="crnNo == 2">
+            and row1 in(4,5)
+        </if>
+        <if test="crnNo == 3">
+            and row1 in(6,7)
+        </if>
+        <if test="crnNo == 4">
+            and row1 in(8,9)
+        </if>
+        ORDER BY lev1 ASC, bay1 ASC
+    </select>
+    <select id="queryLocByBarCode" resultType="com.zy.asrs.entity.LocMast">
+        SELECT TOP 1 loc_no AS locNo,crn_no AS crnNo FROM asr_loc_mast
+        where loc_sts = 'O' and row1 = #{row} ORDER BY lev1 ASC, bay1 ASC
+    </select>
+    <select id="queryLocByBarCodeNew" resultType="com.zy.asrs.entity.LocMast">
+        SELECT TOP 1 loc_no AS locNo,crn_no AS crnNo FROM asr_loc_mast
+        where loc_sts = 'O' and bay1 not in(1,39)
+        <if test="devpNo == 104">
+            and row1 in(1,2,3)
+        </if>
+        <if test="devpNo == 204">
+            and row1 in(4,5)
+        </if>
+        <if test="devpNo == 304">
+            and row1 in(6,7)
+        </if>
+        <if test="flag == 1">
+            and lev1 in(1,2,3,4,5,6)
+        </if>
+        <if test="flag == 2">
+            and lev1 in(7,8,9,10,11)
+        </if>
+        ORDER BY lev1 ASC, bay1 ASC
+    </select>
+
+    <select id="selectByBarcode" resultMap="BaseResultMap">
+        SELECT * FROM asr_loc_mast where 1=1 and barcode = #{barcode}
+    </select>
+    <select id="selectOneByCrnNo" resultMap="BaseResultMap">
+        SELECT * FROM asr_loc_mast where 1=1 and loc_sts = 'O' and crn_no = #{crnNo} order by lev1,bay1
+    </select>
 </mapper>

--
Gitblit v1.9.1