zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
@@ -1153,6 +1153,15 @@ MotionCtgType.SHUTTLE_MOVE )); // 锁定目标楼层穿梭车待机位路径 motionList.addAll(kernelService.mapLockPath( null, MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); dto.setLocNo(standbyLocNoFrom); })) )); // 提升机空载移动到穿梭车层 motionList.addAll(kernelService.liftMove( null zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/KernelService.java
@@ -440,4 +440,40 @@ return motionList; } // Map ----------------------------------------------------------------------------- /** * 地图路径锁定 */ public List<Motion> mapLockPath(MotionDto origin, MotionDto target) { List<Motion> motionList = new ArrayList<>(); motionList.add(Motion.build(motion -> { motion.setDeviceCtg(DeviceCtgType.MAP.val()); motion.setDevice(String.valueOf(target.getShuttleNo())); motion.setMotionCtg(MotionCtgType.MAP_LOCK_PATH.val()); motion.setTarget(target.getLocNo()); })); return motionList; } /** * 地图路径解锁 */ public List<Motion> mapUnlockPath(MotionDto origin, MotionDto target) { List<Motion> motionList = new ArrayList<>(); motionList.add(Motion.build(motion -> { motion.setDeviceCtg(DeviceCtgType.MAP.val()); motion.setDevice(String.valueOf(target.getShuttleNo())); motion.setMotionCtg(MotionCtgType.MAP_UNLOCK_PATH.val()); motion.setTarget(target.getLocNo()); })); return motionList; } } zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
@@ -162,7 +162,7 @@ // return false; // } shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread); shuttleCommands = this.shuttleInOutLiftCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread); shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO; break; case SHUTTLE_MOVE_TO_LIFT://进提升机 @@ -450,5 +450,62 @@ return commands; } public synchronized List<ShuttleCommand> shuttleInOutLiftCommand(String startLocNo, String endLocNo, Integer mapType, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) { NavigateNode startNode = NavigatePositionConvert.locNoToNode(startLocNo); NavigateNode endNode = NavigatePositionConvert.locNoToNode(endLocNo); List<NavigateNode> unlockPath = new ArrayList<>(); unlockPath.add(startNode); unlockPath.add(endNode); ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); //所使用的路径进行锁定/解锁 boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(endLocNo), shuttleProtocol.getShuttleNo(), unlockPath, false);//所使用的路径进行解锁 if (!lockResult) { News.error("{} dash {} can't find unlock path!", startLocNo, endLocNo); return null;//解锁失败 } //获取小车移动速度 Integer runSpeed = Optional.ofNullable(basShuttleService.getOne(new LambdaQueryWrapper<BasShuttle>().eq(BasShuttle::getDeviceId, assignCommand.getDeviceId())).getRunSpeed()).orElse(1000); Long hostId = shuttleThread.getDevice().getHostId(); List<NavigateNode> nodeList = NavigateUtils.calc(startLocNo, endLocNo, mapType, Utils.getShuttlePoints(Integer.parseInt(shuttleThread.getDevice().getDeviceNo()), Utils.getLev(startLocNo))); if (nodeList == null) { News.error("{} dash {} can't find navigate path!", startLocNo, endLocNo); return null; } List<NavigateNode> allNode = new ArrayList<>(); for (NavigateNode node : nodeList) { allNode.add(node.clone()); } List<ShuttleCommand> commands = new ArrayList<>(); //获取分段路径 ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(nodeList); //将每一段路径分成command指令 for (ArrayList<NavigateNode> nodes : data) { //开始路径 NavigateNode startPath = nodes.get(0); //目标路径 NavigateNode endPath = nodes.get(nodes.size() - 1); Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//计算当前路径行走总距离 //通过xy坐标小车二维码 String startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ(), hostId); //通过xy坐标小车二维码 String distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ(), hostId); //获取移动命令 ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed, nodes); command.setNodes(nodes);//将行走节点添加到每一步命令中 commands.add(command); } assignCommand.setNodes(allNode);//当前任务所占用的节点list return commands; } } zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/DeviceCtgType.java
@@ -13,6 +13,7 @@ SHUTTLE, AGV, LED, MAP, ; DeviceCtgType() { zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/MotionCtgType.java
@@ -60,6 +60,10 @@ // AGV ---------------------------------------------- AGV_TRANSPORT(AGV), // MAP ---------------------------------------------- MAP_LOCK_PATH(MAP),//地图锁定路径 MAP_UNLOCK_PATH(MAP),//地图解锁路径 ; public DeviceCtgType deviceCtg; zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java
@@ -41,6 +41,8 @@ private LiftCommandService liftCommandService; @Autowired private ShuttleCommandService shuttleCommandService; @Autowired private MapCommandService mapCommandService; @Scheduled(cron = "0/1 * * * * ? ") public synchronized void executeTask() { @@ -327,6 +329,9 @@ case AGV: executeRes = agvCommandService.accept(motion); break; case MAP: executeRes = mapCommandService.accept(motion); break; default: break; } @@ -362,6 +367,9 @@ case CONVEYOR: executeRes = conveyorCommandService.finish(motion); break; case MAP: executeRes = mapCommandService.finish(motion); break; default: break; } zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigatePositionConvert.java
@@ -38,10 +38,10 @@ //WCS系统库位号转路径算法节点 public static NavigateNode locNoToNode(String locNo) { int col = Integer.parseInt(locNo.substring(0, 2)); int row = Integer.parseInt(locNo.substring(2, 5)); int col = Utils.getRow(locNo); int row = Utils.getBay(locNo); int[] newPosition = coverPosition(col,row); NavigateNode node = new NavigateNode(col, row); NavigateNode node = new NavigateNode(newPosition[0], newPosition[1]); node.setZ(Utils.getLev(locNo)); return node; }