From c411387fa86ad7fd247a768c259b8f21caa70a8c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 02 一月 2021 15:30:35 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java |    4 ++--
 src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java    |    7 +++++--
 src/main/resources/mapper/LocMastMapper.xml                    |    9 ++++++++-
 src/main/java/com/zy/asrs/mapper/LocMastMapper.java            |    2 +-
 src/main/java/com/zy/asrs/service/LocMastService.java          |    2 +-
 src/main/java/com/zy/common/model/LocTypeDto.java              |   27 ++++-----------------------
 src/main/java/com/zy/common/service/CommonService.java         |    1 +
 7 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/src/main/java/com/zy/asrs/mapper/LocMastMapper.java b/src/main/java/com/zy/asrs/mapper/LocMastMapper.java
index 57c635b..5a414ba 100644
--- a/src/main/java/com/zy/asrs/mapper/LocMastMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/LocMastMapper.java
@@ -13,7 +13,7 @@
 @Repository
 public interface LocMastMapper extends BaseMapper<LocMast> {
 
-    LocMast queryFreeLocMast(@Param("row") Integer row);
+    LocMast queryFreeLocMast(@Param("row") Integer row, @Param("locType1") Short locType1);
 
     @Select("select loc_no from asr_loc_mast where 1=1 and loc_sts = 'O' and crn_no = #{crnNo}")
     List<String> queryGroupEmptyStock(Integer crnNo);
diff --git a/src/main/java/com/zy/asrs/service/LocMastService.java b/src/main/java/com/zy/asrs/service/LocMastService.java
index 95932ad..79f0778 100644
--- a/src/main/java/com/zy/asrs/service/LocMastService.java
+++ b/src/main/java/com/zy/asrs/service/LocMastService.java
@@ -10,7 +10,7 @@
     /**
      * 妫�绱㈠彲鐢ㄥ簱浣�
      */
-    LocMast queryFreeLocMast(Integer row);
+    LocMast queryFreeLocMast(Integer row, Short locType1);
 
     /**
      * 鑾峰彇鍚岀粍璐ф灦鐨勭┖搴撲綅
diff --git a/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
index c90868c..4e34f77 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
@@ -18,8 +18,8 @@
     private RowLastnoService rowLastnoService;
 
     @Override
-    public LocMast queryFreeLocMast(Integer row) {
-        return this.baseMapper.queryFreeLocMast(row);
+    public LocMast queryFreeLocMast(Integer row, Short locType1) {
+        return this.baseMapper.queryFreeLocMast(row, locType1);
     }
 
     @Override
diff --git a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
index 0026fc6..0bc3496 100644
--- a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -14,6 +14,7 @@
 import com.zy.asrs.service.*;
 import com.zy.asrs.utils.VersionUtils;
 import com.zy.common.model.LocDetlDto;
+import com.zy.common.model.LocTypeDto;
 import com.zy.common.model.OutLocDto;
 import com.zy.common.model.StartupDto;
 import com.zy.common.model.enums.WorkNoType;
@@ -70,8 +71,9 @@
         // 婧愮珯鐐圭姸鎬佹娴�
         BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getDevpNo(), true);
         // 妫�绱㈠簱浣�
+        LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
         List<String> matNos = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatNo).distinct().collect(Collectors.toList());
-        StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matNos);
+        StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matNos, locTypeDto);
         // 鐢熸垚宸ヤ綔鍙�
         int workNo = dto.getWorkNo();
         // 鐢熸垚宸ヤ綔妗�
@@ -253,7 +255,8 @@
         // 婧愮珯鐐圭姸鎬佹娴�
         BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true);
         // 妫�绱㈠簱浣�
-        StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null);
+        LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
+        StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null, locTypeDto);
         int workNo = dto.getWorkNo();
         // 鐢熸垚宸ヤ綔妗�
         WrkMast wrkMast = new WrkMast();
diff --git a/src/main/java/com/zy/common/model/LocTypeDto.java b/src/main/java/com/zy/common/model/LocTypeDto.java
index ccd52fc..b6343ba 100644
--- a/src/main/java/com/zy/common/model/LocTypeDto.java
+++ b/src/main/java/com/zy/common/model/LocTypeDto.java
@@ -1,7 +1,7 @@
 package com.zy.common.model;
 
 import com.core.exception.CoolException;
-import com.zy.core.model.protocol.StaProtocol;
+import com.zy.asrs.entity.BasDevp;
 import lombok.Data;
 
 /**
@@ -19,34 +19,15 @@
     // 杞婚噸绫诲瀷{0:鏈煡,1:杞诲簱浣�,2:閲嶅簱浣峿
     private Short locType3;
 
-    public LocTypeDto() {
-    }
-
-    public LocTypeDto(StaProtocol staProtocol) {
-        if (staProtocol.isHigh() == staProtocol.isLow()) {
+    public LocTypeDto(BasDevp basDevp) {
+        if (basDevp.getLocType1() == null || basDevp.getLocType1() == 0) {
             throw new CoolException("plc楂樹綆妫�娴嬪紓甯�");
         }
-        if (staProtocol.isLow()) {
+        if (basDevp.getLocType1() == 1) {
             this.locType1 = 1; // 浣庡簱浣�
         } else {
             this.locType1 = 2; // 楂樺簱浣�
         }
-    }
-
-    /**
-     * 搴撲綅绫诲瀷瑙f瀽
-     */
-    public static LocTypeDto process(StaProtocol staProtocol) {
-        LocTypeDto dto = new LocTypeDto();
-        if (staProtocol.isHigh() == staProtocol.isLow()) {
-            throw new CoolException("plc楂樹綆妫�娴嬪紓甯�");
-        }
-        if (staProtocol.isLow()) {
-            dto.setLocType1((short) 1); // 浣庡簱浣�
-        } else {
-            dto.setLocType1((short) 2); // 楂樺簱浣�
-        }
-        return dto;
     }
 
 }
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 20ba532..2bc8599 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -7,6 +7,7 @@
 import com.zy.asrs.entity.*;
 import com.zy.asrs.service.*;
 import com.zy.asrs.utils.Utils;
+import com.zy.common.model.LocTypeDto;
 import com.zy.common.model.Shelves;
 import com.zy.common.model.StartupDto;
 import com.zy.common.properties.SlaveProperties;
diff --git a/src/main/resources/mapper/LocMastMapper.xml b/src/main/resources/mapper/LocMastMapper.xml
index 61d8a3a..67c995b 100644
--- a/src/main/resources/mapper/LocMastMapper.xml
+++ b/src/main/resources/mapper/LocMastMapper.xml
@@ -39,6 +39,13 @@
     </resultMap>
 
     <select id="queryFreeLocMast" resultMap="BaseResultMap">
-        select top 1 * from asr_loc_mast where row1=#{row} and loc_sts='O' order by loc_sts desc ,lev1 asc,bay1 asc
+        select top 1 *
+        from asr_loc_mast
+        where row1=#{row}
+        and loc_sts='O'
+        <if test="locType1 != null">
+            and loc_type1 = #{locType1}
+        </if>
+        order by loc_sts desc ,lev1 asc,bay1 asc
     </select>
 </mapper>

--
Gitblit v1.9.1