检查异常问题
This commit is contained in:
parent
fa77887c0a
commit
71098f6fb5
|
|
@ -1400,11 +1400,37 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
List<BomNewEbomParentVO> checkBom = new ArrayList<>();
|
||||
|
||||
List<BomNewEbomParentVO> tmp1 = dto.getDatas().stream().filter(item -> Objects.nonNull(item.getRowId()) && item.getRowId() > 0).collect(Collectors.toList());
|
||||
List<BomNewEbomParentVO> childList=getChild(dto.getParent().getBomRowId());
|
||||
|
||||
List<BomNewEbomParentVO> tmp1 = dto.getDatas().stream().filter(item -> (Objects.nonNull(item.getRowId()) && item.getRowId() > 0)).collect(Collectors.toList());
|
||||
|
||||
//相同rowid 不同物料号
|
||||
List<BomNewEbomParentVO> union = tmp1.stream().filter(u->{
|
||||
return childList.stream().filter(e->
|
||||
Objects.equals(u.getRowId(),e.getRowId() )
|
||||
&& !Objects.equals(u.getMaterialNo(),e.getMaterialNo())
|
||||
).count()>0;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
//相同rowid 相同物料号
|
||||
List<BomNewEbomParentVO> union2 = tmp1.stream().filter(u->{
|
||||
return childList.stream().filter(e->
|
||||
Objects.equals(u.getRowId(),e.getRowId() )
|
||||
&& Objects.equals(u.getMaterialNo(),e.getMaterialNo())
|
||||
).count()>0;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
List<BomNewEbomParentVO> tmp2 = dto.getDatas().stream().filter(item -> Objects.isNull(item.getRowId()) || item.getRowId() == 0).collect(Collectors.toList());
|
||||
|
||||
|
||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(tmp2, "");
|
||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(union, "");
|
||||
|
||||
|
||||
|
||||
String[] ignore = new String[]{
|
||||
"projectType",
|
||||
|
|
@ -1414,38 +1440,84 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
"materialTexture",
|
||||
"materialGetType"
|
||||
};
|
||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(tmp1, ignore);
|
||||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(union2, ignore);
|
||||
|
||||
checkBom.addAll(tmp1);
|
||||
|
||||
|
||||
checkBom.addAll(union);
|
||||
checkBom.addAll(union2);
|
||||
checkBom.addAll(tmp2);
|
||||
|
||||
// if(dto.getParent().getRootIs()==null ||dto.getParent().getRootIs()==0 ) {
|
||||
// checkBom.add(dto.getParent());
|
||||
// }
|
||||
|
||||
checkBom.add(dto.getParent());
|
||||
// CheckEBomException checkEBomException = new CheckEBomException(checkBom);
|
||||
// checkEBomException.checkException();
|
||||
// this.initBomException(checkBom);
|
||||
|
||||
checkBomException(checkBom, Arrays.asList(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue()));
|
||||
if (CollectionUtil.isNotEmpty(dto.getDatas())) {
|
||||
|
||||
|
||||
|
||||
List<BomNewEbomParentVO> returnList=new ArrayList<>();
|
||||
|
||||
Map<Long,List<BomNewEbomParentVO>> groupList=childList.stream().collect(Collectors.groupingBy(BomNewEbomParentVO::getRowId));
|
||||
if(CollectionUtil.isNotEmpty(union)){
|
||||
union.forEach(item->{
|
||||
if(item.getMaterialUnit().contains("KG")){
|
||||
item.setUnitWeight(null);
|
||||
}else{
|
||||
// if(StrUtil.isNotBlank(item.getMaterialUnit())) {
|
||||
// item.setUnitWeight(NumberUtil.toBigDecimal(item.getMaterialUnit().toString()));
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
item.setTotalWeight(NumberUtil.mul(item.getUnitWeight(), item.getNum()));
|
||||
if(Objects.isNull(item.getMaterialNo())) {
|
||||
BeanUtil.copyProperties(item,groupList.get(item.getRowId()).get(0));
|
||||
}
|
||||
});
|
||||
returnList.addAll(union);
|
||||
}
|
||||
|
||||
if(CollectionUtil.isNotEmpty(union2)){
|
||||
union2.forEach(item->{
|
||||
if(Objects.isNull(item.getMaterialNo())) {
|
||||
BeanUtil.copyProperties(item,groupList.get(item.getRowId()).get(0));
|
||||
}
|
||||
});
|
||||
returnList.addAll(union2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (CollectionUtil.isNotEmpty(tmp2)) {
|
||||
for (BomNewEbomParentVO vo :
|
||||
dto.getDatas()) {
|
||||
tmp2) {
|
||||
if (Objects.isNull(vo.getRowId()) || vo.getRowId() == 0) {
|
||||
vo.setDeviseUserCode(SessionUtil.getUserCode());
|
||||
vo.setDeviseName(SessionUtil.getRealName());
|
||||
vo.setCreatedBy(SessionUtil.getUserCode());
|
||||
|
||||
if (vo.getUnitWeight() == null || BigDecimal.ZERO.compareTo(vo.getUnitWeight()) >= 0) {
|
||||
vo.setUnitWeight(vo.getMaterialWeight());
|
||||
// if (vo.getUnitWeight() == null || BigDecimal.ZERO.compareTo(vo.getUnitWeight()) >= 0) {
|
||||
// vo.setUnitWeight(vo.getMaterialWeight());
|
||||
// }
|
||||
|
||||
if(vo.getMaterialUnit().contains("KG")){
|
||||
vo.setUnitWeight(null);
|
||||
}else{
|
||||
// vo.setUnitWeight(NumberUtil.toBigDecimal( vo.getMaterialUnit() ));
|
||||
}
|
||||
|
||||
|
||||
vo.setTotalWeight(NumberUtil.mul(vo.getUnitWeight(), vo.getNum()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
returnList.addAll(tmp2);
|
||||
}
|
||||
|
||||
return dto.getDatas();
|
||||
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -191,10 +191,15 @@ public class CheckEBomException {
|
|||
return;
|
||||
}
|
||||
for (BomNewEbomParentVO exItem : list) {
|
||||
List<BomNewEbomParentVO> warnList = allBomDetail.stream().filter(u -> exItem.getBomRowId() > 0 && u.getLevelNumber().compareTo(exItem.getLevelNumber()) < 0 && EBomExceptionStatusEnum.OK.equalsValue(u.getExceptionStatus())).collect(Collectors.toList());
|
||||
warnList.forEach(k -> {
|
||||
k.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue());
|
||||
});
|
||||
|
||||
try {
|
||||
List<BomNewEbomParentVO> warnList = allBomDetail.stream().filter(u -> exItem.getBomRowId() != null && exItem.getBomRowId() > 0 && u.getLevelNumber().compareTo(exItem.getLevelNumber()) < 0 && EBomExceptionStatusEnum.OK.equalsValue(u.getExceptionStatus())).collect(Collectors.toList());
|
||||
warnList.forEach(k -> {
|
||||
k.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue());
|
||||
});
|
||||
}catch ( Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue