From f09b972bb7adf8d4fd75fcb87c85973e493432a8 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期二, 30 四月 2024 11:14:20 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java           |   29 +++++++++++---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java        |   27 ++++++++++---
 zy-asrs-flow/src/pages/device/shuttle/index.jsx                                          |    5 ++
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java                 |   27 ++++++++-----
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java |   12 +++++
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java                  |    2 +
 6 files changed, 78 insertions(+), 24 deletions(-)

diff --git a/zy-asrs-flow/src/pages/device/shuttle/index.jsx b/zy-asrs-flow/src/pages/device/shuttle/index.jsx
index be86591..969ea35 100644
--- a/zy-asrs-flow/src/pages/device/shuttle/index.jsx
+++ b/zy-asrs-flow/src/pages/device/shuttle/index.jsx
@@ -239,6 +239,11 @@
                         label: '鏄惁鏈夋墭鐩�',
                         children: item.hasPallet ? 'Y' : 'N',
                     },
+                    {
+                        key: '13',
+                        label: '鑷姩',
+                        children: item.mode ? 'Y' : 'N',
+                    }
                 ];
                 return <div key={item.id} style={{ width: '45%' }}>
                     <div style={{ marginBottom: '10px' }}>
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
index 977fba7..6c02d01 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
@@ -4,12 +4,14 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.zy.asrs.wcs.common.ExecuteSupport;
 import com.zy.asrs.wcs.core.entity.Loc;
 import com.zy.asrs.wcs.core.entity.Task;
 import com.zy.asrs.wcs.core.model.NavigateNode;
 import com.zy.asrs.wcs.core.model.command.ShuttleAssignCommand;
 import com.zy.asrs.wcs.core.model.command.ShuttleCommand;
 import com.zy.asrs.wcs.core.model.command.ShuttleRedisCommand;
+import com.zy.asrs.wcs.core.model.enums.MotionCtgType;
 import com.zy.asrs.wcs.core.model.enums.ShuttleCommandModeType;
 import com.zy.asrs.wcs.core.model.enums.ShuttleTaskModeType;
 import com.zy.asrs.wcs.core.service.BasShuttleService;
@@ -31,6 +33,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 @Component
 public class ShuttleAction {
@@ -109,16 +112,6 @@
         if (shuttleProtocol == null) {
             return false;
         }
-
-        //鍒ゆ柇璁惧鏄惁绌洪棽
-        if (!shuttleThread.isDeviceIdle()) {
-            return false;
-        }
-//        if (!shuttleThread.isIdle(() -> {
-//            return shuttleProtocol.getTaskNo().equals(taskNo);
-//        })) {
-//            return false;
-//        }
 
         //鍒ゆ柇宸ヤ綔鍙锋槸鍚︾浉鍚�
         if (!shuttleProtocol.getTaskNo().equals(taskNo)) {
@@ -222,6 +215,20 @@
         //鍙栧嚭鍛戒护
         ShuttleCommand command = commands.get(commandStep);
 
+        Integer mode = command.getMode();
+        //鍒ゆ柇璁惧鏄惁绌洪棽
+        if (!shuttleThread.isDeviceIdle(new ExecuteSupport() {
+            @Override
+            public Boolean judgement() {
+                if (ShuttleCommandModeType.CHARGE_CLOSE.id.equals(mode)) {//鍏抽棴鍏呯數motion
+                    return false;//涓嶉渶瑕佸垽鏂姸鎬�
+                }
+                return true;//闇�瑕佸垽鏂姸鎬�
+            }
+        })) {
+            return false;
+        }
+
         // 涓嬪彂鍛戒护
         if (!write(command, device)) {
             News.error("鍥涘悜绌挎杞﹀懡浠や笅鍙戝け璐ワ紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
index 707680b..a8913bd 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
@@ -73,9 +73,19 @@
         if (null == shuttleProtocol) {
             return false;
         }
-        if (!shuttleThread.isIdle()) {//璁惧涓嶇┖闂�
+
+        if (!shuttleThread.isIdle(new ExecuteSupport() {
+            @Override
+            public Boolean judgement() {
+                if (Objects.equals(MotionCtgType.get(motion.getMotionCtgEl()), MotionCtgType.SHUTTLE_CHARGE_OFF)) {//闈炲叧闂厖鐢祄otion锛岄渶瑕佸垽鏂澶囩姸鎬�
+                    return false;//涓嶉渶瑕佸垽鏂姸鎬�
+                }
+                return true;//闇�瑕佸垽鏂姸鎬�
+            }
+        })) {//璁惧涓嶇┖闂�
             return false;
         }
+
         if (motionService.count(new LambdaQueryWrapper<Motion>()
                 .eq(Motion::getDeviceCtg, DeviceCtgType.SHUTTLE.val())
                 .eq(Motion::getDevice, motion.getDevice())
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java
index 8dafb49..31cf9a5 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java
@@ -32,6 +32,8 @@
 
     boolean isDeviceIdle();//璁惧鏄惁绌洪棽
 
+    boolean isDeviceIdle(ExecuteSupport support);//璁惧鏄惁绌洪棽
+
     boolean isRequireCharge();//鏄惁婊¤冻鍏呯數鐘舵��
 
     boolean isCharging();//鏄惁鍏呯數涓�
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
index 096c96d..1233ccd 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
@@ -406,8 +406,8 @@
 
     @Override
     public boolean reset(ShuttleCommand command) {
-        this.shuttleProtocol.setTaskNo(0);
-        this.shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
+        setSyncTaskNo(0);
+        setProtocolStatus(ShuttleProtocolStatusType.IDLE);
         return true;
     }
 
@@ -419,10 +419,12 @@
     @Override
     public boolean isIdle(ExecuteSupport support) {
         if (null != support) {
-            if (!support.judgement()) {
-                return false;
+            Boolean judgement = support.judgement();
+            if (judgement != null && !judgement) {
+                return true;
             }
         }
+
         if (this.shuttleProtocol.getDeviceStatus() == null
                 || this.shuttleProtocol.getPakMk() == null
                 || this.shuttleProtocol.getErrorCode() == null
@@ -439,14 +441,27 @@
                 && this.shuttleProtocol.getMode() == 1
                 && this.shuttleProtocol.getPakMk()
                 && this.shuttleProtocol.getErrorCode().equals("0")
-                && (this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.IDLE.id || this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.WAITING.id)
-                && extend.getSuspendState() == 0
-                ;
+                && (this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.IDLE.id
+                || this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.WAITING.id
+                || this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.CHARGING_WAITING.id)
+                && extend.getSuspendState() == 0;
         return res;
     }
 
     @Override
     public boolean isDeviceIdle() {
+        return isDeviceIdle(null);
+    }
+
+    @Override
+    public boolean isDeviceIdle(ExecuteSupport support) {
+        if (null != support) {
+            Boolean judgement = support.judgement();
+            if (judgement != null && !judgement) {
+                return true;
+            }
+        }
+
         if (this.shuttleProtocol.getDeviceStatus() == null
                 || this.shuttleProtocol.getPakMk() == null
                 || this.shuttleProtocol.getErrorCode() == null
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
index e1df620..32d18d7 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
@@ -403,8 +403,8 @@
 
     @Override
     public synchronized boolean reset(ShuttleCommand command) {
-        this.shuttleProtocol.setTaskNo(0);
-        this.shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
+        setSyncTaskNo(0);
+        setProtocolStatus(ShuttleProtocolStatusType.IDLE);
         return true;
     }
 
@@ -416,10 +416,12 @@
     @Override
     public boolean isIdle(ExecuteSupport support) {
         if (null != support) {
-            if (!support.judgement()) {
-                return false;
+            Boolean judgement = support.judgement();
+            if (judgement != null && !judgement) {
+                return true;
             }
         }
+
         if (this.shuttleProtocol.getDeviceStatus() == null
                 || this.shuttleProtocol.getPakMk() == null
                 || this.shuttleProtocol.getErrorCode() == null
@@ -431,13 +433,26 @@
         boolean res = (this.shuttleProtocol.getDeviceStatus() == 3 || this.shuttleProtocol.getDeviceStatus() == 11)
                 && this.shuttleProtocol.getPakMk()
                 && this.shuttleProtocol.getErrorCode().equals("0")
-                && (this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.IDLE.id || this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.WAITING.id)
-                ;
+                && (this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.IDLE.id
+                || this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.WAITING.id
+                || this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.CHARGING_WAITING.id);
         return res;
     }
 
     @Override
     public boolean isDeviceIdle() {
+        return isDeviceIdle(null);
+    }
+
+    @Override
+    public boolean isDeviceIdle(ExecuteSupport support) {
+        if (null != support) {
+            Boolean judgement = support.judgement();
+            if (judgement != null && !judgement) {
+                return true;
+            }
+        }
+
         if (this.shuttleProtocol.getDeviceStatus() == null
                 || this.shuttleProtocol.getPakMk() == null
                 || this.shuttleProtocol.getErrorCode() == null

--
Gitblit v1.9.1