From 38af05d7c80936abcdfa81b8209666a68f73276b Mon Sep 17 00:00:00 2001 From: whycq <913841844@qq.com> Date: 星期日, 19 二月 2023 13:20:23 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/SiemensDevpThread.java | 71 +++++++++++++++++------------------ 1 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java index dfc1b4d..075c113 100644 --- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java +++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java @@ -162,23 +162,23 @@ } staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*2)); // 宸ヤ綔鍙� - staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*2)); // 鐩爣绔� +// staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*2)); // 鐩爣绔� } } -// Thread.sleep(200); -// OperateResultExOne<byte[]> result0 = siemensS7Net.Read("DB101.0", (short) 186); -// if (result0.IsSuccess) { -// for (int i = 0; i < 93; 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.setStaNo(siemensS7Net.getByteTransform().TransInt16(result0.Content, i*2)); // 鐩爣绔� -// } -// } + Thread.sleep(200); + OperateResultExOne<byte[]> result0 = siemensS7Net.Read("DB101.0", (short) (staNoSize*2)); + if (result0.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.setStaNo(siemensS7Net.getByteTransform().TransInt16(result0.Content, i*2)); // 鐩爣绔� + } + } Thread.sleep(200); OperateResultExOne<byte[]> result1 = null; result1 = siemensS7Net.Read("DB102.100", (short) (staNoSize * 2)); @@ -193,9 +193,8 @@ staProtocol.setOutEnable(status[3]);// 鍙嚭 staProtocol.setEmptyMk(status[4]); // 绌烘澘淇″彿 staProtocol.setFullPlt(status[5]); // 婊℃墭鐩� - staProtocol.setHigh(status[6]); // 楂樺簱浣� 鎹蜂赴闀挎墭鐩� - staProtocol.setLow(status[7]); // 浣庡簱浣� 鎹蜂赴鐭� - // 鎵樼洏 + staProtocol.setHigh(status[6]); // 楂樺簱浣� 鎹蜂赴澶ф墭鐩� + staProtocol.setLow(status[7]); // 浣庡簱浣� 鎹蜂赴灏忔墭鐩� if (!staProtocol.isPakMk() && !staProtocol.isLoading()) { staProtocol.setPakMk(true); @@ -204,18 +203,18 @@ } //鏉$爜鎵弿鍣� - Thread.sleep(200); - OperateResultExOne<byte[]> result2 = null; - result2 = siemensS7Net.Read("DB100.200",(short)(barcodeSize*16)); - if (result2.IsSuccess) { - for (int i = 0; i < barcodeSize; i++) { - String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*16,8, "UTF-8"); - BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, slave.getId() == 1 ? i + 1 : i + 3); - if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { - barcodeThread.setBarcode(barcode); - } - } - } + //Thread.sleep(200); + //OperateResultExOne<byte[]> result2 = null; + //result2 = siemensS7Net.Read("DB100.200",(short)(barcodeSize*16)); + //if (result2.IsSuccess) { + // for (int i = 0; i < barcodeSize; i++) { + // String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*16,8, "UTF-8"); + // BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, slave.getId() == 1 ? i + 1 : i + 3); + // if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) { + // barcodeThread.setBarcode(barcode); + // } + // } + //} // //RGV灏忚溅 // Thread.sleep(200); @@ -308,37 +307,37 @@ } if (slave.getId() == 2 && this.ioModeOf1F3 != IoModeType.NONE) { if (!siemensS7Net.Write("DB100.300", this.ioModeOf1F3.id).IsSuccess) { - OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎1F3鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={1}", slave.getId())); + OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎1F3鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={2}", slave.getId())); log.error("鍐欏叆杈撻�佺嚎1F3鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={}", slave.getId()); } } if (slave.getId() == 2 && this.ioModeOf1F4 != IoModeType.NONE) { if (!siemensS7Net.Write("DB100.302", this.ioModeOf1F4.id).IsSuccess) { - OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎1F4鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={1}", slave.getId())); + OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎1F4鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={2}", slave.getId())); log.error("鍐欏叆杈撻�佺嚎1F4鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={}", slave.getId()); } } if (slave.getId() == 2 && this.ioModeOf2F1 != IoModeType.NONE) { if (!siemensS7Net.Write("DB100.304", this.ioModeOf2F1.id).IsSuccess) { - OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎2F1鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={1}", slave.getId())); + OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎2F1鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={2}", slave.getId())); log.error("鍐欏叆杈撻�佺嚎2F1鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={}", slave.getId()); } } if (slave.getId() == 2 && this.ioModeOf2F2 != IoModeType.NONE) { if (!siemensS7Net.Write("DB100.306", this.ioModeOf2F2.id).IsSuccess) { - OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎2F2鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={1}", slave.getId())); + OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎2F2鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={2}", slave.getId())); log.error("鍐欏叆杈撻�佺嚎2F2鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={}", slave.getId()); } } if (slave.getId() == 2 && this.ioModeOf3F1 != IoModeType.NONE) { if (!siemensS7Net.Write("DB100.308", this.ioModeOf3F1.id).IsSuccess) { - OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎3F1鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={1}", slave.getId())); + OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎3F1鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={2}", slave.getId())); log.error("鍐欏叆杈撻�佺嚎3F1鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={}", slave.getId()); } } if (slave.getId() == 2 && this.ioModeOf3F2 != IoModeType.NONE) { if (!siemensS7Net.Write("DB100.310", this.ioModeOf3F2.id).IsSuccess) { - OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎3F2鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={1}", slave.getId())); + OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆戝啓鍏ヨ緭閫佺嚎3F2鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={2}", slave.getId())); log.error("鍐欏叆杈撻�佺嚎3F2鍏ュ嚭搴撴ā寮忓け璐ャ�傝緭閫佺嚎plc缂栧彿={}", slave.getId()); } } -- Gitblit v1.9.1