| | |
| | | package com.zy.acs.manager.core.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.acs.common.utils.RedisSupport; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import com.zy.acs.framework.common.Cools; |
| | |
| | | import com.zy.acs.manager.core.domain.Lane; |
| | | import com.zy.acs.manager.core.service.astart.*; |
| | | import com.zy.acs.manager.core.service.astart.domain.DynamicNode; |
| | | import com.zy.acs.manager.manager.entity.Code; |
| | | import com.zy.acs.manager.manager.entity.Jam; |
| | | import com.zy.acs.manager.manager.entity.Route; |
| | | import com.zy.acs.manager.manager.service.AgvModelService; |
| | | import com.zy.acs.manager.manager.service.AgvService; |
| | | import com.zy.acs.manager.manager.service.CodeService; |
| | | import com.zy.acs.manager.manager.service.RouteService; |
| | | import com.zy.acs.manager.manager.entity.Segment; |
| | | import com.zy.acs.manager.manager.enums.JamStateType; |
| | | import com.zy.acs.manager.manager.service.*; |
| | | import com.zy.acs.manager.system.service.ConfigService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private LaneService laneService; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private SegmentService segmentService; |
| | | @Autowired |
| | | private JamService jamService; |
| | | |
| | | /** |
| | | * avoidPathList ===>> [ minor vehicle ] [wave] [ curr vehicle ] [ code2 ] [ code3 ] ...... |
| | |
| | | List<String> blackList = Utils.singletonList(sponsor); |
| | | |
| | | Double avoidDistance = MapDataUtils.getVehicleWaveSafeDistance(agvModelService.getById(agvService.selectByUuid(sponsor).getAgvModel()).getDiameter() |
| | | , MapDataConstant.IDLE_DISTANCE_COE); |
| | | , MapDataConstant.MAX_DISTANCE_BETWEEN_ADJACENT_AGV_FACTOR); |
| | | List<String> avoidPathListWave = mapService.getWaveScopeByCodeList(lev, avoidPathList, avoidDistance); |
| | | |
| | | DynamicNode[][] dynamicMatrix = mapDataDispatcher.getDynamicMatrix(lev); |
| | |
| | | boolean pointOfTurn = neighborNodes.size() >= 2; |
| | | label: for (RetreatNavigateNode node : neighborNodes) { |
| | | if (node.getCodeData().equals(breakPoint)) { continue; } |
| | | Code code = codeService.selectByData(node.getCodeData()); |
| | | |
| | | int weight = 0; |
| | | |
| | |
| | | continue label; |
| | | } |
| | | if (1 < mapDataDispatcher.queryCodeListFromDynamicNode(lev, otherWave).size()) { |
| | | phaseSecond = false; // there is a way to go |
| | | phaseSecond = false; // there is a running way |
| | | continue label; |
| | | } else { |
| | | weight += WEIGHT_CALC_FACTOR; |
| | |
| | | } |
| | | |
| | | if (lanVehicleSet.size() + 1 > maxAgvCountInLane) { |
| | | phaseSecond = false; // there is a way to go |
| | | phaseSecond = false; // there is a running way |
| | | continue; |
| | | } |
| | | if (lanVehicleSet.contains(sponsor)) { |
| | |
| | | } |
| | | } |
| | | |
| | | // judge whether the node has already been marked as a retreat node? |
| | | // This is a very troublesome matter, if the node be repeatedly mark as a retreat node |
| | | List<Segment> runningSegments = segmentService.getRunningByEndCode(code.getId()); |
| | | for (Segment runningSeg : runningSegments) { |
| | | if (0 < jamService.count(new LambdaQueryWrapper<Jam>() |
| | | .eq(Jam::getAvoSeg, runningSeg.getId()) |
| | | .ne(Jam::getState, JamStateType.DEPRECATED.toString()))) { |
| | | weight += WEIGHT_CALC_FACTOR * 3; |
| | | } else { |
| | | weight += WEIGHT_CALC_FACTOR; |
| | | } |
| | | } |
| | | |
| | | // enable |
| | | if (!avoidPathListWave.contains(node.getCodeData())) { |
| | | enableNodes.add(node); |