| | |
| | | if (Objects.isNull(warehouse.getName())) { |
| | | throw new CoolException("仓库名称不能为空!!"); |
| | | } |
| | | List<Warehouse> warehouses = warehouseService.list(new LambdaQueryWrapper<Warehouse>().eq(Warehouse::getName, warehouse.getName())); |
| | | if (!warehouses.isEmpty()) { |
| | | throw new CoolException("仓库名称已存在!!"); |
| | | } |
| | | if (!warehouseService.list(new LambdaQueryWrapper<Warehouse>().eq(Warehouse::getCode, warehouse.getCode())).isEmpty()) { |
| | | throw new CoolException("仓库编码已存在!!"); |
| | | } |
| | | |
| | | warehouse.setCreateBy(getLoginUserId()); |
| | | warehouse.setUpdateBy(getLoginUserId()); |
| | | if (!warehouseService.save(warehouse)) { |
| | |
| | | throw new CoolException("仓库名称不能为空!!"); |
| | | } |
| | | warehouse.setUpdateBy(getLoginUserId()); |
| | | |
| | | Warehouse warehouse1 = warehouseService.getById(warehouse.getId()); |
| | | if (!warehouse.getName().equals(warehouse1.getName())) { |
| | | List<Warehouse> areasList = warehouseService.list(new LambdaQueryWrapper<Warehouse>().eq(Warehouse::getName, warehouse1.getName())); |
| | | if (!areasList.isEmpty()) { |
| | | throw new CoolException("仓库名已存在!!"); |
| | | } |
| | | } |
| | | if (!warehouse.getCode().equals(warehouse1.getCode())) { |
| | | List<Warehouse> areasList = warehouseService.list(new LambdaQueryWrapper<Warehouse>().eq(Warehouse::getCode, warehouse1.getCode())); |
| | | if (!areasList.isEmpty()) { |
| | | throw new CoolException("仓库编码已存在!!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (!warehouseService.updateById(warehouse)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | |
| | | if (ids.length < 1) { |
| | | throw new CoolException("查询id不能为空!!"); |
| | | } |
| | | List<WarehouseAreas> warehouseAreas = warehouseAreasService.list(new LambdaQueryWrapper<WarehouseAreas>().in(WarehouseAreas::getWareId, ids)); |
| | | List<WarehouseAreas> warehouseAreas = warehouseAreasService.list(new LambdaQueryWrapper<WarehouseAreas>() |
| | | .in(WarehouseAreas::getWarehouseId, ids)); |
| | | if (!warehouseAreas.isEmpty()) { |
| | | throw new CoolException("当前仓库下有未删除库区, 不可操作删除!!"); |
| | | } |