From 01a6b6e2681b35b2d23ade80cf5d35b1c5946141 Mon Sep 17 00:00:00 2001
From: tqs <56479841@qq.com>
Date: 星期五, 30 八月 2024 08:08:26 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/SiemensDevpThread.java | 52 +++++++++++++++++++++++++++++++++-------------------
1 files changed, 33 insertions(+), 19 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index c5c0366..695b434 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -194,7 +194,7 @@
// updateIoMode();
ArrayList<Integer> staNos = getStaNo();
int staNoSize = staNos.size();
- OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize * 4));
+ OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize * 8));
// OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB100.2", (short) (staNoSize*2));
if (result.IsSuccess) {
for (int i = 0; i < staNoSize; i++) {
@@ -205,19 +205,11 @@
staProtocol.setSiteId(siteId);
station.put(siteId, staProtocol);
}
- staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 4)); // 宸ヤ綔鍙�
+ staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 8)); // 宸ヤ綔鍙�
- staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 4 + 2)); // 鐩爣绔�
- }
- }
+ staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 8 + 4)); // 鐩爣绔�
- Thread.sleep(200);
- OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB101.6", (short) (staNoSize * 4));
- if (result1.IsSuccess) {
- for (int i = 0; i < staNoSize; i++) {
- Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
- boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i * 4, 1);
- StaProtocol staProtocol = station.get(siteId);
+ boolean[] status = siemensS7Net.getByteTransform().TransBool(result.Content, i * 8 + 6, 2); //鐘舵��
staProtocol.setAutoing(status[0]); // 鑷姩
staProtocol.setLoading(status[1]); // 鏈夌墿
staProtocol.setInEnable(status[2]); // 鍙叆
@@ -230,17 +222,39 @@
if (!staProtocol.isPakMk() && !staProtocol.isLoading()) {
staProtocol.setPakMk(true);
}
-
- if (staProtocol.getStamp() >= 2 && !staProtocol.isLoading()) {
- staProtocol.setStamp(0);
- } else if (staProtocol.getStamp() < 2 && staProtocol.isLoading()) {
- //lfd鍏ュ簱鍗拌 褰搒tamp>=2鏃舵墠鍏ュ簱
- staProtocol.setStamp(staProtocol.getStamp() + 1);
- }
}
}
// Thread.sleep(200);
+// OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB101.6", (short) (staNoSize * 4));
+// if (result1.IsSuccess) {
+// for (int i = 0; i < staNoSize; i++) {
+// Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
+// boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i * 4, 1);
+// StaProtocol staProtocol = station.get(siteId);
+// staProtocol.setAutoing(status[0]); // 鑷姩
+// staProtocol.setLoading(status[1]); // 鏈夌墿
+// staProtocol.setInEnable(status[2]); // 鍙叆
+// staProtocol.setOutEnable(status[3]);// 鍙嚭
+// staProtocol.setEmptyMk(status[4]); // 绌烘澘淇″彿
+// staProtocol.setFullPlt(status[5]); // 婊℃墭鐩�
+// staProtocol.setHigh(status[6]); // 楂樺簱浣�
+// staProtocol.setLow(status[7]); // 浣庡簱浣�
+//
+// if (!staProtocol.isPakMk() && !staProtocol.isLoading()) {
+// staProtocol.setPakMk(true);
+// }
+//
+// if (staProtocol.getStamp() >= 2 && !staProtocol.isLoading()) {
+// staProtocol.setStamp(0);
+// } else if (staProtocol.getStamp() < 2 && staProtocol.isLoading()) {
+// //lfd鍏ュ簱鍗拌 褰搒tamp>=2鏃舵墠鍏ュ簱
+// staProtocol.setStamp(staProtocol.getStamp() + 1);
+// }
+// }
+// }
+
+// Thread.sleep(200);
// OperateResultExOne<byte[]> result0 = siemensS7Net.Read("DB101.0", (short) 186);
// if (result0.IsSuccess) {
// for (int i = 0; i < 93; i++) {
--
Gitblit v1.9.1