From 4b0fec6fd68a7f6ac0f5b226cf11b3e71cbe68e1 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 12 一月 2021 20:12:29 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/service/CommonService.java |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 926760a..69348e0 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -11,6 +11,7 @@
 import com.zy.common.model.Shelves;
 import com.zy.common.model.StartupDto;
 import com.zy.common.properties.SlaveProperties;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -21,6 +22,7 @@
  * 璐ф灦鏍稿績鍔熻兘
  * Created by vincent on 2020/6/11
  */
+@Slf4j
 @Service
 public class CommonService {
 
@@ -91,7 +93,7 @@
      * @return locNo 妫�绱㈠埌鐨勫簱浣嶅彿
      */
     @Transactional
-    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto) {
+    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, int times) {
         StartupDto startupDto = new StartupDto();
         // 鐢熸垚宸ヤ綔鍙�
         int workNo = getWorkNo(0);
@@ -128,7 +130,7 @@
 
         // 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂�
         if (!Cools.isEmpty(matNos)) {
-            List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0));
+            List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0), sRow, eRow);
             for (String locNo : locNos) {
                 if (Utils.isShallowLoc(slaveProperties, locNo)) {
                     continue;
@@ -146,7 +148,7 @@
 
         // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭
         if (staDescId == 10) {
-            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D"));
+            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").gt("row1", sRow).lt("row1", eRow));
             if (locMasts.size() > 0) {
                 for (LocMast loc : locMasts) {
                     if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
@@ -227,6 +229,9 @@
         BasDevp staNo = basDevpService.selectById(staDesc.getCrnStn());
         int inQty = staNo.getInQty()==null?0:staNo.getInQty();
         if (staNo.getAutoing().equals("Y") && inQty<2) {
+            // 鏇存柊搴撲綅鎺掑彿
+            rowLastno.setCurrentRow(curRow);
+            rowLastnoService.updateById(rowLastno);
             // 鏌ユ壘搴撲綅
             if (locMast == null) {
                 if (Utils.isShallowLoc(slaveProperties, curRow)) {
@@ -241,15 +246,16 @@
                 // 杞昏揣鐗╂壘杞诲簱浣嶄负绌烘椂锛屽彲浠ュ幓鎵鹃噸搴撲綅浠�
                 if (locTypeDto.getLocType1() == 1) {
                     locTypeDto.setLocType1((short) 2);
-                    return getLocNo(null, staDescId, sourceStaNo, matNos, locTypeDto);
+                    return getLocNo(null, staDescId, sourceStaNo, matNos, locTypeDto, times);
                 }
-                throw new CoolException("娌℃湁绌哄簱浣�");
+                if (times >= rowCount) {
+                    log.error("娌℃湁绌哄簱浣�");
+                    throw new CoolException("娌℃湁绌哄簱浣�");
+                }
+                times = times + 1;
+                return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times);
             }
             String locNo = locMast.getLocNo();
-
-            // 鏇存柊搴撲綅鎺掑彿
-            rowLastno.setCurrentRow(curRow);
-            rowLastnoService.updateById(rowLastno);
 
             // 杩斿洖dto
             startupDto.setCrnNo(crnNo);

--
Gitblit v1.9.1