|
|
|
|
@ -18,6 +18,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.google.common.collect.ImmutableList;
|
|
|
|
|
@ -280,7 +281,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
//排除项目类别的赋值
|
|
|
|
|
materialMainService.intiMaterialInfoInPattern(parentChild, "^21 | ^31", EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
|
|
|
|
if (CollUtil.isNotEmpty(parentChild)) {
|
|
|
|
|
List<String> materialNos = parentChild.stream().filter(u->StrUtil.isNotBlank(u.getMaterialNo())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
|
|
|
|
List<String> materialNos = parentChild.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(materialNos)) {
|
|
|
|
|
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos)
|
|
|
|
|
.eq(BomNewEbomParentEntity::getLastVersionIs, 1)
|
|
|
|
|
@ -309,11 +310,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
child.setNoticeNums(parentEntity.getNoticeNums());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue()) && EBomStatusEnum.PUBLISHED.getValue()>parentEntity.getStatus()) {
|
|
|
|
|
if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue()) && EBomStatusEnum.PUBLISHED.getValue() > parentEntity.getStatus()) {
|
|
|
|
|
child.setStatus(EBomStatusEnum.BORROWED_PARTS.getValue());
|
|
|
|
|
}
|
|
|
|
|
//非本人则为借用件
|
|
|
|
|
if (!parentEntity.getCreatedBy().equals(child.getCreatedBy()) && EBomStatusEnum.PUBLISHED.getValue()>parentEntity.getStatus()) {
|
|
|
|
|
if (!parentEntity.getCreatedBy().equals(child.getCreatedBy()) && EBomStatusEnum.PUBLISHED.getValue() > parentEntity.getStatus()) {
|
|
|
|
|
child.setStatus(EBomStatusEnum.REFERENCE.getValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -441,7 +442,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
childEntity.setRowId(u.getRowId());
|
|
|
|
|
childEntity.setProjectType(u.getProjectType());
|
|
|
|
|
childEntity.setProjectTypeInputType(u.getProjectTypeInputType());
|
|
|
|
|
if(Objects.isNull(u.getExceptionStatus())) {
|
|
|
|
|
if (Objects.isNull(u.getExceptionStatus())) {
|
|
|
|
|
childEntity.setExceptionStatus(u.getExceptionStatus());
|
|
|
|
|
}
|
|
|
|
|
child.add(childEntity);
|
|
|
|
|
@ -580,6 +581,45 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void checkAndInitVirtualPackageEnum(VirtualPackageParamDto paramDto, BomNewEbomParentEntity root) {
|
|
|
|
|
if (root.getVirtrualPackageEnum() <= 0) {
|
|
|
|
|
if (root.getMaterialNo().startsWith("31")) {
|
|
|
|
|
|
|
|
|
|
List<BomNewEbomParentVO> list = getChild(root.getRowId());
|
|
|
|
|
List<BomNewEbomParentVO> deliveryList = list.stream().filter(u -> VirtualPackageTypeEnum.DELIVERY_PACKAGE.equalsValue(u.getVirtualPartType())).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(deliveryList)) {
|
|
|
|
|
Integer virtualPartTypeEnum = VirtualPackageTypeEnum.DELIVERY_PACKAGE.getValue() | VirtualPackageTypeEnum.MAKING_PACKAGE.getValue() | VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue();
|
|
|
|
|
List<BomNewEbomChildEntity> preList = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, deliveryList.get(0).getBomRowId())
|
|
|
|
|
.eq(BomNewEbomChildEntity::getVirtualPartType, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()).list();
|
|
|
|
|
if (CollUtil.isNotEmpty(preList)) {
|
|
|
|
|
virtualPartTypeEnum = virtualPartTypeEnum | VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue();
|
|
|
|
|
}
|
|
|
|
|
root.setVirtrualPackageEnum(virtualPartTypeEnum);
|
|
|
|
|
this.updateById(root);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (root.getMaterialNo().startsWith("21")) {
|
|
|
|
|
|
|
|
|
|
List<BomNewEbomParentVO> list = getChild(root.getRowId());
|
|
|
|
|
List<BomNewEbomParentVO> makeList = list.stream().filter(u -> VirtualPackageTypeEnum.MAKING_PACKAGE.equalsValue(u.getVirtualPartType())).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(makeList)) {
|
|
|
|
|
Integer virtualPartTypeEnum = VirtualPackageTypeEnum.MAKING_PACKAGE.getValue() | VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue();
|
|
|
|
|
List<BomNewEbomChildEntity> preList = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, makeList.get(0).getBomRowId())
|
|
|
|
|
.eq(BomNewEbomChildEntity::getVirtualPartType, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()).list();
|
|
|
|
|
if (CollUtil.isNotEmpty(preList)) {
|
|
|
|
|
virtualPartTypeEnum = virtualPartTypeEnum | VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue();
|
|
|
|
|
}
|
|
|
|
|
root.setVirtrualPackageEnum(virtualPartTypeEnum);
|
|
|
|
|
this.updateById(root);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生成虚拟包
|
|
|
|
|
@ -588,7 +628,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
*/
|
|
|
|
|
public void generateVirtualPackage(VirtualPackageParamDto paramDto) {
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BomNewEbomParentEntity root = this.getById(paramDto.getBomRowId());
|
|
|
|
|
//初始化虚拟包-判断枚举(不是手工生成虚拟包的情况)
|
|
|
|
|
checkAndInitVirtualPackageEnum(paramDto,root);
|
|
|
|
|
Boolean flag = true;
|
|
|
|
|
for (Integer f : paramDto.getVirtualPackageValue()) {
|
|
|
|
|
flag = flag & ((root.getVirtrualPackageEnum() & f) == f);
|
|
|
|
|
@ -648,21 +692,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
if (CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())) {
|
|
|
|
|
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
|
|
|
|
|
}
|
|
|
|
|
if (CollUtil.isNotEmpty(eBomToPBom.getVirtualPackageCompositionResult())) {
|
|
|
|
|
if (CollUtil.isNotEmpty(eBomToPBom.getVirtualPackageCompositionResult())) {
|
|
|
|
|
//先删除
|
|
|
|
|
Set<String> delSet = eBomToPBom.getVirtualPackageCompositionResult().stream().map(u -> StrUtil.join("-", u.getVirtualPackageMaterialNo(), u.getParentMaterialNo())).collect(Collectors.toSet());
|
|
|
|
|
for (String s : delSet) {
|
|
|
|
|
String[] split = StrUtil.split(s, "-");
|
|
|
|
|
virtualPackageCompositionService.getBaseMapper().delByVnoAndParentNo(split[0],split[1]);
|
|
|
|
|
virtualPackageCompositionService.getBaseMapper().delByVnoAndParentNo(split[0], split[1]);
|
|
|
|
|
}
|
|
|
|
|
virtualPackageCompositionService.saveOrUpdateBatch(eBomToPBom.getVirtualPackageCompositionResult());
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
//记录变更影响
|
|
|
|
|
if (CollUtil.isNotEmpty(eBomToPBom.getUpgradeChangeResult())) {
|
|
|
|
|
|
|
|
|
|
List<String> vNos = eBomToPBom.getUpgradeChangeResult().stream().map(u -> StrUtil.join( u.getMaterialNo(),u.getRelMaterialNo())).collect(Collectors.toList());
|
|
|
|
|
if(CollUtil.isNotEmpty(vNos)){
|
|
|
|
|
List<String> vNos = eBomToPBom.getUpgradeChangeResult().stream().map(u -> StrUtil.join(u.getMaterialNo(), u.getRelMaterialNo())).collect(Collectors.toList());
|
|
|
|
|
if (CollUtil.isNotEmpty(vNos)) {
|
|
|
|
|
upgradeChangeService.getBaseMapper().delByVNo(vNos);
|
|
|
|
|
}
|
|
|
|
|
upgradeChangeService.saveOrUpdateBatch(eBomToPBom.getUpgradeChangeResult());
|
|
|
|
|
@ -673,7 +716,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
Set<String> delSet = eBomToPBom.getUpgradeChangeDetailResult().stream().map(u -> StrUtil.join("-", u.getVirtualPackageMaterialNo(), u.getParentMaterialNo())).collect(Collectors.toSet());
|
|
|
|
|
for (String s : delSet) {
|
|
|
|
|
String[] split = StrUtil.split(s, "-");
|
|
|
|
|
updateDetailService.getBaseMapper().delByVnoAndParentNo(split[0],split[1]);
|
|
|
|
|
updateDetailService.getBaseMapper().delByVnoAndParentNo(split[0], split[1]);
|
|
|
|
|
}
|
|
|
|
|
updateDetailService.saveOrUpdateBatch(eBomToPBom.getUpgradeChangeDetailResult());
|
|
|
|
|
}
|
|
|
|
|
@ -704,7 +747,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
BomNewEbomParentEntity parent = this.getById(bomRowId);
|
|
|
|
|
List<BomNewEbomParentEntity> existEnt = this.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parent.getMaterialNo()).lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
|
|
|
|
|
//含发布前版本则无需升级
|
|
|
|
|
if(CollUtil.isEmpty(existEnt)) {
|
|
|
|
|
if (CollUtil.isEmpty(existEnt)) {
|
|
|
|
|
List<BomNewEbomChildEntity> child = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, bomRowId).list();
|
|
|
|
|
BomNewEbomParentEntity newParent = new BomNewEbomParentEntity();
|
|
|
|
|
BeanUtil.copyProperties(parent, newParent);
|
|
|
|
|
@ -866,21 +909,17 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
|
|
|
|
|
for (BomNewEbomChildEntity childEntities : eBomEdit.childEntities) {
|
|
|
|
|
childEntities.setOrderNumber(OrderNoUtil.orderNo2Str(orderNo));
|
|
|
|
|
if(childEntities.getMaterialName().contains(VirtualPackageTypeEnum.MAKING_PACKAGE.getConMaterialName()))
|
|
|
|
|
{
|
|
|
|
|
if (childEntities.getMaterialName().contains(VirtualPackageTypeEnum.MAKING_PACKAGE.getConMaterialName())) {
|
|
|
|
|
childEntities.setVirtualPartType(VirtualPackageTypeEnum.MAKING_PACKAGE.getValue());
|
|
|
|
|
childEntities.setVirtualPartIs(1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if(childEntities.getMaterialName().contains(VirtualPackageTypeEnum.DELIVERY_PACKAGE.getConMaterialName())){
|
|
|
|
|
} else if (childEntities.getMaterialName().contains(VirtualPackageTypeEnum.DELIVERY_PACKAGE.getConMaterialName())) {
|
|
|
|
|
childEntities.setVirtualPartType(VirtualPackageTypeEnum.DELIVERY_PACKAGE.getValue());
|
|
|
|
|
childEntities.setVirtualPartIs(1);
|
|
|
|
|
}
|
|
|
|
|
else if(childEntities.getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName())){
|
|
|
|
|
} else if (childEntities.getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName())) {
|
|
|
|
|
childEntities.setVirtualPartType(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue());
|
|
|
|
|
childEntities.setVirtualPartIs(1);
|
|
|
|
|
}
|
|
|
|
|
else if(childEntities.getMaterialName().contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getConMaterialName())){
|
|
|
|
|
} else if (childEntities.getMaterialName().contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getConMaterialName())) {
|
|
|
|
|
childEntities.setVirtualPartType(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue());
|
|
|
|
|
childEntities.setVirtualPartIs(1);
|
|
|
|
|
}
|
|
|
|
|
@ -1247,25 +1286,24 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BomNewEbomParentEntity bomParent=null;
|
|
|
|
|
BomNewEbomChildEntity childEntity=null;
|
|
|
|
|
BomNewEbomParentEntity bomParent = null;
|
|
|
|
|
BomNewEbomChildEntity childEntity = null;
|
|
|
|
|
|
|
|
|
|
if(query.getBomRowId()!=null && query.getBomRowId().longValue()!=0){
|
|
|
|
|
bomParent= getById(query.getBomRowId());
|
|
|
|
|
if (query.getBomRowId() != null && query.getBomRowId().longValue() != 0) {
|
|
|
|
|
bomParent = getById(query.getBomRowId());
|
|
|
|
|
}
|
|
|
|
|
if(query.getRowId()!=null && query.getRowId().longValue()!=0){
|
|
|
|
|
childEntity= SpringUtil.getBean(BomNewEbomChildService.class).getById(query.getRowId());
|
|
|
|
|
if (query.getRowId() != null && query.getRowId().longValue() != 0) {
|
|
|
|
|
childEntity = SpringUtil.getBean(BomNewEbomChildService.class).getById(query.getRowId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(materialMainList)) {
|
|
|
|
|
MaterialMainEntity materialMainEntity = materialMainList.get(0);
|
|
|
|
|
BomNewEbomParentVO baseMaterialVO = new BomNewEbomParentVO();
|
|
|
|
|
|
|
|
|
|
if(childEntity!=null){
|
|
|
|
|
if (childEntity != null) {
|
|
|
|
|
BeanUtil.copyProperties(childEntity, baseMaterialVO);
|
|
|
|
|
if(childEntity.getMaterialNo().equals(materialMainEntity.getMaterialNo())){
|
|
|
|
|
if (childEntity.getMaterialNo().equals(materialMainEntity.getMaterialNo())) {
|
|
|
|
|
return baseMaterialVO;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1273,7 +1311,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
BeanUtil.copyProperties(materialMainEntity, baseMaterialVO);
|
|
|
|
|
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(ImmutableList.of(baseMaterialVO));
|
|
|
|
|
|
|
|
|
|
// baseMaterialVO.setCreatedBy(SessionUtil.getUserCode());
|
|
|
|
|
// baseMaterialVO.setCreatedBy(SessionUtil.getUserCode());
|
|
|
|
|
baseMaterialVO.setRowId(query.getRowId());
|
|
|
|
|
baseMaterialVO.setParentRowId(query.getBomRowId());
|
|
|
|
|
baseMaterialVO.setProjectType(null);
|
|
|
|
|
@ -1286,10 +1324,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
baseMaterialVO.setSource(EBomSourceEnum.FROM_MDM.getValue());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(StrUtil.isNotBlank(materialMainEntity.getMaterialWeight())) {
|
|
|
|
|
if (StrUtil.isNotBlank(materialMainEntity.getMaterialWeight())) {
|
|
|
|
|
baseMaterialVO.setUnitWeight(new BigDecimal(materialMainEntity.getMaterialWeight()));
|
|
|
|
|
}
|
|
|
|
|
if(bomParent!=null){
|
|
|
|
|
if (bomParent != null) {
|
|
|
|
|
baseMaterialVO.setEditStatus(bomParent.getEditStatus());
|
|
|
|
|
baseMaterialVO.setStatus(bomParent.getStatus());
|
|
|
|
|
}
|
|
|
|
|
@ -1299,12 +1337,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
&& (MaterialGetEnum.MaterialStateEnum.STATE_NO_4.equalsValue(baseMaterialVO.getMaterialState())
|
|
|
|
|
|| MaterialGetEnum.MaterialStateEnum.STATE_NO_5.equalsValue(baseMaterialVO.getMaterialState()))) {
|
|
|
|
|
baseMaterialVO.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue());
|
|
|
|
|
}
|
|
|
|
|
else if (StrUtil.isBlank(baseMaterialVO.getMaterialNo()) || Objects.isNull(baseMaterialVO.getNum()) || BigDecimal.ZERO.compareTo(baseMaterialVO.getNum()) >= 0) {
|
|
|
|
|
} else if (StrUtil.isBlank(baseMaterialVO.getMaterialNo()) || Objects.isNull(baseMaterialVO.getNum()) || BigDecimal.ZERO.compareTo(baseMaterialVO.getNum()) >= 0) {
|
|
|
|
|
baseMaterialVO.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (StrUtil.isNotBlank(baseMaterialVO.getMaterialNo()) && Objects.isNull(baseMaterialVO.getMaterialState())) {
|
|
|
|
|
} else if (StrUtil.isNotBlank(baseMaterialVO.getMaterialNo()) && Objects.isNull(baseMaterialVO.getMaterialState())) {
|
|
|
|
|
baseMaterialVO.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_7.getValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1400,7 +1435,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
if (dto.getParent().getRootIs() == null || dto.getParent().getRootIs() == 0) {
|
|
|
|
|
childList.add(dto.getParent());
|
|
|
|
|
}
|
|
|
|
|
// checkAndSaveEBomException(childList);
|
|
|
|
|
// checkAndSaveEBomException(childList);
|
|
|
|
|
//不要异步
|
|
|
|
|
ebomChildService.getBaseMapper().updateEBomMaterialUse();
|
|
|
|
|
// ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
|
|
|
|
@ -1473,7 +1508,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// checkAndSaveEBomException(childList);
|
|
|
|
|
// checkAndSaveEBomException(childList);
|
|
|
|
|
// ebomChildService.getBaseMapper().updateEBomMaterialUse();
|
|
|
|
|
// ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
|
|
|
|
|
return true;
|
|
|
|
|
@ -1530,34 +1565,31 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
CheckEBomException.checkMaterialNoInMain(dto.getDatas());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BomNewEbomParentVO> childList=getChild(dto.getParent().getBomRowId());
|
|
|
|
|
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> unionEdit = tmp1.stream().filter(u->{
|
|
|
|
|
return childList.stream().filter(e->
|
|
|
|
|
Objects.equals(u.getRowId(),e.getRowId() )
|
|
|
|
|
&& !Objects.equals(u.getMaterialNo(),e.getMaterialNo())
|
|
|
|
|
).count()>0;
|
|
|
|
|
List<BomNewEbomParentVO> unionEdit = 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;
|
|
|
|
|
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());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<Long,List<BomNewEbomParentVO>> groupList=childList.stream().collect(Collectors.groupingBy(BomNewEbomParentVO::getRowId));
|
|
|
|
|
Map<Long, List<BomNewEbomParentVO>> groupList = childList.stream().collect(Collectors.groupingBy(BomNewEbomParentVO::getRowId));
|
|
|
|
|
|
|
|
|
|
// Map<Long,List<BomNewEbomParentVO>> groupUnionEdit=unionEdit.stream().collect(Collectors.groupingBy(BomNewEbomParentVO::getRowId));
|
|
|
|
|
// Map<Long,List<BomNewEbomParentVO>> groupUnionEdit=unionEdit.stream().collect(Collectors.groupingBy(BomNewEbomParentVO::getRowId));
|
|
|
|
|
|
|
|
|
|
List<BomNewEbomParentVO> tmp2 = dto.getDatas().stream().filter(item -> Objects.isNull(item.getRowId()) || item.getRowId() == 0).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
@ -1566,7 +1598,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(unionEdit, "projectType");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String[] ignore = new String[]{
|
|
|
|
|
"projectType",
|
|
|
|
|
"procureType",
|
|
|
|
|
@ -1578,11 +1609,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(union2, ignore);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BomNewEbomParentVO> returnList=new ArrayList<>();
|
|
|
|
|
List<BomNewEbomParentVO> returnList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(unionEdit)){
|
|
|
|
|
unionEdit.forEach(item->{
|
|
|
|
|
if (CollectionUtil.isNotEmpty(unionEdit)) {
|
|
|
|
|
unionEdit.forEach(item -> {
|
|
|
|
|
// if(item.getMaterialUnit().contains("KG")){
|
|
|
|
|
// item.setUnitWeight(null);
|
|
|
|
|
// }else{
|
|
|
|
|
@ -1592,25 +1623,24 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item.setTotalWeight(NumberUtil.mul(item.getUnitWeight(), item.getNum()));
|
|
|
|
|
if(StrUtil.isBlank(item.getMaterialNo())) {
|
|
|
|
|
BeanUtil.copyProperties(groupList.get(item.getRowId()).get(0),item);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
returnList.addAll(unionEdit);
|
|
|
|
|
item.setTotalWeight(NumberUtil.mul(item.getUnitWeight(), item.getNum()));
|
|
|
|
|
if (StrUtil.isBlank(item.getMaterialNo())) {
|
|
|
|
|
BeanUtil.copyProperties(groupList.get(item.getRowId()).get(0), item);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
returnList.addAll(unionEdit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(union2)){
|
|
|
|
|
union2.forEach(item->{
|
|
|
|
|
if(Objects.isNull(item.getMaterialNo())) {
|
|
|
|
|
BeanUtil.copyProperties(item,groupList.get(item.getRowId()).get(0));
|
|
|
|
|
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 :
|
|
|
|
|
tmp2) {
|
|
|
|
|
|