|  |  |  | 
|---|
|  |  |  | LocAreaMatRela locAreaMatRela = new LocAreaMatRela(); | 
|---|
|  |  |  | locAreaMatRela | 
|---|
|  |  |  | .setAreaMatId(param.getAreaMatId()) | 
|---|
|  |  |  | .setAreaId(param.getAreaId()) | 
|---|
|  |  |  | //                                .setAreaId(param.getAreaId()) | 
|---|
|  |  |  | .setLocId(locId) | 
|---|
|  |  |  | .setLocTypeId(typeId) | 
|---|
|  |  |  | .setMatnrId(matnrId.getId()) | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!Objects.isNull(param.getLocId()) && !param.getLocId().isEmpty()) { | 
|---|
|  |  |  | List<LocTypeRela> list = locTypeRelaService.list(new LambdaQueryWrapper<LocTypeRela>().in(LocTypeRela::getLocId, param.getLocId()).select(LocTypeRela::getTypeId, LocTypeRela::getLocId)); | 
|---|
|  |  |  | List<LocTypeRela> list = locTypeRelaService.list(new LambdaQueryWrapper<LocTypeRela>() | 
|---|
|  |  |  | .in(LocTypeRela::getLocId, param.getLocId()) | 
|---|
|  |  |  | .select(LocTypeRela::getTypeId, LocTypeRela::getLocId)); | 
|---|
|  |  |  | if (list.isEmpty()) { | 
|---|
|  |  |  | throw new CoolException("数据错误:库位未绑定库位类型!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!this.remove(new LambdaQueryWrapper<LocAreaMatRela>() | 
|---|
|  |  |  | .eq(LocAreaMatRela::getAreaMatId, Long.parseLong(param.get("areaMatId").toString())) | 
|---|
|  |  |  | .eq(LocAreaMatRela::getLocTypeId, Long.parseLong(param.get("locTypeId").toString())))) { | 
|---|
|  |  |  | .eq(LocAreaMatRela::getLocTypeId, Long.parseLong(param.get("typeId").toString())))) { | 
|---|
|  |  |  | throw new CoolException("删除失败!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<LocAreaMatRela> locAreaMatRelas = this.list(new LambdaQueryWrapper<LocAreaMatRela>().eq(LocAreaMatRela::getAreaMatId, id)); | 
|---|
|  |  |  | if (locAreaMatRelas.isEmpty()) { | 
|---|
|  |  |  | throw new CoolException("库区绑定物料为空!!"); | 
|---|
|  |  |  | return new ArrayList<>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<Long> longList = locAreaMatRelas.stream().map(LocAreaMatRela::getGroupId).collect(Collectors.toList()); | 
|---|
|  |  |  | List<MatnrGroup> groups = matnrGroupService.list(new LambdaQueryWrapper<MatnrGroup>().in(MatnrGroup::getId, longList)); | 
|---|
|  |  |  | if (groups.isEmpty()) { | 
|---|
|  |  |  | throw new CoolException("数据错误:物料分组不存在!!"); | 
|---|
|  |  |  | return new ArrayList<>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return groups; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<LocAreaMatRela> locAreaMatRelas = this.list(new LambdaQueryWrapper<LocAreaMatRela>().eq(LocAreaMatRela::getAreaMatId, id)); | 
|---|
|  |  |  | if (locAreaMatRelas.isEmpty()) { | 
|---|
|  |  |  | throw new CoolException("库区绑定物料为空!!"); | 
|---|
|  |  |  | return new ArrayList<>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<Long> longList = locAreaMatRelas.stream().map(LocAreaMatRela::getLocTypeId).collect(Collectors.toList()); | 
|---|
|  |  |  | List<LocType> list = locTypeService.list(new LambdaQueryWrapper<LocType>().in(LocType::getId, longList)); | 
|---|
|  |  |  | if (list.isEmpty()) { | 
|---|
|  |  |  | throw new CoolException("数据错误:库位类型不存在!!"); | 
|---|
|  |  |  | return new ArrayList<>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | } | 
|---|