From c5c1d3745bed9021ce4f90dcaa15c5b25cf4c05c Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期五, 19 一月 2024 21:31:42 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 7 ++- src/main/java/com/zy/common/model/LocTypeDto.java | 8 ++-- src/main/resources/application.yml | 6 +- src/main/java/com/zy/core/ServerBootstrap.java | 70 +++++++++++++++++----------------- 4 files changed, 47 insertions(+), 44 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java index bd0b526..e9f2b31 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -2169,6 +2169,7 @@ */ public synchronized void rgvCompleteWrkMastSta() { try{ + for (DevpSlave devp : slaveProperties.getDevp()) { for (RgvSlave rgvSlave:slaveProperties.getRgv()) { RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, rgvSlave.getId()); RgvProtocol rgvProtocol = rgvThread.getRgvProtocol(); @@ -2209,7 +2210,7 @@ log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{}锛�",rgvProtocol.getRgvNo()); break; } - DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 1); + DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); StaProtocol staProtocol = devpThread.getStation().get(wrkMastSta.getStaEnd()); WrkMast wrkMast = wrkMastMapper.selectPakInStep3(wrkMastSta.getWrkNo().intValue()); if (!Cools.isEmpty(wrkMast)){ @@ -2220,7 +2221,7 @@ staProtocol.setWorkNo(wrkMast.getWrkNo()); staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); devpThread.setPakMk(staProtocol.getSiteId(), false); - if (!MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol))) { + if (!MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol))) { continue; } } @@ -2235,6 +2236,7 @@ log.error("灏忚溅澶嶄綅澶辫触锛屽皬杞﹀彿{},绛夊緟wcs纭浣嗘槸娌℃湁宸ヤ綔鍙凤紒",rgvProtocol.getRgvNo()); } } + } } }catch (Exception e){ log.error("灏忚溅澶嶄綅绾跨▼鎶ラ敊锛�"+e); @@ -2294,6 +2296,7 @@ break; } } + } }catch (Exception e){ log.error("3875琛屾墽琛屽皬杞︽惉杩愪换鍔′笅鍙戝け璐�"); diff --git a/src/main/java/com/zy/common/model/LocTypeDto.java b/src/main/java/com/zy/common/model/LocTypeDto.java index d62d0c8..92ba2b2 100644 --- a/src/main/java/com/zy/common/model/LocTypeDto.java +++ b/src/main/java/com/zy/common/model/LocTypeDto.java @@ -32,11 +32,11 @@ // if (staProtocol.isHigh() == staProtocol.isLow()) { // throw new CoolException("plc楂樹綆妫�娴嬪紓甯�"); // } -// if (staProtocol.isLow()) { + if (staProtocol.getSiteId() == 106){ + this.locType1 = 2; // 楂樺簱浣� + }else { this.locType1 = 1; // 浣庡簱浣� -// } else { -// this.locType1 = 2; // 楂樺簱浣� -// } + } } /** diff --git a/src/main/java/com/zy/core/ServerBootstrap.java b/src/main/java/com/zy/core/ServerBootstrap.java index 2bff72a..520f386 100644 --- a/src/main/java/com/zy/core/ServerBootstrap.java +++ b/src/main/java/com/zy/core/ServerBootstrap.java @@ -134,40 +134,40 @@ public void destroy() { } - @Component - class killThread { +// @Component +// class killThread { +// +// @Scheduled(cron = "0/3 * * * * ? ") +// public void kill() { +// int i = 0; +// for (Map.Entry<CrnThread, Thread> entry : map.entrySet()) { +// i++; +// SiemensCrnThread key = (SiemensCrnThread) entry.getKey(); +//// System.out.println("绗�"+i+"涓爢鍨涙満绾跨▼閲嶅惎绾跨▼鏉′欢锛�"+(System.currentTimeMillis() - key.getSign())); +// if (System.currentTimeMillis() - key.getSign() > 120000) { +// System.out.println("绗�"+i+"涓爢鍨涙満绾跨▼琚噸鍚�"); +// +// // 璇锋眰绾跨▼瀹夊叏鍋滄 +// key.requestStop(); +// +// // 绛夊緟绾跨▼瀹屾垚鍋滄, 鍙互杩欐牱鍋氫篃鍙互閫夋嫨涓嶈繖涔堝仛锛屽彇鍐充簬鏄惁闇�瑕佺瓑寰呯嚎绋嬬粨鏉� +// try { +// entry.getValue().join(20000); // 绛夊緟鏈�澶�20绉� +// } catch (InterruptedException e) { +//// // 鍙�傚綋澶勭悊涓柇 +//// Thread.currentThread().interrupt(); // 淇濈暀涓柇鐘舵�� +// entry.getValue().stop(); +// } +// +// // 閲嶆柊鍚姩绾跨▼ +// Thread thread = new Thread((Runnable) key); // 鍋囪CrnThread瀹炵幇浜哛unnable +// thread.start(); +// +// // 鏇挎崲鏄犲皠鍏崇郴涓殑鏃х嚎绋� +// map.put(entry.getKey(), thread); +// } +// } +// } - @Scheduled(cron = "0/3 * * * * ? ") - public void kill() { - int i = 0; - for (Map.Entry<CrnThread, Thread> entry : map.entrySet()) { - i++; - SiemensCrnThread key = (SiemensCrnThread) entry.getKey(); -// System.out.println("绗�"+i+"涓爢鍨涙満绾跨▼閲嶅惎绾跨▼鏉′欢锛�"+(System.currentTimeMillis() - key.getSign())); - if (System.currentTimeMillis() - key.getSign() > 120000) { - System.out.println("绗�"+i+"涓爢鍨涙満绾跨▼琚噸鍚�"); - - // 璇锋眰绾跨▼瀹夊叏鍋滄 - key.requestStop(); - - // 绛夊緟绾跨▼瀹屾垚鍋滄, 鍙互杩欐牱鍋氫篃鍙互閫夋嫨涓嶈繖涔堝仛锛屽彇鍐充簬鏄惁闇�瑕佺瓑寰呯嚎绋嬬粨鏉� - try { - entry.getValue().join(20000); // 绛夊緟鏈�澶�20绉� - } catch (InterruptedException e) { -// // 鍙�傚綋澶勭悊涓柇 -// Thread.currentThread().interrupt(); // 淇濈暀涓柇鐘舵�� - entry.getValue().stop(); - } - - // 閲嶆柊鍚姩绾跨▼ - Thread thread = new Thread((Runnable) key); // 鍋囪CrnThread瀹炵幇浜哛unnable - thread.start(); - - // 鏇挎崲鏄犲皠鍏崇郴涓殑鏃х嚎绋� - map.put(entry.getKey(), thread); - } - } - } - - } +// } } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 70e315d..6f6f450 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -294,21 +294,21 @@ ip: 10.10.10.249 port: 5005 devpPlcId: ${wcs-slave.devp[0].id} - staArr: 101 + staArr: 100 # LED2 led[1]: id: 2 ip: 10.10.10.248 port: 5005 devpPlcId: ${wcs-slave.devp[0].id} - staArr: 108 + staArr: 106 # LED3 led[2]: id: 3 ip: 10.10.10.247 port: 5005 devpPlcId: ${wcs-slave.devp[0].id} - staArr: 117 + staArr: 107 # LED4 led[3]: id: 4 -- Gitblit v1.9.1