From 5bd42df0ef1bcdbc3911381274b4f3f267d0203b Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期三, 13 八月 2025 09:45:59 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/shuttle_rcs_dev' into shuttle_rcs_dev --- src/main/java/com/zy/common/utils/ShuttleOperaUtils.java | 54 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java b/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java index c421287..db9ab33 100644 --- a/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java +++ b/src/main/java/com/zy/common/utils/ShuttleOperaUtils.java @@ -51,10 +51,14 @@ private DeviceConfigService deviceConfigService; public synchronized List<ShuttleCommand> getStartToTargetCommands(String startLocNo, String endLocNo, List<NavigationMapType> mapTypes, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) { - return getStartToTargetCommands(startLocNo, endLocNo, mapTypes, null, assignCommand, shuttleThread); + return getStartToTargetCommands(startLocNo, endLocNo, mapTypes, null, assignCommand, shuttleThread, "move"); } - public synchronized List<ShuttleCommand> getStartToTargetCommands(String startLocNo, String endLocNo, List<NavigationMapType> mapTypes, List<int[]> whites, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) { + public synchronized List<ShuttleCommand> getStartToTargetCommands(String startLocNo, String endLocNo, List<NavigationMapType> mapTypes, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread, String moveType) { + return getStartToTargetCommands(startLocNo, endLocNo, mapTypes, null, assignCommand, shuttleThread, moveType); + } + + public synchronized List<ShuttleCommand> getStartToTargetCommands(String startLocNo, String endLocNo, List<NavigationMapType> mapTypes, List<int[]> whites, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread, String moveType) { ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); if (shuttleProtocol == null) { return null; @@ -77,7 +81,7 @@ if (whites != null) { boolean flag = false; for (int[] white : whites) { - if(white[0] == node.getX() && white[1] == node.getY()) { + if (white[0] == node.getX() && white[1] == node.getY()) { flag = true; break; } @@ -97,7 +101,9 @@ long endTime = System.currentTimeMillis(); News.info("getSection path time:{}", (endTime - startTime)); //灏嗘瘡涓�娈佃矾寰勫垎鎴恈ommand鎸囦护 - for (List<NavigateNode> nodes : data) { + for (int i = 0; i < data.size(); i++) { + List<NavigateNode> nodes = data.get(i); + //寮�濮嬭矾寰� NavigateNode startPath = nodes.get(0); @@ -110,6 +116,15 @@ String distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ()); //鑾峰彇绉诲姩鍛戒护 ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes); + + if (i + 1 == data.size()) { + if (moveType.equals("inLift")) { + command = shuttleThread.getMoveLiftCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes, true); + }else if (moveType.equals("outLift")) { + command = shuttleThread.getMoveLiftCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes, false); + } + } + command.setNodes(nodes);//灏嗚璧拌妭鐐规坊鍔犲埌姣忎竴姝ュ懡浠や腑 commands.add(command); } @@ -154,16 +169,16 @@ } //妫�娴嬮殰纰嶇墿杞� - public synchronized boolean checkObstacle(String locNo, List<Integer> whiteShuttles) { + public synchronized boolean checkObstacle(String locNo, List<Integer> whiteShuttles, List<NavigateNode> whiteNodes) { int innerCircle = 0; int outerCircle = 3; Config avoidInnerCircleConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "avoidInnerCircle")); - if(avoidInnerCircleConfig != null) { + if (avoidInnerCircleConfig != null) { innerCircle = Integer.parseInt(avoidInnerCircleConfig.getValue()); } Config avoidOuterCircleConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "avoidOuterCircle")); - if(avoidOuterCircleConfig != null) { + if (avoidOuterCircleConfig != null) { outerCircle = Integer.parseInt(avoidOuterCircleConfig.getValue()); } @@ -191,7 +206,7 @@ } //鑾峰彇澶栧湀鑺傜偣 - List<NavigateNode> outerNodes = getOuterNodes(locNo, outerCircle, whiteShuttlePointList, innerNodes); + List<NavigateNode> outerNodes = getOuterNodes(locNo, outerCircle, whiteShuttlePointList, innerNodes, whiteNodes); //灏嗗唴鍦堣妭鐐逛腑闅滅灏忚溅璋冪 for (Integer shuttleNo : nodesCar) { @@ -214,14 +229,14 @@ List<NavigateNode> avoidInnerNodes = getInnerNodes(dispatchLocNo, innerCircle, new ArrayList<>()); //璁$畻鍐呭湀鏄惁鏈夊皬杞� List<Integer> avoidNodesCar = findNodesCar(avoidInnerNodes); - if(!avoidNodesCar.isEmpty()) { - continue; + if (!avoidNodesCar.isEmpty()) { + continue; } targetLocNo = dispatchLocNo; break; } - if(targetLocNo == null) { + if (targetLocNo == null) { continue; } shuttleDispatchUtils.dispatchShuttle(null, targetLocNo, shuttleNo); @@ -268,7 +283,7 @@ return list; } - private List<NavigateNode> getOuterNodes(String locNo, int outerCircle, List<int[]> whiteShuttlePointList, List<NavigateNode> innerNodes) { + private List<NavigateNode> getOuterNodes(String locNo, int outerCircle, List<int[]> whiteShuttlePointList, List<NavigateNode> innerNodes, List<NavigateNode> whiteNodes) { List<NavigateNode> outerNodes = new ArrayList<>(); List<NavigateNode> outerNodesTmp = new ArrayList<>(); int lev = Utils.getLev(locNo); @@ -293,13 +308,24 @@ for (NavigateNode node : outerNodesTmp) { boolean flag = false; for (NavigateNode innerNode : innerNodes) { - if(node.getX() == innerNode.getX() && node.getY() == innerNode.getY()) { + if (node.getX() == innerNode.getX() && node.getY() == innerNode.getY()) { flag = true; break; } } - if(flag) { + if (flag) { + continue; + } + + for (NavigateNode whiteNode : whiteNodes) { + if (node.getX() == whiteNode.getX() && node.getY() == whiteNode.getY()) { + flag = true; + break; + } + } + + if (flag) { continue; } -- Gitblit v1.9.1