From 84f5f360f07c523dfe2569f32d561b7aef4296a1 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期二, 16 八月 2022 14:30:48 +0800
Subject: [PATCH] #

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

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index a5c41cf..13522d1 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -10,6 +10,7 @@
 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;
@@ -161,32 +162,16 @@
 
         // 濡傛灉娌℃湁鐩歌繎鐗╂枡锛屽垯鎸夎鍒欒疆璇㈣揣鏋�
         if (null == locMast) {
-            int t = 0;
-            boolean execute = true;
-            int crnNo1;
-            while (execute && t < 4) {
-                t++;
-                switch (curRow) {
-                    case 3:
-                        curRow = 11;
-                        crnNo1 = 2;
-                        break;
-                    case 11:
-                        curRow = 4;
-                        crnNo1 = 1;
-                        break;
-                    case 4:
-                        curRow = 12;
-                        crnNo1 = 2;
-                        break;
-                    default:
-                        curRow = 3;
-                        crnNo1 = 1;
-                        break;
+            Shelves shelves = new Shelves(rowCount, crn_qty);
+            for (int i = 0; i < shelves.group; i ++) {
+                curRow = shelves.start(curRow);
+                if (curRow < 0) {
+                    throw new CoolException("妫�绱㈠簱浣嶅け璐ワ紝璇疯仈绯荤鐞嗗憳");
                 }
+                Integer crnNo1 = shelves.get(curRow);
                 if (basCrnpService.checkSiteError(crnNo1, true)) {
                     crnNo = crnNo1;
-                    execute = false;
+                    break;
                 }
             }
         }
@@ -232,12 +217,14 @@
             if (times < rowCount) {
                 times = times + 1;
                 return getLocNo(whsType, staDescId, sourceStaNo, matNos, locTypeDto, oldLocType, times);
+            } else {
+                times = 0;
             }
-//            // 璐х墿妫�绱綆搴撲綅浠撳け璐ワ紝鍏煎楂樺簱浣嶄粨鍚庣户缁墽琛�
-//            if (locTypeDto.getLocType1() == 1) {
-//                locTypeDto.setLocType1((short) 2);
-//                return getLocNo(1, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
-//            }
+            // 璐х墿妫�绱綆搴撲綅浠撳け璐ワ紝鍏煎楂樺簱浣嶄粨鍚庣户缁墽琛�
+            if (locTypeDto.getLocType1() == 1) {
+                locTypeDto.setLocType1((short) 2);
+                return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, oldLocType, times);
+            }
             log.error("绯荤粺娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times);
             throw new CoolException("娌℃湁绌哄簱浣�");
         }

--
Gitblit v1.9.1