Browse Source

对接TS70消息,并修改切换导航触发时间

zhifei 1 year ago
parent
commit
51ce016015

+ 19 - 11
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java

@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 
 /**
  * 启动程序
- * 
+ *
  * @author ruoyi
  */
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@@ -16,15 +16,23 @@ public class RuoYiApplication
     {
         // System.setProperty("spring.devtools.restart.enabled", "false");
         SpringApplication.run(RuoYiApplication.class, args);
-        System.out.println("(♥◠‿◠)ノ゙  若依启动成功   ლ(´ڡ`ლ)゙  \n" +
-                " .-------.       ____     __        \n" +
-                " |  _ _   \\      \\   \\   /  /    \n" +
-                " | ( ' )  |       \\  _. /  '       \n" +
-                " |(_ o _) /        _( )_ .'         \n" +
-                " | (_,_).' __  ___(_ o _)'          \n" +
-                " |  |\\ \\  |  ||   |(_,_)'         \n" +
-                " |  | \\ `'   /|   `-'  /           \n" +
-                " |  |  \\    /  \\      /           \n" +
-                " ''-'   `'-'    `-..-'              ");
+        System.out.println("(♥◠‿◠)ノ゙  启动成功   ლ(´ڡ`ლ)゙  \n" +
+        "\n" +
+                "                                                                                     \n" +
+                "                                                                                     \n" +
+                "                                                                  ____               \n" +
+                "                                                                ,'  , `.             \n" +
+                "         .---.             __  ,-.                 .---.     ,-+-,.' _ |             \n" +
+                "        /. ./|           ,' ,'/ /|                /. ./|  ,-+-. ;   , ||  .--.--.    \n" +
+                "     .-'-. ' |  ,--.--.  '  | |' | ,---.       .-'-. ' | ,--.'|'   |  || /  /    '   \n" +
+                "    /___/ \\: | /       \\ |  |   ,'/     \\     /___/ \\: ||   |  ,', |  |,|  :  /`./   \n" +
+                " .-'.. '   ' ..--.  .-. |'  :  / /    /  | .-'.. '   ' .|   | /  | |--' |  :  ;_     \n" +
+                "/___/ \\:     ' \\__\\/: . .|  | ' .    ' / |/___/ \\:     '|   : |  | ,     \\  \\    `.  \n" +
+                ".   \\  ' .\\    ,\" .--.; |;  : | '   ;   /|.   \\  ' .\\   |   : |  |/       `----.   \\ \n" +
+                " \\   \\   ' \\ |/  /  ,.  ||  , ; '   |  / | \\   \\   ' \\ ||   | |`-'       /  /`--'  / \n" +
+                "  \\   \\  |--\";  :   .'   \\---'  |   :    |  \\   \\  |--\" |   ;/          '--'.     /  \n" +
+                "   \\   \\ |   |  ,     .-./       \\   \\  /    \\   \\ |    '---'             `--'---'   \n" +
+                "    '---\"     `--`---'            `----'      '---\"                                  \n" +
+                "                                                                                     \n");
     }
 }

+ 11 - 1
ruoyi-admin/src/main/resources/application-prod.yml

@@ -6,7 +6,7 @@ spring:
         druid:
             # 主库数据源
             master:
-                url: jdbc:mysql://localhost:3306/warewms-tianao?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
+                url: jdbc:mysql://192.168.62.51:3306/warewms-tianao?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
                 username: warewms
                 password: warewms123
             # 从库数据源
@@ -77,3 +77,13 @@ modbus:
             open: false
             host: 192.168.42.209
             port: 8899
+
+# plc连接配置
+plc:
+    plcList[0]:
+        ip: 192.168.60.151
+        enable: true
+        name: conveyorBeltsPlc
+        ePlcType: S1200
+        heartbeat: DB1054.0.0
+        confirmTheStatus: DB1055.0.0

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

@@ -220,7 +220,7 @@ public class AciService {
                 }
 
             } catch (IOException i) {
-                log.error("NDC通讯异常!,msg:{}", i);
+                log.error("NDC通讯异常!,msg: ", i);
                 try {
                     socketChannel.close();
                 } catch (Exception exception) {

+ 5 - 6
warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/service/impl/SocketBufferServiceImpl.java

@@ -181,7 +181,7 @@ public class SocketBufferServiceImpl implements SocketBufferService {
                         try {
                             statusUpdateService.updateStatus(task, Integer.parseInt(agvNo));
                         } catch (InterruptedException e) {
-                            log.error("An exception occurred in the task update,msg,{}",e.getMessage());
+                            log.error("An exception occurred in the task update,msg:",e);
                         }
                     });
                     break;
@@ -218,7 +218,7 @@ public class SocketBufferServiceImpl implements SocketBufferService {
                             try {
                                 statusUpdateService.updateStatus(task02,Integer.parseInt( agvNo));
                             } catch (InterruptedException e) {
-                                log.error("An exception occurred in the task update,msg,{}",e.getMessage());
+                                log.error("An exception occurred in the task update,msg:",e);
                             }
                         });
                     }
@@ -246,7 +246,7 @@ public class SocketBufferServiceImpl implements SocketBufferService {
                             try {
                                 statusUpdateService.confirmAnalysis(task60.getTaskNo(), aciIndex, UNLOAD.getValue(), icarNo);
                             } catch (InterruptedException e) {
-                                throw new RuntimeException(e);
+                                log.error("卸货确认发生异常,msg:",e);
                             }
                         });
                     }
@@ -269,7 +269,7 @@ public class SocketBufferServiceImpl implements SocketBufferService {
                             try {
                                 statusUpdateService.confirmAnalysis(task60Pick.getTaskNo(), aciIndexPick, PICKUP.getValue(), icarNo);
                             } catch (InterruptedException e) {
-                                throw new RuntimeException(e);
+                                log.error("取货确认发生异常,msg:",e);
                             }
                         });
                     }
@@ -286,7 +286,7 @@ public class SocketBufferServiceImpl implements SocketBufferService {
                         }
                         // TODO 车辆暂停上报
                     } catch (Exception e) {
-                        log.error("车辆暂停反馈错误", e);
+                        log.error("车辆暂停反馈错误,msg:", e);
                     }
                     break;
                 case 123:
@@ -421,7 +421,6 @@ public class SocketBufferServiceImpl implements SocketBufferService {
         }
     }
 
-
     @Override
     public void handleMsgOrderAck(byte[] parameters) {
         AmsTask taskBean = new AmsTask();

+ 28 - 21
warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/service/impl/StatusUpdateServiceImpl.java

@@ -97,16 +97,6 @@ public class StatusUpdateServiceImpl implements StatusUpdateService {
                 WcsTask wcsTask = wcsTaskMapper.selectWcsTaskByTaskNo(amsTask.getTaskNo());
                 switch (amsTask.getEvent().intValue()) {
                     case 86:
-                        result.setState(1);
-                        break;
-                    case 90:
-                        if (ObjectUtil.isNotNull(redisCache.getCacheObject(wcsTask.getTaskNo()+"cancel")) ||wcsTask.getState() == 7) {
-                            log.info("任务已取消!");
-                            return;
-                        }
-                        result.setState(2);
-                        break;
-                    case 204:
                         //切换导航
                         threadPoolTaskExecutor.execute(() -> {
                             try {
@@ -118,6 +108,16 @@ public class StatusUpdateServiceImpl implements StatusUpdateService {
                             }
 
                         });
+                        result.setState(1);
+                        break;
+                    case 90:
+                        if (ObjectUtil.isNotNull(redisCache.getCacheObject(wcsTask.getTaskNo()+"cancel")) ||wcsTask.getState() == 7) {
+                            log.info("任务已取消!");
+                            return;
+                        }
+                        result.setState(2);
+                        break;
+                    case 204:
                         result.setState(3);
                         break;
                     case 91:
@@ -263,17 +263,24 @@ public class StatusUpdateServiceImpl implements StatusUpdateService {
         AmsTask amsTask = new AmsTask();
         amsTask = amsTaskService.selectAmsTaskByModel(amsTask);
         if (amsTask != null) {
-            AmsTask addTaskForm = new AmsTask();
-            addTaskForm.setTaskNo(System.currentTimeMillis() + "");
-            addTaskForm.setBusinessType(Constant.TASK_BUSINESS_TYPE.TASK_50.getValue());
-            addTaskForm.setStFrom(998);
-            addTaskForm.setStTo(999);
-            addTaskForm.setPriority(1);
-            addTaskForm.setExt1(carNo.toString());
-            addTaskForm.setExt2(i);
-            addTaskForm.setExt3(ikey.toString());
-            addTaskForm.setIkey((long) BusinessServiceImpl.geniKey(addTaskForm.getTaskNo()));
-            amsTaskService.insertAmsTask(addTaskForm);
+            for (int j = 3; j < 6; j++) {
+                AmsTask addTaskForm = new AmsTask();
+                addTaskForm.setTaskNo(System.currentTimeMillis() + "");
+                addTaskForm.setBusinessType(Constant.TASK_BUSINESS_TYPE.TASK_70.getValue());
+                addTaskForm.setStFrom(998);
+                addTaskForm.setStTo(999);
+                addTaskForm.setPriority(1);
+                addTaskForm.setExt1(String.valueOf(j));
+                addTaskForm.setExt2(i);
+                addTaskForm.setExt3(ikey.toString());
+                addTaskForm.setIkey((long) BusinessServiceImpl.geniKey(addTaskForm.getTaskNo()));
+                amsTaskService.insertAmsTask(addTaskForm);
+                try {
+                    Thread.sleep(500L);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+            }
         }
     }
 

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

@@ -403,9 +403,9 @@ public class Constant {
          */
         TASK_m("m"),
         /**
-         * 50
+         * 切换导航
          */
-        TASK_50("50"),
+        TASK_70("70"),
         /**
          * 暂停
          */

+ 2 - 2
warewms-base/src/main/java/com/ruoyi/base/service/impl/CarInfoServiceImpl.java

@@ -143,10 +143,10 @@ public class CarInfoServiceImpl implements ICarInfoService {
         if ("status".equals(carInfo.getUpdateType())) {
             if (!carInfo.getUserdefine4().equals(baseDate.getUserdefine4())) {
                 baseDate.setUserdefine4(carInfo.getUserdefine4());
-                if ("state off".equals(carInfo.getUserdefine4())) {
+                if ("state_off".equals(carInfo.getUserdefine4())) {
                     redisCache.setCacheObject("carStatusHistory:" + carInfo.getCarno(), baseDate.getUserdefine4());
                 }
-                if ("state off".equals(baseDate.getUserdefine4())) {
+                if ("state_off".equals(baseDate.getUserdefine4())) {
                     String status = redisCache.getCacheObject("carStatusHistory:" + carInfo.getCarno()).toString();
                     if (StringUtils.isNotEmpty(status)) {
                         baseDate.setUserdefine4(status);