| | |
| | | import com.zy.asrs.service.BasShuttleOptService; |
| | | import com.zy.asrs.service.BasShuttleService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.NavigateNode; |
| | | import com.zy.common.utils.CommonUtils; |
| | | import com.zy.common.utils.NavigatePositionConvert; |
| | | import com.zy.common.utils.NavigateUtils; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.common.utils.*; |
| | | import com.zy.core.News; |
| | | import com.zy.core.ThreadHandler; |
| | | import com.zy.core.cache.MessageQueue; |
| | |
| | | //分配任务 |
| | | private void assignWork(ShuttleAssignCommand assignCommand) { |
| | | if (!assignCommand.getAuto()) { |
| | | List<NavigateNode> allNode = new ArrayList<>(); |
| | | List<ShuttleCommand> commands = new ArrayList<>(); |
| | | ShuttleCommand command = new ShuttleCommand(); |
| | | LocMastService locMastService = SpringUtils.getBean(LocMastService.class); |
| | | NavigateMapData navigateMapData; |
| | | switch (assignCommand.getTaskMode()) { |
| | | case 1://入库 |
| | | case 2://出库 |
| | |
| | | //计算小车起点到中点所需命令 |
| | | LocMast currentLocMast = locMastService.queryByQrCode(shuttleProtocol.getCurrentCode().toString()); |
| | | List<NavigateNode> firstMastResult = NavigateUtils.calc(currentLocMast.getLocNo(), assignCommand.getSourceLocNo(), ShuttleTaskModeType.PAK_IN.id); |
| | | //所使用的路径进行锁定禁用 |
| | | navigateMapData = new NavigateMapData(Utils.getLev(currentLocMast.getLocNo())); |
| | | navigateMapData.writeNavigateNodeToRedisMap(firstMastResult, true);////所使用的路径进行锁定禁用 |
| | | |
| | | if (firstMastResult != null) { |
| | | allNode.addAll(firstMastResult);//将节点进行保存 |
| | | //获取分段路径 |
| | | ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(firstMastResult); |
| | | //将每一段路径分成command指令 |
| | |
| | | |
| | | //计算中点到终点路径 |
| | | List<NavigateNode> secMastResult = NavigateUtils.calc(assignCommand.getSourceLocNo(), assignCommand.getLocNo(), ShuttleTaskModeType.PAK_IN.id); |
| | | navigateMapData.writeNavigateNodeToRedisMap(firstMastResult, true);////所使用的路径进行锁定禁用 |
| | | |
| | | if (secMastResult != null) { |
| | | allNode.addAll(secMastResult);//将节点进行保存 |
| | | //获取分段路径 |
| | | ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(secMastResult); |
| | | //将每一段路径分成command指令 |
| | |
| | | case 14://移动到目标库位 |
| | | LocMast locMast = locMastService.queryByQrCode(shuttleProtocol.getCurrentCode().toString()); |
| | | List<NavigateNode> result = NavigateUtils.calc(locMast.getLocNo(), assignCommand.getLocNo(), ShuttleTaskModeType.PAK_IN.id); |
| | | //所使用的路径进行锁定禁用 |
| | | navigateMapData = new NavigateMapData(Utils.getLev(locMast.getLocNo())); |
| | | navigateMapData.writeNavigateNodeToRedisMap(result, true);////所使用的路径进行锁定禁用 |
| | | |
| | | if (result != null) { |
| | | allNode.addAll(result);//将节点进行保存 |
| | | //获取分段路径 |
| | | ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(result); |
| | | //将每一段路径分成command指令 |
| | |
| | | default: |
| | | } |
| | | assignCommand.setCommands(commands); |
| | | assignCommand.setNodes(allNode);//当前任务所占用的节点list |
| | | } |
| | | |
| | | ShuttleRedisCommand redisCommand = new ShuttleRedisCommand(); |
| | |
| | | } |
| | | } |
| | | |
| | | String locNo = shuttleProtocol.getLocNo() == null ? shuttleProtocol.getSourceLocNo() : shuttleProtocol.getLocNo(); |
| | | //解除锁定的库位路径 |
| | | NavigateMapData navigateMapData = new NavigateMapData(Utils.getLev(locNo)); |
| | | navigateMapData.writeNavigateNodeToRedisMap(redisCommand.getAssignCommand().getNodes(), false); |
| | | |
| | | //删除redis |
| | | redisUtil.del("shuttle_wrk_no_" + redisCommand.getWrkNo()); |
| | | |