From ae0f47d70a1a4d539bf7cb0d69e0375d91ef3f7c Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期四, 06 六月 2024 13:18:56 +0800
Subject: [PATCH] #入库任务BUG修复

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   37 +++++++++++++++++++------------------
 1 files changed, 19 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 13036b1..ee3a651 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -10,6 +10,7 @@
 import com.zy.asrs.entity.*;
 import com.zy.asrs.mapper.*;
 import com.zy.asrs.service.*;
+import com.zy.asrs.utils.CodeDetectionUtil;
 import com.zy.asrs.utils.RouteUtils;
 import com.zy.asrs.utils.Utils;
 import com.zy.asrs.utils.VersionUtils;
@@ -125,7 +126,7 @@
 
                 if (!Cools.isEmpty(barcode)) {
 //                    log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
-                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
                         continue;
                     }
                 } else {
@@ -294,7 +295,7 @@
 
                 if (!Cools.isEmpty(barcode)) {
 //                    log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
-                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
                         continue;
                     }
                 } else {
@@ -366,7 +367,7 @@
                         && staProtocol.getWorkNo() == 0
                         && staProtocol.isPakMk()) {// && !Cools.isEmpty(barcode)) {
 
-                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
                         log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
 //                        //鏉$爜涓虹┖鎴栬�呬笉绗﹀悎锛岄��搴撳埌172绔欑偣
 //                        staProtocol.setWorkNo((short)32222);
@@ -463,7 +464,7 @@
 
                 if (!Cools.isEmpty(barcode)) {
 //                    log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
-                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+                    if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
                         continue;
                     }
                 } else {
@@ -535,7 +536,7 @@
                         && staProtocol.getWorkNo() == 0
                         && staProtocol.isPakMk()) {// && !Cools.isEmpty(barcode)) {
 
-                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode)) {
+                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || !CodeDetectionUtil.barcodeDetection(barcode)) {
                         log.info("{}鍙锋潯鐮佹壂鎻忓櫒妫�娴嬫潯鐮佷俊鎭細{}", inSta.getBarcode(), barcode);
 //                        //鏉$爜涓虹┖鎴栬�呬笉绗﹀悎锛岄��搴撳埌172绔欑偣
 //                        staProtocol.setWorkNo((short)32222);
@@ -1926,8 +1927,8 @@
                 log.error("鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
                 continue;
             }
-            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
-                    && staDetl.getCanining() != null && staDetl.getCanining().equals("Y")) {
+            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo().equals(wrkMast.getWrkNo())
+                    && staProtocol.isInEnable() && staDetl.getCanining() != null && staDetl.getCanining().equals("Y")) {
                 flag = true;
             }
             if (!flag) {
@@ -2017,9 +2018,9 @@
             crnCommand.setSourcePosX(crnStn.getRow().shortValue());     // 婧愬簱浣嶆帓
             crnCommand.setSourcePosY(crnStn.getBay().shortValue());     // 婧愬簱浣嶅垪
             crnCommand.setSourcePosZ(crnStn.getLev().shortValue());     // 婧愬簱浣嶅眰
-            crnCommand.setDestinationPosX(locMast.getRow1().shortValue());     // 鐩爣搴撲綅鎺�
-            crnCommand.setDestinationPosY(locMast.getBay1().shortValue());     // 鐩爣搴撲綅鍒�
-            crnCommand.setDestinationPosZ(locMast.getLev1().shortValue());     // 鐩爣搴撲綅灞�
+            crnCommand.setDestinationPosX((short)0);     // 鐩爣搴撲綅鎺�
+            crnCommand.setDestinationPosY((short)0);     // 鐩爣搴撲綅鍒�
+            crnCommand.setDestinationPosZ((short)0);     // 鐩爣搴撲綅灞�
             if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(crnStation==1? 2:5, crnCommand))) {
                 log.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
             } else {
@@ -2079,8 +2080,8 @@
                 log.error("鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
                 continue;
             }
-            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
-                    && staDetl.getCanining() != null && staDetl.getCanining().equals("Y")) {
+            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo().equals(wrkMast.getWrkNo())
+                    && staProtocol.isInEnable() && staDetl.getCanining() != null && staDetl.getCanining().equals("Y")) {
                 flag = true;
             }
 
@@ -2206,8 +2207,8 @@
                 log.error("鍏ュ簱 ===>> 鍫嗗灈鏈虹珯鐐瑰湪鏁版嵁搴撲笉瀛樺湪, 绔欑偣缂栧彿={}", crnStn.getStaNo());
                 continue;
             }
-            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
-                    && staDetl.getCanining() != null && staDetl.getCanining().equals("Y")) {
+            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo().equals(wrkMast.getWrkNo())
+                    && staProtocol.isInEnable() && staDetl.getCanining() != null && staDetl.getCanining().equals("Y")) {
                 flag = true;
             }
             if (!flag) {
@@ -2332,7 +2333,7 @@
                 // 鑾峰彇婧愬簱浣嶄俊鎭�
                 LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo());
                 if (!sourceSta.getLocSts().equals("R") && !sourceSta.getLocSts().equals("P")) {
-                    log.error("鍑哄簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getLocNo(), sourceSta.getLocSts());
+                    log.error("鍑哄簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getSourceLocNo(), sourceSta.getLocSts());
                     continue;
                 }
                 // 鑾峰彇鍫嗗灈鏈哄嚭搴撶珯淇℃伅
@@ -2486,7 +2487,7 @@
             // 鑾峰彇婧愬簱浣嶄俊鎭�
             LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo());
             if (!sourceSta.getLocSts().equals("R") && !sourceSta.getLocSts().equals("P")) {
-                log.error("鍑哄簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getLocNo(), sourceSta.getLocSts());
+                log.error("鍑哄簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getSourceLocNo(), sourceSta.getLocSts());
                 continue;
             }
             // 鑾峰彇鍫嗗灈鏈哄嚭搴撶珯淇℃伅
@@ -2646,7 +2647,7 @@
             // 鑾峰彇婧愬簱浣嶄俊鎭�
             LocMast sourceSta = locMastService.selectById(wrkMastCrn.getSourceLocNo());
             if (!sourceSta.getLocSts().equals("R") && !sourceSta.getLocSts().equals("P")) {
-                log.error("鍑哄簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMastCrn.getLocNo(), sourceSta.getLocSts());
+                log.error("鍑哄簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMastCrn.getSourceLocNo(), sourceSta.getLocSts());
                 continue;
             }
             // 鑾峰彇鍫嗗灈鏈哄嚭搴撶珯淇℃伅
@@ -2788,7 +2789,7 @@
             // 鑾峰彇婧愬簱浣嶄俊鎭�
             LocMast sourceSta = locMastService.selectById(wrkMast.getSourceLocNo());
             if (!sourceSta.getLocSts().equals("R") && !sourceSta.getLocSts().equals("P")) {
-                log.error("鍑哄簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getLocNo(), sourceSta.getLocSts());
+                log.error("鍑哄簱鎿嶄綔搴撲綅鐘舵�佷笉绗﹀悎--鐘舵��, 搴撲綅鍙�={}锛屽簱浣嶇姸鎬�={}", wrkMast.getSourceLocNo(), sourceSta.getLocSts());
                 continue;
             }
             // 鑾峰彇鍫嗗灈鏈哄嚭搴撶珯淇℃伅

--
Gitblit v1.9.1