From 0d04e9440d19f30a8220f498ebdde5a8bfcc48a8 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 10 十月 2023 13:50:03 +0800
Subject: [PATCH] #机械臂任务下发

---
 src/main/java/com/zy/core/thread/NyShuttleThread.java |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/zy/core/thread/NyShuttleThread.java b/src/main/java/com/zy/core/thread/NyShuttleThread.java
index 26fb927..23a86ea 100644
--- a/src/main/java/com/zy/core/thread/NyShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/NyShuttleThread.java
@@ -336,6 +336,7 @@
             );
             opt.setSend(1);//宸蹭笅鍙�
             opt.setResponse(JSON.toJSONString(result));//璇锋眰鍝嶅簲
+            opt.setDeviceWrk(command.getWrkNo().toString());//璁惧宸ヤ綔鍙�
             shuttleOptService.insert(opt);
         }
 
@@ -369,6 +370,7 @@
         }
 
         WrkMastMapper wrkMastMapper = SpringUtils.getBean(WrkMastMapper.class);
+        WrkMast wrkMast = wrkMastMapper.selectByWorkNo(wrkNo.intValue());
 
         Object o = redisUtil.get("shuttle_wrk_no_" + wrkNo);
         if (o == null) {
@@ -446,8 +448,9 @@
         }
 
         if (shuttleProtocol.getFree() == ShuttleStatusType.BUSY.id) {
-            //鍋滄鍏呯數
-            if(!(command.getRequest().getBody().get("requestType").equals("stopCharge") && shuttleProtocol.getChargState() == 1)){
+            String requestType = command.getRequest().getBody().get("requestType").toString();
+            //鍋滄鍏呯數 绠″埗鍛戒护
+            if(!(requestType.equals("stopCharge") && shuttleProtocol.getChargState() == 1) && !requestType.equals("resume")){
                 return false;//灏忚溅鐘舵�佸繖锛岀姝㈡墽琛屽懡浠�
             }
         }
@@ -463,8 +466,15 @@
         }
 
         if (command.getRequest().getBody().get("requestType").equals("move")) {
+            ArrayList<int[]> whiteList = new ArrayList<>();//璁剧疆鑺傜偣鐨勭櫧鍚嶅崟
+            if (wrkMast != null && (wrkMast.getIoType() > 100 && wrkMast.getIoType() < 200)) {
+                //鍑哄簱浠诲姟锛屼笉妫�娴嬮鑺傜偣
+                int[] startArr = NavigatePositionConvert.positionToXY(wrkMast.getSourceLocNo());//寮�濮嬭妭鐐�
+                whiteList.add(startArr);
+            }
+
             //妫�娴嬭矾寰勬槸鍚﹀彲琛岃蛋
-            if (!checkPath(command.getNodes(), nextNodes, redisCommand)) {
+            if (!checkPath(command.getNodes(), nextNodes, whiteList)) {
                 return false;
             }
 
@@ -634,17 +644,17 @@
      * 妫�娴嬭矾寰勬槸鍚﹀彲琛岃蛋
      * 濡傛灉璺緞涓虹洰鏍囧簱浣嶏紝浣嗕笉鍙璧帮紝绯荤粺灏嗗皾璇曢噸鏂拌绠楄矾寰�
      */
-    private boolean checkPath(List<NavigateNode> currentNodes, List<NavigateNode> nextNodes, ShuttleRedisCommand redisCommand) {
+    private boolean checkPath(List<NavigateNode> currentNodes, List<NavigateNode> nextNodes, List<int[]> whitePoints) {
         //妫�娴嬭矾寰勬槸鍚﹀彲琛岃蛋(妫�鏌ヨ矾寰勯攣瀹氱姸鎬侊紝妫�娴嬭矾寰勬槸鍚︽湁鍏朵粬灏忚溅)
         //妫�娴嬪綋鍓嶈璧拌矾寰勶紝鍜屼笅涓�姝ヨ矾寰�
-        boolean checkPathIsAvailable = NavigateUtils.checkPathIsAvailable(currentNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()));
+        boolean checkPathIsAvailable = NavigateUtils.checkPathIsAvailable(currentNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()), whitePoints);
         if (nextNodes == null) {
             if (checkPathIsAvailable) {
                 return true;//鍙璧�
             }
             return false;
         }else {
-            boolean checkPathIsAvailable2 = NavigateUtils.checkPathIsAvailable(nextNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()));
+            boolean checkPathIsAvailable2 = NavigateUtils.checkPathIsAvailable(nextNodes, shuttleProtocol.getShuttleNo().intValue(), Utils.getLev(shuttleProtocol.getCurrentLocNo()), whitePoints);
             if (checkPathIsAvailable && checkPathIsAvailable2) {
                 return true;//鍙璧�
             }

--
Gitblit v1.9.1