From c2a92011aace16261edc4274e7308a161206d631 Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期六, 11 三月 2023 16:13:00 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   49 +++++++++++++++++++++++++++++++------------------
 1 files changed, 31 insertions(+), 18 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 95435d8..9d66bd9 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -128,7 +128,7 @@
                         devpThread.setPakMk(staProtocol.getSiteId(), false);
                         // led 寮傚父鏄剧ず
                         if (ledThread != null) {
-                            News.error(methodName +  ":鎵爜澶辫触锛岃閲嶈瘯");
+                            News.error(methodName + ":鎵爜澶辫触锛岃閲嶈瘯");
                             MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
                         }
                         continue;
@@ -163,8 +163,8 @@
                     if (wrkMast != null) {
                         News.error(methodName + ":宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
                         if (ledThread != null) {
-                            News.error(methodName +  ":鎵爜澶辫触锛岃閲嶈瘯");
-                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, "宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={"+ wrkMast.getWrkNo() + "}, 璇锋墜鍔ㄥ彇娑堝凡瀛樺湪宸ヤ綔妗�"));
+                            News.error(methodName + ":鎵爜澶辫触锛岃閲嶈瘯");
+                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, "宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={" + wrkMast.getWrkNo() + "}, 璇锋墜鍔ㄥ彇娑堝凡瀛樺湪宸ヤ綔妗�"));
                         }
                         continue;
                     }
@@ -201,7 +201,7 @@
                             devpThread.setPakMk(staProtocol.getSiteId(), false);
                             boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                             if (!result) {
-                                News.error(methodName  + ":鏇存柊plc绔欑偣淇℃伅澶辫触");
+                                News.error(methodName + ":鏇存柊plc绔欑偣淇℃伅澶辫触");
 
                                 throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触");
                             }
@@ -219,7 +219,7 @@
                                     MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
                                 }
                             }
-                            News.error(methodName  +":璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
+                            News.error(methodName + ":璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response);
 
                         }
 
@@ -344,7 +344,7 @@
                             News.error(methodName + ":鏇存柊宸ヤ綔妗eけ璐ワ紒锛侊紒 [宸ヤ綔鍙凤細{}]", wrkMast.getWrkNo());
                         }
                     } else {
-                        News.error(methodName +":鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
+                        News.error(methodName + ":鍙戝竷鍛戒护鑷宠緭閫佺嚎闃熷垪澶辫触锛侊紒锛� [plc缂栧彿锛歿}]", devp.getId());
                     }
 
                 }
@@ -482,7 +482,7 @@
                         locMast.setLocSts("Q");
                         locMast.setModiTime(new Date());
                         if (!locMastService.updateById(locMast)) {
-                            News.error(methodName+ ":淇敼搴撲綅鐘舵�佸け璐�");
+                            News.error(methodName + ":淇敼搴撲綅鐘舵�佸け璐�");
 
                             throw new CoolException("淇敼搴撲綅鐘舵�佸け璐�");
                         }
@@ -829,20 +829,33 @@
      */
     public synchronized void locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol) {
         String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
-
-        for (CrnSlave.CrnStn crnStn : slave.getCrnOutStn()) {
-            // 鑾峰彇宸ヤ綔鐘舵�佷负11锛堢敓鎴愬嚭搴揑D锛夌殑鍑哄簱宸ヤ綔妗�
-//            WrkMast wrkMast = wrkMastMapper.selectPakOutStep1(slave.getId(), crnStn.getStaNo());
-            List<WrkMast> wrkMasts = wrkMastMapper.selectPakOutStep11(slave.getId(), crnStn.getStaNo());
+        //鎸夌収宸ヤ綔妗e嚭搴�
+        List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
+                .eq("crn_no", slave.getId())
+                .and()
+                .gt("io_type", 100)
+                .orderBy("appe_time")
+        );
+        if (!Cools.isEmpty(wrkMasts)) {
             for (WrkMast wrkMast : wrkMasts) {
-                if (wrkMast == null) {
+                CrnSlave.CrnStn crnStn = null;
+                for (CrnSlave.CrnStn crnStn1 : slave.getCrnOutStn()) {
+                    if (crnStn1.getStaNo() == wrkMast.getSourceStaNo()) {
+                        crnStn = crnStn1;
+                        break;
+                    } else {
+                        continue;
+                    }
+                }
+                if (Cools.isEmpty(crnStn)) {
                     continue;
                 }
                 // 宸ヤ綔妗g姸鎬佸垽鏂�
-                if (wrkMast.getIoType() < 100 || wrkMast.getSourceStaNo() == null) {
-                    News.error(methodName + ":鏌ヨ宸ヤ綔妗f暟鎹笉绗﹀悎鏉′欢--鍏ュ嚭绫诲瀷/绔欑偣, 宸ヤ綔鍙�={}锛屾簮搴撲綅={}锛屽叆鍑虹被鍨�={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getIoType());
+                if (wrkMast.getSourceStaNo() == null) {
+                    log.error("鏌ヨ宸ヤ綔妗f暟鎹笉绗﹀悎鏉′欢--鍏ュ嚭绫诲瀷/绔欑偣, 宸ヤ綔鍙�={}锛屾簮搴撲綅={}锛屽叆鍑虹被鍨�={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getIoType());
                     continue;
                 }
+
                 // 鑾峰彇婧愬簱浣嶄俊鎭�
                 LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo());
                 if (!sourceSta.getLocSts().equals("R") && !sourceSta.getLocSts().equals("P")) {
@@ -959,6 +972,7 @@
                         break;
                     }
                 }
+
             }
         }
     }
@@ -1104,7 +1118,7 @@
         // 鑾峰彇鐩爣搴撲綅淇℃伅
         LocMast sta = locMastService.selectById(wrkMast.getLocNo());
         if (null == sta) {
-            News.error(methodName  + ":宸ヤ綔妗e簱浣嶇Щ杞け璐ワ紝鍘熷洜锛氭绱㈢洰鏍囧簱浣嶅け璐ワ紒宸ヤ綔鍙�={}锛屾簮搴撲綅={}", wrkMast.getWrkNo(), wrkMast.getLocNo());
+            News.error(methodName + ":宸ヤ綔妗e簱浣嶇Щ杞け璐ワ紝鍘熷洜锛氭绱㈢洰鏍囧簱浣嶅け璐ワ紒宸ヤ綔鍙�={}锛屾簮搴撲綅={}", wrkMast.getWrkNo(), wrkMast.getLocNo());
             return;
         }
         // 鑾峰彇鍫嗗灈鏈轰俊鎭� 骞� 鍒ゆ柇鏄惁鍙叆鍑�
@@ -1524,7 +1538,7 @@
                 ledCommand.setIoType(wrkMast.getIoType());
                 ledCommand.setTitle(wrkMast.getIoType$());
 
-                switch (wrkMast.getIoType()){
+                switch (wrkMast.getIoType()) {
                     case 10:
                     case 110:
                         ledCommand.setEmptyMk(true);
@@ -2117,7 +2131,6 @@
 //
 //
 //    }
-
     public synchronized void outOfDevp() {
         List<WrkMast> wrkMasts = wrkMastMapper.selectPick();
         for (WrkMast wrkMast : wrkMasts) {

--
Gitblit v1.9.1