From 53fcb1fa224f849096510a987ba8b4dd3c1bd3cf Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期四, 25 八月 2022 16:37:41 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/SteThread.java |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/SteThread.java b/src/main/java/com/zy/core/thread/SteThread.java
index dd6640a..1ba98de 100644
--- a/src/main/java/com/zy/core/thread/SteThread.java
+++ b/src/main/java/com/zy/core/thread/SteThread.java
@@ -17,7 +17,6 @@
 import com.zy.core.cache.OutputQueue;
 import com.zy.core.enums.SlaveType;
 import com.zy.core.enums.SteStatusType;
-import com.zy.core.enums.SteTaskModeType;
 import com.zy.core.model.SteSlave;
 import com.zy.core.model.Task;
 import com.zy.core.model.command.SteCommand;
@@ -27,7 +26,6 @@
 
 import java.text.MessageFormat;
 import java.util.Date;
-import java.util.Random;
 
 /**
  * shuttle 绌挎杞︾嚎绋�
@@ -110,10 +108,10 @@
         OperateResult connect = siemensS7Net.ConnectServer();
         if(connect.IsSuccess){
             result = true;
-            OutputQueue.CRN.offer(MessageFormat.format( "銆恵0}銆戠┛姊溅plc杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+            OutputQueue.STE.offer(MessageFormat.format( "銆恵0}銆戠┛姊溅plc杩炴帴鎴愬姛 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
             log.info("绌挎杞lc杩炴帴鎴愬姛 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
         } else {
-            OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戠┛姊溅plc杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] ", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+            OutputQueue.STE.offer(MessageFormat.format("銆恵0}銆戠┛姊溅plc杩炴帴澶辫触锛侊紒锛� ===>> [id:{1}] [ip:{2}] [port:{3}] ", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
             log.error("绌挎杞lc杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
             initSte();
         }
@@ -171,7 +169,7 @@
                 steProtocol.setCrnStopFork(siemensS7Net.getByteTransform().TransInt16(result.Content, 40));
                 steProtocol.setCrnAllowRun(siemensS7Net.getByteTransform().TransInt16(result.Content, 42));
 
-                OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
+                OutputQueue.STE.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
 
                 // 澶嶄綅淇″彿
                 if (steProtocol.getWaiting()) {
@@ -196,12 +194,12 @@
 
                 }
             } else {
-                OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆憑1}绌挎杞lc鐘舵�佷俊鎭け璐�",DateUtils.convert(new Date()), slave.getId()));
+                OutputQueue.STE.offer(MessageFormat.format("銆恵0}銆憑1}绌挎杞lc鐘舵�佷俊鎭け璐�",DateUtils.convert(new Date()), slave.getId()));
                 throw new CoolException(MessageFormat.format( "绌挎杞lc鐘舵�佷俊鎭け璐� ===>> [id:{0}] [ip:{1}] [port:{2}]", slave.getId(), slave.getIp(), slave.getPort()));
             }
         } catch (Exception e) {
             e.printStackTrace();
-            OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戣鍙栫┛姊溅plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+            OutputQueue.STE.offer(MessageFormat.format("銆恵0}銆戣鍙栫┛姊溅plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
             log.error("璇诲彇绌挎杞lc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
             initSte();
         }
@@ -294,16 +292,14 @@
         if (result != null && result.IsSuccess) {
             // 缁存姢鏁版嵁搴撴帓鍒楀眰
             if (!steProtocol.getWaiting()) {
-                this.lastRow = command.getRow().intValue();
-                this.lastBay = command.getBay().intValue();
-                this.lastLev = command.getLev().intValue();
+                this.modifyPos(command.getRow().intValue(), command.getBay().intValue(), command.getLev().intValue());
             }
 
             log.info("绌挎杞﹀懡浠や笅鍙慬id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
-            OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));
+            OutputQueue.STE.offer(MessageFormat.format("銆恵0}銆慬id:{1}] >>>>> 鍛戒护涓嬪彂锛� {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));
             return true;
         } else {
-            OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戝啓鍏ョ┛姊溅plc鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
+            OutputQueue.STE.offer(MessageFormat.format("銆恵0}銆戝啓鍏ョ┛姊溅plc鏁版嵁澶辫触 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort()));
             log.error("鍐欏叆绌挎杞lc鏁版嵁澶辫触 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
             return false;
         }

--
Gitblit v1.9.1