1.转PBOM

This commit is contained in:
大米 2023-12-23 19:01:29 +08:00
parent de3320b4f1
commit 47aa23a108
9 changed files with 245 additions and 44 deletions

View File

@ -14,10 +14,7 @@ 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.query.OriginalBomQuery; import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
import com.nflg.product.bomnew.pojo.vo.*; import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.service.BomNewEbomParentService; import com.nflg.product.bomnew.service.*;
import com.nflg.product.bomnew.service.BomNewOriginalParentService;
import com.nflg.product.bomnew.service.MaterialMainService;
import com.nflg.product.bomnew.service.UserRoleService;
import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageBase; import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageBase;
import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageFor31; import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageFor31;
import com.nflg.product.bomnew.util.EecExcelUtil; import com.nflg.product.bomnew.util.EecExcelUtil;
@ -66,6 +63,9 @@ public class EbomApi extends BaseApi {
@Resource @Resource
private UserRoleService userRoleService; private UserRoleService userRoleService;
@Resource
private BomNewEbomUpgradeChangeService upgradeChangeService;
@PostMapping("workDetailsListByPage") @PostMapping("workDetailsListByPage")
@ApiOperation("Ebom-工作明细列表") @ApiOperation("Ebom-工作明细列表")
@ -81,10 +81,28 @@ public class EbomApi extends BaseApi {
@PostMapping("changeImpact") @PostMapping("changeImpact")
@ApiOperation("Ebom-变更影响") @ApiOperation("Ebom-变更影响")
public ResultVO<Page<BomNewEbomParentVO>> changeImpact(@RequestBody BomNewEbomParentQuery query) { public ResultVO<Page<BomNewEbomUpgradeChangeVO>> changeImpact(@RequestBody BomNewEbomParentQuery query) {
return ResultVO.success(bomNewEbomParentService.formalWorksheet(query)); return ResultVO.success(bomNewEbomParentService.getUpgradeChangeList(query));
} }
@PostMapping("delChangeImpact")
@ApiOperation("Ebom-删除变更影响")
public ResultVO<Boolean> delChangeImpact(@RequestBody List<Long> rowIds){
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要删除的数据");
upgradeChangeService.delChangeImpact(rowIds);
return ResultVO.success(true);
}
@PostMapping("updateChangeImpactVersion")
@ApiOperation("Ebom-更新版本")
public ResultVO<Boolean> updateChangeImpactVersion(@RequestBody List<Long> rowIds){
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要更新版本的数据");
upgradeChangeService.updateChangeImpactVersion(rowIds);
return ResultVO.success(true);
}
@GetMapping("getChild") @GetMapping("getChild")
@ApiOperation("获取子级") @ApiOperation("获取子级")
public ResultVO<List<BomNewEbomParentVO>> getChild(@RequestParam("bomRowId") Long bomRowId) { public ResultVO<List<BomNewEbomParentVO>> getChild(@RequestParam("bomRowId") Long bomRowId) {

View File

@ -6,6 +6,7 @@ import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery; import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
import com.nflg.product.bomnew.pojo.query.OriginalBomQuery; import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO; import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomUpgradeChangeVO;
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO; import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
import com.nflg.product.bomnew.pojo.vo.MaterialHistoryProjectTypeVO; import com.nflg.product.bomnew.pojo.vo.MaterialHistoryProjectTypeVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -38,6 +39,8 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
* @return * @return
*/ */
Page<BomNewEbomParentVO> formalWorksheet(Page<BomNewEbomParentVO> page, @Param("query") BomNewEbomParentQuery query); Page<BomNewEbomParentVO> formalWorksheet(Page<BomNewEbomParentVO> page, @Param("query") BomNewEbomParentQuery query);
Page<BomNewEbomUpgradeChangeVO> getUpgradeChangeList(Page<BomNewEbomUpgradeChangeVO> page, @Param("query") BomNewEbomParentQuery query);
/** /**
* 获取子级 * 获取子级
* @param rowId * @param rowId

View File

@ -0,0 +1,96 @@
package com.nflg.product.bomnew.pojo.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* t_bom_new_ebom_upgrade_change
* ebom-变更影响
*
* @author makejava
* @since 2023-12-23 16:10:19
*/
@Data
@Accessors(chain = true)
@ApiModel(value="com-nflg-product-bomnew-pojo-new-vo-BomNewEbomUpgradeChangeEntityVO")
public class BomNewEbomUpgradeChangeVO implements Serializable {
/**
* 主键-行ID
*/
@ApiModelProperty(value = "主键-行ID")
private Long rowId;
/**
* 受影响的物料编码
*/
@ApiModelProperty(value = "受影响的物料编码")
private String materialNo;
/**
* 修订版()
*/
@ApiModelProperty(value = "修订版(旧)")
private String versionOld;
/**
* 修订版()
*/
@ApiModelProperty(value = "修订版(新)")
private String versionNew;
/**
* 名称
*/
@ApiModelProperty(value = "名称")
private String materialName;
/**
* 图号
*/
@ApiModelProperty(value = "图号")
private String drawingNo;
/**
* 设计人员
*/
@ApiModelProperty(value = "设计人员")
private String deviseName;
/**
* 设计人员部门
*/
@ApiModelProperty(value = "设计人员部门")
private String deptName;
/**
* 关联物料编码
*/
@ApiModelProperty(value = "关联物料编码")
private String relMaterialNo;
/**
* 关联物料描述
*/
@ApiModelProperty(value = "关联物料描述")
private String relMaterialDesc;
/**
* 状态0-未升级处理 1-已升级处理
*/
@ApiModelProperty(value = "状态0-未升级处理 1-已升级处理")
private Integer status;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private LocalDateTime updatedTime;
private static final long serialVersionUID = 1L;
}

View File

@ -200,6 +200,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
/**
* 获取变更影响
* @param query
* @return
*/
public Page<BomNewEbomUpgradeChangeVO> getUpgradeChangeList(BomNewEbomParentQuery query) {
Page<BomNewEbomUpgradeChangeVO> result = this.getBaseMapper().getUpgradeChangeList(new Page<>(query.getPage(), query.getPageSize()), query);
return result;
}
/** /**
* 获取子级 * 获取子级
* *
@ -247,6 +261,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
} }
} }
//初始化错误
initBomException(parentChild);
return parentChild; return parentChild;
} }
@ -436,9 +452,13 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
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);
parent.setBomRowId(parent.getRowId());
EBomToPBom eBomToPBom = new EBomToPBom(parent, bomTree, paramDto.getFacCodes()); parent.setChildBomRowId(parent.getRowId());
parent.setParentRowId(0L);
bomTree.add(parent);
EBomToPBom eBomToPBom = new EBomToPBom(parent, bomTree, paramDto.getFacCodes(),0L);
eBomToPBom.convert(); eBomToPBom.convert();
if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) { if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) {
pBomParentService.saveOrUpdateBatch(eBomToPBom.getPBomParentResult()); pBomParentService.saveOrUpdateBatch(eBomToPBom.getPBomParentResult());
} }

View File

@ -5,6 +5,8 @@ import com.nflg.product.bomnew.mapper.master.BomNewEbomUpgradeChangeMapper;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity; import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* t_bom_new_ebom_upgrade_change 表服务实现类 * t_bom_new_ebom_upgrade_change 表服务实现类
@ -16,4 +18,25 @@ import org.springframework.stereotype.Service;
@Service @Service
public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgradeChangeMapper, BomNewEbomUpgradeChangeEntity> { public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgradeChangeMapper, BomNewEbomUpgradeChangeEntity> {
/**
* 删除
*/
public void delChangeImpact(List<Long> rowIds){
this.getBaseMapper().deleteBatchIds(rowIds);
}
/**
* 更新版本
*/
public void updateChangeImpactVersion(List<Long> rowIds){
List<BomNewEbomUpgradeChangeEntity> upList = this.getBaseMapper().selectBatchIds(rowIds);
//
}
} }

View File

@ -60,7 +60,7 @@ public class EBomDetailTask extends RecursiveTask<List<BomNewEbomParentVO>> {
BomNewEbomParentEntity ebomParentEntity = stringBomNewOriginalParentEntityMap.get(detailVO.getMaterialNo()); BomNewEbomParentEntity ebomParentEntity = stringBomNewOriginalParentEntityMap.get(detailVO.getMaterialNo());
detailVO.setChildBomRowId(ebomParentEntity.getRowId()); detailVO.setChildBomRowId(ebomParentEntity.getRowId());
detailVO.setBomRowId(ebomParentEntity.getRowId()); detailVO.setBomRowId(ebomParentEntity.getRowId());
detailVO.setCurrentVersion(ebomParentEntity.getCurrentVersion());
} }
} }

View File

@ -24,6 +24,7 @@ import com.nflg.product.bomnew.util.ListCommonUtil;
import com.nflg.product.bomnew.util.VUtils; import com.nflg.product.bomnew.util.VUtils;
import com.nflg.product.bomnew.util.VersionUtil; import com.nflg.product.bomnew.util.VersionUtil;
import lombok.Getter; import lombok.Getter;
import org.bouncycastle.crypto.engines.EthereumIESEngine;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -64,11 +65,11 @@ public class EBomToPBom {
private Set<String> upChangeMaterialSet = new HashSet<>(); private Set<String> upChangeMaterialSet = new HashSet<>();
public EBomToPBom(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes) { public EBomToPBom(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes, Long parentRowId) {
this.parent = inParent; this.parent = inParent;
this.allBomDetail = inAllBomDetail; this.allBomDetail = inAllBomDetail;
this.facCodes = inFacCodes; this.facCodes = inFacCodes;
generateDrawingNo(allBomDetail, inParent.getRowId(), ""); generateDrawingNo(allBomDetail, parentRowId, "");
} }
@ -83,6 +84,7 @@ public class EBomToPBom {
List<BomNewEbomParentVO> parentList = result.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList()); List<BomNewEbomParentVO> parentList = result.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList());
for (String facCode : facCodes) { for (String facCode : facCodes) {
//buildPBomParent(parent, facCode);
for (BomNewEbomParentVO vo : parentList) { for (BomNewEbomParentVO vo : parentList) {
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode); BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode);
//子级 //子级
@ -94,6 +96,7 @@ public class EBomToPBom {
childEnt.setRowId(IdWorker.getId()); childEnt.setRowId(IdWorker.getId());
childEnt.setParentRowId(parentEnt.getRowId()); childEnt.setParentRowId(parentEnt.getRowId());
childEnt.setFacCode(facCode); childEnt.setFacCode(facCode);
childEnt.setIdentityNo(StrUtil.join("-", parentEnt.getMaterialNo(), eb.getMaterialNo()));
this.pBomChildResult.add(childEnt); this.pBomChildResult.add(childEnt);
} }
} }
@ -155,8 +158,7 @@ public class EBomToPBom {
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId())); vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
vo.setParentRowId(lastVirtualPackage.getBomRowId()); vo.setParentRowId(lastVirtualPackage.getBomRowId());
result.add(vo); result.add(vo);
} } else { //当没找到直发包时记录到变更影响
else { //当没找到直发包时记录到变更影响
buildUpgradeChange(vo); buildUpgradeChange(vo);
} }
continue; continue;
@ -169,8 +171,7 @@ public class EBomToPBom {
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId())); vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
vo.setParentRowId(lastVirtualPackage.getBomRowId()); vo.setParentRowId(lastVirtualPackage.getBomRowId());
result.add(vo); result.add(vo);
} } else { //当没找到直发包时记录到变更影响
else { //当没找到直发包时记录到变更影响
buildUpgradeChange(vo); buildUpgradeChange(vo);
} }
continue; continue;
@ -224,7 +225,6 @@ public class EBomToPBom {
} }
/** /**
* 提层汇总数量 * 提层汇总数量
* *
@ -272,11 +272,9 @@ public class EBomToPBom {
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList()); List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList());
VUtils.isTure(CollUtil.isEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级"); VUtils.isTure(CollUtil.isEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
if (voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName()) && if (voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName()) &&
!voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getConMaterialName()) && !voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.MAKING_PACKAGE.getConMaterialName())) !voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getConMaterialName()) && !voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.MAKING_PACKAGE.getConMaterialName())) {
{
packageCompositionEntity.setParentMaterialNo(voParent.get(0).getMaterialNo()); packageCompositionEntity.setParentMaterialNo(voParent.get(0).getMaterialNo());
} } else {
else{
packageCompositionEntity.setParentMaterialNo(vo.getMaterialNo()); packageCompositionEntity.setParentMaterialNo(vo.getMaterialNo());
} }

View File

@ -0,0 +1,22 @@
package com.nflg.product.bomnew.service.domain.EBom;
import io.swagger.annotations.ApiModelProperty;
/**
* 更新-变更影响版本
*/
public class UpdateChangeVersion {
@ApiModelProperty("变更行ID")
private Long upChangeRowId;
public UpdateChangeVersion (Long inUpChangeRowId){
this.upChangeRowId=inUpChangeRowId;
}
}

View File

@ -123,6 +123,27 @@
<include refid="whr"/> <include refid="whr"/>
</select> </select>
<sql id="getUpgradeChangeListWhr">
<if test="query.drawingNo!=null and query.drawingNo!=''">
and drawing_no=#{query.drawingNo}
</if>
<if test="query.materialNo!=null and query.materialNo!=''">
and material_no=#{query.materialNo}
</if>
<if test="query.deviseName!=null and query.deviseName!=''">
and devise_name=#{query.deviseName}
</if>
<if test="query.startDate!=null and query.startDate!=''">
and updated_time between #{query.startDate} and #{query.endDate}
</if>
</sql>
<!--BOM-变更影响-->
<select id="getUpgradeChangeList" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomUpgradeChangeVO">
select * from t_bom_new_ebom_upgrade_change where status=0
<include refid="getUpgradeChangeListWhr"/>
</select>
<!--获取子级--> <!--获取子级-->
<select id="getParentChild" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO"> <select id="getParentChild" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
select * select *