From cab87dcfaa7b1e2bc1298572b775026bb17ef38b Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 17 十月 2024 13:54:41 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyLiftThread.java |   60 +++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyLiftThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyLiftThread.java
index 082eeb2..0c2e1c6 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyLiftThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyLiftThread.java
@@ -14,6 +14,7 @@
 import com.zy.asrs.wcs.core.entity.BasLift;
 import com.zy.asrs.wcs.core.model.command.LiftCommand;
 import com.zy.asrs.wcs.core.model.enums.LiftCommandModeType;
+import com.zy.asrs.wcs.core.model.enums.MotionCtgType;
 import com.zy.asrs.wcs.core.service.BasLiftService;
 import com.zy.asrs.wcs.core.utils.RedisUtil;
 import com.zy.asrs.wcs.core.utils.Utils;
@@ -81,9 +82,9 @@
         try {
             readStatus();
 
-            //鎻愬崌鏈哄浜庤繍琛岀姸鎬侊紝灏嗘爣璁扮疆涓篺alse
+            //鎻愬崌鏈哄浜庤繍琛岀姸鎬侊紝灏嗘爣璁扮疆涓簍rue
             if (liftProtocol.getRun()) {
-                liftProtocol.setPakMk(false);
+                liftProtocol.setPakMk(true);
             }
         } catch (Exception e) {
             OutputQueue.LIFT.offer(MessageFormat.format("銆恵0}銆戣鍙栨彁鍗囨満鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), device.getId(), device.getIp(), device.getPort()));
@@ -306,19 +307,40 @@
     }
 
     @Override
-    public boolean isIdle(ExecuteSupport support) {
-        if (null != support) {
-            if (!support.judgement()) {
-                return false;
-            }
-        }
+    public boolean isIdle(MotionCtgType flag) {
         // 鍒ゆ柇鎻愬崌鏈烘槸鍚﹁嚜鍔ㄣ�佸氨缁�佺┖闂�
         if (this.liftProtocol.getModel()
                 && !this.liftProtocol.getRun()
                 && this.liftProtocol.getReady()
                 && this.liftProtocol.getPakMk()
                 && this.liftProtocol.getErrorCode().equals("0")
-                && this.liftProtocol.getProtocolStatus().equals(LiftProtocolStatusType.IDLE)
+                && (this.liftProtocol.getProtocolStatusType().equals(LiftProtocolStatusType.IDLE)
+                || this.liftProtocol.getProtocolStatusType().equals(LiftProtocolStatusType.WAITING))
+        ) {
+            return true;
+        }
+        return false;
+    }
+
+    @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.liftProtocol.getModel()
+                && !this.liftProtocol.getRun()
+                && this.liftProtocol.getReady()
+                && this.liftProtocol.getErrorCode().equals("0")
         ) {
             return true;
         }
@@ -346,7 +368,12 @@
     }
 
     @Override
-    public LiftCommand getMoveCommand(Integer taskNo, Integer sourceLev, Integer targetLev, LiftCommandModeType mode) {
+    public int generateDeviceTaskNo(int taskNo, MotionCtgType motionCtgType) {
+        return taskNo;
+    }
+
+    @Override
+    public List<LiftCommand> getMoveCommand(Integer taskNo, Integer sourceLev, Integer targetLev, LiftCommandModeType mode) {
         /**
          * 浠诲姟绫诲瀷
          * 1=绉绘墭鐩橈紱鍗囬檷鏈哄皢婧愮珯鍙版墭鐩樼Щ鍒扮洰鏍囩珯鍙�
@@ -374,26 +401,29 @@
         command.setMode(LiftCommandModeType.MOVE.id);
         command.setOriginLev(sourceLev);
         command.setTargetLev(targetLev);
-        return command;
+
+        ArrayList<LiftCommand> list = new ArrayList<>();
+        list.add(command);
+        return list;
     }
 
     @Override
-    public LiftCommand getMoveWithShuttleCommand(Integer taskNo, Integer sourceLev, Integer targetLev, LiftCommandModeType mode) {
+    public List<LiftCommand> getMoveWithShuttleCommand(Integer taskNo, Integer sourceLev, Integer targetLev, LiftCommandModeType mode) {
         return getMoveCommand(taskNo, sourceLev, targetLev, mode);
     }
 
     @Override
-    public LiftCommand getPalletInOutCommand(Integer taskNo, Integer sourceLev, Integer targetLev, Integer originSta, Integer targetSta, LiftCommandModeType mode) {
+    public List<LiftCommand> getPalletInOutCommand(Integer taskNo, Integer sourceLev, Integer targetLev, Integer originSta, Integer targetSta, LiftCommandModeType mode) {
         return getMoveCommand(taskNo, sourceLev, targetLev, mode);
     }
 
     @Override
-    public LiftCommand getLockCommand(Integer taskNo, Boolean lock) {
+    public List<LiftCommand> getLockCommand(Integer taskNo, Boolean lock) {
         return null;
     }
 
     @Override
-    public LiftCommand getShuttleSignalCommand(Integer taskNo, Boolean signal) {
+    public List<LiftCommand> getShuttleSignalCommand(Integer taskNo, Boolean signal) {
         return null;
     }
 

--
Gitblit v1.9.1