From 094183c425fd1fd58b7b006247558fe97dd449b8 Mon Sep 17 00:00:00 2001 From: cpT <1@123> Date: 星期二, 01 七月 2025 11:37:18 +0800 Subject: [PATCH] #改造 --- src/main/java/com/zy/core/thread/SiemensDevpThread.java | 35 +++++++++++++++++++++++++---------- 1 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java index 890e381..4756a9a 100644 --- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java +++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java @@ -352,7 +352,6 @@ // Thread.sleep(50); OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB400.148.0",(short) (staW.length*4)); - OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.922.0",(short) (staW.length*4)); if (result3.IsSuccess) { for (int i = 0; i < staW.length; i++) { Integer siteId = staW[i]; // 绔欑偣缂栧彿 @@ -370,18 +369,34 @@ staProtocol.setRightErr(status[4]); // 鍙宠秴闄� staProtocol.setWeightErr(status[5]); // 瓒呴噸 staProtocol.setBarcodeErr(status[6]); // 鎵爜澶辫触 - if (resultErr.IsSuccess){ - boolean[] statusErr = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i*4 + 2, 2); + } + } + + try{ + OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.922.0",(short) (staNoSize*4)); + if (resultErr.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.setSiteId(siteId); + boolean[] statusErr = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i*4, 1); staProtocol.setErrOther1(statusErr[0]); // 鐢佃矾淇濇姢鍣ㄦ柇寮� - staProtocol.setErrOther1(statusErr[1]); // 鍏夌數寮傚父 - staProtocol.setErrOther1(statusErr[2]); // 杩愯瓒呮椂 - staProtocol.setErrOther1(statusErr[3]); // 鍗犱綅瓒呮椂 - staProtocol.setErrOther1(statusErr[4]); // 鏈変换鍔℃棤璐ф晠闅� - staProtocol.setErrOther1(statusErr[5]); // 鍙橀鍣ㄦ晠闅� - staProtocol.setErrOther1(statusErr[6]); // 鎺ヨЕ鍣ㄦ晠闅� - staProtocol.setErrOther1(statusErr[7]); // 椤跺崌鐢垫満鎺ヨЕ鍣ㄦ晠闅� + staProtocol.setErrOther2(statusErr[1]); // 鍏夌數寮傚父 + staProtocol.setErrOther3(statusErr[2]); // 杩愯瓒呮椂 + staProtocol.setErrOther4(statusErr[3]); // 鍗犱綅瓒呮椂 + staProtocol.setErrOther5(statusErr[4]); // 鏈変换鍔℃棤璐ф晠闅� + staProtocol.setErrOther6(statusErr[5]); // 鍙橀鍣ㄦ晠闅� + staProtocol.setErrOther7(statusErr[6]); // 鎺ヨЕ鍣ㄦ晠闅� + staProtocol.setErrOther8(statusErr[7]); // 椤跺崌鐢垫満鎺ヨЕ鍣ㄦ晠闅� } } + } catch (Exception e){ + } if (result.IsSuccess) { -- Gitblit v1.9.1