skyouc
2025-03-21 515dc2664c481e3a65245b71aa1ff4a4d6bfb64f
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocServiceImpl.java
@@ -76,14 +76,14 @@
    @Transactional(rollbackFor = Exception.class)
    public R initLocs(LocMastInitParam param) {
        //清空表
        if (this.baseMapper.delete(new LambdaUpdateWrapper<>()) < 0) {
            throw new CoolException("数据库初始化失败:老数据删除失败!!");
        }
        WarehouseAreas warehouseAreas = warehouseAreasService.getById(param.getAreaId());
        this.baseMapper.deleteAll();
        WarehouseAreas warehouseAreas = warehouseAreasService.getOne(new LambdaQueryWrapper<WarehouseAreas>()
                .eq(WarehouseAreas::getWarehouseId, param.getWarehouseId())
                .eq(WarehouseAreas::getId, param.getAreaId()));
        if (Objects.isNull(warehouseAreas)) {
            throw new CoolException("库区不存在!!");
        }
        List<Loc> list = new ArrayList<>();
        for (int r = param.getStartRow(); r <= param.getEndRow(); r++) {
            for (int b = param.getStartBay(); b <= param.getEndBay(); b++) {
@@ -99,7 +99,6 @@
                            .setAreaId(param.getAreaId())
                            .setWarehouseId(warehouseAreas.getWarehouseId())
                            .setType(param.getType());
                    list.add(loc);
                }
            }
@@ -146,8 +145,7 @@
        if (locs.getId().isEmpty()) {
            throw new CoolException("库位ID不能为空!!");
        }
        Loc loc = locs.getLoc();
        if (Objects.isNull(loc)) {
        if (Objects.isNull(locs.getLocAreaId())) {
            throw new CoolException("修改库位信息不能为空!!");
        }
        List<LocArea> locAreas = locAreaService.list(new LambdaQueryWrapper<LocArea>().eq(LocArea::getId, locs.getLocAreaId()));
@@ -157,7 +155,8 @@
        List<LocAreaRela> relas = new ArrayList<>();
        locs.getId().forEach(id -> {
            LocAreaRela locAreaRela = new LocAreaRela();
            locAreaRela.setLocId(id).setLocAreaId(locs.getLocAreaId());
            locAreaRela.setLocId(id)
                    .setLocAreaId(locs.getLocAreaId());
            relas.add(locAreaRela);
        });
        if (!locAreaRelaService.saveBatch(relas)) {