From 61a93ca962a62f56e378e16fbc2842a3210fd0b5 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期日, 08 六月 2025 08:06:12 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/utils/Utils.java |   62 ++++++++++--------------------
 1 files changed, 21 insertions(+), 41 deletions(-)

diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java
index fa440ef..e82cac2 100644
--- a/src/main/java/com/zy/asrs/utils/Utils.java
+++ b/src/main/java/com/zy/asrs/utils/Utils.java
@@ -87,14 +87,11 @@
      */
     public static String getShallowLoc(SlaveProperties slaveProperties, String deepLoc) {
         int row = getRow(deepLoc);
-        int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
-        int shallowRow = remainder == 1 ? (row + 1) : (row - 1);
-        if(row==9 ||  row==15 ){
-            shallowRow = row + 1;
-        }else if(row==12 ||  row==18 ){
-            shallowRow = row - 1;
+        int shallowRow = row;
+        if (slaveProperties.getDoubleLocsLeft().contains(row)) {
+            shallowRow = (row + 1);
         }else {
-            return null;
+            shallowRow = (row - 1);
         }
         return zerofill(String.valueOf(shallowRow), 2) + deepLoc.substring(2);
     }
@@ -103,8 +100,13 @@
      * 鑾峰彇 娣卞簱浣嶆帓瀵瑰簲鐨勬祬搴撲綅鎺�
      */
     public static Integer getShallowRow(SlaveProperties slaveProperties, Integer deepRow) {
-        int remainder = (int) Arith.remainder(deepRow, slaveProperties.getGroupCount());
-        return remainder == 1 ? (deepRow + 1) : (deepRow - 1);
+        int shallowRow = deepRow;
+        if (slaveProperties.getDoubleLocsLeft().contains(deepRow)) {
+            shallowRow = (deepRow + 1);
+        }else {
+            shallowRow = (deepRow - 1);
+        }
+        return shallowRow;
     }
 
     /**
@@ -112,31 +114,12 @@
      */
     public static String getDeepLoc(SlaveProperties slaveProperties, String shallowLoc) {
         int row = getRow(shallowLoc);
-//        int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
-        int targetRow;
-        switch (row){
-            case 10:
-                targetRow = 9;
-                break;
-            case 11:
-                targetRow = 12;
-                break;
-            case 16:
-                targetRow = 15;
-                break;
-            case 17:
-                targetRow = 18;
-                break;
-            default:
-                throw new RuntimeException(shallowLoc + "涓嶆槸娴呭簱浣嶏紝绯荤粺绻佸繖");
+        int targetRow = row;
+        if (slaveProperties.getShallowLocsLeft().contains(row)) {
+            targetRow = (row - 1);
+        } else if (slaveProperties.getShallowLocsRight().contains(row)) {
+            targetRow = (row + 1);
         }
-//        if (remainder == 2) {
-//            targetRow = row - 1;
-//        } else if (remainder == 3) {
-//            targetRow = row + 1;
-//        } else {
-//            throw new RuntimeException(shallowLoc + "涓嶆槸娴呭簱浣嶏紝绯荤粺绻佸繖");
-//        }
         return zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2);
     }
 
@@ -144,14 +127,11 @@
      * 鑾峰彇 娴呭簱浣嶆帓瀵瑰簲鐨勬繁搴撲綅鎺�
      */
     public static Integer getDeepRow(SlaveProperties slaveProperties, Integer shallowRow) {
-        int remainder = (int) Arith.remainder(shallowRow, slaveProperties.getGroupCount());
-        int targetRow;
-        if (remainder == 2) {
-            targetRow = shallowRow - 1;
-        } else if (remainder == 3) {
-            targetRow = shallowRow + 1;
-        } else {
-            throw new RuntimeException(shallowRow + "涓嶆槸娴呭簱浣嶆帓锛岀郴缁熺箒蹇�");
+        int targetRow = shallowRow;
+        if (slaveProperties.getShallowLocsLeft().contains(shallowRow)) {
+            targetRow = (shallowRow - 1);
+        } else if (slaveProperties.getShallowLocsRight().contains(shallowRow)) {
+            targetRow = (shallowRow + 1);
         }
         return targetRow;
     }

--
Gitblit v1.9.1