|  |  |  | 
|---|
|  |  |  | Integer shuttleNo = shuttleProtocol.getShuttleNo(); | 
|---|
|  |  |  | //获取小车移动速度 | 
|---|
|  |  |  | Integer runSpeed = Optional.ofNullable(basShuttleService.selectOne(new EntityWrapper<BasShuttle>().eq("shuttle_no", shuttleNo)).getRunSpeed()).orElse(1000); | 
|---|
|  |  |  | List<NavigateNode> nodeList = navigateUtils.calc(startLocNo, endLocNo, mapType, Utils.getShuttlePoints(shuttleNo, Utils.getLev(startLocNo)), null); | 
|---|
|  |  |  | List<NavigateNode> nodeList = navigateUtils.calc(startLocNo, endLocNo, mapType, Utils.getShuttlePoints(shuttleNo, Utils.getLev(startLocNo)), whites); | 
|---|
|  |  |  | if (nodeList == null) { | 
|---|
|  |  |  | News.error("{} dash {} can't find navigate path!", startLocNo, endLocNo); | 
|---|
|  |  |  | shuttleThread.offerSystemMsg("{} dash {} can't find navigate path!", startLocNo, endLocNo); | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<NavigateNode> allNode = new ArrayList<>(); | 
|---|
|  |  |  | List<NavigateNode> lockNode = new ArrayList<>(); | 
|---|
|  |  |  | for (NavigateNode node : nodeList) { | 
|---|
|  |  |  | allNode.add(node.clone()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (whites != null) { | 
|---|
|  |  |  | boolean flag = false; | 
|---|
|  |  |  | for (int[] white : whites) { | 
|---|
|  |  |  | if(white[0] == node.getX() && white[1] == node.getY()) { | 
|---|
|  |  |  | flag = true; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (flag) {//白名单跳过锁定 | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | lockNode.add(node.clone()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<ShuttleCommand> commands = new ArrayList<>(); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | assignCommand.setNodes(allNode);//当前任务所占用的节点list | 
|---|
|  |  |  |  | 
|---|
|  |  |  | boolean result = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(startLocNo), shuttleNo, lockNode, true);//锁定路径 | 
|---|
|  |  |  | if (!result) { | 
|---|
|  |  |  | News.error("{} dash {} can't lock path!", startLocNo, endLocNo); | 
|---|
|  |  |  | shuttleThread.offerSystemMsg("{} dash {} can't lock path!", startLocNo, endLocNo); | 
|---|
|  |  |  | return null;//路径锁定失败 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return commands; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(endLocNo), shuttleProtocol.getShuttleNo(), unlockPath, false);//所使用的路径进行解锁 | 
|---|
|  |  |  | if (!lockResult) { | 
|---|
|  |  |  | News.error("{} dash {} can't find unlock path!", startLocNo, endLocNo); | 
|---|
|  |  |  | shuttleThread.offerSystemMsg("{} dash {} can't find unlock path!", startLocNo, endLocNo); | 
|---|
|  |  |  | return null;//解锁失败 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | List<NavigateNode> nodeList = navigateUtils.calc(startLocNo, endLocNo, mapType, Utils.getShuttlePoints(shuttleNo, Utils.getLev(startLocNo)), null); | 
|---|
|  |  |  | if (nodeList == null) { | 
|---|
|  |  |  | News.error("{} dash {} can't find navigate path!", startLocNo, endLocNo); | 
|---|
|  |  |  | shuttleThread.offerSystemMsg("{} dash {} can't find navigate path!", startLocNo, endLocNo); | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|