diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java index e1522629..e014d8a6 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/BomReportApi.java @@ -173,7 +173,7 @@ public class BomReportApi extends BaseApi { return ResultVO.error("查无数据~"); } if(CollUtil.isNotEmpty(r.getChildNodes())){ - Set materialNoSet = r.getChildNodes().stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toSet()); + Set materialNoSet = r.getChildNodes().stream().filter(m -> StrUtil.isNotBlank(m.getMaterialNo())).map(BaseMaterialVO::getMaterialNo).collect(Collectors.toSet()); List materialMainList = materialMainService.list(Wrappers.lambdaQuery().in(MaterialMainEntity::getMaterialNo,materialNoSet)); Map materialMainMap = materialMainList.stream().collect(Collectors.toMap(MaterialMainEntity::getMaterialNo,MaterialMainEntity::getMaterialDesc,(k1, k2)->k1)); r.getChildNodes().forEach(c -> c.setMaterialDesc(materialMainMap.getOrDefault(c.getMaterialNo(),c.getMaterialDesc()))); diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java index 3a2fe244..b45990c7 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java @@ -36,6 +36,7 @@ import nflg.product.common.constant.STATE; import nflg.product.common.vo.ResultVO; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.ttzero.excel.entity.ListSheet; @@ -399,6 +400,11 @@ public class EbomApi extends BaseApi { && dto.getDelDatas().stream().anyMatch(it -> Objects.equals(it.getSource(), EBomSourceEnum.FROM_MDM.getValue()) && !Objects.equals(it.getVirtualPartType(), VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue()))) .throwMessage("要删除发货包请在生成发货包页面取消选中"); + //校验当前BOM中如果只有一行“BOM已删除”标记行时,不让删除保存 + List delBomList = dto.getDelDatas().stream().filter(b-> Objects.equals(b.getProjectType(),"K")).collect(Collectors.toList()); + if(!delBomList.isEmpty()){ + VUtils.isTure(dto.getDatas().isEmpty()).throwMessage("当前BOM没有其他下级物料时,“BOM删除”标记行不能删除"); + } if(CollUtil.isNotEmpty(dto.getDelDatas()) && CollUtil.isNotEmpty(dto.getDatas())){ List delList=dto.getDelDatas().stream().map(BomNewEbomParentVO::getRowId).collect(Collectors.toList()); @@ -576,7 +582,6 @@ public class EbomApi extends BaseApi { return ResultVO.success(true); } - @GetMapping("byHome") public ResultVO>> byHome(){ Map> mp = Maps.newHashMap(); @@ -607,5 +612,21 @@ public class EbomApi extends BaseApi { return ResultVO.success(mp); } + @GetMapping("bomDelete") + @ApiOperation("BOM删除") + @LogRecord(success = "Ebom-BOM删除,操作结果:{{#_ret}}", bizNo = "{{#bomRowId}}", type = "Ebom-BOM删除") + public ResultVO bomDelete(@RequestParam("bomRowId") Long bomRowId, + @RequestParam(value = "childBomRowId",required = false) Long childBomRowId) { + return ResultVO.success(bomNewEbomParentService.bomDelete(bomRowId,childBomRowId)); + } + + @GetMapping("changeBomDelete") + @ApiOperation("BOM变更后BOM删除 ") + @LogRecord(success = "Ebom-BOM变更后删除,操作结果:{{#_ret}}", bizNo = "{{#bomRowId}}", type = "Ebom-BOM变更后删除") + public ResultVO changeBomDelete(@RequestParam("bomRowId") Long bomRowId){ + bomNewEbomParentService.changeBomDelete(bomRowId); + return ResultVO.success(); + } + } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java index ec8f4e48..b8cd7686 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java @@ -80,18 +80,18 @@ public class PBomApi extends BaseApi { public ResultVO> workDetailsListByPage(@RequestBody BomNewPbomParentQuery query) { IPage r = bomNewPbomParentService.workDetailsListByPage(query); //添加仓库地点 by 10002327 0830 - if(!r.getRecords().isEmpty()){ - List materialNoList = Lists.newArrayList(); - List facList = Lists.newArrayList(); - - this.get(r.getRecords(),materialNoList,facList); - List> lgproList = sapService.lgproByList(materialNoList,facList); - Map lgproMap = lgproList.stream().collect(Collectors.toMap(m-> - String.valueOf(m.get("MATNR")) + String.valueOf(m.get("WERKS")) - ,m->String.valueOf(m.get("LGPRO")),(k1,k2)->k1)); - this.set(r.getRecords(),lgproMap); - - } +// if(!r.getRecords().isEmpty()){ +// List materialNoList = Lists.newArrayList(); +// List facList = Lists.newArrayList(); +// +// this.get(r.getRecords(),materialNoList,facList); +// List> lgproList = sapService.lgproByList(materialNoList,facList); +// Map lgproMap = lgproList.stream().collect(Collectors.toMap(m-> +// String.valueOf(m.get("MATNR")) + String.valueOf(m.get("WERKS")) +// ,m->String.valueOf(m.get("LGPRO")),(k1,k2)->k1)); +// this.set(r.getRecords(),lgproMap); +// +// } return ResultVO.success(r); } @@ -362,6 +362,15 @@ public class PBomApi extends BaseApi { } } + @GetMapping("bomDelete") + @ApiOperation("BOM删除") + @LogRecord(success = "PBom删除,操作结果:{{#_ret}}", bizNo = "{{#bomRowId}}",type = "BOM删除") + public ResultVO bomDelete(@RequestParam("bomRowId") Long bomRowId, + @RequestParam(value = "childBomRowId",required = false) Long childBomRowId) { + bomNewPbomParentService.bomDelete(bomRowId,childBomRowId); + return ResultVO.success(true); + } + @Resource MaterialService materialService; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomSourceEnum.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomSourceEnum.java index a74f62fd..7c1cc6f4 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomSourceEnum.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/EBomSourceEnum.java @@ -13,7 +13,8 @@ public enum EBomSourceEnum implements ValueEnum { FROM_EXCE(2, "EXCE导入"), FROM_MDM(3, "MDM创建"), FROM_SAP(4, "从SAP导入"), - FROM_CHANGE(5, "变更"); + FROM_CHANGE(5, "变更"), + FROM_DELETE(6, "BOM删除"); private final Integer value; private final String description; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/PbomSourceEnum.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/PbomSourceEnum.java index c5a52119..734727ca 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/PbomSourceEnum.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/PbomSourceEnum.java @@ -15,7 +15,8 @@ public enum PbomSourceEnum implements ValueEnum { FROM_DQBOM(2, "DQBOM转换"), FROM_SAP(3, "从SAP导入"), FROM_COPY(4, "复制"), - FROM_CHANGE(5, "变更"); + FROM_CHANGE(5, "变更"), + FROM_DELETE(6, "BOM删除"); private final Integer value; private final String description; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/ProjectTypeInputTypeEnum.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/ProjectTypeInputTypeEnum.java index 37d7c7a7..ac04d466 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/ProjectTypeInputTypeEnum.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/ProjectTypeInputTypeEnum.java @@ -37,7 +37,8 @@ public enum ProjectTypeInputTypeEnum implements ValueEnum { TYPE_Q("Q", "清点项"), TYPE_F("F", "直发包"), TYPE_Z("Z", "发货前装配包"), - TYPE_L("L", "普通物料"); + TYPE_L("L", "普通物料"), + TYPE_K("K", "BOM删除"); private final String value; private final String description; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/sap/impart2/ImportSapParamDTO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/sap/impart2/ImportSapParamDTO.java index ecb7053a..d4a3a4be 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/sap/impart2/ImportSapParamDTO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/sap/impart2/ImportSapParamDTO.java @@ -32,4 +32,7 @@ public class ImportSapParamDTO { @ApiModelProperty("详情") private List T1; + + @ApiModelProperty("删除物料") + private List T3; } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/sap/impart2/T3DTO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/sap/impart2/T3DTO.java new file mode 100644 index 00000000..b14acd8f --- /dev/null +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/sap/impart2/T3DTO.java @@ -0,0 +1,13 @@ +package com.nflg.product.bomnew.pojo.dto.sap.impart2; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class T3DTO { + + @ApiModelProperty("父级物料") + protected String MATNR = ""; +} + diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomParentVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomParentVO.java index 3f522c9d..fce8bbdb 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomParentVO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewEbomParentVO.java @@ -85,6 +85,11 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable { @ApiModelProperty(value = "数量") private BigDecimal num; + + public BigDecimal getNum() { + return num==null?null:num.stripTrailingZeros(); + } + /** * 来源1-原BOM转换 2-EXCE导入 3-MDM创建 */ diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomExportToSAP.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomExportToSAP.java index 8f7934d3..a53a3c51 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomExportToSAP.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomExportToSAP.java @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -16,6 +17,7 @@ import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum; import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO; import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO; import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1ExtDTO; +import com.nflg.product.bomnew.pojo.dto.sap.impart2.T3DTO; import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity; import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity; import com.nflg.product.bomnew.pojo.entity.BomNewSapErrorMsgEntity; @@ -23,6 +25,7 @@ import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO; import com.nflg.product.bomnew.util.SapErrorMsgUtil; import com.nflg.product.bomnew.util.VUtils; import nflg.product.common.constant.STATE; +import org.apache.commons.compress.utils.Lists; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -77,6 +80,22 @@ public class BomNewEbomExportToSAP { sapDto.setI_STLAN("2"); sapDto.setI_EMPNO(root.getCreatedBy()); sapDto.setT1(Convert.toList(T1DTO.class, this.children.stream().filter(c -> !c.isIgnore()).collect(Collectors.toList()))); + //BOM的子表仅有一行【BOM删除】项目类别为K的数据 by 10002327 241017 +// Map> t1Map = this.children.stream().collect(Collectors.groupingBy(T1ExtDTO::getMATNR)); +// List t3List = Lists.newArrayList(); +// t1Map.forEach((k,v) -> { +// if(CollUtil.isNotEmpty(v) && v.size() == 1){ +// if(StrUtil.equalsIgnoreCase("K",Optional.ofNullable(v.get(0)).map(T1ExtDTO::getPOSTP).orElse(""))){ +// T3DTO t3DTO = new T3DTO(); +// t3DTO.setMATNR(k); +// t3List.add(t3DTO); +// } +// } +// }); +// if(!t3List.isEmpty()){ +// sapDto.setT3(t3List); +// } + liErrMsg = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null); if (CollUtil.isEmpty(liErrMsg)) { state = SapStatusEnum.PUB_SUCCESS; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java index 5897fb45..61b5fee7 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java @@ -1,4 +1,6 @@ package com.nflg.product.bomnew.service; +import com.sap.conn.jco.JCoParameterList; +import com.google.common.collect.Maps; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; @@ -25,6 +27,8 @@ import com.nflg.product.bomnew.mapper.master.BomNewEbomParentMapper; import com.nflg.product.bomnew.mapper.master.BomNewPbomParentMapper; import com.nflg.product.bomnew.mapper.master.MaterialMainMapper; import com.nflg.product.bomnew.pojo.dto.*; +import com.nflg.product.bomnew.pojo.dto.sap.SapReqParams; +import com.nflg.product.bomnew.pojo.dto.sap.SapResult; import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO; import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO; import com.nflg.product.bomnew.pojo.entity.*; @@ -52,6 +56,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.math.BigDecimal; +import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.util.*; import java.util.concurrent.ExecutionException; @@ -124,6 +129,9 @@ public class BomNewEbomParentService extends ServiceImpl getParentChild( Long rowId) { return this.getBaseMapper().getParentChild(rowId); @@ -1022,14 +1030,6 @@ public class BomNewEbomParentService extends ServiceImpl ebomParentIdList = pbomParent.stream().map(BomNewPbomParentEntity::getSourceRowId).collect(Collectors.toList()); -// this.delBatch(ebomParentIdList); -// //4、删掉ebom 子级的数据 -// ebomChildService.remove(Wrappers.lambdaQuery().in(BomNewEbomChildEntity::getParentRowId,ebomParentIdList)); -// } - //3、判断parent下是否有子级,排除电控系统和仙桃的,如果没有的话,把parent给删除了 物料****因下级全部是F项,仅保存EBOM,未生成PBOM数据 仙桃) List emptyChildParentList = eBomToPBom.getPBomParentResult().stream() .filter(p -> !p.getMaterialDesc().contains("电控系统") && !p.getMaterialDesc().contains("仙桃)") && !eBomToPBom.getPBomChildResult().stream().map(BomNewPbomChildEntity::getParentRowId).collect(Collectors.toList()).contains(p.getRowId()) ) @@ -1054,17 +1054,23 @@ public class BomNewEbomParentService extends ServiceImpl { -// OperationErrorMsgVO oem = new OperationErrorMsgVO(); -// oem.setPrimaryKey(m); -// oem.msg = String.format("物料%s因下级全部是F项,仅保存EBOM,未生成PBOM数据",m); -// return oem; -// }).collect(Collectors.toList()); eBomToPBom.getPBomParentResult().removeAll(emptyChildParentList); } + //3、如果ebom的子表只有一条项目类别为【K】的数据,则不发布到PBOM中 + List kParentList = eBomToPBom.getPBomChildResult().stream().filter(child -> StrUtil.equalsIgnoreCase("K",child.getProjectType())) + .map(BomNewPbomChildEntity::getParentRowId).distinct().collect(Collectors.toList()); + List delPbomList = eBomToPBom.getPBomParentResult().stream() + .filter(b -> kParentList.contains(b.getRowId())).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(delPbomList)) { + delPbomList.forEach(pbom -> { + List pbomChildList = eBomToPBom.getPBomChildResult().stream().filter(child -> Objects.equals(child.getParentRowId(),pbom.getRowId())).collect(Collectors.toList()); + if(CollUtil.isNotEmpty(pbomChildList) && pbomChildList.size() == 1 && StrUtil.equalsIgnoreCase("K",pbomChildList.get(0).getProjectType())){ + eBomToPBom.getPBomParentResult().remove(pbom); + eBomToPBom.getPBomChildResult().removeAll(pbomChildList); + } + }); + } } - if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) { //将物料标记为用户跟节点 List rootParent = eBomToPBom.getPBomParentResult().stream().filter(u -> u.getMaterialNo().equals(parent.getMaterialNo())).collect(Collectors.toList()); @@ -1481,6 +1487,171 @@ public class BomNewEbomParentService extends ServiceImpl mList = materialMainService.list(Wrappers.lambdaQuery() + .eq(MaterialMainEntity::getMaterialNo,parent.getMaterialNo()) + .in(MaterialMainEntity::getMaterialState, com.google.common.collect.Lists.newArrayList(MaterialGetEnum.MaterialStateEnum.STATE_NO_4.getValue(),MaterialGetEnum.MaterialStateEnum.STATE_NO_5.getValue()))); + if(CollUtil.isNotEmpty(mList)){ + VUtils.isTure(true).throwMessage(StrUtil.join(",", Optional.ofNullable(mList).map(l->l.get(0)) + .map(MaterialMainEntity::getMaterialNo).orElse(String.valueOf(bomRowId)), "冻结编码无法编辑删除BOM~")); + } + + //检查是否存在发布前的版本,有则不能发起 BOM删除 + List existEnt = this.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parent.getMaterialNo()) + .lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list(); + Set existMaterialNos = existEnt.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet()); + VUtils.isTure(CollUtil.isNotEmpty(existMaterialNos)).throwMessage(StrUtil.join(",", existMaterialNos, "存在发布前版本。")); + //如果bom 有且只有一条 [BOM已删除] 标记行时,提示已删除,无须重复删除 + List ebomChildEntityList = ebomChildService.list(Wrappers.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId,bomRowId)); + List kChildEntityList = ebomChildEntityList.stream().filter(c -> Objects.equals("K",c.getProjectType())).collect(Collectors.toList()); + VUtils.isTure(ebomChildEntityList.size() == 1 && kChildEntityList.size() == 1).throwMessage(StrUtil.join(",", bomRowId, "BOM已删除,无须重复删除~")); + + List parentResult = new ArrayList<>(); + //1、生成一个新版本号的空BOM,直接变更为正式版 + LogRecordContext.putVariable("bom", parent); + BomNewEbomParentEntity newParent = new BomNewEbomParentEntity(); + BeanUtil.copyProperties(parent, newParent); + newParent.setRowId(IdWorker.getId()); + newParent.setLastVersionIs(1); + newParent.setCurrentVersion(VersionUtil.getNextVersion(parent.getCurrentVersion())); + newParent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); + newParent.setStatus(EBomStatusEnum.PUBLISHED.getValue()); + newParent.setEditStatus(EbomEditStatusEnum.HANDLER_FINISHED.getValue()); + newParent.setDeptRowId(SessionUtil.getDepartRowId()); + newParent.setDeptName(SessionUtil.getDepartName()); + newParent.setDeviseName(SessionUtil.getRealName()); + newParent.setDeviseUserCode(SessionUtil.getUserCode()); + newParent.setRemark(""); + newParent.setSource(EBomSourceEnum.FROM_DELETE.getValue()); + newParent.setConvertToEbomTime(null); + newParent.setRevertDesc(null); + newParent.setRevertTime(null); + newParent.setRevertUserName(null); + newParent.setAuditUserName(null); + newParent.setAuditTime(null); + newParent.setRootIs(1); + newParent.setUserRootIs(1); + newParent.setSapState(SapStatusEnum.PUB_SUCCESS.getValue()); + newParent.setSapTime(null); + newParent.setModifyTime(null); + newParent.setCreatedTime(LocalDateTime.now()); + newParent.setCreatedBy(SessionUtil.getUserCode()); + newParent.setCreatedJob(userRoleService.technician() ? UserJobEnum.ENGINEER.getValue() : UserJobEnum.DESIGNER.getValue()); + newParent.setReleaseTime(LocalDateTime.now()); + newParent.setReleaseUserName(SessionUtil.getUserName()); + newParent.setExpireEndTime(DateUtil.parseLocalDateTime("9999-12-31 23:59:59","yyyy-MM-dd HH:mm:ss")); + + parent.setLastVersionIs(0); + parentResult.add(newParent); + parentResult.add(parent); + //将新增的newParent,替换到旧bom的子表上 + List childEntityList = Lists.newArrayList(); + if(childBomRowId != null){ + BomNewEbomChildEntity oldBomChild = ebomChildService.getById(childBomRowId); + if(oldBomChild != null){ + BomNewEbomChildEntity newBomChild = new BomNewEbomChildEntity(); + BeanUtil.copyProperties(oldBomChild, newBomChild); + newBomChild.setRowId(IdWorker.getId()); + newBomChild.setIdentityNo(newBomChild.getParentRowId() + "_" + newBomChild.getRowId()); + newBomChild.setBomVersionRowId(newParent.getRowId()); + newBomChild.setSource(EBomSourceEnum.FROM_DELETE.getValue()); + childEntityList.add(newBomChild); + } + } + + + //2、子表增加一行项目类别为K,标识删除 + BomNewEbomChildEntity newChild = new BomNewEbomChildEntity(); + newChild.setRowId(IdWorker.getId()); + newChild.setParentRowId(newParent.getRowId()); + newChild.setIdentityNo(newParent.getRowId() + "_" + newChild.getRowId()); + newChild.setOrderNumber("001"); + newChild.setMaterialDesc("[BOM已删除]"); + newChild.setProjectType(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_K.getValue()); + newChild.setProjectTypeInputType(0); + newChild.setCreatedBy(SessionUtil.getUserCode()); + newChild.setVirtualPartIs(1); + newChild.setCreatedTime(LocalDateTime.now()); + newChild.setModifyTime(LocalDateTime.now()); + newChild.setEditStatus(1); + newChild.setExceptionStatus(1); + newChild.setSource(EBomSourceEnum.FROM_DELETE.getValue()); + + childEntityList.add(newChild); + //3、调用SAP接口删除BOM + SapReqParams sapReqParams = new SapReqParams(); + sapReqParams.setFunName("ZRFC_PP_005"); + Map inputParam = Maps.newHashMap(); + inputParam.put("I_LCBT","主数据平台"); + inputParam.put("I_ACT","X"); + inputParam.put("ZID",RandomUtil.randomNumbers(5)); + inputParam.put("I_WERKS","1"); + inputParam.put("I_STLAN","2"); + inputParam.put("I_EMPNO",SessionUtil.getUserCode()); + sapReqParams.setInputParams(inputParam); + Map>> inputTables = new HashMap<>(); + List> parentMapList = Lists.newArrayList(); + Map parentMap = Maps.newHashMap(); + parentMap.put("MATNR", newParent.getMaterialNo()); + parentMapList.add(parentMap); + inputTables.put("T3", parentMapList); + sapReqParams.setInputTables(inputTables); + + SapResult sapResult = sapService.doSapFun(sapReqParams); + if (!sapResult.isSuccess()) { + throw new NflgBusinessException(STATE.RouteServiceError, sapResult.getMsg()); + } + this.saveOrUpdateBatch(parentResult); + ebomChildService.saveBatch(childEntityList); + if(childBomRowId != null){ + ebomChildService.removeById(childBomRowId); + } + //将历史已发布版-转移到正式历史表 + List addRowIds = com.google.common.collect.Lists.newArrayList(newParent.getRowId()); + List delRowIds = com.google.common.collect.Lists.newArrayList(bomRowId); + eBomToFormal(addRowIds, delRowIds); + return true; + } + + /** + * BOM变更后 BOM删除 by 10002327 241015 + * @param bomRowId + */ + @Transactional(rollbackFor = Exception.class) + public void changeBomDelete(Long bomRowId){ + BomNewEbomParentEntity parent = this.getById(bomRowId); + VUtils.isTure(parent == null).throwMessage(StrUtil.join(",", bomRowId, "不存在~")); + VUtils.isTure(!Objects.equals(parent.getSource(),EBomSourceEnum.FROM_CHANGE.getValue())).throwMessage(StrUtil.join(",", parent.getMaterialNo(), "删除失败,仅支持变更后的BOM删除")); + //1、删除旧的子表数据 + ebomChildService.remove(Wrappers.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId,bomRowId)); + //2、子表增加一行项目类别为K,标识删除 + BomNewEbomChildEntity newChild = new BomNewEbomChildEntity(); + newChild.setRowId(IdWorker.getId()); + newChild.setParentRowId(bomRowId); + newChild.setIdentityNo(bomRowId + "_" + newChild.getRowId()); + newChild.setOrderNumber("001"); + newChild.setProjectType(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_K.getValue()); + newChild.setMaterialDesc("[BOM已删除]"); + newChild.setProjectTypeInputType(0); + newChild.setCreatedBy(SessionUtil.getUserCode()); + newChild.setVirtualPartIs(1); + newChild.setCreatedTime(LocalDateTime.now()); + newChild.setModifyTime(LocalDateTime.now()); + newChild.setEditStatus(1); + newChild.setExceptionStatus(1); + newChild.setSource(EBomSourceEnum.FROM_DELETE.getValue()); + ebomChildService.save(newChild); + } + public void editExportBom(EbomEditExportDTO param, OutputStream response) throws IOException { List result = param.getList(); @@ -2426,6 +2597,10 @@ public class BomNewEbomParentService extends ServiceImpl delChildList = SpringUtil.getBean(BomNewEbomChildService.class).list(queryChildWrapper); List deletingTagList = new ArrayList<>(); + List delTagList = new ArrayList<>(); + //“BOM已删除”标记行删除,项目类别为K by 10002327 241016 + delTagList.addAll(delChildList.stream().filter(b -> Objects.equals(b.getProjectType(),"K")).collect(Collectors.toList())); + //检查原始bom里过来数据是否包含正常数据 // List check1List = delChildList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource()) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java index 1f407be2..933c030b 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java @@ -27,6 +27,8 @@ import com.nflg.product.base.core.exception.NflgBusinessException; import com.nflg.product.bomnew.constant.*; import com.nflg.product.bomnew.mapper.master.BomNewPbomParentMapper; import com.nflg.product.bomnew.pojo.dto.*; +import com.nflg.product.bomnew.pojo.dto.sap.SapReqParams; +import com.nflg.product.bomnew.pojo.dto.sap.SapResult; import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO; import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO; import com.nflg.product.bomnew.pojo.entity.*; @@ -282,14 +284,14 @@ public class BomNewPbomParentService extends ServiceImpl(query.getPage(), query.getPageSize()), query); } //添加仓库地点 by 10002327 0830 - if(!result.getRecords().isEmpty()){ - List> lgproList = sapService.lgproByList(result.getRecords().stream().map(BaseMaterialVO::getMaterialNo).distinct().collect(Collectors.toList()), - result.getRecords().stream().map(BomNewPbomParentVO::getFacCode).distinct().collect(Collectors.toList())); - Map lgproMap = lgproList.stream().collect(Collectors.toMap(m-> { - return String.valueOf(m.get("MATNR")) + String.valueOf(m.get("WERKS")); - },m->String.valueOf(m.get("LGPRO")),(k1,k2)->k1)); - result.getRecords().forEach(r -> r.setLgpro(lgproMap.get(StrUtil.padPre(r.getMaterialNo(),18,"0") +r.getFacCode()))); - } +// if(!result.getRecords().isEmpty()){ +// List> lgproList = sapService.lgproByList(result.getRecords().stream().map(BaseMaterialVO::getMaterialNo).distinct().collect(Collectors.toList()), +// result.getRecords().stream().map(BomNewPbomParentVO::getFacCode).distinct().collect(Collectors.toList())); +// Map lgproMap = lgproList.stream().collect(Collectors.toMap(m-> { +// return String.valueOf(m.get("MATNR")) + String.valueOf(m.get("WERKS")); +// },m->String.valueOf(m.get("LGPRO")),(k1,k2)->k1)); +// result.getRecords().forEach(r -> r.setLgpro(lgproMap.get(StrUtil.padPre(r.getMaterialNo(),18,"0") +r.getFacCode()))); +// } materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); return result; } @@ -591,6 +593,12 @@ public class BomNewPbomParentService extends ServiceImpl childList = pbomChildService.getBaseMapper().selectBatchIds(paramDTO.getRowIdList()); List childListVO = Convert.toList(BomNewPbomParentVO.class, childList); materialMainService.intiMaterialInfo(childListVO); + //校验当前BOM中如果只有一行“BOM已删除”标记行时,不让删除保存 + List kChildList = childList.stream().filter(c -> Objects.equals("K",c.getProjectType())).collect(Collectors.toList()); + if(kChildList.size() > 0){ + int cnt = pbomChildService.count(Wrappers.lambdaQuery().eq(BomNewPbomChildEntity::getParentRowId,paramDTO.getBomRowId())); + VUtils.isTure(cnt == childList.size()).throwMessage("当前BOM中有一行“BOM已删除”标记行时,不能全部删除~"); + } // 判断是否是工艺包 List technologypackages = childListVO.stream() @@ -1314,6 +1322,7 @@ public class BomNewPbomParentService extends ServiceImpl oldBomDetail = this.getBaseMapper().getParentChild(oldParent.getRowId()); List oldBomNoTChildren = oldBomDetail.stream().filter(u -> !EBomConstant.PROJECT_TYPE_T.equalsIgnoreCase(u.getProjectType())).collect(Collectors.toList()); @@ -1427,8 +1436,144 @@ public class BomNewPbomParentService extends ServiceImpl mList = materialMainService.list(Wrappers.lambdaQuery() + .eq(MaterialMainEntity::getMaterialNo,parent.getMaterialNo()) + .in(MaterialMainEntity::getMaterialState, com.google.common.collect.Lists.newArrayList(MaterialGetEnum.MaterialStateEnum.STATE_NO_4.getValue(),MaterialGetEnum.MaterialStateEnum.STATE_NO_5.getValue()))); + if(CollUtil.isNotEmpty(mList)){ + VUtils.isTure(true).throwMessage(StrUtil.join(",", Optional.ofNullable(mList).map(l->l.get(0)) + .map(MaterialMainEntity::getMaterialNo).orElse(String.valueOf(bomRowId)), "冻结编码无法编辑删除BOM~")); + } + VUtils.isTure(parent.getStatus() < PBomStatusEnum.PUBLISH.getValue()).throwMessage("只有已发布的BOM,才能删除"); + //检查当前用户是否有该工厂权限 + if(!userRoleService.getUserOfFactory().contains(parent.getFacCode())){ + VUtils.isTure(true).throwMessage("您没有该工厂的权限,无法删除"); + } + LogRecordContext.putVariable("bom",parent); + List waitPublishList = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery() + .eq(BomNewPbomParentEntity::getMaterialNo, parent.getMaterialNo()) + .eq(BomNewPbomParentEntity::getFacCode, parent.getFacCode()) + .lt(BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue()).list(); + VUtils.isTure(CollUtil.isNotEmpty(waitPublishList)).throwMessage(parent.getMaterialNo() + "存在待发布的版本,无法删除"); + //如果bom 有且只有一条 [BOM已删除] 标记行时,提示已删除,无须重复删除 + List childEntityList = pbomChildService.list(Wrappers.lambdaQuery().eq(BomNewPbomChildEntity::getParentRowId,bomRowId)); + List kEntityList = childEntityList.stream().filter(c -> Objects.equals("K",c.getProjectType())).collect(Collectors.toList()); + VUtils.isTure(childEntityList.size() == 1 && kEntityList.size() == 1).throwMessage("BOM已删除,无须重复删除~"); + + BomNewPbomParentVO rootVo = Convert.convert(BomNewPbomParentVO.class, parent); + rootVo.setBomRowId(rootVo.getRowId()); + //1、parent增加一行大版本号记录 直接变更为正式版 + BomNewPbomParentEntity pbomParent = new BomNewPbomParentEntity(); + List parentList = Lists.newArrayList(); + BeanUtil.copyProperties(rootVo, pbomParent); + pbomParent.setRowId(IdWorker.getId()); + pbomParent.setCreatedTime(LocalDateTime.now()); + pbomParent.setCreatedBy(SessionUtil.getUserCode()); + pbomParent.setStatus(PBomStatusEnum.FACTORY_CONFIRM.getValue()); + pbomParent.setEditStatus(PBomEditStatusEnum.HANDLER_FINISHED.getValue()); + //获取大版本号 + pbomParent.setCurrentVersion(VersionUtil.getNextVersion(rootVo.getCurrentVersion())); + pbomParent.setDeptRowId(SessionUtil.getDepartRowId()); + pbomParent.setDeptName(SessionUtil.getDepartName()); + pbomParent.setDeviseName(SessionUtil.getRealName()); + pbomParent.setDeviseUserCode(SessionUtil.getUserCode()); + pbomParent.setTechnologyUserName(SessionUtil.getUserName()); + pbomParent.setTechnologyUserCode(SessionUtil.getUserCode()); + pbomParent.setRemark(""); + pbomParent.setSource(PbomSourceEnum.FROM_DELETE.getValue()); + pbomParent.setSapState(SapStatusEnum.PUB_SUCCESS.getValue()); + pbomParent.setSapTime(null); + pbomParent.setModifyTime(null); + pbomParent.setCreatedJob(SpringUtil.getBean(UserRoleService.class).technician() ? UserJobEnum.ENGINEER.getValue() : UserJobEnum.DESIGNER.getValue()); + pbomParent.setRootIs(1); + pbomParent.setUserRootIs(1); + pbomParent.setLastVersionIs(1); + pbomParent.setEbomVersion(null); + pbomParent.setBomExist(1); + pbomParent.setReleaseTime(LocalDateTime.now()); + pbomParent.setReleaseUserName(SessionUtil.getUserName()); + pbomParent.setExpireEndTime(DateUtil.parseLocalDateTime("9999-12-31 23:59:59","yyyy-MM-dd HH:mm:ss")); + //设置旧版本 + parent.setLastVersionIs(0); + parentList.add(pbomParent); + parentList.add(parent); + + List newChildEntityList = Lists.newArrayList(); + if(childBomRowId != null){ + BomNewPbomChildEntity oldBomChild = pbomChildService.getById(childBomRowId); + if(oldBomChild!= null){ + BomNewPbomChildEntity newBomChild = new BomNewPbomChildEntity(); + BeanUtil.copyProperties(oldBomChild, newBomChild); + newBomChild.setRowId(IdWorker.getId()); + newBomChild.setBomVersionRowId(pbomParent.getRowId()); + newBomChild.setSource(PbomSourceEnum.FROM_DELETE.getValue()); + newChildEntityList.add(newBomChild); + } + } + //2、子表新增一行项目类别为K的标识行 + BomNewPbomChildEntity child = new BomNewPbomChildEntity(); + child.setRowId(IdWorker.getId()); + child.setParentRowId(pbomParent.getRowId()); + child.setFacCode(pbomParent.getFacCode()); + child.setProjectType(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_K.getValue()); + child.setOrderNumber("001"); + child.setMaterialDesc("[BOM已删除]"); + child.setNum(new BigDecimal(1)); + child.setIdentityNo(pbomParent.getRowId() + "_" + child.getRowId()); + child.setCreatedTime(LocalDateTime.now()); + child.setCreatedBy(SessionUtil.getUserCode()); + child.setModifyTime(null); + child.setSource(PbomSourceEnum.FROM_DELETE.getValue()); + child.setRemark(""); + newChildEntityList.add(child); + + //调用SAP接口 删除pbom + SapReqParams sapReqParams = new SapReqParams(); + sapReqParams.setFunName("ZRFC_PP_005"); + Map inputParam = Maps.newHashMap(); + inputParam.put("I_LCBT","主数据平台"); + inputParam.put("I_ACT","X"); + inputParam.put("ZID",RandomUtil.randomNumbers(5)); + inputParam.put("I_WERKS","1"); + if (StrUtil.equals(parent.getFacCode(), EBomConstant.XIAN_TAO_FACTORY_CODE_1020)) { + inputParam.put("I_WERKS","2"); + } + inputParam.put("I_STLAN","1"); + inputParam.put("I_EMPNO",SessionUtil.getUserCode()); + sapReqParams.setInputParams(inputParam); + Map>> inputTables = new HashMap<>(); + List> parentMapList = org.apache.commons.compress.utils.Lists.newArrayList(); + Map parentMap = Maps.newHashMap(); + parentMap.put("MATNR", parent.getMaterialNo()); + parentMapList.add(parentMap); + inputTables.put("T3", parentMapList); + sapReqParams.setInputTables(inputTables); + SapResult sapResult = sapService.doSapFun(sapReqParams); + if (!sapResult.isSuccess()) { + throw new NflgBusinessException(STATE.RouteServiceError, sapResult.getMsg()); + } + this.saveOrUpdateBatch(parentList); + pbomChildService.saveBatch(newChildEntityList); + if(childBomRowId != null){ + pbomChildService.removeById(childBomRowId); + } + List exceptRowIds = Lists.newArrayList(pbomParent.getRowId()); + List parentMaterialNos =Lists.newArrayList(pbomParent.getMaterialNo()); + //历史版本转移到formal正式工作表 + pBomToFormal(exceptRowIds, parentMaterialNos, parent.getFacCode()); } private void resetBomExist(Long rowId) { @@ -2213,6 +2358,7 @@ public class BomNewPbomParentService extends ServiceImpl materialNos = pbomChildService.lambdaQuery() .select(BomNewPbomChildEntity::getMaterialNo) .eq(BomNewPbomChildEntity::getParentRowId, bom.getBomRowId()) + .apply(" material_no != '' ") .list() .stream() .map(BomNewPbomChildEntity::getMaterialNo) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/SapOpUtilService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/SapOpUtilService.java index d03ccadc..998c09d3 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/SapOpUtilService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/SapOpUtilService.java @@ -6,6 +6,7 @@ import cn.hutool.core.convert.Convert; import cn.hutool.core.lang.TypeReference; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; +import com.google.common.collect.Lists; import com.nflg.product.base.core.exception.NflgBusinessException; import com.nflg.product.bomnew.constant.BomConstant; import com.nflg.product.bomnew.pojo.dto.sap.ImportToSapDTO; @@ -182,14 +183,15 @@ public class SapOpUtilService { Map>> outTablesMap = sapResult.getOutTablesMap(); log.info("导入到SAP--返回值:" + JSON.toJSONString(outTablesMap)); List> tOut = outTablesMap.get("T1"); - List list = null; + List list = Lists.newArrayList(); if (!CollectionUtils.isEmpty(tOut)) { list = Convert.convert(new TypeReference>() { }, tOut); } - if (CollUtil.isEmpty(list)) { - throw new NflgBusinessException(STATE.BusinessError, "获取sap返回数据转换异常"); - } + //BOM删除 新增项目类别K,没有返回 +// if (CollUtil.isEmpty(list)) { +// throw new NflgBusinessException(STATE.BusinessError, "获取sap返回数据转换异常"); +// } if (!Objects.isNull(backList)) { backList.addAll(list); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java index 168c6560..7d0bb228 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java @@ -120,6 +120,10 @@ public class CheckEBomException { && unCheckExcept.contains(vo.getExceptionStatus())) { continue; } + //项目类别为K 不做检查 10002327 241016 + if(Objects.equals(vo.getProjectType(),"K")){ + continue; + } vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); if (StrUtil.equals(BomConstant.PROJECT_TYPE_TEMPORARY, vo.getProjectType(), true)) { if (StrUtil.isBlank(vo.getMaterialDesc())) { diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomToPbomBase.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomToPbomBase.java index 215fb54f..01082b09 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomToPbomBase.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomToPbomBase.java @@ -799,7 +799,8 @@ public abstract class EBomToPbomBase { if (oldChildList.size() != newChildList.size()) { return false; } - Map> oldChildMap = oldChildList.stream().collect(Collectors.groupingBy(u -> StrUtil.join("", u.getMaterialNo(), u.getProjectType(), u.getNum()))); + Map> oldChildMap = oldChildList.stream().collect( + Collectors.groupingBy(u -> StrUtil.join("", u.getMaterialNo(), u.getProjectType(), u.getNum()))); for (BomNewEbomParentVO newChild : newChildList) { String key = MyStrUtil.joinStr(newChild.getMaterialNo(), newChild.getProjectType(), newChild.getNum()); if (!oldChildMap.containsKey(key)) { diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/PBom/PBomDetailTask.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/PBom/PBomDetailTask.java index 7e07abd8..526920a7 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/PBom/PBomDetailTask.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/PBom/PBomDetailTask.java @@ -52,6 +52,18 @@ public class PBomDetailTask extends RecursiveTask> { */ public void handlerChildBomVersionDetail() { List materialNos = bomDetail.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(BomNewPbomParentVO::getMaterialNo).collect(Collectors.toList()); + //项目列表为K项时,没有物料编码,相关属性取parent值 by 10002327 241018 +// List kList = bomDetail.stream().filter(u -> Objects.equals(u.getProjectType(),"K")).collect(Collectors.toList()); +// kList.forEach(k -> { +// BomNewPbomParentEntity parent = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery().eq(BomNewPbomParentEntity::getRowId, k.getParentRowId()).one(); +// k.setDeviseUserCode(parent.getDeviseUserCode()); +// k.setDeviseName(parent.getDeviseName()); +// k.setDeptName(parent.getDeptName()); +// k.setDeptRowId(parent.getDeptRowId()); +// k.setStatus(parent.getStatus()); +// k.setEditStatus(parent.getEditStatus()); +// k.setVirtualPackageIs(parent.getVirtualPackageIs()); +// }); if (CollUtil.isNotEmpty(materialNos)) {