| | |
| | | import com.zy.acs.manager.common.utils.CommonUtil; |
| | | import com.zy.acs.manager.core.domain.AgvCntDto; |
| | | import com.zy.acs.manager.core.domain.FilterLaneDto; |
| | | import com.zy.acs.manager.core.domain.Lane; |
| | | import com.zy.acs.manager.core.domain.LaneDto; |
| | | import com.zy.acs.manager.core.domain.TaskPosDto; |
| | | import com.zy.acs.manager.manager.entity.*; |
| | | import com.zy.acs.manager.manager.enums.*; |
| | |
| | | return null; |
| | | } |
| | | |
| | | List<String> availableAgvNos = this.getAvailableAgvNos(agvAreaDispatcher.getAgvNosByTask(task), true); |
| | | List<String> availableAgvNos = this.getAvailableAgvNos(agvAreaDispatcher.getAgvIdsByTask(task), true); |
| | | FilterLaneDto filterLaneDto = this.filterThroughLane(task, availableAgvNos); |
| | | if (filterLaneDto == null) { |
| | | return null; |
| | |
| | | } |
| | | |
| | | // record lane hash for later dispatch/traffic-control logic |
| | | if (filterLaneDto.getOriginLane() != null) { |
| | | task.setOriLaneHash(filterLaneDto.getOriginLane().getHashCode()); |
| | | if (filterLaneDto.getOriginLaneDto() != null) { |
| | | task.setOriLaneHash(filterLaneDto.getOriginLaneDto().getHashCode()); |
| | | } |
| | | if (filterLaneDto.getDestinationLane() != null) { |
| | | task.setDestLaneHash(filterLaneDto.getDestinationLane().getHashCode()); |
| | | if (filterLaneDto.getDestinationLaneDto() != null) { |
| | | task.setDestLaneHash(filterLaneDto.getDestinationLaneDto().getHashCode()); |
| | | } |
| | | |
| | | return agvNo; |
| | |
| | | * it can break the limit of the number of agv backpack |
| | | */ |
| | | public synchronized String normalExecute(Task task) { |
| | | List<String> availableAgvNos = this.getAvailableAgvNos(agvAreaDispatcher.getAgvNosByTask(task), false); |
| | | List<String> availableAgvNos = this.getAvailableAgvNos(agvAreaDispatcher.getAgvIdsByTask(task), false); |
| | | // List<String> availableAgvNos = this.getAvailableAgvNos(null); |
| | | if (Cools.isEmpty(availableAgvNos)) { |
| | | // log.warn("No available agv to assign the task[{}]", task.getSeqNum()); |
| | |
| | | if (null == filterLaneDto) { |
| | | return null; |
| | | } |
| | | Lane originLane = filterLaneDto.getOriginLane(); |
| | | Lane destinationLane = filterLaneDto.getDestinationLane(); |
| | | LaneDto originLaneDto = filterLaneDto.getOriginLaneDto(); |
| | | LaneDto destinationLaneDto = filterLaneDto.getDestinationLaneDto(); |
| | | List<String> actualAvailableAgvNos = filterLaneDto.getActualAvailableAgvNos(); |
| | | if (Cools.isEmpty(actualAvailableAgvNos)) { |
| | | return null; |
| | |
| | | calcAllocateWeight(o1, task) |
| | | )); |
| | | |
| | | if (null != originLane) { |
| | | task.setOriLaneHash(originLane.getHashCode()); |
| | | if (null != originLaneDto) { |
| | | task.setOriLaneHash(originLaneDto.getHashCode()); |
| | | } |
| | | if (null != destinationLane) { |
| | | task.setDestLaneHash(destinationLane.getHashCode()); |
| | | if (null != destinationLaneDto) { |
| | | task.setDestLaneHash(destinationLaneDto.getHashCode()); |
| | | } |
| | | |
| | | return actualAvailableAgvNos.get(0); |
| | |
| | | Integer maxAgvCountInLane = configService.getVal("maxAgvCountInLane", Integer.class); |
| | | |
| | | // checkout lane |
| | | Lane originLane = taskService.checkoutOriginLane(task); |
| | | Lane destinationLane = taskService.checkoutDestinationLane(task); |
| | | LaneDto originLaneDto = taskService.checkoutOriginLane(task); |
| | | LaneDto destinationLaneDto = taskService.checkoutDestinationLane(task); |
| | | |
| | | // allocate about origin |
| | | List<String> availableAgvNosByOriLane = new ArrayList<>(availableAgvNos); |
| | | if (null != originLane) { |
| | | List<String> agvNosByOriLane = findAgvNosByLane(originLane); // the agv list that had tasks in this lane |
| | | if (null != originLaneDto) { |
| | | List<String> agvNosByOriLane = findAgvNosByLane(originLaneDto); // the agv list that had tasks in this lane |
| | | // if full lane |
| | | if (agvNosByOriLane.size() >= maxAgvCountInLane) { |
| | | |
| | |
| | | |
| | | // allocate about destination |
| | | List<String> availableAgvNosByDestLane = new ArrayList<>(availableAgvNos); |
| | | if (null != destinationLane) { |
| | | List<String> agvNosByDestLane = findAgvNosByLane(destinationLane); |
| | | if (null != destinationLaneDto) { |
| | | List<String> agvNosByDestLane = findAgvNosByLane(destinationLaneDto); |
| | | if (agvNosByDestLane.size() >= maxAgvCountInLane) { |
| | | |
| | | availableAgvNosByDestLane = Cools.getIntersection(agvNosByDestLane, availableAgvNos); |
| | |
| | | return null; |
| | | } |
| | | |
| | | return new FilterLaneDto(originLane, destinationLane, actualAvailableAgvNos); |
| | | return new FilterLaneDto(originLaneDto, destinationLaneDto, actualAvailableAgvNos); |
| | | } |
| | | |
| | | public List<String> findAgvNosByLane(Lane lane) { |
| | | if (null == lane) { |
| | | public List<String> findAgvNosByLane(LaneDto laneDto) { |
| | | if (null == laneDto) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<Task> taskList = taskService.findRunningTasksByLaneHash(lane.getHashCode()); |
| | | List<Task> taskList = taskService.findRunningTasksByLaneHash(laneDto.getHashCode()); |
| | | if (Cools.isEmpty(taskList)) { |
| | | return new ArrayList<>(); |
| | | } |
| | |
| | | } |
| | | |
| | | public Boolean validCapacityOfLane(String agvNo, Code code) { |
| | | Lane lane = laneBuilder.search(code.getData()); |
| | | if (null != lane) { |
| | | LaneDto laneDto = laneBuilder.search(code.getData()); |
| | | if (null != laneDto) { |
| | | Integer maxAgvCountInLane = configService.getVal("maxAgvCountInLane", Integer.class); |
| | | |
| | | List<String> agvNosByLane = this.findAgvNosByLane(lane); |
| | | List<String> agvNosByLane = this.findAgvNosByLane(laneDto); |
| | | agvNosByLane.remove(agvNo); |
| | | if (agvNosByLane.size() >= maxAgvCountInLane) { |
| | | return false; |