| | |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.common.properties.SlaveProperties; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // 获取当前库位出库前方库位组不包含最外侧库位 |
| | | public static List<String> getGroupOutWrkLoc(String locNo){ |
| | | // 获取库位前侧全部单品区域库位组(不包含最外侧库位高频区域) |
| | | public static List<String> getGroupOuterSingleLoc(String locNo){ |
| | | int row = getRow(locNo); |
| | | switch (row) { |
| | | case 1: |
| | |
| | | if (sign) { |
| | | break; |
| | | } |
| | | List<String> groupInsideLoc = Utils.getGroupOutWrkLoc(locNo); |
| | | List<String> groupInsideLoc = Utils.getGroupOuterSingleLoc(locNo); |
| | | if (!Cools.isEmpty(groupInsideLoc)) { |
| | | for (String insideLoc : groupInsideLoc) { |
| | | if (locNos.contains(insideLoc)) { |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 随机获取可用且有空库位的堆垛机号 |
| | | */ |
| | | public static Integer getRandomCrnNo(List<Integer> crnNos, Short locType1) { |
| | | BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class); |
| | | LocMastService locMastService = SpringUtils.getBean(LocMastService.class); |
| | | Random random = new Random(); |
| | | //可用堆垛机list |
| | | ArrayList<Integer> normalCrnNos = new ArrayList<>(); |
| | | for (Integer crnNo : crnNos) { |
| | | List<LocMast> emptyLocMast = locMastService.findEmptyLocMast(locType1, crnNo); |
| | | if (basCrnpService.checkSiteError(crnNo, true) && emptyLocMast.size() > 0) { |
| | | normalCrnNos.add(crnNo); |
| | | } |
| | | } |
| | | if (normalCrnNos.size() == 0) { |
| | | throw new CoolException("没有可用堆垛机"); |
| | | } |
| | | //随机可用堆垛机号 |
| | | Integer randomCrnNo = normalCrnNos.get(random.nextInt(normalCrnNos.size())); |
| | | return randomCrnNo; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | List<String> groupLoc = Utils.getGroupLoc("1300801"); |
| | | System.out.println(groupLoc); |