From 15b5002fd412a5d33be5d5c6deb63b3d02c77c41 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期二, 23 九月 2025 14:35:39 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/impl/NyLiftThread.java |   51 ++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/impl/NyLiftThread.java b/src/main/java/com/zy/core/thread/impl/NyLiftThread.java
index b495438..1af1ca3 100644
--- a/src/main/java/com/zy/core/thread/impl/NyLiftThread.java
+++ b/src/main/java/com/zy/core/thread/impl/NyLiftThread.java
@@ -3,13 +3,10 @@
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.core.common.DateUtils;
 import com.core.common.SpringUtils;
-import com.zy.asrs.entity.BasLift;
 import com.zy.asrs.entity.DeviceConfig;
 import com.zy.asrs.entity.DeviceDataLog;
-import com.zy.asrs.service.BasLiftService;
 import com.zy.asrs.service.DeviceDataLogService;
 import com.zy.asrs.utils.Utils;
 import com.zy.common.ExecuteSupport;
@@ -194,12 +191,19 @@
             //************琛ュ厖鎵╁睍瀛楁*************
             InnerLiftExtend liftExtend = (InnerLiftExtend) liftProtocol.getExtend();
             liftProtocol.setExtend(liftExtend);
-            liftExtend.setFrontOverrun(data.getBoolean("frontOverrun"));
-            liftExtend.setBackOverrun(data.getBoolean("backOverrun"));
-            liftExtend.setLeftOverrun(data.getBoolean("leftOverrun"));
-            liftExtend.setRightOverrun(data.getBoolean("rightOverrun"));
-            liftExtend.setOverHeight(data.getBoolean("overHeight"));
-            liftExtend.setOverWeight(data.getBoolean("overWeight"));
+            JSONObject extend = data.getJSONObject("extend");
+            liftExtend.setFrontOverrun(extend.getInteger("frontOverrun") == 1);
+            liftExtend.setBackOverrun(extend.getInteger("backOverrun") == 1);
+            liftExtend.setLeftOverrun(extend.getInteger("leftOverrun") == 1);
+            liftExtend.setRightOverrun(extend.getInteger("rightOverrun") == 1);
+            liftExtend.setOverHeight(extend.getInteger("overHeight") == 1);
+            liftExtend.setOverWeight(extend.getInteger("overWeight") == 1);
+            liftExtend.setPlcTaskNoComplete(extend.getInteger("plcTaskNoComplete"));
+
+            if (!liftExtend.getPlcTaskNoComplete().equals(liftProtocol.getPlcTaskNo())) {
+                //璁惧鐘舵��
+                liftProtocol.setDeviceStatus(LiftDeviceStatusType.BUSY.id);
+            }
 
             //璇诲彇绔欑偣
             JSONArray stationList = data.getJSONArray("stationList");
@@ -388,6 +392,7 @@
                 || this.liftProtocol.getPlcTaskNo() == null
                 || this.liftProtocol.getProtocolStatus() == null
                 || this.liftProtocol.getModel() == null
+                || this.liftProtocol.getDeviceStatus() == null
                 || this.liftProtocol.getErrorCode() == null
                 || this.liftProtocol.getExtend() == null
         ) {
@@ -400,6 +405,7 @@
 //                && this.liftProtocol.getPlcTaskNo() == 0
                 && this.liftProtocol.getTaskNo() == 0
                 && this.liftProtocol.getModel() == 2
+                && this.liftProtocol.getDeviceStatus() == LiftDeviceStatusType.IDLE.id
                 && this.liftProtocol.getErrorCode() == 0
                 && !extend.getFrontOverrun()
                 && !extend.getBackOverrun()
@@ -427,6 +433,7 @@
 
         if (this.liftProtocol.getProtocolStatus() == null
                 || this.liftProtocol.getModel() == null
+                || this.liftProtocol.getDeviceStatus() == null
                 || this.liftProtocol.getErrorCode() == null
                 || this.liftProtocol.getExtend() == null
         ) {
@@ -437,6 +444,7 @@
 
         boolean res = this.liftProtocol.getProtocolStatus() == LiftProtocolStatusType.IDLE.id
                 && this.liftProtocol.getModel() == 2
+                && this.liftProtocol.getDeviceStatus() == LiftDeviceStatusType.IDLE.id
                 && this.liftProtocol.getErrorCode() == 0
                 && !extend.getFrontOverrun()
                 && !extend.getBackOverrun()
@@ -488,6 +496,10 @@
         command.setPick(pick);
         command.setPut(put);
 
+        LiftStaProtocol pickSta = findSta(pick);
+        LiftStaProtocol putSta = findSta(put);
+        command.setPickLev(pickSta.getLev());
+        command.setPutLev(putSta.getLev());
         return command;
     }
 
@@ -500,6 +512,10 @@
         command.setPick(pick);
         command.setPut(put);
 
+        LiftStaProtocol pickSta = findSta(pick);
+        LiftStaProtocol putSta = findSta(put);
+        command.setPickLev(pickSta.getLev());
+        command.setPutLev(putSta.getLev());
         return command;
     }
 
@@ -512,6 +528,10 @@
         command.setPick(pick);
         command.setPut(put);
 
+        LiftStaProtocol pickSta = findSta(pick);
+        LiftStaProtocol putSta = findSta(put);
+        command.setPickLev(pickSta.getLev());
+        command.setPutLev(putSta.getLev());
         return command;
     }
 
@@ -636,6 +656,15 @@
         }
     }
 
+    private LiftStaProtocol findSta(Integer staNo) {
+        for (LiftStaProtocol liftStaProtocol : this.liftStaProtocols) {
+            if (liftStaProtocol.getSiteId().equals(staNo)) {
+                return liftStaProtocol;
+            }
+        }
+        return null;
+    }
+
     /**
      * 鎵╁睍瀛楁
      */
@@ -672,8 +701,8 @@
          */
         private Boolean overWeight;
 
-        //鎻愬崌鏈虹珯鐐�
-        private List<LiftStaProtocol> liftStaProtocols;
+        //PLC宸插畬鎴愪换鍔″彿
+        private Integer plcTaskNoComplete;
 
     }
 }

--
Gitblit v1.9.1