From 4871bcf8e6850a4a665c76b1be1fcea67907d9aa Mon Sep 17 00:00:00 2001 From: lty <876263681@qq.com> Date: 星期一, 04 八月 2025 16:20:11 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/SiemensDevpThread.java | 41 ++++++++++++++++++++++++++++------------- 1 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java index 1c45bd3..1148d41 100644 --- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java +++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java @@ -56,23 +56,22 @@ add(108);add(109);add(110);add(111); add(112);add(113);add(114);add(115); add(116);add(117);add(118);add(119); - add(120);add(121);add(122);add(123); - add(124);add(125);add(126);add(127); - add(128);add(129);add(130);add(131); - add(132);add(133);add(134);add(135); - add(136);add(137);add(138);add(139); - add(140);add(141);add(142);add(143); - add(144);add(145);add(146);add(147); - add(148);add(149);add(150);add(151); - add(152);add(153);add(154);add(155); - add(156);add(157);add(158);add(159); - add(160);add(161); - add(1); -// add(200);add(201);add(202); + }}; + + public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{ + add(100);add(101);add(102);add(103); + add(104);add(105);add(106);add(107); + add(108);add(109);add(110);add(111); + }}; + + public static final ArrayList<Integer> BarcodeList = new ArrayList<Integer>() {{ add(0); add(1); add(2); + }}; + public static final ArrayList<Integer> BarcodeListMat = new ArrayList<Integer>() {{ + add(3); add(4); }}; public static final ArrayList<Integer> staNosErrList = new ArrayList<Integer>() {{ add(106); add(107); add(159); @@ -106,6 +105,8 @@ switch (slave.getId()) { case 1: return staNos1; + case 2: + return staNos2; default: throw new CoolException("鏈嶅姟鍣ㄥ紓甯�"); } @@ -299,6 +300,19 @@ } } } + //鏉$爜鎵弿鍣� + ArrayList<Integer> barcodeListMat = BarcodeListMat; + OperateResultExOne<byte[]> result2Mat = siemensS7Net.Read("DB103.0", (short) (barcodeListMat.size() * 30)); + if (result2Mat.IsSuccess) { + for (int i = 0; i < barcodeListMat.size(); i++) { + Integer barcodeId = barcodeListMat.get(i); + String barcode = siemensS7Net.getByteTransform().TransString(result2Mat.Content,i*30,30, "UTF-8"); + BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId + 1); + if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { + barcodeThread.setBarcode(barcode); + } + } + } //澶栧舰妫�娴� ArrayList<Integer> staNoErrs = staNosErrList; int staNoErrsSize = staNoErrs.size(); @@ -411,6 +425,7 @@ Thread.sleep(200); write1 = siemensS7Net.Write("DB100." + (index*6+4), staProtocol.getStaNo().shortValue()); // 鐩爣绔� if(write.IsSuccess && write1.IsSuccess){ + log.error("鍐欏叆杈撻�佺嚎鍛戒护鎴愬姛銆傝緭閫佺嚎plc缂栧彿={}锛岀珯鐐规暟鎹�={},鍐欏叆娆℃暟={}", slave.getId(), JSON.toJSON(staProtocol), writeCount); break; } else { -- Gitblit v1.9.1