| | |
| | | locMast = locMastList.get(0); |
| | | } else { // 奇数,不可以入库 |
| | | // 自动给前面任务补尾桶信号 |
| | | if (wrkMast.getCtnType() == 0) { |
| | | wrkMast.setCtnType(1); |
| | | wrkMastService.updateById(wrkMast); |
| | | log.info("自动补尾桶信号成功,任务号:{}",wrkMast.getCtnType()); |
| | | } |
| | | wrkMastService.updateCtnType(wrkMast); |
| | | log.error("-----与前面桶类型不一样,前面桶不是尾桶,前面该桶类型任务数不是偶数,不能入库----"); |
| | | throw new CoolException("与前面桶类型不一样,前面桶不是尾桶,前面该桶类型任务数不是偶数,不能入库"); |
| | | } |
| | |
| | | throw new CoolException("入库请求库位失败,没有联机堆垛机或堆垛机异常"); |
| | | } |
| | | |
| | | List<Integer> crnList = basCrnps.stream().map(BasCrnp::getCrnNo).collect(Collectors.toList()); |
| | | List<BasCrnp> basCrnpList = new ArrayList<>(); |
| | | for(BasCrnp basCrnp: basCrnps) { |
| | | Integer count = locMastMapper.selectCount(new EntityWrapper<LocMast>().eq("crn_no", basCrnp.getCrnNo()).eq("loc_sts", "S")); |
| | | basCrnp.setWrkNo(count); |
| | | basCrnpList.add(basCrnp); |
| | | } |
| | | |
| | | basCrnpList = basCrnpList.stream().sorted(Comparator.comparing(BasCrnp::getWrkNo)).collect(Collectors.toList()); |
| | | |
| | | // 入库桶型 |
| | | String model = findLocNoAttributeVo.getModel(); |
| | | Wrapper<LocMast> wrapper = new EntityWrapper<LocMast>().eq("loc_sts", 'O') |
| | | .in("crn_no", crnList).orderBy("lev1").orderBy("bay1").orderBy("row1"); |
| | | // 入库桶型是不是208L |
| | | if (model == null || !model.equals("208L")) { |
| | | wrapper.ne("lev1", 11); |
| | | } |
| | | locMast = locMastService.selectOne(wrapper.in("row1", 1, 4, 5, 6, 7, 8)); |
| | | // 深库位没有了则获取一个浅库位 |
| | | if (locMast == null) { |
| | | locMast = locMastService.selectOne(wrapper.in("row1", 2, 3)); |
| | | if (locMast == null) { |
| | | log.error("-----库位不足----"); |
| | | throw new CoolException("库位不足"); |
| | | } else { |
| | | int count = locMastService.selectCount(wrapper.in("row1", 2, 3)); |
| | | if (count <= 10) { |
| | | log.error("-----库位不足,预留10个库位用来库位转移----"); |
| | | throw new CoolException("库位不足,预留10个库位用来库位转移"); |
| | | |
| | | locMast = null; |
| | | |
| | | for(BasCrnp basCrnp:basCrnpList) { |
| | | Integer crnNo = basCrnp.getCrnNo(); |
| | | Wrapper<LocMast> wrapper = new EntityWrapper<LocMast>().eq("loc_sts", 'O') |
| | | .eq("crn_no", crnNo).orderBy("lev1").orderBy("bay1").orderBy("row1"); |
| | | // 入库桶型是不是208L |
| | | if (model == null || !model.equals("208L")) { |
| | | wrapper.ne("lev1", 11); |
| | | } |
| | | if (crnNo == 1) { |
| | | wrapper.in("row1", 1, 4); |
| | | } |
| | | locMast = locMastService.selectOne(wrapper); |
| | | if (locMast != null) { |
| | | break; |
| | | } |
| | | // 深库位没有了则获取一个浅库位 |
| | | if (crnNo == 1) { |
| | | locMast = locMastService.selectOne(wrapper.in("row1", 2, 3)); |
| | | if (locMast != null) { |
| | | int count = locMastService.selectCount(wrapper); |
| | | if (count <= 10) { |
| | | locMast = null; |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (locMast == null) { |
| | | List<Integer> collect = basCrnps.stream().map(BasCrnp::getCrnNo).collect(Collectors.toList()); |
| | | log.error("-----{}堆垛机库位不足----",collect.toString()); |
| | | throw new CoolException(collect.toString() + "堆垛机库位不足"); |
| | | } |
| | | } else { |
| | | log.error("入库类型错误,staDescId={}", staDescId); |
| | | throw new CoolException("入库类型错误,staDescId=" + staDescId); |