删除bom 工艺角色调整

This commit is contained in:
jing's 2024-03-29 13:22:29 +08:00
parent 63f125918a
commit 7abecbd672
2 changed files with 38 additions and 11 deletions

View File

@ -1498,8 +1498,25 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
//取bom信息删除
this.getBaseMapper().delBatch(eBomDel.getDelEBom().stream()
.map(BomNewEbomParentVO::getBomRowId)
.map(BomNewEbomParentVO::getRowId)
.collect(Collectors.toList()));
// List<Long> parentList= eBomDel.getDelEBom().stream().filter(u -> (ObjectUtil.isNotNull(u.getBomRowId()) && u.getBomRowId() > 0))
// .map(BomNewEbomParentVO::getBomRowId).collect(Collectors.toList());
// List<Long> childList= eBomDel.getDelEBom().stream().filter(u -> (ObjectUtil.isNull(u.getBomRowId()) || u.getBomRowId().longValue()==0l))
// .map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
//
//
// QueryWrapper<BomNewEbomParentEntity> parentWrapper=new QueryWrapper<>();
// parentWrapper.lambda().in(BomNewEbomParentEntity::getRowId,parentList);
//
// QueryWrapper<BomNewEbomChildEntity> childWrapper=new QueryWrapper<>();
// childWrapper.lambda().in(BomNewEbomChildEntity::getRowId,childList);
//
// this.remove(parentWrapper);
// SpringUtil.getBean(BomNewEbomChildService.class).remove(childWrapper);
}else{
VUtils.isTure(true).throwMessage("未找到你删除的数据");
}
@ -1508,6 +1525,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
List<Long> rowIds = eBomDel.getRevertOBom().stream().map(BomNewEbomParentVO::getSourceRowId).collect(Collectors.toList());
SpringUtil.getBean(BomNewOriginalParentService.class).revertBom(rowIds);
}
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
ThreadUtil.execAsync(() -> computeLevelNumAndRootState());

View File

@ -2,6 +2,7 @@ package com.nflg.product.bomnew.service.domain.EBom;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.bomnew.constant.EBomConstant;
@ -52,26 +53,24 @@ public class EBomDel {
// 原始bom导入过来的只能 设计人员自己删工艺不能删;双角色可以删自己数据
//设计人员在Ebom中创建的数据 工艺人员可以删除
if(roleList.contains(EBomConstant.DESIGNER)){
delEBom = bomTreeAll.stream().filter(u -> u.getBomRowId() > 0
&& u.getCreatedBy().equals(SessionUtil.getUserCode())
&& (u.getSource().equals(EBomSourceEnum.FROM_MDM.getValue()) ||u.getSource().equals(EBomSourceEnum.FROM_EXCE.getValue())))
delEBom = bomTreeAll.stream().filter(u ->ObjectUtil.equal( u.getCreatedBy(),SessionUtil.getUserCode())
&& (ObjectUtil.equal(u.getSource(),EBomSourceEnum.FROM_MDM.getValue()) || ObjectUtil.equal(u.getSource(), EBomSourceEnum.FROM_EXCE.getValue() )))
.collect(Collectors.toList());
}
//工艺 删除自己和设计人员的数据只能是excel和手动录入
if(roleList.contains(EBomConstant.TECHNICIAN)){
delEBom = bomTreeAll.stream().filter(u -> u.getBomRowId() > 0
&&( u.getCreatedJob().equals(UserJobEnum.DESIGNER.getValue())||u.getCreatedBy().equals(SessionUtil.getUserCode()))
&& (u.getSource().equals(EBomSourceEnum.FROM_MDM.getValue()) ||u.getSource().equals(EBomSourceEnum.FROM_EXCE.getValue())))
delEBom = bomTreeAll.stream().filter(u -> (ObjectUtil.equal(UserJobEnum.DESIGNER.getValue(),u.getCreatedJob()) || ObjectUtil.equal(u.getCreatedBy(),SessionUtil.getUserCode()))
&& ( ObjectUtil.equal(u.getSource(),EBomSourceEnum.FROM_MDM.getValue()) || ObjectUtil.equal(u.getSource(), EBomSourceEnum.FROM_EXCE.getValue() )))
.collect(Collectors.toList());
}
//借用件不能删除原始bom转换只能删自己
// if(roleList.contains(EBomConstant.DESIGNER)){
revertOBom = bomTreeAll.stream().filter(u -> u.getBomRowId() > 0
&& (u.getSource().equals(EBomSourceEnum.FROM_BOM.getValue())
&& u.getCreatedBy().equals(SessionUtil.getUserCode())
revertOBom = bomTreeAll.stream().filter(u -> (ObjectUtil.isNotNull(u.getBomRowId()) && u.getBomRowId() > 0)
&& (ObjectUtil.equal(u.getSource(),EBomSourceEnum.FROM_BOM.getValue())
&& ObjectUtil.equal(u.getCreatedBy(),SessionUtil.getUserCode())
))
.collect(Collectors.toList());
@ -79,7 +78,15 @@ public class EBomDel {
if(CollUtil.isEmpty(delEBom)){
delEBom=new ArrayList<>();
}
delEBom.addAll(revertOBom);
//原始bom
List<BomNewEbomParentVO> oBomList = bomTreeAll.stream().filter(u ->
(ObjectUtil.equal(u.getSource(),EBomSourceEnum.FROM_BOM.getValue())
&& ObjectUtil.equal(u.getCreatedBy(),SessionUtil.getUserCode())
))
.collect(Collectors.toList());
delEBom.addAll(oBomList);
}
// }