| | |
| | | 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; |
| | | |
| | |
| | | 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); |