From f18dee1034da10cdd537f4cef94a6bcbe141c6a8 Mon Sep 17 00:00:00 2001 From: Administrator <pjb> Date: 星期四, 05 六月 2025 18:13:45 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/glccwcs' into glccwcs --- src/main/java/com/zy/core/thread/SiemensDevpThread.java | 27 +++++++++++++++++---------- 1 files changed, 17 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 066b51e..af6d15e 100644 --- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java +++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java @@ -252,14 +252,14 @@ } // 璇诲彇姝i潰鏉$爜 - OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB103.0", (short) (5 * 40)); - if (result3.IsSuccess) { + OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB103.0", (short) (5 * 40)); + if (result2.IsSuccess) { for (int i = 0; i < 5; i++) { - String barcode = siemensS7Net.getByteTransform().TransString(result3.Content, i * 40, 40, "UTF-8"); + String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 40, 40, "UTF-8"); if(!Cools.isEmpty()){ barcode = barcode.trim(); } - List<String> barcodeList = Arrays.stream(barcode.split(";")).collect(Collectors.toList()); + List<String> barcodeList = Arrays.stream(barcode.split(",")).collect(Collectors.toList()); Iterator<String> iterator = barcodeList.iterator(); while (iterator.hasNext()){ String next = iterator.next(); @@ -270,7 +270,7 @@ } } - BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i+1); + BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i); if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { barcodeThread.setBarcode(barcode); } @@ -482,14 +482,14 @@ // 鐩爣绔欏湴鍧� String staNoAddress; // 楂樺害绫诲瀷鍦板潃 - String heightAddress; + String heightAddress = null; if (index < 16) { workNoAddress = "DB100." + index * 4; staNoAddress = "DB100." + (index * 4 + 2); - heightAddress = "DB104." + (index * 4 + 2); + heightAddress = "DB104." + (index * 4); } else { - workNoAddress = "DB100." + (400 + (index-16) * 4); - staNoAddress = "DB100." + (400 + (index-16) * 4 + 2); + workNoAddress = "DB100." + (400 + (index - 16) * 4); + staNoAddress = "DB100." + (400 + (index - 16) * 4 + 2); } OperateResult writeResult; @@ -499,7 +499,14 @@ boolean writeFlag = false; while (writeCount < 5) { OperateResult writeResult1 = siemensS7Net.Write(workNoAddress, staProtocol.getWorkNo()); // 宸ヤ綔鍙� - OperateResult writeResult2 = siemensS7Net.Write(staNoAddress, staProtocol.getStaNo()); // 鐩爣绔� + OperateResult writeResult2 = siemensS7Net.Write(staNoAddress, staProtocol.getStaNo());// 鐩爣绔� + if (!Cools.isEmpty(staProtocol.getHeight()) && heightAddress != null) { + OperateResult writeResult3 = siemensS7Net.Write(heightAddress, Short.valueOf(staProtocol.getHeight())); // 楂樺害绫诲瀷 + if (!writeResult3.IsSuccess) { + log.error("鍐欏叆杈撻�佺嚎鍛戒护澶辫触锛屽皾璇曢噸鏂板啓鍏ワ紝杈撳叆鍙傛暟={}锛岃緭鍑哄弬鏁�={}", JSON.toJSON(staProtocol), writeResult3);// 鍐欏叆杈撻�佺嚎鍛戒护澶辫触锛屽皾璇曢噸鏂板啓鍏ワ紝杈撳叆鍙傛暟={}锛岃緭鍑哄弬鏁�={}", JSON.toJSON(staProtocol), writeResult3); + writeResult3 = siemensS7Net.Write(heightAddress, staProtocol.getHeight()); // 楂樺害绫诲瀷 + } + } if (writeResult1.IsSuccess && writeResult2.IsSuccess) { Thread.sleep(200); OperateResultExOne<byte[]> readResult = siemensS7Net.Read("DB100." + index * 4, (short) 2); -- Gitblit v1.9.1