From f11edf2a41cd186ce46581f0b72ebccfc650674f Mon Sep 17 00:00:00 2001
From: zc <zc@123>
Date: 星期四, 24 四月 2025 14:02:14 +0800
Subject: [PATCH] 初步调试

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   86 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 76 insertions(+), 10 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 42bebb2..892adf2 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -34,6 +34,7 @@
 import com.zy.core.model.protocol.StaProtocol;
 import com.zy.core.properties.SlaveProperties;
 import com.zy.core.thread.DevpThread;
+import com.zy.core.thread.LedThread;
 import com.zy.core.thread.LiftThread;
 import com.zy.core.thread.ShuttleThread;
 import com.zy.core.thread.impl.FyDevpThread;
@@ -177,12 +178,41 @@
                         staProtocol = staProtocol.clone();
                     }
                     Short workNo = staProtocol.getWorkNo();
+                    // 灏哄妫�娴嬪紓甯�
+                    boolean back = false;
+                    LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
+                    String errMsg = "";
+                    if (!back && staProtocol.isBackErr()) {
+                        errMsg = "瓒呭寮傚父";
+                        back = true;
+                    }
+                    if (!back && staProtocol.isHighErr()) {
+                        errMsg = "瓒呴珮寮傚父";
+                        back = true;
+                    }
+                    if (!back && staProtocol.isRightErr()) {
+                        errMsg = "瓒呴暱寮傚父";
+                        back = true;
+                    }
+                    if (!back && staProtocol.isWeightErr()) {
+                        errMsg = "瓒呴噸";
+                        back = true;
+                    }
+                    // 閫�鍥�
+                    if (back) {
+                        if (!staProtocol.isLoading()) {
+                            continue;
+                        }
+                        if (!staProtocol.isPakMk()) {
+                            continue;
+                        }
+                        // led 寮傚父鏄剧ず
+                        if (ledThread != null) {
+                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
+                            ledThread.error(errMsg);
+                        }
+                    }
 
-//                        // led 寮傚父鏄剧ず
-//                        LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
-//                        if (ledThread != null) {
-//                            ledThread.error(errMsg);
-//                        }
                     // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
                     if (staProtocol.isAutoing() && staProtocol.isLoading() && isInEnable(devpThread, inSta.getStaNo()) && !staProtocol.isEmptyMk() && (workNo == 0 || (workNo >= 9990 && workNo <= 9999)) && staProtocol.isPakMk()) {
                         String barcode = staProtocol.getBarcode();
@@ -426,8 +456,12 @@
         ShuttleProtocol status1 = shuttleThread1.getStatus();
         ShuttleProtocol status2 = shuttleThread2.getStatus();
         List<String> loc = new ArrayList<>();
-        loc.add(status1.getCurrentLocNo());
-        loc.add(status2.getCurrentLocNo());
+        if (status1 != null) {
+            loc.add(status1.getCurrentLocNo());
+        }
+        if (status2 != null) {
+            loc.add(status2.getCurrentLocNo());
+        }
         DevpSlave devpSlave = slaveProperties.getDevp().get(0);
         // 閬嶅巻鍫嗗灈鏈哄嚭搴撶珯
         DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devpSlave.getId());
@@ -848,7 +882,39 @@
             if (staProtocol == null) {
                 return false;
             }
-
+            int led = 1;
+            if (wrkMast.getSourceStaNo() == 1022) {
+                led = 3;
+            } else if (wrkMast.getSourceStaNo() == 1031) {
+            }
+            // 灏哄妫�娴嬪紓甯�
+            boolean back = false;
+            LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, led);
+            String errMsg = "";
+            if (!back && staProtocol.isBackErr()) {
+                errMsg = "瓒呭寮傚父";
+                back = true;
+            }
+            if (!back && staProtocol.isHighErr()) {
+                errMsg = "瓒呴珮寮傚父";
+                back = true;
+            }
+            if (!back && staProtocol.isRightErr()) {
+                errMsg = "瓒呴暱寮傚父";
+                back = true;
+            }
+            if (!back && staProtocol.isWeightErr()) {
+                errMsg = "瓒呴噸";
+                back = true;
+            }
+            // 閫�鍥�
+            if (back) {
+                // led 寮傚父鏄剧ず
+                if (ledThread != null) {
+                    MessageQueue.offer(SlaveType.Led, led, new Task(3, errMsg));
+                    ledThread.error(errMsg);
+                }
+            }
             if (!staProtocol.isAutoing()) {
                 News.info("{}浠诲姟锛寋}绔欑偣锛屼笉鍦ㄨ嚜鍔ㄧ姸鎬�", wrkMast.getWrkNo(), staProtocol.getSiteId());
                 return false;
@@ -1215,9 +1281,9 @@
             //鑾峰彇鎻愬崌鏈哄懡浠�
             List<LiftCommand> liftCommands = liftThread.getPalletOutCommand(wrkMast.getWrkNo(), sourceLev, wrkMast.getStaNo());
             LiftCommand liftCommand = liftCommands.get(0);
-            if ( wrkMast.getStaNo()==1031){
+            if (wrkMast.getStaNo() == 1031) {
                 liftCommand.setTaskNo(wrkMast.getWrkNo());
-            }else {
+            } else {
                 int deviceWrk = commonService.getWorkNo(8);//鐢熸垚鎻愬崌鏈鸿澶囧伐浣滃彿
                 liftCommand.setTaskNo(deviceWrk);//鏇存崲闅忔満浠诲姟鍙�
             }

--
Gitblit v1.9.1