diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/BomNewEBomParentCreateDTO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/BomNewEBomParentCreateDTO.java new file mode 100644 index 00000000..958f9cd2 --- /dev/null +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/BomNewEBomParentCreateDTO.java @@ -0,0 +1,2 @@ +package com.nflg.product.bomnew.pojo.dto;public class BomNewEBomParentCreateDTO { +} diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/BomNewEBomParentEditDTO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/BomNewEBomParentEditDTO.java new file mode 100644 index 00000000..105641c6 --- /dev/null +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/BomNewEBomParentEditDTO.java @@ -0,0 +1,17 @@ +package com.nflg.product.bomnew.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class BomNewEBomParentCreateDTO { + + @ApiModelProperty("操作类型 1-暂存 2-提交") + private Integer opType=1; + @ApiModelProperty("列表数据") + private List datas; + + +} diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/query/BomNewEbomMaterialQuery.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/query/BomNewEbomMaterialQuery.java new file mode 100644 index 00000000..b836a28f --- /dev/null +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/query/BomNewEbomMaterialQuery.java @@ -0,0 +1,36 @@ +package com.nflg.product.bomnew.pojo.query; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * t_bom_new_ebom_parent + * + * + * @author makejava + * @since 2023-11-17 16:55:15 + */ +@Data +@Accessors(chain = true) +@ApiModel(value="com-nflg-product-bomnew-pojo-new-query-BomNewEbomMaterialQuery") +public class BomNewEbomMaterialQuery implements Serializable { + + /** + * 图号 + */ + @ApiModelProperty(value = "图号") + private String drawingNo; + + /** + * 物料编码 + */ + @ApiModelProperty(value = "物料编码") + private String materialNo; + + + +} diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomEditDetailVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomEditDetailVO.java index d026b820..7021067a 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomEditDetailVO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomEditDetailVO.java @@ -19,6 +19,6 @@ public class BomNewEbomEditDetailVO implements Serializable { private BomNewEbomParentVO parent; - private List list; + private List datas; } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/MaterialMainVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/MaterialMainVO.java new file mode 100644 index 00000000..65f82421 --- /dev/null +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/MaterialMainVO.java @@ -0,0 +1,368 @@ +package com.nflg.product.bomnew.pojo.vo; + + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +@Data +public class MaterialMainVO { + + /** + * 行ID 雪花 + */ + + @ApiModelProperty(value = "行ID 雪花") + private Long rowId; + + /** + * 物料编码 + */ + + @ApiModelProperty(value = "物料编码") + private String materialNo; + + /** + * 物料名称 + */ + + @ApiModelProperty(value = "物料名称") + private String materialName; + + /** + * 物料描述 + */ + + @ApiModelProperty(value = "物料描述") + private String materialDesc; + + /** + * 物料描述(简写) + */ + + @ApiModelProperty(value = "物料描述(简写)") + private String shortMaterialDesc; + + /** + * 物料规格 + */ + + @ApiModelProperty(value = "物料规格") + private String materialSpecifications; + + /** + * 物料分类编码 + */ + + @ApiModelProperty(value = "物料分类编码") + private String materialCategoryCode; + + /** + * 图号 + */ + + @ApiModelProperty(value = "图号") + private String drawingNo; + + /** + * 重量-kg + */ + + @ApiModelProperty(value = "重量-kg") + private String materialWeight; + + /** + * 品牌 + */ + + @ApiModelProperty(value = "品牌") + private String materialBrand; + + /** + * 基本计量单位 + */ + + @ApiModelProperty(value = "基本计量单位") + private String materialUnit; + + /** + * 辅助单位 + */ + + @ApiModelProperty(value = "辅助单位") + private String materialAssistUnit; + + /** + * 该字段废除 + */ + + @ApiModelProperty(value = "该字段废除") + private Integer reuseState; + + /** + * 预估年使用量 + */ + + @ApiModelProperty(value = "预估年使用量") + private Integer useOfYear; + + /** + * 是否一次性使用物料 0:重复性使用物料;1:一次性使用物料 + */ + + @ApiModelProperty(value = "是否一次性使用物料 0:重复性使用物料;1:一次性使用物料") + private Integer reuseOfOnceState; + + /** + * 是否标准件:0:否 1:是 + */ + + @ApiModelProperty(value = "是否标准件:0:否 1:是") + private Integer standardState; + + /** + * 物料类型:0:外购 1:自制 + */ + + @ApiModelProperty(value = "物料类型:0:外购 1:自制") + private Integer materialType; + + /** + * 备注 + */ + + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 材质 + */ + + @ApiModelProperty(value = "材质") + private String materialTexture; + + /** + * 两年出库量 + */ + + @ApiModelProperty(value = "两年出库量") + private BigDecimal towYearLssl; + + /** + * 四年出库量 + */ + + @ApiModelProperty(value = "四年出库量") + private BigDecimal fourYearLssl; + + /** + * 两年出库天次 + */ + + @ApiModelProperty(value = "两年出库天次") + private Integer towYearLsslDay; + + /** + * 库存量 + */ + + @ApiModelProperty(value = "库存量") + private BigDecimal materialStock; + + /** + * 最近采购价格 + */ + + @ApiModelProperty(value = "最近采购价格") + private BigDecimal lastPurchasePrice; + + /** + * 最近采购日期 + */ + + @ApiModelProperty(value = "最近采购日期") + private LocalDate lastPurchaseDate; + + /** + * 最近出库时间 + */ + + @ApiModelProperty(value = "最近出库时间") + private LocalDateTime lastOutWarehouseTime; + + /** + * 订单保护价 + */ + + @ApiModelProperty(value = "订单保护价") + private BigDecimal orderProtectPrice; + + /** + * 配件销售价 + */ + + @ApiModelProperty(value = "配件销售价") + private BigDecimal partsSalePrice; + + /** + * 物料状态 1:激活 2:禁止采购 3:售后专用 4:冻结 5:完全弃用 + */ + + @ApiModelProperty(value = "物料状态 1:激活 2:禁止采购 3:售后专用 4:冻结 5:完全弃用") + private Integer materialState; + + /** + * 流程状态:0:待提交 2:已驳回 5: 变更申请中 10:OA审核中 15:已审核 100: 历史正式物料(已审核) + */ + + @ApiModelProperty(value = "流程状态:0:待提交 2:已驳回 5: 变更申请中 10:OA审核中 15:已审核 100: 历史正式物料(已审核)") + private Integer processState; + + /** + * 驳回人 + */ + + @ApiModelProperty(value = "驳回人") + private String rejectUser; + + /** + * 驳回原因 + */ + + @ApiModelProperty(value = "驳回原因") + private String rejectResion; + + /** + * 使用说明 + */ + + @ApiModelProperty(value = "使用说明") + private String useRemark; + + /** + * 申请人(存中文名称) + */ + + @ApiModelProperty(value = "申请人(存中文名称)") + private String applyUserCode; + + /** + * 申请部门 + */ + + @ApiModelProperty(value = "申请部门") + private String applyDeptName; + + /** + * 变更审请人 + */ + + @ApiModelProperty(value = "变更审请人") + private String updatedByUserCode; + + /** + * 最近变更时间 + */ + + @ApiModelProperty(value = "最近变更时间") + private LocalDateTime lastApplyTime; + + /** + * 替代物料 + */ + + @ApiModelProperty(value = "替代物料") + private String replaceMaterialNo; + + /** + * 物料分类:0:非正式物料 1:正式物料 + */ + + @ApiModelProperty(value = "物料分类:0:非正式物料 1:正式物料") + private Integer materialClass; + + /** + * 是否使用类别通用外形图:0=不使用、1=使用 + */ + + @ApiModelProperty(value = "是否使用类别通用外形图:0=不使用、1=使用") + private Integer commonZeroFile; + + /** + * 制作物料获取类型:1=自制、2=外协、3=采购 + */ + + @ApiModelProperty(value = "制作物料获取类型:1=自制、2=外协、3=采购") + private Integer materialGetType; + + /** + * 创建人 + */ + + @ApiModelProperty(value = "创建人") + private String createdBy; + + /** + * 创建时间 + */ + + @ApiModelProperty(value = "创建时间") + private LocalDateTime createdTime; + + /** + * 更新人 + */ + + @ApiModelProperty(value = "更新人") + private String updatedBy; + + /** + * 更新时间 + */ + + @ApiModelProperty(value = "更新时间") + private LocalDateTime updatedTime; + + /** + * 对应OA 的行ID + */ + + @ApiModelProperty(value = "对应OA 的行ID") + private Long oaRowId; + + /** + * 采购类型 + */ + + @ApiModelProperty(value = "采购类型") + private String procureType; + + /** + * 项目类别(F、Q、L) + */ + @TableField(value = "project_type") + @ApiModelProperty(value = "项目类别(F、Q、L)") + private String projectType; + + /** + * 冻结计算起始日期 + */ + @TableField(value = "freeze_calc_start") + @ApiModelProperty(value = "冻结计算起始日期") + private LocalDate freezeCalcStart; + + /** + * 推荐度(0-5) + */ + @TableField(value = "recommend") + @ApiModelProperty(value = "推荐度(0-5)") + private Integer recommend; + + +} 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 4a9a9f6a..f95263e9 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 @@ -26,6 +26,7 @@ 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.query.BomNewEbomMaterialQuery; import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery; import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO; import com.nflg.product.bomnew.pojo.vo.BomNewEbomEditDetailVO; @@ -35,6 +36,7 @@ import com.nflg.product.bomnew.service.domain.EBom.*; import com.nflg.product.bomnew.util.*; import nflg.product.common.constant.STATE; import nflg.product.common.vo.ResultVO; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -380,17 +382,17 @@ public class BomNewEbomParentService extends ServiceImpl bomTree = getBomTree(bomRowId); - EBomToPBom eBomToPBom =new EBomToPBom(parent,bomTree, paramDto.getFacCodes()); + EBomToPBom eBomToPBom = new EBomToPBom(parent, bomTree, paramDto.getFacCodes()); eBomToPBom.convert(); - if(CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())){ + if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) { pBomParentService.saveOrUpdateBatch(eBomToPBom.getPBomParentResult()); } - if(CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())){ + if (CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())) { pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult()); } @@ -592,8 +594,7 @@ public class BomNewEbomParentService extends ServiceImpl updateReviewIdList=new ArrayList<>(); + List updateReviewIdList = new ArrayList<>(); //子bom检查 for (BomNewEbomParentEntity item : bomNewEbomParentEntityList) { @@ -654,23 +655,21 @@ public class BomNewEbomParentService extends ServiceImpl updateReviewList=new ArrayList<>(); - for(Long id:updateReviewIdList){ - BomNewEbomParentEntity entity=new BomNewEbomParentEntity(); + List updateReviewList = new ArrayList<>(); + for (Long id : updateReviewIdList) { + BomNewEbomParentEntity entity = new BomNewEbomParentEntity(); entity.setRowId(id); entity.setAuditTime(LocalDateTime.now()); entity.setAuditUserName(dto.getRevertUserName()); @@ -685,21 +684,57 @@ public class BomNewEbomParentService extends ServiceImpl parentList=new ArrayList<>(); + BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parent); + List parentList = new ArrayList<>(); parentList.add(parentVO); - materialMainService.intiMaterialInfo(parentList ); + materialMainService.intiMaterialInfo(parentList); vo.setList(getChild(bomRowId)); vo.setParent(parentList.get(0)); - return vo; + return vo; } + public BaseMaterialVO queryMaterial(BomNewEbomMaterialQuery query) { + List materialMainList=null; + if (StringUtils.isNotEmpty(query.getMaterialNo())) { + materialMainList = materialMainService.lambdaQuery().eq(MaterialMainEntity::getMaterialNo, query.getMaterialNo()).list(); + if (CollUtil.isEmpty(materialMainList)) { + throw new NflgBusinessException(STATE.Error, StrUtil.format("{} 物料编码的物料信息不存在",query.getMaterialNo())); + } + if (CollUtil.isNotEmpty(materialMainList) && materialMainList.size() > 1) { + throw new NflgBusinessException(STATE.Error, StrUtil.format("同时存在{}多条相同物料编码的物料信息",query.getMaterialNo())); + } + + }else if (StringUtils.isNotEmpty(query.getDrawingNo())) { + materialMainList = materialMainService.lambdaQuery().eq(MaterialMainEntity::getDrawingNo, query.getDrawingNo()).list(); + if (CollUtil.isEmpty(materialMainList)) { + throw new NflgBusinessException(STATE.Error, StrUtil.format("{} 图号的物料信息不存在",query.getDrawingNo())); + } + if (CollUtil.isNotEmpty(materialMainList) && materialMainList.size() > 1) { + throw new NflgBusinessException(STATE.Error, StrUtil.format("同时存在多条 {} 图号的物料信息",query.getDrawingNo())); + } + + } + + if(CollUtil.isNotEmpty(materialMainList)){ + MaterialMainEntity materialMainEntity = materialMainList.get(0); + BaseMaterialVO baseMaterialVO = new BaseMaterialVO(); + BeanUtil.copyProperties(materialMainEntity, baseMaterialVO); + return baseMaterialVO; + } + + throw new NflgBusinessException(STATE.Error, "未查询到相关物料信息"); + +} + + + + }