czt
2026-01-21 164a53adaed58ad0519bc214b08c0bfb287723f4
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/DepotService.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.fzzy.igds.constant.RedisConst;
import com.fzzy.igds.domain.Depot;
import com.fzzy.igds.domain.DepotStore;
import com.fzzy.igds.mapper.DepotMapper;
import com.fzzy.igds.utils.ContextUtil;
import com.ruoyi.common.core.redis.RedisCache;
@@ -43,7 +44,7 @@
        QueryWrapper<Depot> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("company_id", companyId);
        if(StringUtils.isNotBlank(deptId)){
            queryWrapper.eq("dept_id", deptId);
            queryWrapper.likeRight("dept_id", deptId);
        }
        
        if(idDesc){
@@ -55,6 +56,17 @@
        }
        return depotMapper.selectList(queryWrapper);
    }
    /**
     * 根据库存表信息,更新仓库库存
     * @param data
     */
    public void updateByDepotStore(DepotStore data) {
        UpdateWrapper<Depot> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id", data.getDepotId()).set("storage_real", data.getStorageReal());
        depotMapper.update(null, updateWrapper);
    }
    /**
@@ -257,4 +269,30 @@
        }
        return depot;
    }
    /**
     * 获取仓库信息-根据仓库名称获取仓库ID
     *
     * @param deptId
     * @return
     */
    public String getDepotId(String deptId, String depotName) {
        if (StringUtils.isEmpty(deptId)) {
            return null;
        }
        if (StringUtils.isEmpty(depotName)) {
            return null;
        }
        List<Depot> depotList = getCacheDepotList(ContextUtil.getCompanyId(), deptId);
        if(null == depotList || depotList.isEmpty()){
            return null;
        }
        for (Depot depot : depotList) {
            if(depotName.equals(depot.getName())){
                return depot.getId();
            }
        }
        return null;
    }
}