bom-查看:图号查询

This commit is contained in:
大米 2024-09-27 15:29:04 +08:00
parent ad7afba8f0
commit 1e36417038
1 changed files with 41 additions and 2 deletions

View File

@ -10,12 +10,14 @@ import com.google.common.collect.ImmutableList;
import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.base.core.exception.NflgBusinessException;
import com.nflg.product.bomnew.constant.ReportConstant;
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
import com.nflg.product.bomnew.pojo.query.ChildBomReportQuery;
import com.nflg.product.bomnew.pojo.query.CompareReportQuery;
import com.nflg.product.bomnew.pojo.query.ReverseReportQuery;
import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.service.CompareReportService;
import com.nflg.product.bomnew.service.ForwardReportService;
import com.nflg.product.bomnew.service.MaterialMainService;
import com.nflg.product.bomnew.service.ReverseReportService;
import com.nflg.product.bomnew.util.EecExcelUtil;
import com.nflg.product.bomnew.util.VUtils;
@ -48,13 +50,17 @@ public class BomReportApi extends BaseApi {
@Resource
CompareReportService compareReportService;
@Resource
MaterialMainService materialMainService;
@PostMapping("reverseReport")
@ApiOperation("bom-反查")
public ResultVO<List<ReverseReportVO>> reverseReport(@Valid @RequestBody ReverseReportQuery query) {
VUtils.isTure(!ImmutableList.of(1,2).contains(query.getBomType())).throwMessage("只能查询EBom和PBom");
VUtils.isTure(StrUtil.isBlank(query.getMaterialNo())).throwMessage("物料编码不能为空");
//图号查询
checkAndDrawingNoToMaterialNo(query);
if(query.getBomType().equals(1)){
return ResultVO.success(reverseReportService.queryEBom(query));
}
@ -64,6 +70,39 @@ public class BomReportApi extends BaseApi {
return ResultVO.success();
}
/**
* 图号转物料编码
* @param query
* @return
*/
private void checkAndDrawingNoToMaterialNo(ReverseReportQuery query){
VUtils.isTure(StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isBlank(query.getDrawingNo())).throwMessage("请输入物料编码或图号");
if(StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isNotBlank(query.getDrawingNo())) {
List<MaterialMainEntity> materials = materialMainService.lambdaQuery().eq(MaterialMainEntity::getDrawingNo, query.getDrawingNo()).list();
VUtils.isTure(CollUtil.isEmpty(materials)).throwMessage("图号在物料库不存在");
query.setMaterialNo(materials.get(0).getMaterialNo());
}
}
/**
* 处理图号查询
* 1.当输入物料编码时物料编码优先
* @param query
*/
private void handlerDrawingNoQuery(ReverseReportQuery query){
if(StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isNotBlank(query.getDrawingNo())) {
List<MaterialMainEntity> materials = materialMainService.lambdaQuery().eq(MaterialMainEntity::getDrawingNo, query.getDrawingNo()).list();
if(CollUtil.isNotEmpty(materials)) {
query.setMaterialNo(materials.get(0).getMaterialNo());
}
}
}
ResultVO checkQueryParam(ReverseReportQuery query) {
if (query == null) {
@ -121,7 +160,7 @@ public class BomReportApi extends BaseApi {
if (resultVO != null) {
return resultVO;
}
handlerDrawingNoQuery(query);
return ResultVO.success(forwardReportService.factoryBomType(query));
}