skyouc
2025-03-21 180a71c6cce5954cbd774db63a968f8f61994e4a
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/WarehouseController.java
@@ -73,6 +73,14 @@
        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)) {
@@ -92,6 +100,15 @@
            throw new CoolException("仓库名称不能为空!!");
        }
        warehouse.setUpdateBy(getLoginUserId());
        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("仓库编码已存在!!");
        }
        if (!warehouseService.updateById(warehouse)) {
            return R.error("Update Fail");
        }
@@ -105,7 +122,8 @@
        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("当前仓库下有未删除库区, 不可操作删除!!");
        }