| | |
| | | package com.zy.acs.manager.core.constant; |
| | | |
| | | import org.springframework.stereotype.Component; |
| | | import com.zy.acs.manager.manager.entity.Loc; |
| | | import com.zy.acs.manager.manager.entity.Task; |
| | | import com.zy.acs.manager.manager.service.LocService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.List; |
| | |
| | | import static com.zy.acs.manager.core.constant.AreaConstant.*; |
| | | import static com.zy.acs.manager.core.constant.AreaDisableConstant.*; |
| | | |
| | | @Component |
| | | @Service |
| | | public class AgvAreaDispatcher { |
| | | |
| | | public static final Map<String, List<String>> AGV_AREA = new ConcurrentHashMap<>(); |
| | | public static final Map<String, List<String>> AGV_DISABLE_AREA = new ConcurrentHashMap<>(); |
| | | |
| | | @Autowired |
| | | private LocService locService; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | |
| | | } |
| | | } |
| | | |
| | | public List<String> getAgvNosByTask(Task task) { |
| | | if (null == task) { |
| | | return null; |
| | | } |
| | | Loc oriLoc = null; |
| | | Loc destLoc = null; |
| | | if (null != task.getOriLoc()) { |
| | | oriLoc = locService.getById(task.getOriLoc()); |
| | | return this.getAgvNosByRow(oriLoc.getRow()); |
| | | } |
| | | if (null != task.getDestLoc()) { |
| | | destLoc = locService.getById(task.getDestLoc()); |
| | | return this.getAgvNosByRow(destLoc.getRow()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public List<String> getAgvNosByRow(Integer row) { |
| | | if (LocGroupConstant.FAR_LEFT_LOC_ROW_LIST.contains(row)) { |
| | | return AgvGroupConstant.FIRST_AGV_GROUP; |
| | | } |
| | | if (LocGroupConstant.LEFT_LOC_ROW_LIST.contains(row)) { |
| | | return AgvGroupConstant.SECOND_AGV_GROUP; |
| | | } |
| | | if (LocGroupConstant.MIDDLE_LOC_ROW_LIST.contains(row)) { |
| | | return AgvGroupConstant.THIRD_AGV_GROUP; |
| | | } |
| | | if (LocGroupConstant.RIGHT_LOC_ROW_LIST.contains(row)) { |
| | | return AgvGroupConstant.FOURTH_AGV_GROUP; |
| | | } |
| | | if (LocGroupConstant.FAR_RIGHT_LOC_ROW_LIST.contains(row)) { |
| | | return AgvGroupConstant.FIFTH_AGV_GROUP; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |