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/model/Shelves.java         |   21 ++++------
 src/main/java/com/zy/common/service/CommonService.java |   43 +++++++--------------
 2 files changed, 24 insertions(+), 40 deletions(-)

diff --git a/src/main/java/com/zy/common/model/Shelves.java b/src/main/java/com/zy/common/model/Shelves.java
index b759351..d88945c 100644
--- a/src/main/java/com/zy/common/model/Shelves.java
+++ b/src/main/java/com/zy/common/model/Shelves.java
@@ -1,7 +1,6 @@
 package com.zy.common.model;
 
 import com.alibaba.fastjson.JSON;
-import com.core.common.Arith;
 import com.core.exception.CoolException;
 
 import java.util.ArrayList;
@@ -111,18 +110,16 @@
     }
 
     public static void main(String[] args) throws InterruptedException {
-
-        double remainder = Arith.divides(1,16 - 1, 16);
-        System.out.println(remainder);
-        System.out.println((int) remainder);
-//        Shelves shelves = new Shelves(8,2);
-//        System.out.println(shelves.nodes.toString());
-//        int start = 1;
-//        while (true) {
+        Shelves shelves = new Shelves(2,2);
+        System.out.println(shelves.nodes.toString());
+        int start = 1;
+        while (true) {
 //            System.out.println(start);
-//            start = shelves.start(start);
-//            Thread.sleep(500L);
-//        }
+            start = shelves.start(start);
+            Integer crnNo1 = shelves.get(start);
+            System.out.println(crnNo1);
+            Thread.sleep(500L);
+        }
     }
 
 }
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