fix(ebom): 调整删除虚拟包校验逻辑的位置
This commit is contained in:
parent
e97946f8fc
commit
7b16839f29
|
|
@ -10,6 +10,8 @@ import com.mzt.logapi.starter.annotation.LogRecord;
|
|||
import com.nflg.product.base.core.api.BaseApi;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.bomnew.constant.EBomConstant;
|
||||
import com.nflg.product.bomnew.constant.EBomSourceEnum;
|
||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||
import com.nflg.product.bomnew.pojo.dto.*;
|
||||
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
|
||||
|
|
@ -370,14 +372,18 @@ public class EbomApi extends BaseApi {
|
|||
|
||||
|
||||
void checkDeleteRule(BomNewEBomParentEditDTO dto){
|
||||
VUtils.isTure(dto.getParent().getMaterialNo().startsWith("31")
|
||||
&& dto.getDelDatas().stream().anyMatch(it -> Objects.equals(it.getSource(), EBomSourceEnum.FROM_MDM.getValue())
|
||||
&& !Objects.equals(it.getVirtualPartType(), VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue())))
|
||||
.throwMessage("要删除发货包请在生成发货包页面取消选中");
|
||||
|
||||
if(CollUtil.isNotEmpty(dto.getDelDatas()) && CollUtil.isNotEmpty(dto.getDatas())){
|
||||
List<Long> delList=dto.getDelDatas().stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
|
||||
|
||||
List<Long> dataList=dto.getDatas().stream().filter(u-> ObjectUtil.isNotNull(u.getRowId())&& u.getRowId().longValue()>0).map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
|
||||
List<Long> dataList = dto.getDatas().stream().filter(u -> ObjectUtil.isNotNull(u.getRowId()) && u.getRowId() > 0).map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
|
||||
|
||||
//交 删除编辑出现相同(互斥)
|
||||
List<Long> sameList= CollectionUtil.intersection(delList,dataList).stream().collect(Collectors.toList());
|
||||
List<Long> sameList = new ArrayList<>(CollectionUtil.intersection(delList, dataList));
|
||||
if(CollUtil.isNotEmpty(sameList)){
|
||||
VUtils.isTure(true).throwMessage(StrUtil.format("删除数据与编辑数据出现相同行 {}",StrUtil.join(",",sameList)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -2221,10 +2220,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
// if (CollUtil.isNotEmpty(check1List)) {
|
||||
// throw new NflgBusinessException(STATE.Error, StrUtil.format("从原始Bom导入的数据,数据没有异常的情况下,{} 不可以删除 ", StrUtil.join(",", check1List.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()))));
|
||||
// }
|
||||
VUtils.isTure(parent.getMaterialNo().startsWith("31")
|
||||
&& delChildList.stream().anyMatch(c -> Objects.equals(c.getSource(), EBomSourceEnum.FROM_MDM.getValue()))
|
||||
&& delChildList.stream().anyMatch(d -> !Objects.equals(d.getVirtualPartType(), VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue())))
|
||||
.throwMessage("请重新生成发货包");
|
||||
// VUtils.isTure(parent.getMaterialNo().startsWith("31")
|
||||
// && delChildList.stream().anyMatch(c -> Objects.equals(c.getSource(), EBomSourceEnum.FROM_MDM.getValue()))
|
||||
// && delChildList.stream().anyMatch(d -> !Objects.equals(d.getVirtualPartType(), VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue())))
|
||||
// .throwMessage("请重新生成发货包");
|
||||
|
||||
//检查有bom数据关系是否可以删?
|
||||
// List<BomNewEbomParentVO> check2List = delList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
|
||||
|
|
|
|||
Loading…
Reference in New Issue