From 72bd968bf48058cad19361ebf723f9262d6369e1 Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期五, 03 十一月 2023 13:26:43 +0800 Subject: [PATCH] #路径锁定问题(temp) --- src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 48 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java b/src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java index a4bc2e7..528b586 100644 --- a/src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java +++ b/src/main/java/com/zy/common/utils/NyShuttleOperaUtils.java @@ -1,5 +1,6 @@ package com.zy.common.utils; +import com.core.common.SpringUtils; import com.zy.asrs.utils.Utils; import com.zy.common.model.NavigateNode; import com.zy.common.model.NyShuttleOperaResult; @@ -86,14 +87,16 @@ * 鑾峰彇璧风偣鍒扮洰鏍囩偣琛岃蛋鍛戒护 */ 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(targetPoint))); + List<NavigateNode> calc = NavigateUtils.calc(startPoint, targetPoint, mapType, Utils.getShuttlePoints(shuttleNo, Utils.getLev(startPoint)), null); if (calc == null) { return null; } //鍛戒护闆嗗悎 ArrayList<NyShuttleHttpCommand> commands = new ArrayList<>(); + List<NavigateNode> allNode = new ArrayList<>(); //鑾峰彇鍒嗘璺緞 ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(calc); @@ -107,8 +110,52 @@ NyShuttleHttpCommand moveCommand = NyHttpUtils.getMoveCommand(shuttleNo, wrkNo, startPath, targetPath); moveCommand.setNodes(nodes);//灏嗚璧拌妭鐐规坊鍔犲埌姣忎竴姝ュ懡浠や腑 commands.add(moveCommand); + + allNode.addAll(nodes); } + 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); + } + + boolean result = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(startPoint), allNode, true);//閿佸畾璺緞 + if (!result) { + return null;//璺緞閿佸畾澶辫触 + } return result(commands, calc); } -- Gitblit v1.9.1