ebom正式工作表精确搜索时,如果存在物料,但是此物料不存在下级时,提示“不存在此BOM物料”

This commit is contained in:
曹鹏飞 2024-03-21 11:29:53 +08:00
parent 90a3568945
commit 1761db7965
1 changed files with 17 additions and 5 deletions

View File

@ -10,6 +10,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@ -23,10 +24,7 @@ import com.nflg.product.base.core.exception.NflgBusinessException;
import com.nflg.product.bomnew.constant.*;
import com.nflg.product.bomnew.mapper.master.BomNewEbomParentMapper;
import com.nflg.product.bomnew.pojo.dto.*;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomMaterialUseEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
import com.nflg.product.bomnew.pojo.entity.*;
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.*;
@ -256,7 +254,21 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
public Page<BomNewEbomParentVO> formalWorksheet(BomNewEbomParentQuery query) {
Page<BomNewEbomParentVO> result = this.getBaseMapper().formalWorksheet(new Page<>(query.getPage(), query.getPageSize()), query);
materialMainService.intiMaterialInfo(result.getRecords());
if (CollUtil.isNotEmpty(result.getRecords())) {
materialMainService.intiMaterialInfo(result.getRecords());
} else {
//查bom是否存在
LambdaQueryWrapper<BomNewEbomChildEntity> wrapper = new LambdaQueryWrapper<>();
if (StrUtil.isNotBlank(query.getDrawingNo())) {
wrapper.eq(BomNewEbomChildEntity::getDrawingNo, query.getDrawingNo());
} else if (StrUtil.isNotBlank(query.getMaterialNo())) {
wrapper.eq(BomNewEbomChildEntity::getMaterialNo, query.getMaterialNo());
}
if (wrapper.nonEmptyOfWhere() && ebomChildService.getBaseMapper().selectCount(wrapper) > 0) {
VUtils.isTure(true).throwMessage("不存在此BOM物料");
}
}
return result;
}