From 3ee0ff0bd24d4df9b795146ece6da43a78bf8bd0 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期二, 12 十二月 2023 20:55:18 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/LiftThread.java |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/LiftThread.java b/src/main/java/com/zy/core/thread/LiftThread.java
index 71a7099..d58a02d 100644
--- a/src/main/java/com/zy/core/thread/LiftThread.java
+++ b/src/main/java/com/zy/core/thread/LiftThread.java
@@ -288,6 +288,7 @@
 
         OperateResult result = siemensS7Net.Write("DB83.0", array);
         if (result != null && result.IsSuccess) {
+            liftProtocol.setSendTime(System.currentTimeMillis());//鎸囦护涓嬪彂鏃堕棿
             News.info("鎻愬崌鏈哄懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
             OutputQueue.LIFT.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));
             return true;
@@ -329,7 +330,7 @@
         redisCommand.setCommandStep(0);//鍛戒护鎵ц姝ュ簭
         redisCommand.setAssignCommand(assignCommand);//鍛戒护
         //浠诲姟鏁版嵁淇濆瓨鍒皉edis
-        redisUtil.set("lift_wrk_no_" + assignCommand.getTaskNo(), JSON.toJSONString(redisCommand));
+        redisUtil.set(RedisKeyType.LIFT.key + assignCommand.getTaskNo(), JSON.toJSONString(redisCommand));
         liftProtocol.setAssignCommand(assignCommand);
         liftProtocol.setProtocolStatus(LiftProtocolStatusType.WORKING);
         //鎵ц涓嬪彂浠诲姟
@@ -344,7 +345,7 @@
         }
 
         WrkMastMapper wrkMastMapper = SpringUtils.getBean(WrkMastMapper.class);
-        Object o = redisUtil.get("lift_wrk_no_" + wrkNo);
+        Object o = redisUtil.get(RedisKeyType.LIFT.key + wrkNo);
         if (o == null) {
             return false;
         }
@@ -357,6 +358,10 @@
 
         //鍙栧嚭鍛戒护
         NyLiftCommand command = commands.get(commandStep);
+
+        if (!redisCommand.getLiftNo().equals(liftProtocol.getLiftNo())) {
+            return false;
+        }
 
         //涓嬪彂鍛戒护
         if (!write(command)) {
@@ -376,7 +381,7 @@
             short[] commandArr = getCommandArr(command);//鑾峰彇鍛戒护鎶ユ枃
             BasLiftOpt opt = new BasLiftOpt(
                     redisCommand.getWrkNo().intValue(),
-                    redisCommand.getLiftNo().intValue(),
+                    liftProtocol.getLiftNo().intValue(),
                     new Date(),
                     null,
                     null,
@@ -395,11 +400,11 @@
             commandStep++;
             redisCommand.setCommandStep(commandStep);
             //浠诲姟鏁版嵁淇濆瓨鍒皉edis
-            redisUtil.set("lift_wrk_no_" + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
+            redisUtil.set(RedisKeyType.LIFT.key + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
         }else {
             //宸叉墽琛屽畬鎴�
             //鍒犻櫎redis
-            redisUtil.del("lift_wrk_no_" + redisCommand.getWrkNo());
+            redisUtil.del(RedisKeyType.LIFT.key + redisCommand.getWrkNo());
 
             //瀵逛富绾跨▼鎶涘嚭绛夊緟纭鐘舵�亀aiting
             liftProtocol.setProtocolStatus(LiftProtocolStatusType.WAITING);

--
Gitblit v1.9.1