k 2 vuotta sitten
vanhempi
commit
d31970b477

+ 12 - 12
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/test/AutoDoorTestController.java

@@ -30,8 +30,8 @@ public class AutoDoorTestController {
      */
     @ApiOperation("发送开门")
     @PostMapping("/sendOpen")
-    public Boolean sendOpen(Boolean con) {
-        return autoDoorClient.sendOpen(con);
+    public Boolean sendOpen(String con) {
+        return autoDoorClient.sendOpen(AutoDoorClient.AUTO_DOOR_NO.getByValue(con));
     }
 
     /**
@@ -41,8 +41,8 @@ public class AutoDoorTestController {
      */
     @ApiOperation("发送关门")
     @PostMapping("/sendClose")
-    public Boolean sendClose(Boolean con) {
-        return autoDoorClient.sendClose(con);
+    public Boolean sendClose(String con) {
+        return autoDoorClient.sendClose(AutoDoorClient.AUTO_DOOR_NO.getByValue(con));
     }
 
     /**
@@ -52,8 +52,8 @@ public class AutoDoorTestController {
      */
     @ApiOperation("查询开门状态")
     @PostMapping("/readOpenSts")
-    public AjaxResult readOpenSts(Boolean con) {
-        return autoDoorClient.readOpenSts(con);
+    public AjaxResult readOpenSts(String con) {
+        return autoDoorClient.readOpenSts(AutoDoorClient.AUTO_DOOR_NO.getByValue(con));
     }
 
     /**
@@ -63,8 +63,8 @@ public class AutoDoorTestController {
      */
     @ApiOperation("查询关门状态")
     @PostMapping("/readCloseSts")
-    public AjaxResult readCloseSts(Boolean con) {
-        return autoDoorClient.readCloseSts(con);
+    public AjaxResult readCloseSts(String con) {
+        return autoDoorClient.readCloseSts(AutoDoorClient.AUTO_DOOR_NO.getByValue(con));
     }
 
     /**
@@ -74,8 +74,8 @@ public class AutoDoorTestController {
      */
     @ApiOperation("发送开门清除标记")
     @PostMapping("/sendOpenClear")
-    public Boolean sendOpenClear(Boolean con) {
-        return autoDoorClient.sendOpenClear(con);
+    public Boolean sendOpenClear(String con) {
+        return autoDoorClient.sendOpenClear(AutoDoorClient.AUTO_DOOR_NO.getByValue(con));
     }
 
     /**
@@ -85,8 +85,8 @@ public class AutoDoorTestController {
      */
     @ApiOperation("发送关门清除标记")
     @PostMapping("/sendCloseClear")
-    public Boolean sendCloseClear(Boolean con) {
-        return autoDoorClient.sendCloseClear(con);
+    public Boolean sendCloseClear(String con) {
+        return autoDoorClient.sendCloseClear(AutoDoorClient.AUTO_DOOR_NO.getByValue(con));
     }
 
 }

+ 22 - 8
warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/thread/AutoRfidReaderTask.java

@@ -45,8 +45,9 @@ public class AutoRfidReaderTask {
      */
     public void run() {
         String tagId = iSysConfigService.selectConfigByKey(REDIS_KEY_RFID_TAGID_OUT);
+        String[] tagIds = tagId.split(",");
         List<String> tagList = rfidReaderClient.readTagsOut();
-        execute(tagId, tagList, true);
+        execute(tagIds, tagList, AutoDoorClient.AUTO_DOOR_NO.A, true);
     }
 
 
@@ -55,26 +56,30 @@ public class AutoRfidReaderTask {
      */
     public void run01() {
         String tagId = iSysConfigService.selectConfigByKey(REDIS_KEY_RFID_TAGID_IN);
+        String[] tagIds = tagId.split(",");
         List<String> tagList = rfidReaderClient.readTagsIn();
-        execute(tagId, tagList, false);
+        execute(tagIds, tagList, AutoDoorClient.AUTO_DOOR_NO.B, false);
     }
 
     /**
      * 执行任务
      *
-     * @param tagId     需要校验的标签ID
+     * @param tagIds     需要校验的标签ID
      * @param tagList   RFID读取到的tagId
+     * @param doorNo    门编号
      * @param isOutdoor 是否墙外的自动门
      */
-    public void execute(String tagId, List<String> tagList, boolean isOutdoor) {
+    public void execute(String[] tagIds, List<String> tagList, AutoDoorClient.AUTO_DOOR_NO doorNo, boolean isOutdoor) {
         if (tagList == null) {
             // 如果没有读到标签 关闭自动门
             // 因为大部分时间都是读不到标签的 所以关门的指令不能一直重复下发
             // 记录关门的次数 超过10次 就不再重复关门
             if (isOutdoor ? closeOutDoorNum < 10 : closeInDoorNum < 10) {
-                autoDoorClient.sendClose(isOutdoor);
+                autoDoorClient.sendClose(doorNo);
 //                log.info("发送关门指令!{},{}", isOutdoor, isOutdoor ? closeOutDoorNum : closeInDoorNum);
                 if (isOutdoor) {
+                    // 关闭墙外同时 打开墙里第二层自动门
+//                    autoDoorClient.sendOpen(AutoDoorClient.AUTO_DOOR_NO.C);
                     closeOutDoorNum++;
                 } else {
                     closeInDoorNum++;
@@ -82,11 +87,18 @@ public class AutoRfidReaderTask {
             }
             return;
         }
-        boolean contains = tagList.contains(tagId);
+        boolean contains = false;
+        for (String tagId : tagIds) {
+            if (contains = tagList.contains(tagId)) {
+                break;
+            }
+        }
         // 如果读到标签 打开自动门
         if (contains) {
-            autoDoorClient.sendOpen(isOutdoor);
+            autoDoorClient.sendOpen(doorNo);
             if (isOutdoor) {
+                // 打开墙外同时 关闭墙里第二层自动门(应该大部分时间多是关闭的)
+//                autoDoorClient.sendClose(AutoDoorClient.AUTO_DOOR_NO.C);
                 closeOutDoorNum = 0;
             } else {
                 closeInDoorNum = 0;
@@ -96,9 +108,11 @@ public class AutoRfidReaderTask {
             // 因为大部分时间都是读不到标签的 所以关门的指令不能一直重复下发
             // 记录关门的次数 超过10次 就不再重复关门
             if (isOutdoor ? closeOutDoorNum < 10 : closeInDoorNum < 10) {
-                autoDoorClient.sendClose(isOutdoor);
+                autoDoorClient.sendClose(doorNo);
 //                log.info("发送关门指令!{},{}", isOutdoor, isOutdoor ? closeOutDoorNum : closeInDoorNum);
                 if (isOutdoor) {
+                    // 关闭墙外同时 打开墙里第二层自动门
+//                    autoDoorClient.sendOpen(AutoDoorClient.AUTO_DOOR_NO.C);
                     closeOutDoorNum++;
                 } else {
                     closeInDoorNum++;