Browse Source

充电机新指令维护

zhangxin 1 year ago
parent
commit
3d1d819ca1

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/AciService.java

@@ -111,9 +111,9 @@ public class AciService {
                 taskBean.setAciAccept(0);
                 taskBean.setBusinessType(Constant.TASK_BUSINESS_TYPE.TASK_POWER.getValue());
                 taskBean = amsTaskService.selectAmsTaskByModel(taskBean);
-                s = "87CD0008000C00010071000663010001%04X";
+//                s = "87CD0008000C00010071000663010001%04X";
                 if (taskBean != null) {
-
+                    s = Constant.AGV_POWER_CMD.getValueByCode(taskBean.getDeviceName());
                     s = String.format(s, Integer.parseInt(taskBean.getDeviceName()));
                     buffer.put(ByteUtil.hexString2ByteArray(s));
                     buffer.flip();

+ 43 - 0
warewms-base/src/main/java/com/ruoyi/base/constant/Constant.java

@@ -99,6 +99,49 @@ public class Constant {
         }
     }
 
+    public static void main(String[] args) {
+        System.out.println(AGV_POWER_CMD.getValueByCode("1"));
+    }
+
+    public enum AGV_POWER_CMD{
+        /***
+         * 一号堆垛车车号以及充电指令
+         */
+        First("1", "87CD0008000C00010071000663010001%04X"),
+
+        /***
+         * 二号堆垛车车号以及充电指令
+         */
+        second("2", "87CD000800080001007100046301%04X");
+
+        private String code;
+
+        private String value;
+
+        AGV_POWER_CMD(String code, String value) {
+            this.code = code;
+            this.value = value;
+
+        }
+
+        public String getCode() {
+            return code;
+        }
+
+        public String getValue() {
+            return value;
+        }
+
+        public static String getValueByCode(String code) {
+            for (AGV_POWER_CMD agvPowerCmd : values()) {
+                if (agvPowerCmd.getCode().equals(code)) {
+                    return agvPowerCmd.value;
+                }
+            }
+            return null;
+        }
+
+    }
 
     /**
      * 产线编号