From f278d31676c40fab8b3a8a9f9593470971018639 Mon Sep 17 00:00:00 2001
From: lsh <lsh123456>
Date: 星期一, 09 一月 2023 09:27:53 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  101 +++++++++++++++++---------------------------------
 1 files changed, 34 insertions(+), 67 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 1abe6ed..b609a62 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -105,6 +105,14 @@
                     continue;
                 }
                 String barcode = barcodeThread.getBarcode();
+                if (!Cools.isEmpty(barcode)) {
+                    log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
+                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+                        continue;
+                    }
+                } else {
+                    continue;
+                }
 
                 // 鑾峰彇鍏ュ簱绔欎俊鎭�
                 SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
@@ -113,63 +121,6 @@
                     continue;
                 } else {
                     staProtocol = staProtocol.clone();
-                }
-
-                if (!Cools.isEmpty(barcode)) {
-                    log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
-                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
-                        if (inSta.getStaNo()==101 || inSta.getStaNo()==109 || inSta.getStaNo()==117){
-                            staProtocol.setWorkNo((short)9998);
-                            staProtocol.setStaNo((short)100);
-                            devpThread.setPakMk(staProtocol.getSiteId(), false);
-                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                            if (!result) {
-                                throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
-                            }
-                        }else if (inSta.getStaNo()==201 || inSta.getStaNo()==207 || inSta.getStaNo()==213){
-                            staProtocol.setWorkNo((short)9998);
-                            if (inSta.getStaNo()==201){
-                                staProtocol.setStaNo((short)200);
-                            }else if (inSta.getStaNo()==207){
-                                staProtocol.setStaNo((short)206);
-                            }else if (inSta.getStaNo()==213){
-                                staProtocol.setStaNo((short)212);
-                            }
-                            devpThread.setPakMk(staProtocol.getSiteId(), false);
-                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                            if (!result) {
-                                throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
-                            }
-                        }
-                        continue;
-                    }
-                } else if (staProtocol.getWorkNo()==9999 && staProtocol.isLoading() && !staProtocol.isEmptyMk()){
-                    if (inSta.getStaNo()==101 || inSta.getStaNo()==109 || inSta.getStaNo()==117){
-                        staProtocol.setWorkNo((short)9998);
-                        staProtocol.setStaNo((short)100);
-                        devpThread.setPakMk(staProtocol.getSiteId(), false);
-                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                        if (!result) {
-                            throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
-                        }
-                    }else if (inSta.getStaNo()==201 || inSta.getStaNo()==207 || inSta.getStaNo()==213){
-                        staProtocol.setWorkNo((short)9998);
-                        if (inSta.getStaNo()==201){
-                            staProtocol.setStaNo((short)200);
-                        }else if (inSta.getStaNo()==207){
-                            staProtocol.setStaNo((short)206);
-                        }else if (inSta.getStaNo()==213){
-                            staProtocol.setStaNo((short)212);
-                        }
-                        devpThread.setPakMk(staProtocol.getSiteId(), false);
-                        boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
-                        if (!result) {
-                            throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
-                        }
-                    }
-                    continue;
-                }else {
-                    continue;
                 }
 
                 // 鍏ュ嚭搴撴ā寮忓垽鏂�
@@ -290,8 +241,6 @@
                                 if (!result) {
                                     throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
                                 }
-
-
                             }
                         }
 
@@ -1529,11 +1478,20 @@
             }
             // 鍛戒护涓嬪彂 -------------------------------------------------------------------------------
             if (!commands.isEmpty()) {
-                if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) {
-                    log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
-                    continue;
+                if (led.getId() == 7) {
+                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(3, commands))) {
+                        log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
+                        continue;
+                    } else {
+                        ledThread.setLedMk(false);
+                    }
                 } else {
-                    ledThread.setLedMk(false);
+                    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);
+                    }
                 }
 
             }
@@ -1610,11 +1568,20 @@
             LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led.getId());
             // led鏄剧ず榛樿鍐呭
             if (reset && !ledThread.isLedMk()) {
-                ledThread.setLedMk(true);
-                if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) {
-                    log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
-                } else {
+                if (led.getId() == 7) {
+                    ledThread.setLedMk(true);
+                    if (!MessageQueue.offer(SlaveType.Led, led.getId(), new Task(4, new ArrayList<>()))) {
+                        log.error("{}鍙稬ED鍛戒护涓嬪彂澶辫触锛侊紒锛乕ip锛歿}] [port锛歿}]", led.getId(), led.getIp(), led.getPort());
+                    } else {
 
+                    }
+                } else {
+                    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