From b427e1d0102d4b3b4263c7c6e572f29f9c50bef9 Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期四, 08 五月 2025 11:01:04 +0800
Subject: [PATCH] 初始化
---
src/main/java/com/zy/core/thread/SiemensDevpThread.java | 51 ++++++++++++++-------------------------------------
1 files changed, 14 insertions(+), 37 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index 0df27dd..be7d3ac 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -172,7 +172,7 @@
*/
private void read() throws InterruptedException {
// // 鏇存柊鍏ュ嚭搴撴ā寮�
- updateIoMode();
+// updateIoMode();
ArrayList<Integer> staNos = getStaNo();
int staNoSize = staNos.size();
OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize*8));
@@ -207,15 +207,18 @@
//澶栧舰妫�娴�
OperateResultExOne<byte[]> resultErr1 = siemensS7Net.Read("DB101.702.0", (short) (barcodeSize*1));
- StaProtocol staProtocol1 = station.get(101);
- boolean[] status1 = siemensS7Net.getByteTransform().TransBool(resultErr1.Content, 0, 1);
- staProtocol1.setFrontErr(status1[0]);
- staProtocol1.setBackErr(status1[1]);
- staProtocol1.setHighErr(status1[2]);
- staProtocol1.setLeftErr(status1[3]);
- staProtocol1.setRightErr(status1[4]);
- staProtocol1.setWeightErr(status1[5]);
- staProtocol1.setBarcodeErr(status1[6]);
+ if(resultErr1.IsSuccess){
+ StaProtocol staProtocol1 = station.get(101);
+ boolean[] status1 = siemensS7Net.getByteTransform().TransBool(resultErr1.Content, 0, 1);
+ staProtocol1.setFrontErr(status1[0]);
+ staProtocol1.setBackErr(status1[1]);
+ staProtocol1.setHighErr(status1[2]);
+ staProtocol1.setLeftErr(status1[3]);
+ staProtocol1.setRightErr(status1[4]);
+ staProtocol1.setWeightErr(status1[5]);
+ staProtocol1.setBarcodeErr(status1[6]);
+
+ }
Thread.sleep(200);
if(slave.getId()==1) {
@@ -291,33 +294,7 @@
}
}
- // 鏇存柊鍏ュ嚭搴撴ā寮�
- private void updateIoMode() throws InterruptedException {
- if (this.ioModeOf1F != IoModeType.NONE) {
- 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.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.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.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