From 1e3641703827ed84e9c9f58a5dc40b5371852c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=B1=B3?= <470431449@qq.com> Date: Fri, 27 Sep 2024 15:29:04 +0800 Subject: [PATCH] =?UTF-8?q?bom-=E6=9F=A5=E7=9C=8B=EF=BC=9A=E5=9B=BE?= =?UTF-8?q?=E5=8F=B7=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/bomnew/api/user/BomReportApi.java | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java index 9b7a0e04..ad02869a 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java @@ -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> 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 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 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)); }