| | |
| | | throw new CoolException("修改库位信息不能为空!!"); |
| | | } |
| | | |
| | | String join = loc.getType(); |
| | | if (!Objects.isNull(loc.getTypeIds()) && !loc.getTypeIds().isEmpty()) { |
| | | join = StringUtils.join(loc.getTypeIds(), ","); |
| | | } |
| | | boolean update = this.update(new LambdaUpdateWrapper<Loc>() |
| | | .in(Loc::getId, locs.getId()) |
| | | .eq(Loc::getStatus, 1) |
| | | .set(!Objects.isNull(loc.getAreaId()), Loc::getAreaId, loc.getAreaId()) |
| | | .set(!Objects.isNull(loc.getWarehouseId()), Loc::getWarehouseId, loc.getWarehouseId()) |
| | | .set(!Objects.isNull(loc.getUseStatus()), Loc::getUseStatus, loc.getUseStatus()) |
| | | .set(!Objects.isNull(loc.getType()), Loc::getType, loc.getType()) |
| | | .set(!Objects.isNull(loc.getTypeIds()) && !loc.getTypeIds().isEmpty(), Loc::getType, join) |
| | | .set(!Objects.isNull(loc.getLength()), Loc::getLength, loc.getLength()) |
| | | .set(!Objects.isNull(loc.getWidth()), Loc::getWidth, loc.getWidth()) |
| | | .set(!Objects.isNull(loc.getHeight()), Loc::getHeight, loc.getHeight()) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!this.saveBatch(list)) { |
| | | throw new CoolException("库位初始化失败!!"); |
| | | } |
| | | List<LocTypeRela> locTypeRelas = new ArrayList<>(); |
| | | for (Long typeId : param.getTypeIds()) { |
| | | for (Loc loc : list) { |
| | | LocTypeRela typeRela = new LocTypeRela(); |
| | | typeRela.setLocId(loc.getId()).setTypeId(typeId); |
| | | locTypeRelas.add(typeRela); |
| | | } |
| | | } |
| | | if (!locTypeRelaService.saveBatch(locTypeRelas)) { |
| | | throw new CoolException("库位类型关联失败!!"); |
| | | } |
| | | return R.ok("初始化成功!!"); |
| | | } |
| | | |