From 26040a05a66227a59259d83d95f654030eb210d8 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <xltys1995>
Date: 星期六, 14 十一月 2020 15:06:59 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/thread/DevpThread.java |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/DevpThread.java b/src/main/java/com/zy/core/thread/DevpThread.java
index 9ed86e6..90d5837 100644
--- a/src/main/java/com/zy/core/thread/DevpThread.java
+++ b/src/main/java/com/zy/core/thread/DevpThread.java
@@ -138,6 +138,16 @@
                 }
             }
         }
+        // 鍙拌溅浣嶇疆
+        OperateResultExOne<Short> result2 = siemensS7Net.ReadInt16("DB100.48");
+        if (result2.IsSuccess) {
+            StaProtocol staProtocol = station.get(8);
+            staProtocol.setPosition(result2.Content);
+        } else {
+            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆�8鍙峰彴杞﹁幏鍙栧疄鏃朵綅缃け璐ワ紒锛侊紒", DateUtils.convert(new Date())));
+            log.error("8鍙峰彴杞﹁幏鍙栧疄鏃朵綅缃け璐ワ紒锛侊紒");
+        }
+
         if (result.IsSuccess && result1.IsSuccess) {
 
             OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId()));
@@ -172,7 +182,7 @@
             return;
         }
         OperateResult write = siemensS7Net.Write("DB100." + (staProtocol.getSiteId() - 1) * 2, staProtocol.getWorkNo());    // 宸ヤ綔鍙�
-        Thread.sleep(100);
+        Thread.sleep(300);
         OperateResult write1 = siemensS7Net.Write("DB100." + ((staProtocol.getSiteId() - 1) * 2 + 20), staProtocol.getStaNo());    // 鐩爣绔�
 //        boolean[] status = new boolean[8];
 //        status[0] = staProtocol.isAutoing();
@@ -182,6 +192,7 @@
 //        status[4] = staProtocol.isEmptyMk();
 //        OperateResult write2 = siemensS7Net.Write("DB100." + ((staProtocol.getSiteId() - 1) + 40), status);     //  鐘舵��
         if (!write.IsSuccess || !write1.IsSuccess) {
+            staProtocol = station.get(staProtocol.getSiteId());
             if (staProtocol.getWorkNo() == 0 && staProtocol.getStaNo() ==0) {
                 staProtocol.setPakMk(true);
             }
@@ -240,6 +251,16 @@
         }
     }
 
+    /**
+     * 璁剧疆鍏ュ簱鏍囪
+     */
+    public void setPakMk(Integer siteId, boolean pakMk) {
+        StaProtocol staProtocol = station.get(siteId);
+        if (null != staProtocol) {
+            staProtocol.setPakMk(pakMk);
+        }
+    }
+
     @Override
     public void close() {
         siemensS7Net.ConnectClose();

--
Gitblit v1.9.1