| | |
| | | return result; |
| | | } |
| | | |
| | | public synchronized Agv execute(Task task) { |
| | | public synchronized String execute(Task task, AllocateSupport support) { |
| | | // inbound roller station |
| | | Sta rollerOriSta = getInboundRollerSta(task); |
| | | Agv inboundAgv = tryAllocateForRoller(task, rollerOriSta, true); |
| | | if (inboundAgv != null) { |
| | | String inboundAgv = tryAllocateForRoller(task, rollerOriSta, true); |
| | | if (!Cools.isEmpty(inboundAgv)) { |
| | | return inboundAgv; |
| | | } |
| | | |
| | | // outbound roller station |
| | | Sta rollerDestSta = getOutboundRollerSta(task); |
| | | Agv outboundAgv = tryAllocateForRoller(task, rollerDestSta, false); |
| | | if (outboundAgv != null) { |
| | | String outboundAgv = tryAllocateForRoller(task, rollerDestSta, false); |
| | | if (!Cools.isEmpty(outboundAgv)) { |
| | | return outboundAgv; |
| | | } |
| | | |
| | | return this.normalExecute(task); |
| | | String normalAgv = this.normalExecute(task); |
| | | if (!Cools.isEmpty(normalAgv)) { |
| | | support.success(task, normalAgv); |
| | | return normalAgv; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | private Agv tryAllocateForRoller(Task task, Sta rollerSta, boolean inbound) { |
| | | private String tryAllocateForRoller(Task task, Sta rollerSta, boolean inbound) { |
| | | if (rollerSta == null) { |
| | | return null; |
| | | } |
| | |
| | | task.setDestLaneHash(filterLaneDto.getDestinationLane().getHashCode()); |
| | | } |
| | | |
| | | return agvService.selectByUuid(agvNo); |
| | | return agvNo; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * it can break the limit of the number of agv backpack |
| | | */ |
| | | public synchronized Agv normalExecute(Task task) { |
| | | public synchronized String normalExecute(Task task) { |
| | | List<String> availableAgvNos = this.getAvailableAgvNos(agvAreaDispatcher.getAgvNosByTask(task), false); |
| | | // List<String> availableAgvNos = this.getAvailableAgvNos(null); |
| | | if (Cools.isEmpty(availableAgvNos)) { |
| | |
| | | task.setDestLaneHash(destinationLane.getHashCode()); |
| | | } |
| | | |
| | | return agvService.selectByUuid(actualAvailableAgvNos.get(0)); |
| | | return actualAvailableAgvNos.get(0); |
| | | } |
| | | |
| | | private String checkoutAgvForInboundRoller(Task task, Sta sta, List<String> availableAgvNos) { |
| | |
| | | ) |
| | | ); |
| | | if (taskCnt == 0) { |
| | | break; |
| | | continue; |
| | | } |
| | | |
| | | // has enough backpack space to load |
| | | Integer backpack = agvService.getBackpack(agvId); |
| | | int countRemainingBackpack = segmentService.countRemainingBackpack(null, agvId); |
| | | if (countRemainingBackpack >= backpack) { |
| | | break; |
| | | continue; |
| | | } |
| | | |
| | | return agvNo; |