From 54c965b6e35719dbbf4a538dc137e1c42e450ea0 Mon Sep 17 00:00:00 2001 From: yxFwq <1> Date: 星期二, 19 十一月 2024 08:55:49 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/SiemensDevpThread.java | 30 +++++++++++++++++++++++++----- 1 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java index f005729..1d2f54c 100644 --- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java +++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java @@ -356,7 +356,7 @@ if (result2.IsSuccess) { int[] staNosRgv = new int[]{281,292,173,214,120}; if (slave.getId()==2){ - staNosRgv = new int[]{453,460,508,534,611}; + staNosRgv = new int[]{453,460,518,532,607}; } for (int i = 0; i < barcodeSize; i++) { //1:281 2:292 3:174(173) 4:214 5:120 @@ -371,6 +371,21 @@ } staProtocol.setBarcode(barcode); barcodeThread.setBarcode(barcode); + } + } + } + + if (slave.getId()==2){ + OperateResultExOne<byte[]> result464 = siemensS7Net.Read("DB101.3720",(short)(8)); + if (result464.IsSuccess) { + String barcode = siemensS7Net.getByteTransform().TransString(result464.Content,0,8, "UTF-8"); + BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 11); + if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { + StaProtocol staProtocol = station.get(464); + if (null != staProtocol) { + staProtocol.setBarcode(barcode); + barcodeThread.setBarcode(barcode); + } } } } @@ -401,9 +416,13 @@ basDevps.add(staProtocol.toSqlModel()); } - BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); - if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) { - throw new Exception("鏇存柊鏁版嵁搴撴暟鎹け璐�"); + try{ + BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class); + if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) { + throw new Exception("鏇存柊鏁版嵁搴撴暟鎹け璐�"); + } + } catch (Exception e){ + log.error("鏇存柊鏁版嵁搴撴暟鎹け璐� ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); } } catch (Exception e) { e.printStackTrace(); @@ -1021,9 +1040,10 @@ * 璁剧疆鍏ュ簱鏍囪 */ @Override - public void setPakMk(Integer siteId, boolean pakMk) { + public void setPakMk(Integer siteId, boolean pakMk,Integer i) { StaProtocol staProtocol = station.get(siteId); if (null != staProtocol) { + log.info("閿佸畾鍏ュ簱鏍囪锛岀珯鐐瑰彿={};pakMk={};鏃堕棿={};鏍囪={}",siteId,pakMk,new Date(),i); staProtocol.setPakMk(pakMk); } } -- Gitblit v1.9.1