From e8b1c6a2bda0d156fae26c4b365d2e3b90e10016 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期二, 25 十月 2022 14:57:28 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |    4 
 src/main/java/com/zy/core/enums/SteTaskModeType.java        |  221 ++++++------------------------------------------------
 2 files changed, 29 insertions(+), 196 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 275afd2..12e7d0a 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -1350,7 +1350,7 @@
         SteCommand steCommand = new SteCommand();
         steCommand.setSteNo(steNo); // 绌挎杞︾紪鍙�
         steCommand.setTaskNo(wrkCharge.getWrkNo()); // 宸ヤ綔鍙�
-        steCommand.setTaskMode(SteTaskModeType.findOriginByLoc(steProtocol.getRow())); // 浠诲姟妯″紡:  鍘昏繎鐐� 绛夊緟鍫嗗灈鏈哄弶鍙�
+        steCommand.setTaskMode(SteTaskModeType.findOriginByLoc(steProtocol.getRow().intValue())); // 浠诲姟妯″紡:  鍘昏繎鐐� 绛夊緟鍫嗗灈鏈哄弶鍙�
 
         steCommand.setRow(Utils.getGroupRow(steProtocol.getRow().intValue()).shortValue());
         steCommand.setBay(steProtocol.getBay());
@@ -2809,7 +2809,7 @@
                 SteCommand steCommand = new SteCommand();
                 steCommand.setSteNo(steNo); // 绌挎杞︾紪鍙�
                 steCommand.setTaskNo(wrkCharge.getWrkNo()); // 宸ヤ綔鍙�
-                SteTaskModeType originByLoc = SteTaskModeType.findOriginByLoc(steProtocol.getRow());
+                SteTaskModeType originByLoc = SteTaskModeType.findOriginByLoc(steProtocol.getRow().intValue());
                 if (originByLoc.equals(SteTaskModeType.GO_ORIGIN)) {
                     originByLoc = SteTaskModeType.BACK_ORIGIN;
                 } else if (originByLoc.equals(SteTaskModeType.BACK_ORIGIN)) {
diff --git a/src/main/java/com/zy/core/enums/SteTaskModeType.java b/src/main/java/com/zy/core/enums/SteTaskModeType.java
index 980a032..ae2d958 100644
--- a/src/main/java/com/zy/core/enums/SteTaskModeType.java
+++ b/src/main/java/com/zy/core/enums/SteTaskModeType.java
@@ -82,213 +82,46 @@
 
     // -----------------------------------------------
 
+    // 鍘诲緟鎼偣
     public static SteTaskModeType findOriginByLoc(SteProtocol steProtocol) {
-        switch (steProtocol.getRow()) {
-            case 1:
-            case 2:
-            case 3:
-            case 8:
-            case 9:
-            case 10:
-            case 11:
-            case 15:
-            case 16:
-            case 17:
-            case 18:
-                return SteTaskModeType.GO_ORIGIN;
-            case 4:
-            case 5:
-            case 6:
-            case 7:
-            case 12:
-            case 13:
-            case 14:
-            case 19:
-            case 20:
-            case 21:
-                return SteTaskModeType.BACK_ORIGIN;
-            default:
-                throw new CoolException("瑙f瀽绌挎杞﹀師鐐瑰畾浣嶅け璐�");
+        int row = steProtocol.getRow().intValue();
+        if (Utils.FIRST_GROUP_ROW_LIST.contains(row)) {
+            return SteTaskModeType.BACK_ORIGIN;
+        } else if (Utils.SECOND_GROUP_ROW_LIST.contains(row)) {
+            return SteTaskModeType.GO_ORIGIN;
+        } else {
+            throw new CoolException("瑙f瀽绌挎杞﹀師鐐瑰畾浣嶅け璐�");
         }
     }
 
-    public static SteTaskModeType findOriginByLoc(Short row) {
-        switch (row) {
-            case 1:
-            case 2:
-            case 3:
-            case 8:
-            case 9:
-            case 10:
-            case 11:
-            case 15:
-            case 16:
-            case 17:
-            case 18:
-                return SteTaskModeType.GO_ORIGIN;
-            case 4:
-            case 5:
-            case 6:
-            case 7:
-            case 12:
-            case 13:
-            case 14:
-            case 19:
-            case 20:
-            case 21:
-                return SteTaskModeType.BACK_ORIGIN;
-            default:
-                throw new CoolException("瑙f瀽绌挎杞﹀師鐐瑰畾浣嶅け璐�");
+    public static SteTaskModeType findOriginByLoc(Integer row) {
+        if (Utils.FIRST_GROUP_ROW_LIST.contains(row)) {
+            return SteTaskModeType.BACK_ORIGIN;
+        } else if (Utils.SECOND_GROUP_ROW_LIST.contains(row)) {
+            return SteTaskModeType.GO_ORIGIN;
+        } else {
+            throw new CoolException("瑙f瀽绌挎杞﹀師鐐瑰畾浣嶅け璐�");
         }
     }
 
-    public static SteTaskModeType findInByLoc(SteProtocol steProtocol) {
-        switch (steProtocol.getRow()) {
-            case 1:
-            case 2:
-            case 3:
-            case 8:
-            case 9:
-            case 10:
-            case 11:
-            case 15:
-            case 16:
-            case 17:
-            case 18:
-                return SteTaskModeType.IN_LEFT;
-            case 4:
-            case 5:
-            case 6:
-            case 7:
-            case 12:
-            case 13:
-            case 14:
-            case 19:
-            case 20:
-            case 21:
-                return SteTaskModeType.IN_RIGHT;
-            default:
-                throw new CoolException("瑙f瀽绌挎杞﹀師鐐瑰畾浣嶅け璐�");
-        }
-    }
-
-    public static SteTaskModeType findOutByLoc(SteProtocol steProtocol) {
-        switch (steProtocol.getRow()) {
-            case 1:
-            case 2:
-            case 3:
-            case 8:
-            case 9:
-            case 10:
-            case 11:
-            case 15:
-            case 16:
-            case 17:
-            case 18:
-                return SteTaskModeType.OUT_LEFT;
-            case 4:
-            case 5:
-            case 6:
-            case 7:
-            case 12:
-            case 13:
-            case 14:
-            case 19:
-            case 20:
-            case 21:
-                return SteTaskModeType.OUT_RIGHT;
-            default:
-                throw new CoolException("瑙f瀽绌挎杞﹀師鐐瑰畾浣嶅け璐�");
-        }
-    }
 
     public static SteTaskModeType findWaiting(Integer row) {
-        switch (row) {
-            case 1:
-            case 2:
-            case 3:
-            case 8:
-            case 9:
-            case 10:
-            case 11:
-            case 15:
-            case 16:
-            case 17:
-            case 18:
-                return SteTaskModeType.WAITING_RIGHT;
-            case 4:
-            case 5:
-            case 6:
-            case 7:
-            case 12:
-            case 13:
-            case 14:
-            case 19:
-            case 20:
-            case 21:
-                return SteTaskModeType.WAITING_LEFT;
-            default:
-                throw new CoolException("瑙f瀽绌挎杞﹀師鐐瑰畾浣嶅け璐�");
+        if (Utils.FIRST_GROUP_ROW_LIST.contains(row)) {
+            return SteTaskModeType.WAITING_LEFT;
+        } else if (Utils.SECOND_GROUP_ROW_LIST.contains(row)) {
+            return SteTaskModeType.WAITING_RIGHT;
+        } else {
+            throw new CoolException("瑙f瀽绌挎杞﹀師鐐瑰畾浣嶅け璐�");
         }
     }
 
     public static SteTaskModeType findChargeByLoc(Integer row) {
-        switch (row) {
-            case 1:
-            case 2:
-            case 3:
-            case 8:
-            case 9:
-            case 10:
-            case 11:
-            case 15:
-            case 16:
-            case 17:
-            case 18:
-                return SteTaskModeType.CHARGE_LEFT;
-            case 4:
-            case 5:
-            case 6:
-            case 7:
-            case 12:
-            case 13:
-            case 14:
-            case 19:
-            case 20:
-            case 21:
-                return SteTaskModeType.CHARGE_RIGHT;
-            default:
-                throw new CoolException("瑙f瀽绌挎杞﹀師鐐瑰畾浣嶅け璐�");
-        }
-    }
-
-    public static SteTaskModeType findChargeByLocForCharge(Integer row) {
-        switch (row) {
-            case 1:
-            case 2:
-            case 3:
-            case 8:
-            case 9:
-            case 10:
-            case 11:
-            case 15:
-            case 16:
-            case 17:
-            case 18:
-                return SteTaskModeType.GO_ORIGIN;
-            case 4:
-            case 5:
-            case 6:
-            case 7:
-            case 12:
-            case 13:
-            case 14:
-            case 19:
-            case 20:
-            case 21:
-                return SteTaskModeType.BACK_ORIGIN;
-            default:
-                throw new CoolException("瑙f瀽绌挎杞﹀師鐐瑰畾浣嶅け璐�");
+        if (Utils.FIRST_GROUP_ROW_LIST.contains(row)) {
+            return SteTaskModeType.CHARGE_RIGHT;
+        } else if (Utils.SECOND_GROUP_ROW_LIST.contains(row)) {
+            return SteTaskModeType.CHARGE_LEFT;
+        } else {
+            throw new CoolException("瑙f瀽绌挎杞﹀師鐐瑰畾浣嶅け璐�");
         }
     }
 

--
Gitblit v1.9.1