From 26419bf11ec888de7af9141a0ac1874065775e61 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期六, 04 十一月 2023 13:59:51 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java b/src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java
index 2c46cd8..552b933 100644
--- a/src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java
+++ b/src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java
@@ -89,7 +89,7 @@
public static NyShuttleOperaResult getStartToTargetCommands(Integer shuttleNo, Integer wrkNo, String startPoint, String targetPoint, Integer mapType) {
NavigateMapUtils navigateMapUtils = SpringUtils.getBean(NavigateMapUtils.class);
//璁$畻璧风偣鍒扮洰鏍囩偣琛岃蛋鑺傜偣
- List<NavigateNode> calc = NavigateUtils.calc(startPoint, targetPoint, mapType, Utils.getShuttlePoints(shuttleNo, Utils.getLev(startPoint)));
+ List<NavigateNode> calc = NavigateUtils.calc(startPoint, targetPoint, mapType, Utils.getShuttlePoints(shuttleNo, Utils.getLev(startPoint)), null);
if (calc == null) {
return null;
}
@@ -114,7 +114,63 @@
allNode.addAll(nodes);
}
- navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(startPoint), allNode, true);//閿佸畾璺緞
+ boolean result = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(startPoint), allNode, true);//閿佸畾璺緞
+ if (!result) {
+ return null;//璺緞閿佸畾澶辫触
+ }
+ return result(commands, calc);
+ }
+
+ /**
+ * 鑾峰彇璧风偣鍒扮洰鏍囩偣琛岃蛋鍛戒护(鍙紶鐧藉悕鍗�)
+ */
+ public static NyShuttleOperaResult getStartToTargetCommandsByWhites(Integer shuttleNo, Integer wrkNo, String startPoint, String targetPoint, Integer mapType, List<int[]> whites) {
+ NavigateMapUtils navigateMapUtils = SpringUtils.getBean(NavigateMapUtils.class);
+ //璁$畻璧风偣鍒扮洰鏍囩偣琛岃蛋鑺傜偣
+ List<NavigateNode> calc = NavigateUtils.calc(startPoint, targetPoint, mapType, Utils.getShuttlePoints(shuttleNo, Utils.getLev(startPoint)), whites);
+ if (calc == null) {
+ return null;
+ }
+
+ //鍛戒护闆嗗悎
+ ArrayList<NyShuttleHttpCommand> commands = new ArrayList<>();
+ List<NavigateNode> allNode = new ArrayList<>();
+
+ //鑾峰彇鍒嗘璺緞
+ ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(calc);
+ //灏嗘瘡涓�娈佃矾寰勫垎鎴恈ommand鎸囦护
+ for (ArrayList<NavigateNode> nodes : data) {
+ //寮�濮嬭矾寰�
+ NavigateNode startPath = nodes.get(0);
+ //鐩爣璺緞
+ NavigateNode targetPath = nodes.get(nodes.size() - 1);
+ //鑾峰彇绉诲姩鍛戒护
+ NyShuttleHttpCommand moveCommand = NyHttpUtils.getMoveCommand(shuttleNo, wrkNo, startPath, targetPath);
+ moveCommand.setNodes(nodes);//灏嗚璧拌妭鐐规坊鍔犲埌姣忎竴姝ュ懡浠や腑
+ commands.add(moveCommand);
+
+ allNode.addAll(nodes);
+ }
+
+ //閿佸畾璺緞鏃跺墧闄ょ櫧鍚嶅崟鑺傜偣
+ ArrayList<NavigateNode> nodes = new ArrayList<>();
+ for (NavigateNode node : allNode) {
+ boolean flag = false;
+ for (int[] white : whites) {
+ if (node.getX() == white[0] && node.getY() == white[1]) {
+ flag = true;//瀛樺湪鐧藉悕鍗曡妭鐐�
+ break;//璺宠繃鐧藉悕鍗曡妭鐐�
+ }
+ }
+
+ if (!flag) {
+ nodes.add(node);
+ }
+ }
+ boolean result = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(startPoint), nodes, true);//閿佸畾璺緞
+ if (!result) {
+ return null;//璺緞閿佸畾澶辫触
+ }
return result(commands, calc);
}
--
Gitblit v1.9.1