This commit is contained in:
jing's 2023-12-21 17:31:45 +08:00
parent 6748b2b7d0
commit 392d53784f
6 changed files with 478 additions and 20 deletions

View File

@ -0,0 +1,2 @@
package com.nflg.product.bomnew.pojo.dto;public class BomNewEBomParentCreateDTO {
}

View File

@ -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<BomNewEbomParentDTO> datas;
}

View File

@ -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;
}

View File

@ -19,6 +19,6 @@ public class BomNewEbomEditDetailVO implements Serializable {
private BomNewEbomParentVO parent; private BomNewEbomParentVO parent;
private List<BomNewEbomParentVO> list; private List<BomNewEbomParentVO> datas;
} }

View File

@ -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: 变更申请中 10OA审核中 15已审核 100: 历史正式物料(已审核)
*/
@ApiModelProperty(value = "流程状态0待提交 2:已驳回 5: 变更申请中 10OA审核中 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;
/**
* 项目类别FQL
*/
@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;
}

View File

@ -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.BomNewEbomMaterialUseEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity; import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity; 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.query.BomNewEbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO; import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomEditDetailVO; 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 com.nflg.product.bomnew.util.*;
import nflg.product.common.constant.STATE; import nflg.product.common.constant.STATE;
import nflg.product.common.vo.ResultVO; import nflg.product.common.vo.ResultVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -380,17 +382,17 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void convertToPBom(EBomToPBomParamDTO paramDto) throws ExecutionException, InterruptedException { public void convertToPBom(EBomToPBomParamDTO paramDto) throws ExecutionException, InterruptedException {
for (Long bomRowId:paramDto.getBomRowIds()) { for (Long bomRowId : paramDto.getBomRowIds()) {
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, this.getById(bomRowId)); BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, this.getById(bomRowId));
List<BomNewEbomParentVO> bomTree = getBomTree(bomRowId); List<BomNewEbomParentVO> bomTree = getBomTree(bomRowId);
EBomToPBom eBomToPBom =new EBomToPBom(parent,bomTree, paramDto.getFacCodes()); EBomToPBom eBomToPBom = new EBomToPBom(parent, bomTree, paramDto.getFacCodes());
eBomToPBom.convert(); eBomToPBom.convert();
if(CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())){ if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) {
pBomParentService.saveOrUpdateBatch(eBomToPBom.getPBomParentResult()); pBomParentService.saveOrUpdateBatch(eBomToPBom.getPBomParentResult());
} }
if(CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())){ if (CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())) {
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult()); pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
} }
@ -592,8 +594,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
List<Long> updateReviewIdList = new ArrayList<>();
List<Long> updateReviewIdList=new ArrayList<>();
//子bom检查 //子bom检查
for (BomNewEbomParentEntity item : for (BomNewEbomParentEntity item :
bomNewEbomParentEntityList) { bomNewEbomParentEntityList) {
@ -654,23 +655,21 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
} }
} }
updateReviewIdList.addAll( childBomList.stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList())); updateReviewIdList.addAll(childBomList.stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList()));
} }
//改变复核状态 //改变复核状态
List<BomNewEbomParentEntity> updateReviewList=new ArrayList<>(); List<BomNewEbomParentEntity> updateReviewList = new ArrayList<>();
for(Long id:updateReviewIdList){ for (Long id : updateReviewIdList) {
BomNewEbomParentEntity entity=new BomNewEbomParentEntity(); BomNewEbomParentEntity entity = new BomNewEbomParentEntity();
entity.setRowId(id); entity.setRowId(id);
entity.setAuditTime(LocalDateTime.now()); entity.setAuditTime(LocalDateTime.now());
entity.setAuditUserName(dto.getRevertUserName()); entity.setAuditUserName(dto.getRevertUserName());
@ -685,21 +684,57 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
public BomNewEbomEditDetailVO editDetail(Long bomRowId){ public BomNewEbomEditDetailVO editDetail(Long bomRowId) {
BomNewEbomEditDetailVO vo=new BomNewEbomEditDetailVO(); BomNewEbomEditDetailVO vo = new BomNewEbomEditDetailVO();
BomNewEbomParentEntity parent = this.getBaseMapper().selectById(bomRowId); BomNewEbomParentEntity parent = this.getBaseMapper().selectById(bomRowId);
BomNewEbomParentVO parentVO= Convert.convert(BomNewEbomParentVO.class,parent); BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parent);
List<BomNewEbomParentVO> parentList=new ArrayList<>(); List<BomNewEbomParentVO> parentList = new ArrayList<>();
parentList.add(parentVO); parentList.add(parentVO);
materialMainService.intiMaterialInfo(parentList ); materialMainService.intiMaterialInfo(parentList);
vo.setList(getChild(bomRowId)); vo.setList(getChild(bomRowId));
vo.setParent(parentList.get(0)); vo.setParent(parentList.get(0));
return vo; return vo;
} }
public BaseMaterialVO queryMaterial(BomNewEbomMaterialQuery query) {
List<MaterialMainEntity> 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, "未查询到相关物料信息");
}
} }