Selaa lähdekoodia

修改ts信号对接

k 2 vuotta sitten
vanhempi
commit
263c9ddf92

+ 8 - 0
warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/service/IAmsTaskService.java

@@ -35,6 +35,14 @@ public interface IAmsTaskService {
      */
     AmsTask selectAmsTaskByModel(AmsTask amsTask);
 
+    /**
+     * 根据index号查询
+     *
+     * @param aciIndex
+     * @return
+     */
+    AmsTask selectAmsTaskByModel(Integer aciIndex);
+
     /**
      * 新增ams任务列表
      *

+ 12 - 0
warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/service/StatusUpdateService.java

@@ -25,6 +25,18 @@ public interface StatusUpdateService {
      */
     void confirmAnalysis(String taskNo, Integer aciIndex, String type, Integer carNo);
 
+    /**
+     * 取卸货确认分析
+     *
+     * @param taskNo
+     * @param aciIndex
+     * @param carNo
+     * @param updateLocation
+     * @param updateValue
+     */
+    void confirmAnalysis(String taskNo, Integer aciIndex, Integer carNo
+            , String updateLocation, String updateValue);
+
 
     /**
      * 回告ts门已经打开

+ 15 - 8
warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/service/impl/AmsTaskServiceImpl.java

@@ -9,19 +9,19 @@ import com.ruoyi.ams.agv.ndc.service.IAmsTaskService;
 
 /**
  * ams任务列表Service业务层处理
- * 
+ *
  * @author andy
  * @date 2022-08-08
  */
 @Service
-public class AmsTaskServiceImpl implements IAmsTaskService 
+public class AmsTaskServiceImpl implements IAmsTaskService
 {
     @Autowired
     private AmsTaskMapper amsTaskMapper;
 
     /**
      * 查询ams任务列表
-     * 
+     *
      * @param id ams任务列表主键
      * @return ams任务列表
      */
@@ -33,7 +33,7 @@ public class AmsTaskServiceImpl implements IAmsTaskService
 
     /**
      * 查询ams任务列表列表
-     * 
+     *
      * @param amsTask ams任务列表
      * @return ams任务列表
      */
@@ -60,9 +60,16 @@ public class AmsTaskServiceImpl implements IAmsTaskService
         }
     }
 
+    @Override
+    public AmsTask selectAmsTaskByModel(Integer aciIndex) {
+        AmsTask amsTaskQuery = new AmsTask();
+        amsTaskQuery.setAciIndex(aciIndex);
+        return this.selectAmsTaskByModel(amsTaskQuery);
+    }
+
     /**
      * 新增ams任务列表
-     * 
+     *
      * @param amsTask ams任务列表
      * @return 结果
      */
@@ -74,7 +81,7 @@ public class AmsTaskServiceImpl implements IAmsTaskService
 
     /**
      * 修改ams任务列表
-     * 
+     *
      * @param amsTask ams任务列表
      * @return 结果
      */
@@ -86,7 +93,7 @@ public class AmsTaskServiceImpl implements IAmsTaskService
 
     /**
      * 批量删除ams任务列表
-     * 
+     *
      * @param ids 需要删除的ams任务列表主键
      * @return 结果
      */
@@ -98,7 +105,7 @@ public class AmsTaskServiceImpl implements IAmsTaskService
 
     /**
      * 删除ams任务列表信息
-     * 
+     *
      * @param id ams任务列表主键
      * @return 结果
      */

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

@@ -170,7 +170,7 @@ public class SocketBufferServiceImpl implements SocketBufferService {
                 case 90://user event Order Complete             任务完成
                 case 91://user event Loaded                     取货完成
                 case 92://user event Delivered                  卸货完成
-                case 93://user event Redirect message for FETCH
+//                case 93://user event Redirect message for FETCH
                 case 94://user event Redirect message for DELIVER
                 case 113://user event Fetch Empty
                     log.info("----event:" + eventId + ":" + JSON.toJSONString(event));
@@ -249,29 +249,40 @@ public class SocketBufferServiceImpl implements SocketBufferService {
                         log.error("车辆暂停反馈错误", e);
                     }
                     break;
-                case 123:
-                    //空托盘堆叠层数申请
-                    log.info("空托盘堆叠层数申请");
-                    Integer index130 = Integer.parseInt(event.getLp1());
-                    AmsTask task130 = new AmsTask();
-                    task130.setAciIndex(index130);
-                    task130 = amsTaskService.selectAmsTaskByModel(task130);
-                    if (task130 != null) {
-                        // agvUnloadingConfirmService.confirmEmptyPlate(task130.getTaskNo());
+                case 93:// 544
+                    log.info("申请空托!" + "-" + JSON.toJSONString(event));
+                    Integer index93 = Integer.parseInt(event.getLp1());
+                    AmsTask task93 = amsTaskService.selectAmsTaskByModel(index93);
+                    if (task93 != null) {
+                        executorService.execute(() -> {
+                            statusUpdateService.confirmAnalysis(task93.getTaskNo(), index93, icarNo
+                                    , "09", "0001");
+                        });
+                    }
+                    break;
+                case 123: // 594
+                    log.info("申请称重机!" + "-" + JSON.toJSONString(event));
+                    Integer index123 = Integer.parseInt(event.getLp1());
+                    AmsTask task123 = amsTaskService.selectAmsTaskByModel(index123);
+                    if (task123 != null) {
+                        executorService.execute(() -> {
+                            statusUpdateService.confirmAnalysis(task123.getTaskNo(), index123, icarNo
+                                    , "10", "0001");
+                        });
                     }
                     break;
-                case 126: //600 中间卷帘门请求开启 定时请求
+                case 126: //547 中间卷帘门请求开启 定时请求
                     log.info("快速门-请求开启!" + "-" + JSON.toJSONString(event));
-                    String lp3_126 = event.getLp3();
+                    String lp1_126 = event.getLp1();
                     executorService.execute(() -> {
-                        statusUpdateService.openDoor(Integer.valueOf(lp3_126));
+                        statusUpdateService.openDoor(Integer.valueOf(lp1_126));
                     });
                     break;
-                case 127: //601 中间卷帘门请求关闭 只请求一次
+                case 127: //549 中间卷帘门请求关闭 只请求一次
                     log.info("快速门-请求关闭!" + "-" + JSON.toJSONString(event));
-                    String lp3_127 = event.getLp3();
+                    String lp1_127 = event.getLp1();
                     executorService.execute(() -> {
-                        statusUpdateService.closeDoor(Integer.valueOf(lp3_127));
+                        statusUpdateService.closeDoor(Integer.valueOf(lp1_127));
                     });
                     break;
                 case 134:

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

@@ -1,5 +1,6 @@
 package com.ruoyi.ams.agv.ndc.service.impl;
 
+import cn.hutool.core.thread.ThreadUtil;
 import com.ruoyi.ams.agv.ndc.domain.AmsTask;
 import com.ruoyi.ams.agv.ndc.entity.CallbackResult;
 import com.ruoyi.ams.agv.ndc.service.IAmsTaskService;
@@ -138,6 +139,41 @@ public class StatusUpdateServiceImpl implements StatusUpdateService {
         }
     }
 
+    @Override
+    public synchronized void confirmAnalysis(String taskNo, Integer aciIndex, Integer carNo
+            , String updateLocation, String updateValue) {
+        AmsTask amsTask = new AmsTask();
+        amsTask.setTaskNo(taskNo);
+        amsTask = amsTaskService.selectAmsTaskByModel(amsTask);
+        if (amsTask != null) {
+            AmsTask addTaskForm = new AmsTask();
+            addTaskForm.setTaskNo(System.currentTimeMillis() + "");
+            addTaskForm.setBusinessType(Constant.TASK_BUSINESS_TYPE.TASK_m.getValue());
+            addTaskForm.setExt1(amsTask.getAciIndex().toString());
+            addTaskForm.setStFrom(998);
+            addTaskForm.setStTo(999);
+            addTaskForm.setPriority(1);
+            addTaskForm.setRemark(taskNo);
+            addTaskForm.setExt2(updateLocation);
+            addTaskForm.setExt3(updateValue);
+            //如果ams_task已经有此任务的待接收m消息,则不生成新的m消息
+            AmsTask amsTaskQuery = new AmsTask();
+            amsTaskQuery.setAciAccept(0);
+            amsTaskQuery.setIsDelete(0);
+            amsTaskQuery.setRemark(taskNo);
+            amsTaskQuery.setBusinessType(Constant.TASK_BUSINESS_TYPE.TASK_m.getValue());
+            amsTaskQuery.setExt2(addTaskForm.getExt2());
+            amsTaskQuery.setExt2(addTaskForm.getExt3());
+            List<AmsTask> undoneList = amsTaskService.selectAmsTaskList(amsTaskQuery);
+            if (undoneList.size() > 0) {
+                return;
+            }
+            // todo 现场测试
+            ThreadUtil.sleep(5000);
+            amsTaskService.insertAmsTask(addTaskForm);
+        }
+    }
+
     @Override
     public void feedbackTS(Integer doorNo) {
         AmsTask addTaskForm = new AmsTask();
@@ -157,6 +193,7 @@ public class StatusUpdateServiceImpl implements StatusUpdateService {
         amsTaskQuery.setIsDelete(0);
         amsTaskQuery.setBusinessType(Constant.TASK_BUSINESS_TYPE.TASK_164.getValue());
         amsTaskQuery.setExt2(addTaskForm.getExt2());
+        amsTaskQuery.setExt3(addTaskForm.getExt3());
         List<AmsTask> undoneList = amsTaskService.selectAmsTaskList(amsTaskQuery);
         if (undoneList.size() > 0) {
             return;
@@ -172,8 +209,10 @@ public class StatusUpdateServiceImpl implements StatusUpdateService {
         } else if (doorNo == 2) {
             doorNum = AutoDoorClient.AUTO_DOOR_NO.C;
         }
-        Boolean isOpen = autoDoorClient.sendOpen(doorNum);
+//        Boolean isOpen = autoDoorClient.sendOpen(doorNum);
+        Boolean isOpen = true;
         if (isOpen) {
+            ThreadUtil.sleep(5000);
             log.info("开门信号发送成功!门号:" + doorNo);
             feedbackTS(doorNo);
         }
@@ -187,11 +226,12 @@ public class StatusUpdateServiceImpl implements StatusUpdateService {
         } else if (doorNo == 2) {
             doorNum = AutoDoorClient.AUTO_DOOR_NO.C;
         }
+//        Boolean isClose = autoDoorClient.sendClose(doorNum);
         Boolean isClose = autoDoorClient.sendClose(doorNum);
         if (isClose) {
+            ThreadUtil.sleep(5000);
             log.info("关门信号发送成功!门号:" + doorNo);
-            // 不需要反馈
-//            feedbackTS(doorNo);
+            feedbackTS(doorNo);
         }
     }
 }