| | |
| | | return false; |
| | | } |
| | | |
| | | //检测是否存在移动任务 |
| | | WrkMast moveWorking = wrkMastService.selectShuttleHasMoveWorking(wrkMast.getShuttleNo()); |
| | | if (moveWorking != null) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "{}任务,小车存在移动任务", wrkMast.getWrkNo()); |
| | | return false; |
| | | } |
| | | |
| | | ShuttleAssignCommand assignCommand = new ShuttleAssignCommand(); |
| | | assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo()); // 四向穿梭车编号 |
| | | assignCommand.setTaskMode(ShuttleTaskModeType.TRANSPORT.id);//小车移库任务 |
| | |
| | | return false; |
| | | } |
| | | |
| | | //检测是否存在移动任务 |
| | | WrkMast moveWorking = wrkMastService.selectShuttleHasMoveWorking(wrkMast.getShuttleNo()); |
| | | if (moveWorking != null) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "{}任务,小车存在移动任务", wrkMast.getWrkNo()); |
| | | return false; |
| | | } |
| | | |
| | | //检测障碍物车 |
| | | boolean checkObstacle = shuttleOperaUtils.checkObstacle(wrkMast.getLocNo(), new ArrayList<Integer>() {{ |
| | | add(shuttleProtocol.getShuttleNo()); |
| | |
| | | assignCommand.setTaskMode(ShuttleTaskModeType.TRANSPORT.id);//小车移库任务 |
| | | assignCommand.setTaskNo(wrkMast.getWrkNo());//任务号 |
| | | assignCommand.setAuto(true);//自动模式 |
| | | assignCommand.setLocNo(wrkMast.getLocNo()); |
| | | |
| | | //获取小车到输送站点行走命令 |
| | | List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(wrkMast.getSourceLocNo(), wrkMast.getLocNo(), NavigationMapType.getDfxWithDevice(), assignCommand, shuttleThread); |
| | | List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(wrkMast.getSourceLocNo(), wrkMast.getLocNo(), NavigationMapType.getMapTypes(NavigationMapType.DFX), assignCommand, shuttleThread); |
| | | if (commands == null) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "{}任务,{}小车,路径计算失败", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo()); |
| | | return false; |
| | |
| | | assignCommand.setLocNo(wrkMast.getLocNo());//目标库位 |
| | | |
| | | //获取小车到目标库位命令 |
| | | List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo(), NavigationMapType.getNormalWithDevice(), assignCommand, shuttleThread); |
| | | List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo(), NavigationMapType.getMapTypes(NavigationMapType.NORMAL), assignCommand, shuttleThread); |
| | | if (commands == null) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "{}任务,{}小车,路径计算失败", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo()); |
| | | return false;//路径计算失败 |
| | |
| | | private ShuttleTaskUtils shuttleTaskUtils; |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public void shuttleFinished() { |
| | | public synchronized void shuttleFinished() { |
| | | //四向穿梭车任务完成 |
| | | shuttleTaskUtils.shuttleFinished(); |
| | | } |
| | |
| | | /** |
| | | * 四向穿梭车任务完成 |
| | | */ |
| | | public void shuttleFinished() { |
| | | public synchronized void shuttleFinished() { |
| | | try { |
| | | List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() |
| | | .eq("device_type", String.valueOf(SlaveType.Shuttle))); |
| | |
| | | lockMap.remove(key); |
| | | } |
| | | } |
| | | lockMap.putAll(lockMap); |
| | | redisUtil.set(RedisKeyType.LOCK_MAP_NODES.key + lev, lockMap); |
| | | return true; |
| | | } |
| | |
| | | |
| | | private boolean is_valid(int[][] map, int x, int y) { |
| | | if (x < 0 || x >= map.length |
| | | || y < 0 || y >= map[0].length) { |
| | | || y < 0 || y >= map[1].length) { |
| | | return false; |
| | | } |
| | | // 如果结点的位置小于0,则不合法 |
| | |
| | | |
| | | //移动命令,锁定路径 |
| | | if (command.getMode() == ShuttleCommandModeType.MOVE.id) { |
| | | TrafficControlThread trafficControlThread = (TrafficControlThread) SlaveConnection.get(SlaveType.TrafficControl, 1); |
| | | if (trafficControlThread == null) { |
| | | return false; |
| | | } |
| | | |
| | | List<NavigateNode> nodes = JSON.parseArray(JSON.toJSONString(command.getNodes()), NavigateNode.class); |
| | | //申请管制 |
| | | boolean apply = applyTrafficControl(commands, nodes, shuttleNo, taskNo); |
| | |
| | | if (!result) { |
| | | News.error("{} device can't lock path!", shuttleNo); |
| | | shuttleThread.offerSystemMsg("{} device can't lock path!", shuttleNo); |
| | | trafficControlThread.trafficReportError(shuttleNo, taskNo); |
| | | return false;//路径锁定失败 |
| | | } |
| | | } |
| | |
| | | return false; |
| | | } |
| | | if (targetPoints.contains(Utils.getRow(currentLocNo) + "-" + Utils.getBay(currentLocNo))) { |
| | | command.setComplete(true); |
| | | boolean result = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(shuttleProtocol.getCurrentLocNo()), shuttleProtocol.getShuttleNo(), nodes, false);//解锁路径 |
| | | if (!result) { |
| | | return false;//解锁失败 |
| | | } |
| | | command.setComplete(true); |
| | | }else { |
| | | return false; |
| | | } |
| | |
| | | |
| | | boolean trafficReport(List<NavigateNode> nodeList, Integer shuttleNo, Integer taskNo); |
| | | |
| | | boolean trafficReportError(Integer shuttleNo, Integer taskNo); |
| | | |
| | | boolean cancelTrafficControl(Integer shuttleNo, Integer taskNo); |
| | | |
| | | boolean forceCancelTrafficControl(Integer shuttleNo); |
| | |
| | | } |
| | | |
| | | ShuttleCommand firstCommand = originCommands.get(0); |
| | | ShuttleCommand endCommand = originCommands.get(commands.size() - 1); |
| | | ShuttleCommand endCommand = originCommands.get(originCommands.size() - 1); |
| | | |
| | | if (firstCommand.getMode() != ShuttleCommandModeType.PALLET_LIFT.id) { |
| | | return false; |
| | |
| | | private HashMap<Integer, HashMap<String, List<Integer>>> levNodesMap = null; |
| | | |
| | | |
| | | private HashMap<Integer,Long> shuttleReportErrorMap = new HashMap<>(); |
| | | private HashMap<Integer,Long> pathIdleShuttleMap = new HashMap<>(); |
| | | private HashMap<Integer,Long> applyRecordsMap = new HashMap<>(); |
| | | private HashMap<String, List<NavigateNode>> taskNodesMap = new HashMap<>(); |
| | |
| | | |
| | | controlDataModel.setTotalNodeList(newTotalNodeList); |
| | | trafficControlDataList.set(i, controlDataModel); |
| | | shuttleReportErrorMap.remove(shuttleNo); |
| | | return true; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean trafficReportError(Integer shuttleNo, Integer taskNo) { |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo); |
| | | if (shuttleThread == null) { |
| | | return false; |
| | | } |
| | | |
| | | if(shuttleReportErrorMap.containsKey(shuttleNo)) { |
| | | Long errorTime = shuttleReportErrorMap.get(shuttleNo); |
| | | if((System.currentTimeMillis() - errorTime) > 1000 * 10) { |
| | | shuttleReportErrorMap.remove(shuttleNo); |
| | | shuttleThread.restartCalcPath(); |
| | | } |
| | | }else { |
| | | shuttleReportErrorMap.put(shuttleNo, System.currentTimeMillis()); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public synchronized boolean cancelTrafficControl(Integer shuttleNo, Integer taskNo) { |
| | | //检测车子是否存在管制 |
| | | for (int i = 0; i < trafficControlDataList.size(); i++) { |