From 2db722e23d7e5d1d2e719174938f354d804644af Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期二, 23 四月 2024 08:13:52 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java |   48 ++++++++++++++++--------------------------------
 1 files changed, 16 insertions(+), 32 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java
index 4075c60..4fb2d5f 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java
@@ -19,7 +19,6 @@
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.Objects;
 
 /**
@@ -48,11 +47,8 @@
             return false;
         }
 
-        //鑷姩銆佸氨缁�佺┖闂�
-        if (!(liftProtocol.getModel()
-                && liftProtocol.getReady()
-                && !liftProtocol.getRun())
-        ) {
+        //鍒ゆ柇鎻愬崌鏈烘槸鍚﹁嚜鍔�
+        if (!liftThread.isIdle()) {
             return false;
         }
 
@@ -66,7 +62,7 @@
         ArrayList<LiftCommand> list = new ArrayList<>();
         LiftAssignCommand assignCommand = new LiftAssignCommand();
         assignCommand.setLiftNo(liftProtocol.getLiftNo());
-        assignCommand.setTaskNo(motion.getWrkNo());
+        assignCommand.setTaskNo(motion.getTaskNo());
         assignCommand.setCommands(list);
 
         LiftCommand command = new LiftCommand();
@@ -74,11 +70,11 @@
             case LIFT_MOVE:
                 // 濡傛灉宸茬粡鍦ㄧ洰鏍囧眰锛岄偅杈瑰眰杩囨护
                 if (liftProtocol.getLev().equals(Integer.valueOf(motion.getTarget()))) {
-                    liftProtocol.setTaskNo(motion.getWrkNo());
+                    liftThread.setSyncTaskNo(motion.getTaskNo());
                     break;
                 }
 
-                command = liftThread.getEmptyMoveCommand(motion.getWrkNo(), Integer.parseInt(motion.getTarget()));
+                command = liftThread.getMoveCommand(motion.getTaskNo(), 0, Integer.parseInt(motion.getTarget()), null);
                 list.add(command);
                 return liftAction.assignWork(liftThread.getDevice(), assignCommand);
             case LIFT_WITH_GOODS:
@@ -96,7 +92,7 @@
                     return false;
                 }
 
-                command = liftThread.getMoveWithShuttleCommand(motion.getWrkNo(), Integer.parseInt(motion.getOrigin()), Integer.parseInt(motion.getTarget()));
+                command = liftThread.getMoveWithShuttleCommand(motion.getTaskNo(), Integer.parseInt(motion.getOrigin()), Integer.parseInt(motion.getTarget()), null);
                 list.add(command);
                 return liftAction.assignWork(liftThread.getDevice(), assignCommand);
             case LIFT_WITH_GOODS_AND_SHUTTLE:
@@ -212,17 +208,14 @@
             return false;
         }
 
-        if (liftProtocol.getRun() || liftProtocol.getTaskNo() != motion.getWrkNo().shortValue()) {
+        if (liftProtocol.getRun() || liftProtocol.getTaskNo() != motion.getTaskNo().shortValue()) {
             return false;
         }
 
         switch (Objects.requireNonNull(MotionCtgType.get(motion.getMotionCtgEl()))){
             case LIFT_MOVE:
-                // 鍒ゆ柇鎻愬崌鏈烘槸鍚﹁嚜鍔ㄣ�佺┖闂层�佸噯澶囧氨缁�侀摼鏉℃病鏈夎浆鍔ㄣ�佹病鏈夋湭灏辩华鎶ラ敊
-                if (!liftProtocol.getModel()
-                        || liftProtocol.getRun()
-                        || !liftProtocol.getReady()
-                ) {
+                // 鍒ゆ柇鎻愬崌鏈烘槸鍚︾┖闂�
+                if (!liftThread.isIdle()) {
                     return false;
                 }
 
@@ -231,11 +224,8 @@
                 }
                 break;
             case LIFT_WITH_GOODS:
-                // 鍒ゆ柇鎻愬崌鏈烘槸鍚﹁嚜鍔ㄣ�佺┖闂层�佸噯澶囧氨缁�侀摼鏉℃病鏈夎浆鍔ㄣ�佹病鏈夋湭灏辩华鎶ラ敊
-                if (!liftProtocol.getModel()
-                        || liftProtocol.getRun()
-                        || !liftProtocol.getReady()
-                ) {
+                // 鍒ゆ柇鎻愬崌鏈烘槸鍚︾┖闂�
+                if (!liftThread.isIdle()) {
                     return false;
                 }
 
@@ -249,11 +239,8 @@
 
                 break;
             case LIFT_WITH_SHUTTLE:
-                // 鍒ゆ柇鎻愬崌鏈烘槸鍚﹁嚜鍔ㄣ�佺┖闂层�佸噯澶囧氨缁�侀摼鏉℃病鏈夎浆鍔ㄣ�佹病鏈夋湭灏辩华鎶ラ敊
-                if (!liftProtocol.getModel()
-                        || liftProtocol.getRun()
-                        || !liftProtocol.getReady()
-                ) {
+                // 鍒ゆ柇鎻愬崌鏈烘槸鍚︾┖闂�
+                if (!liftThread.isIdle()) {
                     return false;
                 }
 
@@ -267,11 +254,8 @@
                 }
                 break;
             case LIFT_WITH_GOODS_AND_SHUTTLE:
-                // 鍒ゆ柇鎻愬崌鏈烘槸鍚﹁嚜鍔ㄣ�佺┖闂层�佸噯澶囧氨缁�侀摼鏉℃病鏈夎浆鍔ㄣ�佹病鏈夋湭灏辩华鎶ラ敊
-                if (!liftProtocol.getModel()
-                        || liftProtocol.getRun()
-                        || !liftProtocol.getReady()
-                ) {
+                // 鍒ゆ柇鎻愬崌鏈烘槸鍚︾┖闂�
+                if (!liftThread.isIdle()) {
                     return false;
                 }
 
@@ -354,7 +338,7 @@
                 return false;
         }
 
-        liftProtocol.setTaskNo(0);//娓呴浂宸ヤ綔鍙�
+        liftThread.setSyncTaskNo(0);//娓呴浂宸ヤ綔鍙�
         return true;
     }
 

--
Gitblit v1.9.1