| | |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.api.enums.LocAreaType; |
| | | import com.zy.api.enums.MatLocType; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.enums.LocStsType; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.BasAreasServiceImpl; |
| | | import com.zy.asrs.service.impl.BasStationServiceImpl; |
| | | import com.zy.asrs.service.impl.LocCacheServiceImpl; |
| | | import com.zy.asrs.service.impl.MatServiceImpl; |
| | | import com.zy.common.model.LocDto; |
| | | import com.zy.common.model.TaskDto; |
| | | import com.zy.common.web.BaseController; |
| | |
| | | private LocCacheServiceImpl locCacheService; |
| | | @Autowired |
| | | private BasStationServiceImpl basStationService; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | |
| | | @PostMapping("/out/pakout/orderDetlIds/auth") |
| | |
| | | |
| | | List<LocDto> locDtos = new ArrayList<>(); |
| | | |
| | | Set<String> exist = new HashSet<>(); |
| | | Set<String> exist = new HashSet<>(); |
| | | |
| | | // 获取订单主表 |
| | | OrderPakout orderPakOut = orderPakOutService.selectByNo(orderDetlPakouts.get(0).getOrderNo()); |
| | |
| | | List<String> collect = basStations.stream().map(BasStation::getDevNo).collect(Collectors.toList()); |
| | | locDto.setAgvStaNos(collect); |
| | | locDto.setBrand(orderDetl.getBrand()); |
| | | locDto.setSuppCode(orderDetl.getSuppCode()); |
| | | |
| | | locDto.setStandby1(orderDetl.getStandby1()); |
| | | locDto.setStandby2(orderDetl.getStandby2()); |
| | |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | locDto.setFrozen(locDetl.getFrozen()); |
| | | locDto.setFrozenLoc(locMast.getFrozen()); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), currentIssue >= available ? 101 : 103); |
| | | locDto.setStaNos(staNos); |
| | | locDto.setBrand(orderDetl.getBrand()); |
| | | |
| | | Mat mat = matService.selectOne(new EntityWrapper<Mat>() |
| | | .eq("matnr", locDetl.getMatnr()) |
| | | .eq("supp_code", locDetl.getSuppCode())); |
| | | if (Objects.isNull(mat)) { |
| | | throw new CoolException("物料基础信息不存在!!"); |
| | | } |
| | | if (!Objects.isNull(mat.getLocType()) && mat.getLocType().equals(Long.parseLong(MatLocType.EO_HOLDING.type))) { |
| | | locDto.setStaNos(Arrays.asList(240)); |
| | | } else { |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), currentIssue >= available ? 101 : 103); |
| | | locDto.setStaNos(staNos); |
| | | } |
| | | locDto.setBrand(orderDetl.getBrand()); |
| | | locDto.setStandby1(orderDetl.getStandby1()); |
| | | locDto.setStandby2(orderDetl.getStandby2()); |
| | | locDto.setStandby3(orderDetl.getStandby3()); |
| | |
| | | locDto.setBoxType2(orderDetl.getBoxType2()); |
| | | locDto.setBoxType3(orderDetl.getBoxType3()); |
| | | locDtos.add(locDto); |
| | | |
| | | |
| | | locDetlUsage.put(detlId, used + currentIssue); |
| | | // 剩余待出数量递减 |
| | | issued = issued - currentIssue; |
| | |
| | | if (Cools.isEmpty(locDtos)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | |
| | | |
| | | List<LocDto> locDtoArrayList = new ArrayList<>(); |
| | | for (LocDto locDto : locDtos){ |
| | | if (locDto.getFrozen()!=1 && locDto.getFrozenLoc()!=1){ |
| | |
| | | for (LocDto locDto : locDtos) { |
| | | if (locDto.isLack()) { continue; } |
| | | TaskDto taskDto = new TaskDto(locDto.getLocNo(), locDto.getAgvStaNo(), locDto); |
| | | if (TaskDto.has(taskDtos, taskDto)) { |
| | | TaskDto dto = TaskDto.find(taskDtos, taskDto); |
| | | if (TaskDto.hasAgv(taskDtos, taskDto)) { |
| | | TaskDto dto = TaskDto.findAgv(taskDtos, taskDto); |
| | | assert dto != null; |
| | | dto.getLocDtos().addAll(taskDto.getLocDtos()); |
| | | } else { |
| | |
| | | } |
| | | } |
| | | // ----------------------------------------------------------------------------------------------- |
| | | for (TaskDto taskDto : taskDtos) { |
| | | // BasDevp staNo = basDevpService.checkSiteStatus(taskDto.getStaNo()); |
| | | BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>() |
| | | .in("loc_sts", Arrays.asList(LocStsType.LOC_STS_TYPE_O.type, LocStsType.LOC_STS_TYPE_O.type)) |
| | | .eq("dev_no", taskDto.getAgvStaNo())); |
| | | if (Objects.isNull(station)) { throw new CoolException("数据错误,站点不存在或已使用!!"); } |
| | | workService.agvStockOut(station, taskDto, getUserId()); |
| | | } |
| | | Map<String, List<TaskDto>> listMap = taskDtos.stream().collect(Collectors.groupingBy(TaskDto::getLocNo)); |
| | | listMap.keySet().forEach(locNo -> { |
| | | listMap.get(locNo).forEach(taskDto -> { |
| | | BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>() |
| | | .in("loc_sts", Arrays.asList(LocStsType.LOC_STS_TYPE_O.type, LocStsType.LOC_STS_TYPE_O.type)) |
| | | .eq("dev_no", taskDto.getAgvStaNo())); |
| | | if (Objects.isNull(station)) { throw new CoolException("数据错误,站点不存在或已使用!!"); } |
| | | workService.agvStockOut(station, taskDto, getUserId()); |
| | | }); |
| | | }); |
| | | // for (TaskDto taskDto : taskDtos) { |
| | | //// BasDevp staNo = basDevpService.checkSiteStatus(taskDto.getStaNo()); |
| | | // BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>() |
| | | // .in("loc_sts", Arrays.asList(LocStsType.LOC_STS_TYPE_O.type, LocStsType.LOC_STS_TYPE_O.type)) |
| | | // .eq("dev_no", taskDto.getAgvStaNo())); |
| | | // if (Objects.isNull(station)) { throw new CoolException("数据错误,站点不存在或已使用!!"); } |
| | | // workService.agvStockOut(station, taskDto, getUserId()); |
| | | // } |
| | | return R.ok(); |
| | | } |
| | | |