optimize: 一些调整
This commit is contained in:
parent
1adb6dc3c6
commit
1fbe82d335
|
|
@ -517,13 +517,13 @@ public class EbomApi extends BaseApi {
|
|||
}
|
||||
|
||||
/**
|
||||
* 检查下级是否存在Q项
|
||||
* 检查下级的项目类型
|
||||
* @param bomRowIds bomRowIds
|
||||
* @return 检查结果
|
||||
*/
|
||||
@PostMapping("checkQ")
|
||||
@ApiOperation("检查下级是否存在Q项")
|
||||
public ResultVO<List<CheckBomQVO>> checkQ(@Valid @RequestBody @NotEmpty List<Long> bomRowIds) {
|
||||
return ResultVO.success(bomNewEbomParentService.checkQ(bomRowIds));
|
||||
@PostMapping("checkProjectType")
|
||||
@ApiOperation("检查下级的项目类型")
|
||||
public ResultVO<List<CheckBomProjectTypeVO>> checkProjectType(@Valid @RequestBody @NotEmpty List<Long> bomRowIds) {
|
||||
return ResultVO.success(bomNewEbomParentService.checkProjectType(bomRowIds));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,10 +69,10 @@ public class EbomV2Api extends BaseApi {
|
|||
result = originalParentV2Service.pullFromCadAndToEBom(parents);
|
||||
|
||||
//跟新EBom 根节点
|
||||
ebomParentService.getBaseMapper().updateRootState();
|
||||
ebomParentService.getBaseMapper().updateRootForWaitReview();
|
||||
// ebomParentService.getBaseMapper().updateRootState();
|
||||
// ebomParentService.getBaseMapper().updateRootForWaitReview();
|
||||
|
||||
ebomParentService.resetAllBomExist(parents.stream().map(BomOriginalCadParentEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||
// ebomParentService.resetAllBomExist(parents.stream().map(BomOriginalCadParentEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||
} catch (Exception e) {
|
||||
VUtils.isTure(true).throwMessage("转换失败:" + e.getMessage());
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ public enum EBomExceptionStatusEnum implements ValueEnum<Integer> {
|
|||
EXCEPT_NO_13(13, "项目类型需要用户确认") ,
|
||||
EXCEPT_NO_14(14, "黄色警告(下级节点存在异常)"),
|
||||
EXCEPT_NO_15(15, "物料名称不一致"),
|
||||
EXCEPT_NO_16(16, "物料单位不一致");
|
||||
EXCEPT_NO_16(16, "物料单位不一致"),
|
||||
EXCEPT_NO_17(17, "项目赋值异常(当父级物料的项目类型为Q时,子级中的物料的项目类型不能全部为F");
|
||||
|
||||
private final Integer value;
|
||||
private final String description;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ import java.io.Serializable;
|
|||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "com-nflg-product-bomnew-pojo-original-vo-CheckBomQVO")
|
||||
public class CheckBomQVO implements Serializable {
|
||||
@ApiModel(value = "com-nflg-product-bomnew-pojo-original-vo-CheckBomProjectTypeVO")
|
||||
public class CheckBomProjectTypeVO implements Serializable {
|
||||
|
||||
/**
|
||||
* bom行id
|
||||
|
|
@ -26,5 +26,11 @@ public class CheckBomQVO implements Serializable {
|
|||
* 下级是否存在Q项
|
||||
*/
|
||||
@ApiModelProperty(value = "下级是否存在Q项")
|
||||
private Boolean exists;
|
||||
private Boolean existsQ;
|
||||
|
||||
/**
|
||||
* 下级是否全是F项
|
||||
*/
|
||||
@ApiModelProperty(value = "下级是否全是F项")
|
||||
private Boolean allIsF;
|
||||
}
|
||||
|
|
@ -25,6 +25,7 @@ import com.nflg.product.bomnew.util.VersionUtil;
|
|||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.dto.LoginUserInfoDTO;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
|
@ -562,18 +563,7 @@ public class BomNewEbomGenerateVirtualPackageServiceFor31Impl implements IBomNew
|
|||
}
|
||||
|
||||
public static String buildDrawingNo(String drawingNo, String materialName, VirtualPackageTypeEnum type, boolean is1020Factory) {
|
||||
return StrUtil.format("({})({}{})({})", drawingNo, materialName, is1020Factory ? "仙桃" : "", type.getConMaterialName());
|
||||
}
|
||||
|
||||
private String getMaterialNoForAdd(BomNewEbomChildEntity c) {
|
||||
AddVirtrualMaterialDTO ent = new AddVirtrualMaterialDTO();
|
||||
ent.setKey(c.getRowId().toString());
|
||||
ent.setDrawingNo(c.getDrawingNo());
|
||||
ent.setMaterialName(c.getMaterialName());
|
||||
ent.setMaterialDesc(c.getMaterialDesc());
|
||||
ent.setMaterialCategoryCode(c.getMaterialCategoryCode());
|
||||
Map<String, AddVirtrualMaterialDTO> vMNosResult = materialService.batchAddMaterial(Collections.singletonList(ent), userInfo);
|
||||
return vMNosResult.get(c.getRowId().toString()).getMaterialNo();
|
||||
return StrUtil.format("({})({}{})({})", drawingNo, StringUtils.deleteWhitespace(materialName), is1020Factory ? "仙桃" : "", type.getConMaterialName());
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -2156,6 +2156,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
if (CollUtil.isEmpty(delList)) {
|
||||
return;
|
||||
}
|
||||
BomNewEbomParentEntity parentEntity = getById(parent.getRowId());
|
||||
VUtils.isTure(Objects.isNull(parentEntity)).throwMessage("父级不存在");
|
||||
VUtils.isTure(Objects.equals(parentEntity.getStatus(), EBomStatusEnum.PUBLISHED.getValue()))
|
||||
.throwMessage("已定版数据不能删除");
|
||||
|
||||
List<Long> rowIds = delList.stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList());
|
||||
QueryWrapper<BomNewEbomChildEntity> queryChildWrapper = new QueryWrapper<>();
|
||||
queryChildWrapper.lambda().in(BomNewEbomChildEntity::getRowId, rowIds);
|
||||
|
|
@ -2172,6 +2177,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
// 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("请重新生成发货包");
|
||||
|
||||
|
|
@ -2213,9 +2219,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(delTagList)) {
|
||||
List<Long> rowIdList = delTagList.stream().filter(u -> u.getRowId() != null || u.getRowId().longValue() > 0).map(BomNewEbomChildEntity::getRowId).collect(Collectors.toList());
|
||||
List<Long> rowIdList = delTagList.stream().map(BomNewEbomChildEntity::getRowId).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(rowIdList)) {
|
||||
ebomChildService.removeByIds(rowIdList);
|
||||
//将对应的parent设置为根节点
|
||||
setRootIs1(delTagList.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toList()), SessionUtil.getUserCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2851,16 +2859,42 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
return baseMapper.getReverseBoms(parentRowId);
|
||||
}
|
||||
|
||||
public List<CheckBomQVO> checkQ(List<Long> bomRowIds) {
|
||||
public List<CheckBomProjectTypeVO> checkProjectType(List<Long> bomRowIds) {
|
||||
List<BomNewEbomChildEntity> children = ebomChildService.lambdaQuery()
|
||||
.in(BomNewEbomChildEntity::getParentRowId, bomRowIds)
|
||||
.list();
|
||||
return bomRowIds.stream().map(bomRowId -> {
|
||||
CheckBomQVO vo = new CheckBomQVO();
|
||||
CheckBomProjectTypeVO vo = new CheckBomProjectTypeVO();
|
||||
vo.setBomRowId(bomRowId);
|
||||
vo.setExists(children.stream().anyMatch(c -> c.getParentRowId().equals(bomRowId)
|
||||
&& StrUtil.equals(c.getProjectType(), ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue())));
|
||||
if (CollUtil.isEmpty(children)) {
|
||||
vo.setExistsQ(false);
|
||||
vo.setAllIsF(false);
|
||||
} else {
|
||||
vo.setExistsQ(children.stream().anyMatch(c -> c.getParentRowId().equals(bomRowId)
|
||||
&& StrUtil.equals(c.getProjectType(), ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue())));
|
||||
vo.setAllIsF(children.stream().allMatch(c -> c.getParentRowId().equals(bomRowId)
|
||||
&& StrUtil.equals(c.getProjectType(), ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue())));
|
||||
}
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置根节点
|
||||
* @param materialNos 物料编号
|
||||
* @param userCode 用户编号
|
||||
*/
|
||||
public void setRootIs1(Collection<String> materialNos, String userCode) {
|
||||
if (CollUtil.isNotEmpty(materialNos)) {
|
||||
log.debug("setRootIs1 将{}设置为根节点", String.join(",", materialNos));
|
||||
this.lambdaUpdate()
|
||||
.set(BomNewEbomParentEntity::getRootIs, 1)
|
||||
.set(BomNewEbomParentEntity::getUserRootIs, 1)
|
||||
.set(BomNewEbomParentEntity::getModifyTime, LocalDateTime.now())
|
||||
.in(BomNewEbomParentEntity::getMaterialNo, materialNos)
|
||||
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||
.eq(BomNewEbomParentEntity::getCreatedBy, userCode)
|
||||
.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,16 +9,14 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.bomnew.constant.EBomStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.OriginalEditStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.OriginalStatusEnum;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewOriginalParentMapper;
|
||||
import com.nflg.product.bomnew.pojo.dto.BaseImportExcelDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.BomNewOriginalExcelDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewOriginalParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomOriginalCadChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomOriginalCadParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomOriginalPlmBomVO;
|
||||
|
|
@ -115,7 +113,7 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
|||
|
||||
VUtils.isTure(CollUtil.isEmpty(parents)).throwMessage("没有你的数据,你无需转换");
|
||||
//物料编号去除前后空格
|
||||
parents.parallelStream().forEach(u -> {
|
||||
parents.forEach(u -> {
|
||||
u.setMaterialNo(StrUtil.trim(u.getMaterialNo()));
|
||||
if (StrUtil.equals(u.getMaterialNo(), "无")) {
|
||||
u.setMaterialNo("");
|
||||
|
|
@ -124,14 +122,14 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
|||
//检查物料编码在主数据中是否存在
|
||||
List<BomOriginalCadChildEntity> childs = originalCadChildService.lambdaQuery().in(BomOriginalCadChildEntity::getParentRowId, parents.stream().map(u -> u.getRowId()).collect(Collectors.toList())).list();
|
||||
//物料编号去除前后空格
|
||||
childs.parallelStream().forEach(u -> {
|
||||
childs.forEach(u -> {
|
||||
u.setMaterialNo(StrUtil.trim(u.getMaterialNo()));
|
||||
if (StrUtil.equals(u.getMaterialNo(), "无")) {
|
||||
u.setMaterialNo("");
|
||||
}
|
||||
});
|
||||
checkMaterialHasExist(parents.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(BomOriginalCadParentEntity::getMaterialNo).collect(Collectors.toList()));
|
||||
checkMaterialHasExist(childs.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(BomOriginalCadChildEntity::getMaterialNo).collect(Collectors.toList()));
|
||||
// checkMaterialHasExist(parents.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(BomOriginalCadParentEntity::getMaterialNo).collect(Collectors.toList()));
|
||||
// checkMaterialHasExist(childs.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(BomOriginalCadChildEntity::getMaterialNo).collect(Collectors.toList()));
|
||||
|
||||
//父级物料编码不能为空
|
||||
materialMainService.initMaterialForDrawdingNo(parents, BomOriginalCadParentEntity::getChartNo, BomOriginalCadParentEntity::setMaterialNo, BomOriginalCadParentEntity::setMaterialName);
|
||||
|
|
@ -147,6 +145,16 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
|||
VUtils.isTure(true).throwMessage(StrUtil.join(",", hasVirtualPackageMaterialNo)+"已生成虚拟包,请先删除再导入");
|
||||
}
|
||||
|
||||
//把没有child的parent删除
|
||||
List<Integer> nonChildParents = parents.stream()
|
||||
.map(BomOriginalCadParentEntity::getRowId)
|
||||
.filter(rowId -> childs.stream().noneMatch(c -> Objects.equals(c.getParentRowId(), rowId)))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(nonChildParents)) {
|
||||
parents.removeIf(u -> nonChildParents.contains(u.getRowId()));
|
||||
originalCadParentService.getBaseMapper().deleteBatchIds(nonChildParents);
|
||||
}
|
||||
|
||||
PlmBomToOriginalConvertV2 convert = new PlmBomToOriginalConvertV2();
|
||||
//存原始BOM
|
||||
toOriginalBom(parents,convert);
|
||||
|
|
@ -212,11 +220,13 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
|||
List<ImportOriginalBomVO> importOriginalBomVOList = new ArrayList<>();
|
||||
|
||||
//开始转换
|
||||
List<BomNewEbomParentEntity> allParents = new ArrayList<>();
|
||||
List<BomNewEbomChildEntity> allChildren = new ArrayList<>();
|
||||
for (BomNewOriginalParentEntity parent : bomNewOriginalParentEntities) {
|
||||
|
||||
Long ebomRowId = IdWorker.getId();
|
||||
try {
|
||||
convertToEBomDoV2(parent, ebomRowId);
|
||||
convertToEBomDoV2(parent, ebomRowId, allParents, allChildren);
|
||||
} catch (Exception e) {
|
||||
importOriginalBomVOList.add(new ImportOriginalBomVO(parent.getDrawingNo(), "操作失败:" + e.getMessage()));
|
||||
throw e;
|
||||
|
|
@ -225,6 +235,11 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
|||
//更新并保存异常信息
|
||||
ebomParentService.checkAndSaveEBomException(ebomRowId);
|
||||
}
|
||||
//设置根节点
|
||||
Set<String> materialNos = allParents.stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toSet());
|
||||
materialNos.removeAll(allChildren.stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||
ebomParentService.setRootIs1(materialNos, SessionUtil.getUserCode());
|
||||
|
||||
return importOriginalBomVOList;
|
||||
}
|
||||
|
||||
|
|
@ -234,7 +249,8 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
|||
* @param parent
|
||||
*/
|
||||
|
||||
private void convertToEBomDoV2(BomNewOriginalParentEntity parent, Long eBomRowId) throws ExecutionException, InterruptedException {
|
||||
private void convertToEBomDoV2(BomNewOriginalParentEntity parent, Long eBomRowId
|
||||
, List<BomNewEbomParentEntity> allParents, List<BomNewEbomChildEntity> allChildren) {
|
||||
|
||||
List<BomOriginalListVO> bomAllChildList = this.getBaseMapper().getParentChild(parent.getRowId());
|
||||
BomOriginalListVO parentVO = Convert.convert(BomOriginalListVO.class, parent);
|
||||
|
|
@ -242,14 +258,34 @@ public class BomNewOriginalParentV2Service extends ServiceImpl<BomNewOriginalPar
|
|||
OriginalBomToEBomV2Convert convert = new OriginalBomToEBomV2Convert(parentVO, bomAllChildList);
|
||||
convert.convert();
|
||||
|
||||
convert.getEBomParentResult()
|
||||
.stream()
|
||||
.filter(p -> convert.getEBomChildResult().stream().noneMatch(c -> StrUtil.equals(p.getMaterialNo(), c.getMaterialNo())))
|
||||
.forEach(p -> {
|
||||
//设置是否有下级
|
||||
p.setBomExist(convert.getEBomChildResult().stream().anyMatch(c -> Objects.equals(p.getRowId(), c.getParentRowId())) ? 1 : 0);
|
||||
});
|
||||
//取消本人以前导入的,草稿状态的bom的根节点状态
|
||||
Set<String> materialNos = convert.getEBomChildResult().stream().map(BomNewEbomChildEntity::getMaterialNo).collect(Collectors.toSet());
|
||||
materialNos.removeAll(convert.getEBomParentResult().stream().map(BomNewEbomParentEntity::getMaterialNo).collect(Collectors.toSet()));
|
||||
if (CollUtil.isNotEmpty(materialNos)) {
|
||||
ebomParentService.lambdaUpdate()
|
||||
.set(BomNewEbomParentEntity::getRootIs, 0)
|
||||
.set(BomNewEbomParentEntity::getUserRootIs, 0)
|
||||
.set(BomNewEbomParentEntity::getRootIsForWaitReview, 0)
|
||||
.in(BomNewEbomParentEntity::getMaterialNo, materialNos)
|
||||
.lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue())
|
||||
.eq(BomNewEbomParentEntity::getCreatedBy, SessionUtil.getUserCode())
|
||||
.update();
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(convert.getEBomParentResult())) {
|
||||
ebomParentService.saveOrUpdateBatch(convert.getEBomParentResult());
|
||||
|
||||
|
||||
allParents.addAll(convert.getEBomParentResult());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(convert.getEBomChildResult())) {
|
||||
ebomChildService.saveOrUpdateBatch(convert.getEBomChildResult());
|
||||
allChildren.addAll(convert.getEBomChildResult());
|
||||
}
|
||||
//将原始BOM及子级转为已处理
|
||||
if (CollUtil.isNotEmpty(convert.getHasHandlerParentIds())) {
|
||||
|
|
|
|||
|
|
@ -195,6 +195,12 @@ public class CheckEBomException {
|
|||
// qList.forEach(u -> u.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue()));
|
||||
// }
|
||||
// }
|
||||
if (ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue().equals(parent.getProjectType())) {
|
||||
if (CollUtil.isNotEmpty(child) && child.stream()
|
||||
.allMatch(c -> StrUtil.equals(c.getProjectType(), ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue()))) {
|
||||
parent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_17.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
// checkCircularDependency(checkEBomExceptionDTOS);
|
||||
//bom异常-黄色警号
|
||||
|
|
|
|||
|
|
@ -268,9 +268,9 @@ public class EBomEdit {
|
|||
if (StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(), child.getProjectType())) {
|
||||
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue());
|
||||
}
|
||||
if (StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue(), child.getProjectType())) {
|
||||
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue());
|
||||
}
|
||||
// if (StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue(), child.getProjectType())) {
|
||||
// child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue());
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,15 +2,26 @@ package com.nflg.product.bomnew.service.domain.OriginalBom;
|
|||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.github.xiaoymin.knife4j.core.util.StrUtil;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.nflg.product.bomnew.constant.*;
|
||||
import com.nflg.product.bomnew.constant.OriginalConstant;
|
||||
import com.nflg.product.bomnew.constant.OriginalEditStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.OriginalSourceEnum;
|
||||
import com.nflg.product.bomnew.constant.OriginalStatusEnum;
|
||||
import com.nflg.product.bomnew.mapper.master.MaterialMainMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import com.nflg.product.bomnew.service.*;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewOriginalParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomOriginalCadChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomOriginalCadParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomOriginalPlmBomVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ImportOriginalBomVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.MaterialMateVO;
|
||||
import com.nflg.product.bomnew.service.BomNewOriginalChildService;
|
||||
import com.nflg.product.bomnew.service.BomNewOriginalParentService;
|
||||
import com.nflg.product.bomnew.service.BomOriginalCadChildService;
|
||||
import com.nflg.product.bomnew.service.MaterialMainService;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import lombok.Getter;
|
||||
|
||||
|
|
@ -49,11 +60,15 @@ public class PlmBomToOriginalConvertV2 extends BaseConvert {
|
|||
if (parent.getMaterialNo().trim().equalsIgnoreCase("无")) {
|
||||
parent.setMaterialNo("");
|
||||
}
|
||||
parent.setMaterialNo(StrUtil.trim(parent.getMaterialNo()));
|
||||
if (StrUtil.isBlank(parent.getMaterialNo())) {
|
||||
SpringUtil.getBean(MaterialMainService.class).initMaterialForDrawdingNo(ImmutableList.of(parent), BomOriginalPlmBomVO::getDrawingNo, BomOriginalPlmBomVO::setMaterialNo, BomOriginalPlmBomVO::setMaterialName);
|
||||
}
|
||||
childs.stream().filter(f -> f.getMaterialNo().trim().equalsIgnoreCase("无")).forEach(it -> {
|
||||
it.setMaterialNo("");
|
||||
childs.parallelStream().forEach(f -> {
|
||||
f.setMaterialNo(StrUtil.trim(f.getMaterialNo()));
|
||||
if (StrUtil.equals("无", f.getMaterialNo())) {
|
||||
f.setMaterialNo("");
|
||||
}
|
||||
});
|
||||
List<BomOriginalPlmBomVO> noMaterialNoList = childs.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(noMaterialNoList)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue