From 01a2d01abeadef5488a100ddf58a22dbcf7b95d6 Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期二, 23 四月 2024 20:18:03 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/SiemensDevpThread.java | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java index 221619e..18f3eef 100644 --- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java +++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java @@ -143,6 +143,18 @@ add(4010);add(4016); }}; + public static final ArrayList<Integer> errorStaNos1 = new ArrayList<Integer>() {{ + add(1002);add(1012); + }}; + + public static final ArrayList<Integer> errorStaNos2 = new ArrayList<Integer>() {{ + add(2107); + }}; + + public static final ArrayList<Integer> errorStaNos4 = new ArrayList<Integer>() {{ + add(3007);add(3012); + }}; + /** * 鏉$爜鏁伴噺 */ @@ -195,6 +207,19 @@ return writeStaNos5; case 6: return writeStaNos6; + default: + throw new CoolException("鑾峰彇绔欑偣澶辫触锛�"); + } + } + + private ArrayList<Integer> getErrorStaNo() { + switch (slave.getId()) { + case 1: + return errorStaNos1; + case 2: + return errorStaNos2; + case 4: + return errorStaNos4; default: throw new CoolException("鑾峰彇绔欑偣澶辫触锛�"); } @@ -313,6 +338,26 @@ } } + //鎶ヨ淇℃伅 + Thread.sleep(200); + OperateResultExOne<byte[]> result3 = null; + result3 = siemensS7Net.Read("DB101.200.0", (short) (getErrorStaNo().size() * 4)); + if (result3.IsSuccess) { + for (int i = 0; i < getErrorStaNo().size(); i++) { + Integer siteId = getErrorStaNo().get(i); // 绔欑偣缂栧彿 + StaProtocol staProtocol = station.get(siteId); +// staProtocol.setLocType1(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4)); // 搴撲綅楂樺害 + boolean[] status = siemensS7Net.getByteTransform().TransBool(result3.Content, i*4+2, 1); + staProtocol.setFrontErr(status[0]); + staProtocol.setBackErr(status[1]); + staProtocol.setHighErr(status[2]); + staProtocol.setLeftErr(status[3]); + staProtocol.setRightErr(status[4]); + staProtocol.setWeightErr(status[5]); + staProtocol.setBarcodeErr(status[6]); + } + } + if (result.IsSuccess && !Cools.isEmpty(result1) && result1.IsSuccess) { OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), slave.getId())); -- Gitblit v1.9.1