From e6ec6cd0e0fab11bf79f052be352a66db2dd51d3 Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期二, 26 十一月 2024 13:18:54 +0800
Subject: [PATCH] 项目搭建完成

---
 src/main/java/com/zy/common/service/CommonService.java |  320 ++++++++++++++++++++++++++++++++++------------------
 1 files changed, 209 insertions(+), 111 deletions(-)

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 3dd5b72..33b8dd8 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -3,16 +3,14 @@
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.Wrapper;
-import com.core.common.Arith;
 import com.core.common.Cools;
 import com.core.exception.CoolException;
 import com.zy.asrs.entity.*;
-import com.zy.asrs.entity.result.KeyValueVo;
+import com.zy.asrs.mapper.LocMastMapper;
 import com.zy.asrs.service.*;
 import com.zy.asrs.utils.Utils;
 import com.zy.asrs.utils.VersionUtils;
 import com.zy.common.model.LocTypeDto;
-import com.zy.common.model.Shelves;
 import com.zy.common.model.StartupDto;
 import com.zy.common.properties.SlaveProperties;
 import lombok.extern.slf4j.Slf4j;
@@ -20,11 +18,9 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.time.LocalDate;
-import java.time.format.DateTimeFormatter;
-import java.time.temporal.ChronoUnit;
-import java.util.ArrayList;
+import javax.annotation.Resource;
 import java.util.List;
+import java.util.Optional;
 
 /**
  * 璐ф灦鏍稿績鍔熻兘
@@ -56,6 +52,9 @@
     private SlaveProperties slaveProperties;
     @Autowired
     private WrkDetlService wrkDetlService;
+
+    @Resource
+    private LocMastMapper locMastMapper;
 
     /**
      * 鐢熸垚宸ヤ綔鍙�
@@ -150,7 +149,72 @@
         }catch (Exception e){
             log.error("绔欑偣={} 鏈煡璇㈠埌瀵瑰簲鐨勮鍒�",sourceStaNo);
         }
-        return null;
+        throw new CoolException("鑾峰彇搴撲綅寮傚父");
+    }
+
+    /**
+     * 鑾峰彇搴撲綅锛屾澃涓婃澃鐢�
+     * @param ioType 1鍏ㄦ澘鍏ュ簱锛�10绌烘墭鐩樼粍鍏ュ簱
+     * @param sourceSite 婧愮珯鐐�
+     * @param locType 搴撲綅妫�娴嬩俊鎭� 0绌烘墭1鍒楋紝1涓�灞傦紝2.2-4灞傦紝3.5-9灞�
+     * @return 鐩爣搴撲綅淇℃伅
+     */
+    @Transactional
+    public StartupDto getLocNoRunNew(Integer ioType, Integer sourceSite, Integer locType) {
+
+        // 鏍规嵁鍏ュ簱绫诲瀷鍜屾簮绔欑偣鑾峰彇宸ヤ綔璺緞
+        StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>().eq("type_no", ioType).eq("crn_stn", sourceSite));
+        if (staDesc == null) {
+            throw new CoolException("鑾峰彇宸ヤ綔璺緞寮傚父锛�" + ioType + " , " + sourceSite);
+        }
+
+        // 瀵绘壘鍒扮殑搴撲綅
+        LocMast locMast = null;
+
+        // 鎸夊簱浣嶇被鍨嬭幏鍙栧簱浣�
+        List<LocMast> locMasts = locMastMapper.selectLocByTypeToList(locType, staDesc.getCrnNo());
+
+        // todo 濡傛灉褰撳墠绫诲瀷搴撲綅鍓╀綑涓嶅锛屾槸涓�鐩存斁婊★紝杩樻槸鍏煎鍒颁笅涓�绉嶅簱浣嶇被鍨�
+        // 鑰冭檻绉诲簱闇�瑕佸悓绫诲瀷搴撲綅锛岃繖閲岄檺鍒朵笉鑳芥斁婊★紝鍏煎涓嬩竴绉嶅簱浣嶇被鍨�
+        if (locMasts.size() <= 4) {
+            switch (locType) {
+                case 0:
+                case 2:
+                    return getLocNoRunNew(ioType, sourceSite, 3);
+                case 1:
+                case 3:
+                    throw new CoolException("褰撳墠搴撲綅鍓╀綑鍥涗釜鐢ㄤ簬绉诲簱锛屾棤娉曞崰鐢細" + locType);
+                default:
+            }
+        }
+
+        // 鍏堝彇娣卞簱浣�
+        Optional<LocMast> first = locMasts.stream().filter(o -> o.getRow1() == 1 || o.getRow1() == 4 || o.getRow1() == 5 || o.getRow1() == 8).findFirst();
+        if (first.isPresent()) {
+               locMast = first.get();
+        } else {
+            // 娣卞簱浣嶉噷闈㈡病鏈変粠娴呭簱浣嶉噷闈㈠彇
+            Optional<LocMast> first2 = locMasts.stream().filter(o -> o.getRow1() == 2 || o.getRow1() == 3 || o.getRow1() == 5 || o.getRow1() == 7).findFirst();
+            if(first2.isPresent()) {
+                locMast = first2.get();
+            }
+        }
+
+        if (locMast == null) {
+            throw new CoolException("娌℃湁鎵惧埌鍚堥�傜┖搴撲綅");
+        }
+
+        // 鐢熸垚宸ヤ綔鍙�
+        int workNo = getWorkNo(0);
+        // 杩斿洖dto
+        StartupDto startupDto = new StartupDto();
+        startupDto.setWorkNo(workNo);
+        startupDto.setCrnNo(staDesc.getCrnNo());
+        startupDto.setSourceStaNo(staDesc.getStnNo());
+        startupDto.setStaNo(sourceSite);
+        startupDto.setLocNo(locMast.getLocNo());
+
+        return startupDto;
     }
 
     /**
@@ -409,13 +473,13 @@
                             locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
                                     .eq("loc_no", shallowLoc).eq("loc_sts", "F").eq("whs_type",rowLastnoType.getType().longValue()));
                             if (!Cools.isEmpty(locMast2)) {
-                                locMast = locMast2;
+                                locMast = locMast1;
                                 break;
                             } else {
                                 locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
                                         .eq("loc_no", shallowLoc).eq("loc_sts", "D").eq("whs_type",rowLastnoType.getType().longValue()));
                                 if (!Cools.isEmpty(locMast2)) {
-                                    locMast = locMast2;
+                                    locMast = locMast1;
                                     break;
                                 }
                             }
@@ -508,21 +572,18 @@
         //姝ょ▼搴忕敤浜庝紭鍖栧爢鍨涙満寮傚父鏃剁殑杩愯鏃堕棿
         for (int i = times; i < crnNumber*2; i++) {
             int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber);
+            rowCount =  locNecessaryParameters[0];
             curRow = locNecessaryParameters[1];
             crnNo = locNecessaryParameters[2];
-            if (basCrnpService.checkSiteError(crnNo, true)) {
-                rowCount =  locNecessaryParameters[0];
-                nearRow = locNecessaryParameters[3];
-                List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
-                        .eq("crn_no", crnNo).eq("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue()));
-                if (locMasts.size()<=5){
-                    times++;
-                    continue;
-                }
-                break;
-            } else {
+            nearRow = locNecessaryParameters[3];
+            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+                    .eq("crn_no", crnNo).eq("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue()));
+            if (locMasts.size()<=5){
                 times++;
+                continue;
             }
+            break;
+
         }
         if (crnNo == 0) {
             throw new CoolException("鏃犲彲鐢ㄥ簱浣�");
@@ -606,6 +667,8 @@
             int nearbay = 0;
             int nearlev = 0;
             for (WrkMast wrkMast:wrkMasts){
+                int curRowW = curRow;    //鐩镐技宸ヤ綔妗f 鏈�娣卞簱浣嶆帓
+                int nearRowW = nearRow;    //鐩镐技宸ヤ綔妗f 鏈�娴呭簱浣嶆帓
                 if (Cools.isEmpty(wrkMast.getLocNo())){
                     continue;
                 }
@@ -625,17 +688,30 @@
 //                List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow);
                 LocMast locMastGro = locMastService.selectById(wrkMast.getLocNo());
 
-                LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMastGro,rowLastnoType.getType().longValue());
+                for (int i = 0; i < crnNumber*2; i++) {
+                    if (!(Utils.getRow(locMastGro.getLocNo())>nearRowW && Utils.getRow(locMastGro.getLocNo())<=curRowW) && !(Utils.getRow(locMastGro.getLocNo())<nearRowW && Utils.getRow(locMastGro.getLocNo())>=curRowW) ){
+                        int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber);
+                        curRowW = locNecessaryParameters[1];
+                        nearRowW = locNecessaryParameters[3];
+                    }else {
+                        break;
+                    }
+                }
 
-                if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo())!=nearRow && locMast2.getLocSts().equals("S")){
+                LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW,nearRowW,locMastGro,rowLastnoType.getType().longValue());
+
+                if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo())!=nearRowW && locMast2.getLocSts().equals("S")){
                     int row2=0;
-                    if (Utils.getRow(locMast2.getLocNo())>nearRow){
+                    if (Utils.getRow(locMast2.getLocNo())>nearRowW){
                         row2=Utils.getRow(locMast2.getLocNo())-1;
                     }else {
                         row2=Utils.getRow(locMast2.getLocNo())+1;
                     }
                     String targetLocNo = zerofill(String.valueOf(row2), 2) + locMast2.getLocNo().substring(2);
-                    locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",targetLocNo));
+                    locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",targetLocNo).eq("loc_sts","O"));
+                    if (Cools.isEmpty(locMast)){
+                        continue;
+                    }
                     break;
                 }
             }
@@ -683,64 +759,122 @@
             }
         }else if (signRule2){
             List<String> locNos = locDetlService.getSameDetlToday(matnr, sRow, eRow);
+            int nearbay = 0;
+            int nearlev = 0;
             for (String locNo : locNos) {
-                if (Utils.isShallowLoc(slaveProperties, locNo)) {
+                int curRowW = curRow;    //鐩镐技宸ヤ綔妗f 鏈�娣卞簱浣嶆帓
+                int nearRowW = nearRow;    //鐩镐技宸ヤ綔妗f 鏈�娴呭簱浣嶆帓
+                if (Cools.isEmpty(locNo)){
                     continue;
                 }
-                String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo);
-                // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣�
-                LocMast shallowLoc = locMastService.selectById(shallowLocNo);
-                if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
-                    if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) {
-                        if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
-                            locMast = shallowLoc;
-                            crnNo = locMast.getCrnNo();
-                            break;
-                        }
+                if (Utils.getRow(locNo)==nearRow){
+                    continue;
+                }
+                if (Utils.getBay(locNo)==nearbay && Utils.getLev(locNo)==nearlev){
+                    continue;
+                }else {
+                    nearbay=Utils.getBay(locNo);
+                    nearlev=Utils.getLev(locNo);
+                }
+//                List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow);
+                LocMast locMastGro = locMastService.selectById(locNo);
+
+                for (int i = 0; i < crnNumber*2; i++) {
+                    if (!(Utils.getRow(locMastGro.getLocNo())>nearRowW && Utils.getRow(locMastGro.getLocNo())<=curRowW) && !(Utils.getRow(locMastGro.getLocNo())<nearRowW && Utils.getRow(locMastGro.getLocNo())>=curRowW) ){
+                        int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber);
+                        curRowW = locNecessaryParameters[1];
+                        nearRowW = locNecessaryParameters[3];
+                    }else {
+                        break;
                     }
                 }
-            }
-        }
 
-        // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭  //鍒嗙鐗�
-        if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(rowLastno)) {
-            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O"));
-            for (LocMast locMast1:locMasts){
-                //鑾峰彇宸烽亾
-//                List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow);
-                //鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娴呴潪绌哄簱浣�
-                LocMast locMastF = locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
-                if (!Cools.isEmpty(locMastF) && locMastF.getLocSts().equals("D")){
-                    //鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娴呴潪绌哄簱浣�
-                    locMast = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
+                LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW,nearRowW,locMastGro,rowLastnoType.getType().longValue());
+
+                if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo())!=nearRowW && locMast2.getLocSts().equals("S")){
+                    int row2=0;
+                    if (Utils.getRow(locMast2.getLocNo())>nearRowW){
+                        row2=Utils.getRow(locMast2.getLocNo())-1;
+                    }else {
+                        row2=Utils.getRow(locMast2.getLocNo())+1;
+                    }
+                    String targetLocNo = zerofill(String.valueOf(row2), 2) + locMast2.getLocNo().substring(2);
+                    locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",targetLocNo).eq("loc_sts","O"));
+                    if (Cools.isEmpty(locMast)){
+                        continue;
+                    }
                     break;
                 }
             }
         }
 
-//        // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭 //浜掗�氱増
-//        if (staDescId == 10  && Utils.BooleanWhsTypeStaIoType(whsType)) {
-//            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow));
-//            if (locMasts.size() > 0) {
-//                for (LocMast loc : locMasts) {
-//                    if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
-//                        continue;
-//                    }
-//                    String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo());
-//                    // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣�
-//                    LocMast shallowLoc = locMastService.selectById(shallowLocNo);
-//                    if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
-//                        if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) {
-//                            if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
-//                                locMast = shallowLoc;
-//                                crnNo = locMast.getCrnNo();
-//                                break;
-//                            }
-//                        }
-//                    }
+//        // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭  //鍒嗙鐗�
+//        if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(rowLastno)) {
+//            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O"));
+//            for (LocMast locMast1:locMasts){
+//                //鑾峰彇宸烽亾
+////                List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow);
+//                //鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娴呴潪绌哄簱浣�
+//                LocMast locMastF = locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
+//                if (!Cools.isEmpty(locMastF) && locMastF.getLocSts().equals("D")){
+//                    //鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娴呴潪绌哄簱浣�
+//                    locMast = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
+//                    break;
 //                }
 //            }
 //        }
+
+        // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭 //浜掗�氱増
+        if (staDescId == 10  && Utils.BooleanWhsTypeStaIoType(rowLastno)) {
+            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow));
+            int nearbay = 0;
+            int nearlev = 0;
+            for (LocMast locMastSign:locMasts){
+                int curRowW = curRow;    //鐩镐技宸ヤ綔妗f 鏈�娣卞簱浣嶆帓
+                int nearRowW = nearRow;    //鐩镐技宸ヤ綔妗f 鏈�娴呭簱浣嶆帓
+                if (Cools.isEmpty(locMastSign.getLocNo())){
+                    continue;
+                }
+                if (Utils.getRow(locMastSign.getLocNo())==nearRow){
+                    continue;
+                }
+                if (Utils.getBay(locMastSign.getLocNo())==nearbay && Utils.getLev(locMastSign.getLocNo())==nearlev){
+                    continue;
+                }else {
+                    nearbay=Utils.getBay(locMastSign.getLocNo());
+                    nearlev=Utils.getLev(locMastSign.getLocNo());
+                }
+//                List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow);
+                LocMast locMastGro = locMastService.selectById(locMastSign.getLocNo());
+
+                for (int i = 0; i < crnNumber*2; i++) {
+                    if (!(Utils.getRow(locMastGro.getLocNo())>nearRowW && Utils.getRow(locMastGro.getLocNo())<=curRowW) && !(Utils.getRow(locMastGro.getLocNo())<nearRowW && Utils.getRow(locMastGro.getLocNo())>=curRowW) ){
+                        int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber);
+                        curRowW = locNecessaryParameters[1];
+                        nearRowW = locNecessaryParameters[3];
+                    }else {
+                        break;
+                    }
+                }
+
+                LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW,nearRowW,locMastGro,rowLastnoType.getType().longValue());
+
+                if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo())!=nearRowW && locMast2.getLocSts().equals("S")){
+                    int row2=0;
+                    if (Utils.getRow(locMast2.getLocNo())>nearRowW){
+                        row2=Utils.getRow(locMast2.getLocNo())-1;
+                    }else {
+                        row2=Utils.getRow(locMast2.getLocNo())+1;
+                    }
+                    String targetLocNo = zerofill(String.valueOf(row2), 2) + locMast2.getLocNo().substring(2);
+                    locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",targetLocNo).eq("loc_sts","O"));
+                    if (Cools.isEmpty(locMast)){
+                        continue;
+                    }
+                    break;
+                }
+            }
+        }
 
         Wrapper<StaDesc> wrapper = null;
         StaDesc staDesc = null;
@@ -754,14 +888,12 @@
                     .eq("crn_no", crnNo);
             staDesc = staDescService.selectOne(wrapper);
             if (Cools.isEmpty(staDesc)) {
-                log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo);
-//                throw new CoolException("鍏ュ簱璺緞涓嶅瓨鍦�");
+                log.error("鍏ュ簱璺緞涓嶅瓨鍦�:type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo);
                 crnNo = 0;
             }else {
                 staNo = basDevpService.selectById(staDesc.getCrnStn());
                 if (!staNo.getAutoing().equals("Y")) {
                     log.error("鐩爣绔�"+staDesc.getCrnStn()+"涓嶅彲鐢�");
-//                throw new CoolException("鐩爣绔�"+staDesc.getCrnStn()+"涓嶅彲鐢�");
                     crnNo = 0;
                 }
                 startupDto.setStaNo(staNo.getDevNo());
@@ -787,9 +919,6 @@
                     continue;
                 }
                 if (Utils.BooleanWhsTypeStaIoType(rowLastno)){
-//                    String shallowLoc = Utils.getDeepLocYTl(slaveProperties, locMast1.getLocNo());
-//                    LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
-//                            .eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue()));
                     //鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娣辩┖搴撲綅
                     LocMast locMast2 = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue());
                     if (!Cools.isEmpty(locMast2) && locMast2.getBay1()==curRow) {
@@ -830,21 +959,6 @@
                     }
                 }
             }
-
-//            //鏈壘鍒�  鎵剧涓�鎺�
-//            if (Cools.isEmpty(locMast) && Utils.BooleanWhsTypeStaIoType(rowLastno)){
-//                locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
-//                        .eq("row1", 1)
-//                        .eq("loc_sts", "O")
-//                        .orderBy("lev1",true).orderBy("bay1",true));
-//                for (LocMast locMast1 : locMasts) {
-//                    if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
-//                        continue;
-//                    }
-//                    locMast = locMast1;
-//                    break;
-//                }
-//            }
         }
 
         // 閫掑綊鏌ヨ
@@ -854,12 +968,6 @@
                 times = times + 1;
                 return getLocNoRun4(whsType, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo, locTypeDto, times);
             }
-//            // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
-//            if (locTypeDto.getLocType1() < 2) {
-//                int i = locTypeDto.getLocType1() + 1;
-//                locTypeDto.setLocType1((short)i);
-//                return getLocNo(1, staDescId, sourceStaNo, matnr,batch,grade, locTypeDto, 0);
-//            }
             log.error("绯荤粺娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times);
             throw new CoolException("娌℃湁绌哄簱浣�");
         }
@@ -913,21 +1021,11 @@
         }
 
         //姝ょ▼搴忕敤浜庝紭鍖栧爢鍨涙満寮傚父鏃剁殑杩愯鏃堕棿
-        for (int i = times; i < crnNumber*2; i++) {
-            int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber);
-            curRow = locNecessaryParameters[1];
-            crnNo = locNecessaryParameters[2];
-            if (basCrnpService.checkSiteError(crnNo, true)) {
-                rowCount =  locNecessaryParameters[0];
-                nearRow = locNecessaryParameters[3];
-                break;
-            } else {
-                times++;
-            }
-        }
-        if (crnNo == 0) {
-            throw new CoolException("鏃犲彲鐢ㄥ簱浣�");
-        }
+        int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber);
+        curRow = locNecessaryParameters[1];
+        crnNo = locNecessaryParameters[2];
+        rowCount =  locNecessaryParameters[0];
+        nearRow = locNecessaryParameters[3];
 
         Wrapper<StaDesc> wrapper = null;
         StaDesc staDesc = null;

--
Gitblit v1.9.1