From d1cff38b67687ef4b5d7dfddc4f7d070c879f2f5 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 25 十月 2023 13:21:28 +0800
Subject: [PATCH] #redis锁(暂时认定的bug)

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 50 insertions(+), 4 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 443f207..cecad4c 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -108,6 +108,8 @@
     private BasLiftOptService basLiftOptService;
     @Autowired
     private ConfigService configService;
+    @Autowired
+    private NavigateMapUtils navigateMapUtils;
 
 
     /**
@@ -2067,6 +2069,7 @@
                                 //瑕嗙洊宸ヤ綔妗g洰鏍囩珯
                                 wrkMast.setStaNo(targetSta.intValue());
                                 wrkMast.setShuttleNo(null);//閲婃斁灏忚溅
+                                wrkMast.setLiftNo(null);//閲婃斁鎻愬崌鏈�
                                 if (wrkMastMapper.updateById(wrkMast) > 0) {
                                     //鍚�300绔欏啓鍏ョ洰鏍囩珯
                                     staProtocol = staProtocol.clone();
@@ -2088,6 +2091,7 @@
 //                        //瑕嗙洊宸ヤ綔妗g洰鏍囩珯
 //                        wrkMast.setStaNo(targetSta.intValue());
 //                        wrkMast.setShuttleNo(null);//閲婃斁灏忚溅
+//                        wrkMast.setLiftNo(null);//閲婃斁鎻愬崌鏈�
 //                        if (wrkMastMapper.updateById(wrkMast) > 0) {
 //                            //鍚�300绔欏啓鍏ョ洰鏍囩珯
 //                            staProtocol = staProtocol.clone();
@@ -2159,9 +2163,9 @@
                 continue;
             }
 
-            if (staProtocol309.isAutoing() && staProtocol309.isLoading()) {
+            if (staProtocol309.isAutoing() && staProtocol309.isLoading() && staProtocol309.isInEnable()) {
                 // 鑾峰彇鏉$爜鎵弿浠俊鎭�
-                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 11);//308绔欐潯鐮佸櫒
+                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 9);//308绔欐潯鐮佸櫒
                 if (barcodeThread == null) {
                     continue;
                 }
@@ -2169,10 +2173,13 @@
                 if(!Cools.isEmpty(barcode)) {
                     //閫氱煡AGV鍙栬揣
                     agvRestockCall("CS-301-001-01@3", barcode);
+                    log.info("閫氱煡AGV鍙栬揣锛屾潯鐮佸彿锛�" + barcode);
                 }
-            } else if (staProtocol312.isAutoing() && staProtocol312.isLoading()) {
+            }
+
+            if (staProtocol312.isAutoing() && staProtocol312.isLoading() && staProtocol312.isInEnable()) {
                 // 鑾峰彇鏉$爜鎵弿浠俊鎭�
-                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 12);//311绔欐潯鐮佸櫒
+                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 10);//311绔欐潯鐮佸櫒
                 if (barcodeThread == null) {
                     continue;
                 }
@@ -2180,6 +2187,7 @@
                 if(!Cools.isEmpty(barcode)) {
                     //閫氱煡AGV鍙栬揣
                     agvRestockCall("CS-302-001-01@3", barcode);
+                    log.info("閫氱煡AGV鍙栬揣锛屾潯鐮佸彿锛�" + barcode);
                 }
             }
         }
@@ -2686,6 +2694,22 @@
                 return false;
             }
 
+            //*************灏濊瘯閿佸畾鐩爣绔欒矾寰�***************
+            List<NavigateNode> targetNodes = NyLiftUtils.getLiftStaNodes(wrkMast.getStaNo());
+            if (targetNodes == null) {
+                return false;//鏈幏鍙栧埌鑺傜偣
+            }
+            boolean checkPathIsAvailable = NavigateUtils.checkPathIsAvailable(targetNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(wrkMast.getLocNo()), null);
+            if (!checkPathIsAvailable) {
+                return false;//妫�娴嬬洰鏍囩珯鐐硅矾寰勬槸鍚︽湭琚崰鐢�
+            }
+            //灏濊瘯閿佸畾鐩爣绔欒矾寰�
+            boolean result2 = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(wrkMast.getLocNo()), targetNodes, true);//鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+            if (!result2) {
+                return false;//璺緞閿佸畾澶辫触
+            }
+            //*************灏濊瘯閿佸畾鐩爣绔欒矾寰�***************
+
             //鑾峰彇婧愯緭閫佺珯
             LiftStaProtocol liftSta = NyLiftUtils.getLiftStaByStaNo(wrkMast.getSourceStaNo());
             if (liftSta == null) {
@@ -3053,6 +3077,7 @@
             if (basLift.getPoint() == null) {
                 return false;//娌℃湁璁剧疆鎻愬崌鏈虹偣浣嶅潗鏍�
             }
+
             NavigateNode liftNode = new NavigateNode(basLift.getPoint$().getX(), basLift.getPoint$().getY());
             liftNode.setZ(liftSta.getLev());
 
@@ -3117,6 +3142,27 @@
                 return false;
             }
 
+            //璺ㄦゼ灞傜Щ鍔ㄤ换鍔�
+            if (Utils.getLev(wrkMast.getSourceLocNo()) != Utils.getLev(wrkMast.getLocNo())) {
+                //鑾峰彇鐩爣绔�
+                LiftStaProtocol liftSta = NyLiftUtils.getLiftStaByStaNo(wrkMast.getStaNo());
+                if (liftSta == null) {
+                    return false;//鎵句笉鍒扮珯鐐�
+                }
+
+                //*************灏濊瘯瑙i攣鐩爣绔欒矾寰�***************
+                List<NavigateNode> targetNodes = NyLiftUtils.getLiftStaNodes(liftSta.getStaNo());
+                if (targetNodes == null) {
+                    return false;//鏈幏鍙栧埌鑺傜偣
+                }
+                //灏濊瘯瑙i攣鐩爣绔欒矾寰�
+                boolean result = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(wrkMast.getLocNo()), targetNodes, false);//鎵�浣跨敤鐨勮矾寰勮繘琛岃В閿�
+                if (!result) {
+                    return false;//璺緞瑙i攣澶辫触
+                }
+                //*************灏濊瘯瑙i攣鐩爣绔欒矾寰�***************
+            }
+
 //            //鑾峰彇鐩爣绔欏搴旂殑杈撻�佺珯鐐�
 //            BasDevp targetBasDevp = basDevpService.selectByLevAndLiftNo(Utils.getLev(wrkMast.getLocNo()), wrkMast.getLiftNo());
 //            if (targetBasDevp == null) {

--
Gitblit v1.9.1