更新异常
This commit is contained in:
parent
5f5ffcd78a
commit
f2bd86937d
|
|
@ -321,4 +321,18 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
private List<BomNewEbomParentVO> childNodes = Collections.emptyList();
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
BomNewEbomParentVO that = (BomNewEbomParentVO) o;
|
||||
return rowId.equals(that.rowId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), rowId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import java.math.BigDecimal;
|
|||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 原始BOM-列表
|
||||
|
|
@ -206,8 +207,19 @@ public class BomOriginalListVO extends BaseMaterialVO {
|
|||
private List<BomOriginalListVO> childNodes = Collections.emptyList();
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
BomOriginalListVO that = (BomOriginalListVO) o;
|
||||
return rowId.equals(that.rowId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), rowId);
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.nflg.product.bomnew.service.domain.EBom;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
|
@ -16,15 +15,14 @@ import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
|||
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
||||
import com.nflg.product.bomnew.service.MaterialMainService;
|
||||
import com.nflg.product.bomnew.util.BomLevelUtil;
|
||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||
import com.nflg.product.bomnew.util.TreeUtils;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -143,9 +141,9 @@ public class CheckEBomException {
|
|||
*/
|
||||
private void checkOther() {
|
||||
// List<CheckEBomExceptionDTO> checkEBomExceptionDTOS=new ArrayList<>();
|
||||
List<BomNewEbomParentVO> parents = allBomDetail.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList());
|
||||
List<BomNewEbomParentVO> parents = ListCommonUtil.toDistinct( allBomDetail.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList()),BomNewEbomParentVO::getBomRowId);
|
||||
for (BomNewEbomParentVO parent : parents) {
|
||||
List<BomNewEbomParentVO> child = allBomDetail.stream().filter(u -> u.getParentRowId().equals(parent.getBomRowId())).collect(Collectors.toList());
|
||||
List<BomNewEbomParentVO> child = allBomDetail.stream().filter(u -> u.getParentRowId().equals(parent.getBomRowId())).distinct().collect(Collectors.toList());
|
||||
|
||||
//是否存在重复物料
|
||||
List<BomNewEbomParentVO> hasMaterialNoList = child.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).collect(Collectors.toList());
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class EBomToPBom {
|
|||
check();
|
||||
//bom 提层
|
||||
liftingLayer();
|
||||
List<BomNewEbomParentVO> parentList = result.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList());
|
||||
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) {
|
||||
|
|
@ -100,7 +100,7 @@ public class EBomToPBom {
|
|||
|
||||
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode);
|
||||
//子级
|
||||
List<BomNewEbomParentVO> child = result.stream().filter(u -> u.getParentRowId().equals(vo.getBomRowId())).collect(Collectors.toList());
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ public class OriginalBomToEBomConvert extends BaseConvert {
|
|||
|
||||
//处理子级
|
||||
List<BomOriginalListVO> bomParents = bomDetail.stream().filter(u -> u.getBomRowId() > 0 && ( OriginalStatusEnum.UN_CONVERT.equalsValue(u.getStatus()) || OriginalStatusEnum.REFERENCE.equalsValue(u.getStatus())) ).collect(Collectors.toList());
|
||||
//去重
|
||||
bomParents= ListCommonUtil.toDistinct(bomParents,BomOriginalListVO::getBomRowId);
|
||||
for (BomOriginalListVO childParent : bomParents) {
|
||||
hanlerDo(childParent);
|
||||
this.hasHandlerParentIds.add(childParent.getBomRowId());
|
||||
|
|
@ -109,7 +111,7 @@ public class OriginalBomToEBomConvert extends BaseConvert {
|
|||
return;
|
||||
}
|
||||
//子节点
|
||||
List<BomOriginalListVO> parentChild = bomDetail.stream().filter(u -> Objects.nonNull(u.getParentRowId()) && u.getParentRowId().equals(parentEnt.getBomRowId())).collect(Collectors.toList());
|
||||
List<BomOriginalListVO> parentChild = bomDetail.stream().filter(u -> Objects.nonNull(u.getParentRowId()) && u.getParentRowId().equals(parentEnt.getBomRowId())).distinct().collect(Collectors.toList());
|
||||
List<BomOriginalListVO> parentChildNoMaterilaNoList = parentChild.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo())).collect(Collectors.toList());
|
||||
//无编码
|
||||
if (StrUtil.isBlank(parentEnt.getMaterialNo())) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nflg.product.bomnew.util;
|
|||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -57,4 +58,28 @@ public class ListCommonUtil extends ListUtil {
|
|||
}
|
||||
return list.stream().collect(Collectors.groupingBy(function));
|
||||
}
|
||||
|
||||
/**
|
||||
* 去重
|
||||
* @param list
|
||||
* @param identityFunc
|
||||
* @return
|
||||
* @param <T>
|
||||
* @param <R>
|
||||
*/
|
||||
public static <T,R> List<T> toDistinct(List<T> list, Function<T, R> identityFunc){
|
||||
List<T> result = new ArrayList<>();
|
||||
Map<R,String> fidler=new HashMap<>();
|
||||
list.forEach(k->{
|
||||
if(!fidler.containsKey(identityFunc.apply(k))){
|
||||
result.add(k);
|
||||
fidler.put(identityFunc.apply(k),"1");
|
||||
}
|
||||
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue