| | |
| | | log.error("获取所有站点信息异常"); |
| | | return; |
| | | } |
| | | List<Integer> siteList = SortTheExecutionOfTheCarUtil.WrkMastExtractSites(wrkMasts); |
| | | List<Integer> devpList = SortTheExecutionOfTheCarUtil.BasDevpPositionExtractSites(basDevpPositions); |
| | | Integer siteNo = SortTheExecutionOfTheCarUtil.ObtainDenseAreasFirstPlace(siteList, devpList); |
| | | if (siteNo == null) { |
| | | log.error("就近密集原则获取站点失败"); |
| | | return; |
| | | } |
| | | // List<Integer> siteList = SortTheExecutionOfTheCarUtil.WrkMastExtractSites(wrkMasts); |
| | | // List<Integer> devpList = SortTheExecutionOfTheCarUtil.BasDevpPositionExtractSites(basDevpPositions); |
| | | // Integer siteNo = SortTheExecutionOfTheCarUtil.ObtainDenseAreasFirstPlace(siteList, devpList); |
| | | Integer siteNo = 110; |
| | | // if (siteNo == null) { |
| | | // log.error("就近密集原则获取站点失败"); |
| | | // return; |
| | | // } |
| | | Long sitePosition = 0L; |
| | | for (BasDevpPosition basDevpPosition : basDevpPositions) { |
| | | if (basDevpPosition.getDevNo().equals(siteNo)) { |
| | | sitePosition = basDevpPosition.getPlcPosition(); |
| | | break; |
| | | } |
| | | } |
| | | List<List<Long>> rgvPositionList = new ArrayList<>(); |
| | |
| | | RgvProtocol rgvProtocol = rgvThread.getRgvProtocol(); |
| | | if (rgvProtocol == null) { |
| | | sign = true; |
| | | } else if (rgvProtocol.modeType != RgvModeType.AUTO || (rgvProtocol.getStatusType() != RgvStatusType.IDLE && rgvProtocol.getStatusType() != RgvStatusType.ROAM)) { |
| | | } else if (rgvProtocol.modeType != RgvModeType.AUTO || (rgvProtocol.getStatusType() != RgvStatusType.IDLE && rgvProtocol.getStatusType() != RgvStatusType.ROAM && rgvProtocol.getStatusType() != RgvStatusType.WALK)) { |
| | | sign = true; |
| | | } else { |
| | | rgvNo = basCircularShuttle.getRgvNo(); |
| | |
| | | log.error("更新小车任务失败,任务号:" + wrkMast.getWrkNo()); |
| | | } |
| | | break runRgv; |
| | | } else if (rgvProtocol != null |
| | | && rgvProtocol.modeType == RgvModeType.AUTO |
| | | && rgvProtocol.getStatusType() == RgvStatusType.WALK |
| | | && rgvProtocol.getTaskNo1() == 0 |
| | | && rgvProtocol.getAlarm() == 0) { |
| | | if (rgvProtocol.getStatusType() == RgvStatusType.WALK) { |
| | | double finalVelocity = 0.0; // 最终速度 (m/s) |
| | | double distance = (Math.pow(finalVelocity, 2) - Math.pow(rgvProtocol.instantaneousSpeed / 60, 2)) / (2 * acceleration); |
| | | BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("dev_no", wrkMast.getSourceStaNo())); |
| | | if ((distance * proportion + (rgvProtocol.instantaneousSpeed / 60) * proportion * rgvDate) > (SortTheExecutionOfTheCarUtil.LatelyAndLessThan(basDevpPosition.getPlcPosition(), rgvProtocol.getRgvPos(), perimeter) )) { |
| | | // List<BasDevpPosition> basDevpPositions = basDevpPositionService.selectList(new EntityWrapper<BasDevpPosition>().orderBy("plc_position", true)); |
| | | // if (basDevpPositions.isEmpty()) { |
| | | // log.error("获取所有站点信息异常,RGV任务下发失败,请联系管理员!!!"); |
| | | // break runRgv; |
| | | // } |
| | | // List<Integer> devpList = SortTheExecutionOfTheCarUtil.BasDevpPositionExtractSites(basDevpPositions); |
| | | // |
| | | // if (!SortTheExecutionOfTheCarUtil.calculateShortestDistanceDirection(devpList,rgvProtocol.getEndStaM(),wrkMast.getSourceStaNo())){ |
| | | continue; |
| | | // } |
| | | } |
| | | } |
| | | RgvCommand rgvCommand = new RgvCommand(); |
| | | rgvCommand.setRgvNo(rgvProtocol.getRgvNo()); |
| | | rgvCommand.setAckFinish1((short) 0); // 工位1任务完成确认位 |
| | | rgvCommand.setTaskNo1(wrkMast.getWrkNo().shortValue()); |
| | | rgvCommand.setTaskMode1(RgvTaskModeType.X_MOVE); // 工位1任务模式: 取放货 |
| | | rgvCommand.setSourceStaNo1(wrkMast.getSourceStaNo().shortValue()); //工位1起点 |
| | | rgvCommand.setDestinationStaNo1(wrkMast.getStaNo().shortValue()); //工位1目标站点 |
| | | rgvCommand.setCommand((short) 1); //工位1任务确认 |
| | | rgvCommand.setRgvSome(basCircularShuttle.getRgvSome()==1 ? (short) 1 : (short) 0); |
| | | if (!MessageQueue.offer(SlaveType.Rgv, rgvProtocol.getRgvNo(), new Task(3, rgvCommand))) { |
| | | // |
| | | log.error("RGV命令下发失败,RGV号={},任务数据={}", rgvId, JSON.toJSON(rgvCommand)); |
| | | break runRgv; |
| | | } |
| | | log.info("RGV命令下发成功,RGV号={},任务数据={}", rgvId, JSON.toJSON(rgvCommand)); |
| | | |
| | | wrkMast.setWrkSts(2L); |
| | | wrkMast.setRgvNo(rgvProtocol.getRgvNo()); |
| | | Date now = new Date(); |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setCrnStrTime(now); |
| | | try { |
| | | wrkMastService.updateById(wrkMast); |
| | | break; |
| | | } catch (Exception e) { |
| | | log.error("更新小车任务失败,任务号:" + wrkMast.getWrkNo()); |
| | | } |
| | | break runRgv; |
| | | } else { |
| | | break runRgv; |
| | | } |