skyouc
2025-03-25 ef69d3bad0c7f03da11cb1c1e46a84bcebe02bc4
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocServiceImpl.java
@@ -12,6 +12,7 @@
import com.vincent.rsf.server.manager.mapper.LocTypeRelaMapper;
import com.vincent.rsf.server.manager.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -76,13 +77,15 @@
    @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("库区不存在!!");
        }
        String join = StringUtils.join(param.getTypeIds(), ",");
        List<Loc> list = new ArrayList<>();
        for (int r = param.getStartRow(); r <= param.getEndRow(); r++) {
@@ -96,10 +99,9 @@
                            .setRow(r)
                            .setCol(b)
                            .setLev(l)
                            .setType(join)
                            .setAreaId(param.getAreaId())
                            .setWarehouseId(warehouseAreas.getWarehouseId())
                            .setType(param.getType());
                            .setWarehouseId(warehouseAreas.getWarehouseId());
                    list.add(loc);
                }
            }
@@ -146,8 +148,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 +158,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)) {