From 04ef1a453d35fab8742f185a33d2659f623b038c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <xltys1995>
Date: 星期二, 22 二月 2022 16:32:12 +0800
Subject: [PATCH] Merge branch 'xgmwcs' of http://47.97.1.152:5880/r/zy-wcs into xgmwcs

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   49 ++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 46 insertions(+), 3 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..a0c3c1e 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());
@@ -311,9 +326,8 @@
                 } else {
                     staProtocol = staProtocol.clone();
                 }
-                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
-                    && staProtocol.getWorkNo() > 0 && staProtocol.isPakMk()){
-                    WrkMast wrkMast = wrkMastMapper.selectPickStep(staProtocol.getWorkNo().intValue());
+                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.isPakMk()){
+                    WrkMast wrkMast = wrkMastMapper.selectPickStep(barcode);
                     if (wrkMast == null) {
                         // 鏃犳嫞鏂欐暟鎹�
                         continue;
@@ -1115,6 +1129,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 +1160,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