mbom sap
This commit is contained in:
parent
ca6c4ab940
commit
9b1d387bec
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
|
@ -13,6 +14,7 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||||
import com.nflg.product.bomnew.constant.BomConstant;
|
import com.nflg.product.bomnew.constant.BomConstant;
|
||||||
import com.nflg.product.bomnew.constant.EBomConstant;
|
import com.nflg.product.bomnew.constant.EBomConstant;
|
||||||
|
import com.nflg.product.bomnew.constant.EBomSuperMaterialStatusEnum;
|
||||||
import com.nflg.product.bomnew.constant.MBomConstantEnum;
|
import com.nflg.product.bomnew.constant.MBomConstantEnum;
|
||||||
import com.nflg.product.bomnew.mapper.master.BomNewMbomParentMapper;
|
import com.nflg.product.bomnew.mapper.master.BomNewMbomParentMapper;
|
||||||
import com.nflg.product.bomnew.pojo.dto.BomNewMBomChildDTO;
|
import com.nflg.product.bomnew.pojo.dto.BomNewMBomChildDTO;
|
||||||
|
|
@ -197,8 +199,64 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
|
||||||
parentVO.setBomExist(1);
|
parentVO.setBomExist(1);
|
||||||
|
|
||||||
List<BomNewMbomMiddleVO> list=queryDetail(0l,parentVO.getRowId());
|
List<BomNewMbomMiddleVO> list=queryDetail(0l,parentVO.getRowId());
|
||||||
|
|
||||||
list.add(0,parentVO);
|
list.add(0,parentVO);
|
||||||
|
|
||||||
|
//查找超级物料
|
||||||
|
List<BomNewMbomMiddleVO> superList=list.stream().filter(item-> ObjectUtil.equal(item.getSuperMaterialStatus(), EBomSuperMaterialStatusEnum.SUPER_MATERIAL_1.getValue())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if(CollUtil.isNotEmpty(superList)) {
|
||||||
|
List<BomNewMbomMiddleVO> delList=new ArrayList<>();
|
||||||
|
//超级物料提层
|
||||||
|
for (BomNewMbomMiddleVO item :
|
||||||
|
superList) {
|
||||||
|
BomNewMbomMiddleVO parent=list.stream().filter(u->ObjectUtil.equal(item.getParentRowId(),u.getRowId())).collect(Collectors.toList()).get(0);
|
||||||
|
//超级物料上一级是根忽略
|
||||||
|
if(parent.getParentRowId().longValue()==0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Long grandparentRowId=parent.getParentRowId();
|
||||||
|
//提层
|
||||||
|
item.setParentRowId(grandparentRowId);
|
||||||
|
delList.add(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除提层被替换的
|
||||||
|
if(CollUtil.isNotEmpty(delList)){
|
||||||
|
List<Long> rowIds=new ArrayList<>();
|
||||||
|
List<Long> tmpId=new ArrayList<>();
|
||||||
|
List<Long> nextTmpId=new ArrayList<>();
|
||||||
|
Map<Long, List<BomNewMbomMiddleVO>> mapList = list.stream().collect(Collectors.groupingBy(BomNewMbomMiddleVO::getParentRowId));
|
||||||
|
delList.forEach(
|
||||||
|
item->{
|
||||||
|
tmpId.clear();
|
||||||
|
tmpId.add(item.getRowId());
|
||||||
|
while (!tmpId.isEmpty()){
|
||||||
|
nextTmpId.clear();
|
||||||
|
for(Long id:tmpId){
|
||||||
|
if(CollUtil.isNotEmpty(mapList.get(id))) {
|
||||||
|
nextTmpId.addAll(mapList.get(id).stream().map(BomNewMbomMiddleVO::getRowId).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rowIds.addAll(tmpId);
|
||||||
|
tmpId.clear();
|
||||||
|
tmpId.addAll(nextTmpId);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
for (Long id:
|
||||||
|
rowIds) {
|
||||||
|
list.removeIf(u->ObjectUtil.equal(u.getRowId(),id));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ImportSapParamDTO result=new ImportSapParamDTO();
|
ImportSapParamDTO result=new ImportSapParamDTO();
|
||||||
result.setT1(new ArrayList<>());
|
result.setT1(new ArrayList<>());
|
||||||
result.setZID(RandomUtil.randomNumbers(5));
|
result.setZID(RandomUtil.randomNumbers(5));
|
||||||
|
|
@ -251,6 +309,7 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultVO;
|
return resultVO;
|
||||||
|
// return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue