From 452e50a55031c5229e87aa82ecf922964016773e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Thu, 27 Jun 2024 15:46:42 +0800 Subject: [PATCH] =?UTF-8?q?optimize:=20=E4=BC=98=E5=8C=96=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E6=9F=A5=E8=AF=A2=E7=89=A9=E6=96=99=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nflg/product/bomnew/api/user/EbomApi.java | 2 +- .../bomnew/pojo/vo/EbomQueryMaterialsVO.java | 131 ++++++++++++++++++ .../service/BomNewEbomParentService.java | 32 +---- 3 files changed, 137 insertions(+), 28 deletions(-) create mode 100644 nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/EbomQueryMaterialsVO.java diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java index 8b0dbb5a..f1ff639a 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java @@ -482,7 +482,7 @@ public class EbomApi extends BaseApi { */ @PostMapping("queryMaterials") @ApiOperation("批量查询物料信息") - public ResultVO> queryMaterials(@Valid @RequestBody @NotEmpty List query) { + public ResultVO> queryMaterials(@Valid @RequestBody @NotEmpty List query) { return ResultVO.success(bomNewEbomParentService.queryMaterials(query)); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/EbomQueryMaterialsVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/EbomQueryMaterialsVO.java new file mode 100644 index 00000000..8db7cdb1 --- /dev/null +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/EbomQueryMaterialsVO.java @@ -0,0 +1,131 @@ +package com.nflg.product.bomnew.pojo.vo; + +import com.nflg.product.base.core.conmon.util.SessionUtil; +import com.nflg.product.bomnew.constant.EBomStatusEnum; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Objects; + +/** + * @author 曹鹏飞 + * @date 2024/6/27 11:43:35 + */ +@Data +@Accessors(chain = true) +public class EbomQueryMaterialsVO implements Serializable { + + @ApiModelProperty("物料主数据行ID") + private Long materialRowId; + + @ApiModelProperty("物料编码") + private String materialNo; + + @ApiModelProperty("物料名称") + private String materialName; + + @ApiModelProperty("物料描述") + private String materialDesc; + + @ApiModelProperty("物料分类编码") + private String materialCategoryCode; + + @ApiModelProperty("制作物料获取类型:1=自制、2=外协、3=采购") + private Integer materialGetType; + + @ApiModelProperty("采购类型") + private String procureType; + + @ApiModelProperty("物料状态 1:激活 2:禁止采购 3:售后专用 4:冻结 5:完全弃用") + private Integer materialState; + + @ApiModelProperty("图号") + protected String drawingNo; + + /** + * 材料 + */ + @ApiModelProperty(value = "材料") + private String material; + + @ApiModelProperty("材质") + private String materialTexture; + + @ApiModelProperty("物料大类别") + private String relCategoryCode; + + @ApiModelProperty("物料分类编码名称") + private String categoryName; + + @ApiModelProperty("单位") + private String materialUnit; + + @ApiModelProperty("单重") + private BigDecimal materialWeight; + + /** + * 前端行序号 + */ + @ApiModelProperty(value = "前端行序号") + private String orderNumber; + + /** + * 设计人员名称 + */ + @ApiModelProperty(value = "设计人员名称") + private String deviseName = SessionUtil.getRealName(); + + /** + * 设计维护部门名称 + */ + @ApiModelProperty(value = "设计维护部门名称") + private String deptName = SessionUtil.getDepartName(); + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private LocalDateTime createdTime = LocalDateTime.now(); + + /** + * 修改时间 + */ + @ApiModelProperty(value = "修改时间") + private LocalDateTime modifyTime; + + /** + * 版本过期时间=下个版本的创建时间 + */ + @ApiModelProperty(value = "版本过期时间=下个版本的创建时间") + private LocalDateTime expireEndTime = LocalDateTime.parse("9999-12-31 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + + /** + * 1=待复核、2=已复核、3=已退回、4=定版(已发布PBOM) + */ + @ApiModelProperty(value = "1=待复核、2=已复核、3=已退回、4=定版(已发布PBOM)99=借用件 100=引用件") + private Integer status = EBomStatusEnum.CHECKED.getValue(); + + /** + * 是否有BOM: 0-否 1-是 + */ + @ApiModelProperty(value = "是否有BOM: 0-否 1-是") + private Integer bomExist = 0; + + @ApiModelProperty("单重1") + private BigDecimal unitWeight; + + public BigDecimal getUnitWeight() { + if (Objects.nonNull(unitWeight)) { + return unitWeight; + } + return getMaterialWeight(); + } + + @ApiModelProperty("总重") + private BigDecimal totalWeight; +} diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java index 8c3fbab9..29500efe 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java @@ -2470,7 +2470,7 @@ public class BomNewEbomParentService extends ServiceImpl queryMaterials(List query) { + public List queryMaterials(List query) { List datas = new ArrayList<>(); List keys = query.stream().map(QueryMaterialsQuery::getMaterialNo) .filter(StrUtil::isNotBlank) @@ -2494,7 +2494,7 @@ public class BomNewEbomParentService extends ServiceImpl { - // QueryMaterialsVO vo = new QueryMaterialsVO(); - // vo.setMaterialNo(d.getMaterialNo()); - // vo.setMaterialName(d.getMaterialName()); - // vo.setMaterialDesc(d.getMaterialDesc()); - // vo.setUnitWeight(d.getMaterialWeight()); - // vo.setMaterialCategoryCode(d.getMaterialCategoryCode()); - // vo.setMaterialState(d.getMaterialState()); - // vo.setDrawingNo(d.getDrawingNo()); - // vo.setMaterialTexture(d.getMaterialTexture()); - // vo.setMaterialUnit(d.getMaterialUnit()); - // vo.setCategoryName(d.getCategoryName()); - // vo.setRelCategoryCode(d.getRelCategoryCode()); - // vo.setTotalWeight(d.getMaterialWeight()); - // QueryMaterialsQuery q = query.stream() - // .filter(f -> StrUtil.equals(f.getMaterialNo(), vo.getMaterialNo()) || StrUtil.equals(f.getDrawingNo(), vo.getDrawingNo())) - // .findFirst() - // .orElse(null); - // if (Objects.nonNull(q)) { - // vo.setUnitWeight(q.getUnitWeight()); - // vo.setProjectType(q.getProjectType()); - // } - // return vo; - // }).collect(Collectors.toList()); } public BomNewEbomParentEntity getLatestByMaterialNo(String materialNo) {