From 10cced415ff3ba1919c08137c50db582d420ffd5 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <xltys1995> Date: 星期二, 22 二月 2022 16:32:00 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 39 ++++++++++++++++++++++++++++++++++----- 1 files changed, 34 insertions(+), 5 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 e753cd9..80947ba 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -7,7 +7,6 @@ import com.core.common.Cools; import com.core.common.DateUtils; import com.core.exception.CoolException; -import com.zy.asrs.domain.enums.WorkNoType; import com.zy.asrs.entity.*; import com.zy.asrs.mapper.BasCrnErrorMapper; import com.zy.asrs.mapper.WaitPakinMapper; @@ -17,11 +16,11 @@ import com.zy.asrs.utils.VersionUtils; import com.zy.common.model.LocTypeDto; import com.zy.common.model.MatDto; +import com.zy.common.model.SearchLocParam; import com.zy.common.model.StartupDto; import com.zy.common.service.CommonService; import com.zy.common.utils.CollectionUtils; import com.zy.common.utils.HttpHandler; -import com.zy.common.model.SearchLocParam; import com.zy.core.CrnThread; import com.zy.core.DevpThread; import com.zy.core.cache.MessageQueue; @@ -1116,6 +1115,8 @@ if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(1, commands))) { log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort()); continue; + } else { + ledThread.setLedMk(false); } } @@ -1145,6 +1146,33 @@ */ @Async public void ledReset() { +// for (LedSlave led : slaveProperties.getLed()) { +// // 鑾峰彇杈撻�佺嚎plc绾跨▼ +// DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId()); +// // 鍛戒护闆嗗悎 +// boolean reset = true; +// for (Integer staNo : led.getStaArr()) { +// // 鑾峰彇鍙夎溅绔欑偣 +// StaProtocol staProtocol = devpThread.getStation().get(staNo); +// if (staProtocol == null) { +// continue; +// } else { +// staProtocol = staProtocol.clone(); +// } +// if (staProtocol.getWorkNo() != 0) { +// reset = false; +// break; +// } +// } +// // 鑾峰彇led绾跨▼ +// LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getDevpPlcId()); +// // led鏄剧ず榛樿鍐呭 +// if (reset) { +// if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) { +// log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort()); +// } +// } +// } for (LedSlave led : slaveProperties.getLed()) { // 鑾峰彇杈撻�佺嚎plc绾跨▼ DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, led.getDevpPlcId()); @@ -1155,8 +1183,6 @@ StaProtocol staProtocol = devpThread.getStation().get(staNo); if (staProtocol == null) { continue; - } else { - staProtocol = staProtocol.clone(); } if (staProtocol.getWorkNo() != 0) { reset = false; @@ -1166,9 +1192,12 @@ // 鑾峰彇led绾跨▼ LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getDevpPlcId()); // led鏄剧ず榛樿鍐呭 - if (reset) { + if (reset && !ledThread.isLedMk()) { + ledThread.setLedMk(true); if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(2, new ArrayList<>()))) { log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort()); + } else { + } } } -- Gitblit v1.9.1