Merge branch 'refs/heads/feature/DM/nflg-bom' into feature/DM/nflg-bom-transition
This commit is contained in:
commit
c0a9a36d42
|
|
@ -418,42 +418,6 @@ public class EbomApi extends BaseApi {
|
|||
return ResultVO.success(true);
|
||||
}
|
||||
|
||||
|
||||
// @GetMapping("getrel")
|
||||
// @ApiOperation("模糊匹配物料")
|
||||
// public ResultVO<MaterialMateVO> getRelMaterial(@RequestParam(value = "materialName", required = false) String materialName ,@RequestParam(value = "materialTexture" ,required = false) String materialTexture ){
|
||||
// MaterialMateCache mateCache = new MaterialMateCache();
|
||||
// MaterialMateVO materialMate = mateCache.findMaterialByNameOrmaterialTexture(materialName,materialTexture);
|
||||
// return ResultVO.success(materialMate) ;
|
||||
// }
|
||||
|
||||
|
||||
@LogRecord(success = "luo下了一个订单,购买商品「{{#bom.currentVersion}}}」,测试变量「dsfsdf」,下单结果:{{#_ret}}",
|
||||
bizNo = "sfsfsa", type = "dsfdsf")
|
||||
@PostMapping("log")
|
||||
@ApiOperation("测试日志")
|
||||
public boolean createOrder() {
|
||||
bomNewEbomParentService.createOrder();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("loginDebug")
|
||||
@ApiOperation("模拟登录")
|
||||
public ResultVO<Boolean> loginDebug() {
|
||||
|
||||
LoginUserInfoDTO dto = new LoginUserInfoDTO();
|
||||
dto.setUserCode("QHI17062100");
|
||||
dto.setUserName("郑军榕");
|
||||
dto.setRealName("郑军榕");
|
||||
dto.setDepartName("信息流程中心/IT支持");
|
||||
dto.setFullDeptName("信息流程中心/IT支持");
|
||||
dto.setRowId(1585164668335439881L);
|
||||
BaseApi.loginUser.set(dto);
|
||||
|
||||
return ResultVO.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入到SAP
|
||||
* @param rootBomRowIds 顶级bom的rowId
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ public class EBomConstant {
|
|||
public static final List<String> VIRTUAL_PACKAGE_DRAWING_NO_1010_AND_1020= ImmutableList.of("",EBomConstant.XIAN_TAO_FACTORY_Name_1020);
|
||||
|
||||
|
||||
public static final String PROJECT_TYPE_T="T";
|
||||
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum EBomExcelImportEnum implements ValueEnum<Integer> {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@ public enum EBomExceptionStatusEnum implements ValueEnum<Integer> {
|
|||
EXCEPT_NO_13(13, "项目类型需要用户确认") ,
|
||||
EXCEPT_NO_14(14, "黄色警告(下级节点存在异常)"),
|
||||
EXCEPT_NO_15(15, "物料名称不一致"),
|
||||
EXCEPT_NO_16(16, "物料单位不一致");
|
||||
EXCEPT_NO_16(16, "物料单位不一致"),
|
||||
|
||||
EXCEPT_NO_17(17, "T项物料描述为空");
|
||||
|
||||
private final Integer value;
|
||||
private final String description;
|
||||
|
|
|
|||
|
|
@ -1,19 +1,18 @@
|
|||
package com.nflg.product.bomnew.pojo.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* t_bom_new_ebom_child
|
||||
|
|
@ -227,8 +226,11 @@ public class BomNewEbomChildEntity implements Serializable {
|
|||
private String materialOriginalUnit;
|
||||
|
||||
|
||||
private String materialNoAndProjectType;
|
||||
|
||||
|
||||
public String getMaterialNoAndProjectType() {
|
||||
return StrUtil.join(materialNo,projectType);
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -14147430944632372L;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
|
@ -279,5 +280,12 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty("所有父级的rowId")
|
||||
private Set<Long> allParentRowIds = new HashSet<>();
|
||||
|
||||
|
||||
private String materialNoAndProjectType;
|
||||
|
||||
public String getMaterialNoAndProjectType() {
|
||||
return StrUtil.join(getMaterialNo(),getProjectType());
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,6 +140,9 @@ public class CheckEBomException {
|
|||
&& (StrUtil.isBlank(vo.getExceptionTag()) || !vo.getExceptionTag().contains("16"))) {
|
||||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_16.getValue());
|
||||
}
|
||||
else if (EBomConstant.PROJECT_TYPE_T.equalsIgnoreCase(vo.getProjectType()) && StrUtil.isBlank(vo.getMaterialDesc())){
|
||||
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_17.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
checkOther();
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.nflg.product.base.core.conmon.util.SessionUtil;
|
|||
import com.nflg.product.bomnew.constant.*;
|
||||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import com.nflg.product.bomnew.service.BomNewEbomVirtualPackageCompositionService;
|
||||
import com.nflg.product.bomnew.service.BomNewPbomChildService;
|
||||
import com.nflg.product.bomnew.service.BomNewPbomParentService;
|
||||
|
|
@ -57,7 +58,7 @@ public class EBomToPBom {
|
|||
private List<BomNewEbomUpgradeChangeEntity> upgradeChangeResult = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
private List<BomNewEbomUpdateDetailEntity> upgradeChangeDetailResult=new ArrayList<>();
|
||||
private List<BomNewEbomUpdateDetailEntity> upgradeChangeDetailResult = new ArrayList<>();
|
||||
|
||||
private Set<String> hasBuildVNo = Sets.newHashSet();
|
||||
|
||||
|
|
@ -79,27 +80,32 @@ public class EBomToPBom {
|
|||
check();
|
||||
//bom 提层
|
||||
liftingLayer();
|
||||
List<BomNewEbomParentVO> parentList = ListCommonUtil.toDistinct( result.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList()),BomNewEbomParentVO::getBomRowId);
|
||||
List<String> hasConvert=new ArrayList<>();
|
||||
List<BomNewEbomParentVO> parentList = ListCommonUtil.toDistinct(result.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList()), BomNewEbomParentVO::getBomRowId);
|
||||
List<String> hasConvert = new ArrayList<>();
|
||||
|
||||
for (String facCode : facCodes) {
|
||||
//buildPBomParent(parent, facCode);
|
||||
for (BomNewEbomParentVO vo : parentList) {
|
||||
String hasConvertKey=StrUtil.join("-",facCode,vo.getBomRowId());
|
||||
if(hasConvert.contains(hasConvertKey) || PBomStatusEnum.PUBLISH.equalsValue(vo.getStatus()) ){
|
||||
String hasConvertKey = StrUtil.join("-", facCode, vo.getBomRowId());
|
||||
if (hasConvert.contains(hasConvertKey) || PBomStatusEnum.PUBLISH.equalsValue(vo.getStatus())) {
|
||||
continue;
|
||||
}
|
||||
hasConvert.add(hasConvertKey);
|
||||
//构建变更明细
|
||||
buildUpgradeChangeDetail(vo,VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
buildUpgradeChangeDetail(vo,VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
buildUpgradeChangeDetail(vo, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
buildUpgradeChangeDetail(vo, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
|
||||
//子级
|
||||
List<BomNewEbomParentVO> child = result.stream().filter(u -> u.getParentRowId().equals(vo.getBomRowId())).distinct().collect(Collectors.toList());
|
||||
List<BomNewEbomParentVO> mergeChild = mergeChild(child);
|
||||
if( compareContentIsSame(vo, mergeChild, facCode)){
|
||||
continue;
|
||||
}
|
||||
|
||||
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode);
|
||||
//子级
|
||||
List<BomNewEbomParentVO> child = result.stream().filter(u -> u.getParentRowId().equals(vo.getBomRowId())).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(child)) {
|
||||
//合并子级
|
||||
List<BomNewEbomParentVO> mergeChild = mergeChild(child);
|
||||
for (BomNewEbomParentVO eb : mergeChild) {
|
||||
BomNewPbomChildEntity childEnt = new BomNewPbomChildEntity();
|
||||
BeanUtil.copyProperties(eb, childEnt);
|
||||
|
|
@ -115,14 +121,63 @@ public class EBomToPBom {
|
|||
}
|
||||
}
|
||||
}
|
||||
//合并子级
|
||||
public List<BomNewEbomParentVO> mergeChild (List<BomNewEbomParentVO> child){
|
||||
|
||||
List<BomNewEbomParentVO> result=child.stream().filter(u->StrUtil.isBlank(u.getMaterialNo())).collect(Collectors.toList());
|
||||
/**
|
||||
* BOM 明细对比,如只有T项变化则,不升级直接修改
|
||||
*/
|
||||
private Boolean compareContentIsSame(BomNewEbomParentVO pVo, List<BomNewEbomParentVO> newChildren, String facCode) {
|
||||
BomNewPbomParentEntity oldParent = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery()
|
||||
.eq(BomNewPbomParentEntity::getMaterialNo, pVo.getMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getFacCode, facCode).last(" order by current_version desc limit 1").one();
|
||||
if (oldParent != null) {
|
||||
List<BomNewPbomParentVO> oldBomDetail = SpringUtil.getBean(BomNewPbomParentService.class).getBaseMapper().getParentChild(oldParent.getRowId());
|
||||
//旧bom除T项之外
|
||||
List<BomNewPbomParentVO> oldBomNoTChildren = oldBomDetail.stream().filter(u -> !EBomConstant.PROJECT_TYPE_T.equalsIgnoreCase(u.getProjectType())).collect(Collectors.toList());
|
||||
//新BOM 除T项外
|
||||
List<BomNewEbomParentVO> newBomNoTChildren = newChildren.stream().filter(u -> !EBomConstant.PROJECT_TYPE_T.equalsIgnoreCase(u.getProjectType())).collect(Collectors.toList());
|
||||
if(oldBomNoTChildren.size()!= newBomNoTChildren.size()) {
|
||||
return false;
|
||||
}
|
||||
//除T项外的对比
|
||||
Map<String, BomNewPbomParentVO> oldBomMap = oldBomNoTChildren.stream().collect(Collectors.toMap(BomNewPbomParentVO::getMaterialNoAndProjectType, u -> u, (k1, k2) -> k1));
|
||||
for (BomNewEbomParentVO newVo : newBomNoTChildren) {
|
||||
if(!oldBomMap.containsKey(newVo.getMaterialNoAndProductType()) || !Objects.equals(newVo.getNum(),oldBomMap.get(newVo.getMaterialNoAndProductType()).getNum())){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//当T项外都一致时,直接更新T项
|
||||
List<BomNewPbomParentVO> bomDetailForT = oldBomDetail.stream().filter(u -> EBomConstant.PROJECT_TYPE_T.equalsIgnoreCase(u.getProcureType())).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(bomDetailForT)){
|
||||
List<Long> bomRowIdsForT = bomDetailForT.stream().map(u -> u.getRowId()).collect(Collectors.toList());
|
||||
SpringUtil.getBean(BomNewPbomChildService.class).getBaseMapper().deleteBatchIds(bomRowIdsForT);
|
||||
}
|
||||
List<BomNewEbomParentVO> newBomT = newChildren.stream().filter(u -> EBomConstant.PROJECT_TYPE_T.equalsIgnoreCase(u.getProcureType())).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(newBomT)) {
|
||||
for (BomNewEbomParentVO netT : newBomT) {
|
||||
BomNewPbomChildEntity childEnt = new BomNewPbomChildEntity();
|
||||
BeanUtil.copyProperties(netT, childEnt);
|
||||
childEnt.setRowId(IdWorker.getId());
|
||||
childEnt.setParentRowId(oldParent.getRowId());
|
||||
childEnt.setFacCode(facCode);
|
||||
childEnt.setIdentityNo(StrUtil.join("-", oldParent.getMaterialNo(), netT.getMaterialNo()));
|
||||
this.pBomChildResult.add(childEnt);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//合并子级
|
||||
public List<BomNewEbomParentVO> mergeChild(List<BomNewEbomParentVO> child) {
|
||||
|
||||
List<BomNewEbomParentVO> result = child.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo())).collect(Collectors.toList());
|
||||
|
||||
Map<String, List<BomNewEbomParentVO>> listMp = ListCommonUtil.listGroupMap(child, BomNewEbomParentVO::getMaterialNo);
|
||||
|
||||
for ( String key: listMp.keySet()) {
|
||||
for (String key : listMp.keySet()) {
|
||||
List<BomNewEbomParentVO> voList = listMp.get(key);
|
||||
BomNewEbomParentVO ent = voList.get(0);
|
||||
ent.setNum(voList.stream().map(aa -> aa.getNum()).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
|
|
@ -156,7 +211,7 @@ public class EBomToPBom {
|
|||
.eq(BomNewPbomParentEntity::getMaterialNo, parentVo.getMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getFacCode, facCode).last(" order by current_version desc limit 1").one();
|
||||
|
||||
// this.hasConvertEBomRowIds.add(parentVo.getRowId());
|
||||
// this.hasConvertEBomRowIds.add(parentVo.getRowId());
|
||||
if (Objects.nonNull(oldParent) && !EBomStatusEnum.PUBLISHED.equalsValue(oldParent.getStatus())) {
|
||||
SpringUtil.getBean(BomNewPbomChildService.class).getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldParent.getRowId()));
|
||||
oldParent.setCurrentVersion(parentVo.getCurrentVersion());
|
||||
|
|
@ -176,8 +231,8 @@ public class EBomToPBom {
|
|||
//版本=EBom版本
|
||||
pBomParent.setCurrentVersion(parentVo.getCurrentVersion());
|
||||
pBomParent.setEditStatus(PBomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||
if(Objects.nonNull(oldParent)){
|
||||
// pBomParent.setCurrentVersion(VersionUtil.getNextVersion(oldParent.getCurrentVersion()));
|
||||
if (Objects.nonNull(oldParent)) {
|
||||
// pBomParent.setCurrentVersion(VersionUtil.getNextVersion(oldParent.getCurrentVersion()));
|
||||
oldParent.setExpireEndTime(LocalDateTime.now());
|
||||
oldParent.setLastVersionIs(0);
|
||||
}
|
||||
|
|
@ -196,7 +251,7 @@ public class EBomToPBom {
|
|||
*/
|
||||
private void liftingLayer() {
|
||||
for (BomNewEbomParentVO vo : allBomDetail) {
|
||||
if (StrUtil.isNotBlank(vo.getProjectType()) && vo.getProjectType().equals(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getProductTypeKey())) {
|
||||
if (StrUtil.isNotBlank(vo.getProjectType()) && vo.getProjectType().equals(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getProductTypeKey())) {
|
||||
BomNewEbomParentVO lastVirtualPackage = getLastVirtualPackage(vo, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
if (Objects.nonNull(lastVirtualPackage)) {
|
||||
liftingLayerSummary(lastVirtualPackage, vo);
|
||||
|
|
@ -211,7 +266,7 @@ public class EBomToPBom {
|
|||
// }
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isNotBlank(vo.getProjectType()) && vo.getProjectType().equals(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getProductTypeKey())) {
|
||||
if (StrUtil.isNotBlank(vo.getProjectType()) && vo.getProjectType().equals(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getProductTypeKey())) {
|
||||
BomNewEbomParentVO lastVirtualPackage = getLastVirtualPackage(vo, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
if (Objects.nonNull(lastVirtualPackage)) {
|
||||
liftingLayerSummary(lastVirtualPackage, vo);
|
||||
|
|
@ -230,14 +285,14 @@ public class EBomToPBom {
|
|||
}
|
||||
|
||||
//变更记录(明细)
|
||||
private void buildUpgradeChangeDetail(BomNewEbomParentVO parent,VirtualPackageTypeEnum packageTypeEnum) {
|
||||
private void buildUpgradeChangeDetail(BomNewEbomParentVO parent, VirtualPackageTypeEnum packageTypeEnum) {
|
||||
|
||||
List<BomNewEbomVirtualPackageCompositionEntity> list = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentMaterialNo, parent.getMaterialNo())
|
||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getProjectType, packageTypeEnum.getProductTypeKey()).list();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
//老的虚拟包组成
|
||||
Set<String> oldMaterialNoAndNumSet = list.stream().filter(u-> u.getParentMaterialNo().equals(parent.getMaterialNo())).map(u->StrUtil.join("-", u.getChildMaterialNo(),u.getNum())).collect(Collectors.toSet());
|
||||
Set<String> oldMaterialNoAndNumSet = list.stream().filter(u -> u.getParentMaterialNo().equals(parent.getMaterialNo())).map(u -> StrUtil.join("-", u.getChildMaterialNo(), u.getNum())).collect(Collectors.toSet());
|
||||
|
||||
List<BomNewEbomParentVO> parentChildren = allBomDetail.stream().filter(u -> u.getParentRowId().equals(parent.getBomRowId())).collect(Collectors.toList());
|
||||
//物料编码 +数量
|
||||
|
|
@ -247,7 +302,7 @@ public class EBomToPBom {
|
|||
|
||||
List<String> vmaterialNoList = list.stream().map(u -> u.getVirtualPackageMaterialNo()).distinct().collect(Collectors.toList());
|
||||
//记录变更明细行
|
||||
buildChangeDetailD0(vmaterialNoList,parent, parentChildren);
|
||||
buildChangeDetailD0(vmaterialNoList, parent, parentChildren);
|
||||
//变更
|
||||
buildUpgradeChange(list, parent);
|
||||
}
|
||||
|
|
@ -255,10 +310,10 @@ public class EBomToPBom {
|
|||
|
||||
}
|
||||
|
||||
private void buildChangeDetailD0( List<String> vmaterialNoList, BomNewEbomParentVO parent, List<BomNewEbomParentVO> parentChildren){
|
||||
private void buildChangeDetailD0(List<String> vmaterialNoList, BomNewEbomParentVO parent, List<BomNewEbomParentVO> parentChildren) {
|
||||
for (BomNewEbomParentVO vo : parentChildren) {
|
||||
for (String vNo:vmaterialNoList) {
|
||||
BomNewEbomUpdateDetailEntity changeDetailEnt=new BomNewEbomUpdateDetailEntity();
|
||||
for (String vNo : vmaterialNoList) {
|
||||
BomNewEbomUpdateDetailEntity changeDetailEnt = new BomNewEbomUpdateDetailEntity();
|
||||
changeDetailEnt.setRowId(IdWorker.getId());
|
||||
changeDetailEnt.setVirtualPackageMaterialNo(vNo);
|
||||
changeDetailEnt.setParentMaterialNo(parent.getMaterialNo());
|
||||
|
|
@ -276,13 +331,11 @@ public class EBomToPBom {
|
|||
}
|
||||
|
||||
|
||||
|
||||
private void buildUpgradeChange(List<BomNewEbomVirtualPackageCompositionEntity> changeList, BomNewEbomParentVO parent) {
|
||||
List<String> vmaterialNoList = changeList.stream().map(u -> u.getVirtualPackageMaterialNo()).distinct().collect(Collectors.toList());
|
||||
for (String vmaterialNo : vmaterialNoList) {
|
||||
String key = StrUtil.join("-", vmaterialNo, parent.getMaterialNo());
|
||||
if(hasBuildVNo.contains(key))
|
||||
{
|
||||
if (hasBuildVNo.contains(key)) {
|
||||
continue;
|
||||
}
|
||||
BomNewEbomUpgradeChangeEntity changeEntity = new BomNewEbomUpgradeChangeEntity();
|
||||
|
|
@ -297,7 +350,7 @@ public class EBomToPBom {
|
|||
changeEntity.setStatus(0);
|
||||
upgradeChangeResult.add(changeEntity);
|
||||
|
||||
hasBuildVNo.add( key);
|
||||
hasBuildVNo.add(key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -341,7 +394,7 @@ public class EBomToPBom {
|
|||
VUtils.isTure(CollUtil.isEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
|
||||
packageCompositionEntity.setParentMaterialNo(voParent.get(0).getMaterialNo());
|
||||
packageCompositionEntity.setChildMaterialNo(vo.getMaterialNo());
|
||||
packageCompositionEntity.setParentFullPathNum(StrUtil.join(",",parentFullPathNum));
|
||||
packageCompositionEntity.setParentFullPathNum(StrUtil.join(",", parentFullPathNum));
|
||||
packageCompositionEntity.setProjectType(vo.getProjectType());
|
||||
packageCompositionEntity.setUnitWeight(vo.getUnitWeight());
|
||||
packageCompositionEntity.setTotalWeight(vo.getTotalWeight());
|
||||
|
|
@ -361,7 +414,7 @@ public class EBomToPBom {
|
|||
|
||||
private BomNewEbomParentVO getLastVirtualPackage(BomNewEbomParentVO vo, VirtualPackageTypeEnum virtualPackageTypeEnum) {
|
||||
List<BomNewEbomParentVO> zhiFaList = allBomDetail.stream().filter(u -> vo.getLevelNumber().compareTo(u.getLevelNumber()) > 0 && u.getMaterialName().contains(virtualPackageTypeEnum.getConMaterialName())).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(zhiFaList)) {
|
||||
if (CollUtil.isNotEmpty(zhiFaList)) {
|
||||
return Collections.max(zhiFaList, Comparator.comparing(BomNewEbomParentVO::getLevelNumber));
|
||||
}
|
||||
return null;
|
||||
|
|
@ -386,7 +439,7 @@ public class EBomToPBom {
|
|||
* @param bomRowID
|
||||
* @param parentDrawingNo
|
||||
*/
|
||||
public void generateDrawingNo(List<BomNewEbomParentVO> saveBomDetailParamDTO, Long bomRowID, String parentDrawingNo) {
|
||||
public void generateDrawingNo(List<BomNewEbomParentVO> saveBomDetailParamDTO, Long bomRowID, String parentDrawingNo) {
|
||||
List<BomNewEbomParentVO> firstLevelBoms = saveBomDetailParamDTO.stream().filter(u -> u.getParentRowId().equals(bomRowID)).collect(Collectors.toList());
|
||||
parentDrawingNo = StrUtil.isNotBlank(parentDrawingNo) ? parentDrawingNo : "";
|
||||
Integer gNo = 1;
|
||||
|
|
|
|||
|
|
@ -24,11 +24,15 @@ import com.nflg.product.bomnew.util.MaterialshouldBomExistUtil;
|
|||
import com.nflg.product.bomnew.util.VersionUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.ObjectInputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -302,13 +306,14 @@ public abstract class BaseConvert {
|
|||
if (oldChildList.size() != newChildList.size()) {
|
||||
return false;
|
||||
}
|
||||
final List<String> compareFields = ImmutableList.of("materialNo", "num","projectType");
|
||||
Map<String, Map<String, Object>> stringMapMap = ClassCompareUtil.compareObject(oldChildList, newChildList, compareFields);
|
||||
if (stringMapMap.size() > 0) {
|
||||
return false;
|
||||
Map<String, BomNewEbomChildEntity> oldChildMap = oldChildList.stream().collect(Collectors.toMap(BomNewEbomChildEntity::getMaterialNoAndProjectType , Function.identity()));
|
||||
for (BomNewEbomChildEntity newChild : newChildList) {
|
||||
String key=StrUtil.join(newChild.getMaterialNo(),newChild.getProjectType());
|
||||
if(!oldChildMap.containsKey(key) || Objects.equals(newChild.getNum(), oldChildMap.get(key).getNum()) ){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue