From a439542ebcd5466ebc544741bca13d82955580ce Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期二, 22 二月 2022 16:18:24 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 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 19460b6..d32e861 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -303,6 +303,21 @@
         for (DevpSlave devp : slaveProperties.getDevp()) {
             // 閬嶅巻鎷f枡鍏ュ簱鍙�
             for (DevpSlave.Sta pickSta : devp.getPickSta()) {
+                // 鑾峰彇鏉$爜鎵弿浠俊鎭�
+                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, pickSta.getBarcode());
+                if (barcodeThread == null) {
+                    continue;
+                }
+                String barcode = barcodeThread.getBarcode();
+                if(!Cools.isEmpty(barcode)) {
+                    log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", pickSta.getBarcode(), barcode);
+                    if("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+                        continue;
+                    }
+                } else {
+                    continue;
+                }
+
                 // 鑾峰彇鎷f枡鍏ュ簱绔欎俊鎭�
                 DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                 StaProtocol staProtocol = devpThread.getStation().get(pickSta.getStaNo());
@@ -1115,6 +1130,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);
                 }
             }
 
@@ -1144,6 +1161,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());

--
Gitblit v1.9.1