From 77c77e93eea77ea93306ea36b1a0d009b692a41f Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期六, 29 六月 2024 15:16:12 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/SiemensDevpThread.java | 58 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index dd6619f..7a5f576 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -45,7 +45,7 @@
public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{
add(100);add(101);add(102);add(103);add(104);
- add(201);add(202);add(203);
+ add(105);add(106);add(107);
}};
public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{
@@ -181,7 +181,7 @@
updateIoMode();
ArrayList<Integer> staNos = getStaNo();
int staNoSize = staNos.size();
- OperateResultExOne<byte[]> result = siemensS7Net.Read("DB100.0", (short) (staNoSize*2));
+ OperateResultExOne<byte[]> result = siemensS7Net.Read("DB100.0", (short) (staNoSize*4));
if (result.IsSuccess) {
for (int i = 0; i < staNoSize; i++) {
Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
@@ -191,33 +191,33 @@
staProtocol.setSiteId(siteId);
station.put(siteId, staProtocol);
}
- staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*2)); // 宸ヤ綔鍙�
+ staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4)); // 宸ヤ綔鍙�
-// staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4 + 2)); // 鐩爣绔�
+ staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4 + 2)); // 鐩爣绔�
}
}
Thread.sleep(200);
- OperateResultExOne<byte[]> result0 = siemensS7Net.Read("DB101.0", (short) (staNoSize*2));
- if (result0.IsSuccess) {
- for (int i = 0; i < staNoSize; i++) {
- Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
- StaProtocol staProtocol = station.get(siteId);
- if (null == staProtocol) {
- staProtocol = new StaProtocol();
- staProtocol.setSiteId(siteId);
- station.put(siteId, staProtocol);
- }
- staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result0.Content, i*2)); // 鐩爣绔�
- }
- }
- Thread.sleep(200);
+// OperateResultExOne<byte[]> result0 = siemensS7Net.Read("DB100.2", (short) (staNoSize*2));
+// if (result0.IsSuccess) {
+// for (int i = 0; i < staNoSize; i++) {
+// Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
+// StaProtocol staProtocol = station.get(siteId);
+// if (null == staProtocol) {
+// staProtocol = new StaProtocol();
+// staProtocol.setSiteId(siteId);
+// station.put(siteId, staProtocol);
+// }
+// staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result0.Content, i*2)); // 鐩爣绔�
+// }
+// }
+// Thread.sleep(200);
OperateResultExOne<byte[]> result1 = null;
if(slave.getId()==1) {
- result1 = siemensS7Net.Read("DB102.100", (short) (staNoSize));
+ result1 = siemensS7Net.Read("DB102.0", (short) (staNoSize*2));
if (result1.IsSuccess) {
for (int i = 0; i < staNoSize; i++) {
Integer siteId = staNos.get(i); // 绔欑偣缂栧彿
- boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i, 1);
+ boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i*2, 1);
StaProtocol staProtocol = station.get(siteId);
staProtocol.setAutoing(status[0]); // 鑷姩
staProtocol.setLoading(status[1]); // 鏈夌墿
@@ -260,7 +260,7 @@
Thread.sleep(200);
if(slave.getId()==1) {
- OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.200", (short) (barcodeSize * 8));
+ OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB102.40", (short) (barcodeSize * 8));
if (result2.IsSuccess) {
for (int i = 0; i < barcodeSize; i++) {
String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 8, 8, "UTF-8");
@@ -319,11 +319,11 @@
short[] array = new short[2];
array[0] = staProtocol.getWorkNo();
array[1] = staProtocol.getStaNo();
-// OperateResult write = siemensS7Net.Write("DB100." + index*4, array);
+ OperateResult write = siemensS7Net.Write("DB100." + index*4, array);
- OperateResult write = siemensS7Net.Write("DB100." + index*2, staProtocol.getWorkNo()); // 宸ヤ綔鍙�
- Thread.sleep(500);
- OperateResult write1 = siemensS7Net.Write("DB101." + index*2, staProtocol.getStaNo()); // 鐩爣绔�
+// OperateResult write = siemensS7Net.Write("DB100.0" + index*4, staProtocol.getWorkNo()); // 宸ヤ綔鍙�
+// Thread.sleep(500);
+// OperateResult write1 = siemensS7Net.Write("DB100.2" + index*4+2, staProtocol.getStaNo()); // 鐩爣绔�
if (!write.IsSuccess) {
staProtocol = station.get(staProtocol.getSiteId());
@@ -341,25 +341,25 @@
// 鏇存柊鍏ュ嚭搴撴ā寮�
private void updateIoMode() throws InterruptedException {
if (this.ioModeOf1F != IoModeType.NONE) {
- if (!siemensS7Net.Write("DB100.180", this.ioModeOf1F.id).IsSuccess) {
+ if (!siemensS7Net.Write("DB100.80", this.ioModeOf1F.id).IsSuccess) {
OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎F1鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={1}", slave.getId()));
log.error("鍐欏叆杈撻�佺嚎1F鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={}", slave.getId());
}
}
if (this.ioModeOf2F != IoModeType.NONE) {
- if (!siemensS7Net.Write("DB100.182", this.ioModeOf2F.id).IsSuccess) {
+ if (!siemensS7Net.Write("DB100.82", this.ioModeOf2F.id).IsSuccess) {
OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎F2鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={1}", slave.getId()));
log.error("鍐欏叆杈撻�佺嚎2F鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={}", slave.getId());
}
}
if (this.ioModeOf3F != IoModeType.NONE) {
- if (!siemensS7Net.Write("DB100.184", this.ioModeOf3F.id).IsSuccess) {
+ if (!siemensS7Net.Write("DB100.84", this.ioModeOf3F.id).IsSuccess) {
OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎F3鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={1}", slave.getId()));
log.error("鍐欏叆杈撻�佺嚎3F鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={}", slave.getId());
}
}
if (this.ioModeOf4F != IoModeType.NONE) {
- if (!siemensS7Net.Write("DB100.186", this.ioModeOf4F.id).IsSuccess) {
+ if (!siemensS7Net.Write("DB100.86", this.ioModeOf4F.id).IsSuccess) {
OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎F4鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={1}", slave.getId()));
log.error("鍐欏叆杈撻�佺嚎4F鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={}", slave.getId());
}
--
Gitblit v1.9.1