Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom

# Conflicts:
#	nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java
This commit is contained in:
大米 2024-05-21 17:02:15 +08:00
commit 30aa342ff7
3 changed files with 29 additions and 13 deletions

View File

@ -335,7 +335,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
List<BomNewEbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId); List<BomNewEbomParentVO> parentChild = this.getBaseMapper().getParentChild(rowId);
//排除项目类别的赋值 //排除项目类别的赋值
materialMainService.intiMaterialInfoInPattern(parentChild, "^21 | ^31", EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); materialMainService.intiMaterialInfoInPattern(parentChild, "^21 | ^31", EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
if (CollUtil.isNotEmpty(parentChild)) { if (CollUtil.isNotEmpty(parentChild)) {
List<String> materialNos = parentChild.stream().map(BaseMaterialVO::getMaterialNo).filter(StrUtil::isNotBlank).collect(Collectors.toList()); List<String> materialNos = parentChild.stream().map(BaseMaterialVO::getMaterialNo).filter(StrUtil::isNotBlank).collect(Collectors.toList());
if (CollUtil.isNotEmpty(materialNos)) { if (CollUtil.isNotEmpty(materialNos)) {
@ -838,11 +838,22 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
//31 须有虚拟包 //31 须有虚拟包
List<BomNewEbomParentEntity> parents = this.getBaseMapper().selectBatchIds(paramDto.getBomRowIds()); List<BomNewEbomParentEntity> parents = this.getBaseMapper().selectBatchIds(paramDto.getBomRowIds());
VUtils.isTure(paramDto.getFacCodes().contains("1020") && parents.stream().anyMatch(u -> u.getMaterialNo().startsWith("31"))) // VUtils.isTure(paramDto.getFacCodes().contains("1020") && parents.stream().anyMatch(u -> u.getMaterialNo().startsWith("31")))
.throwMessage("31码不能生成仙桃(1020)的pbom"); // .throwMessage("31码不能生成仙桃(1020)的pbom");
VUtils.isTure(parents.stream().anyMatch(u -> u.getMaterialNo().startsWith("31") && u.getVirtrualPackageEnum() <= 0)) // VUtils.isTure(parents.stream().anyMatch(u -> u.getMaterialNo().startsWith("31") && u.getVirtrualPackageEnum() <= 0))
.throwMessage("31码须有虚拟包"); // .throwMessage("31码须有虚拟包");
parents.forEach(p -> {
if (p.getMaterialNo().startsWith("31")) {
List<String> errors = new ArrayList<>();
if (ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, p.getRowId())
.eq(BomNewEbomChildEntity::getVirtualPartType, VirtualPackageTypeEnum.UN_VIRTUAL_PACKAGE.getValue())
.exists()) {
errors.add(p.getMaterialNo() + "下还有未生成发货包的物料");
}
VUtils.isTure(CollUtil.isNotEmpty(errors)).throwMessage(StrUtil.join("<br/>", errors));
}
});
//检查该版本是否已转换过该工厂的Pbom //检查该版本是否已转换过该工厂的Pbom
for (BomNewEbomParentEntity parent : parents){ for (BomNewEbomParentEntity parent : parents){
List<BomNewPbomParentEntity> list = pBomParentService.lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, parent.getMaterialNo()).eq(BomNewPbomParentEntity::getCurrentVersion, parent.getCurrentVersion()) List<BomNewPbomParentEntity> list = pBomParentService.lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, parent.getMaterialNo()).eq(BomNewPbomParentEntity::getCurrentVersion, parent.getCurrentVersion())
@ -864,7 +875,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
parent.setChildBomRowId(parent.getRowId()); parent.setChildBomRowId(parent.getRowId());
parent.setParentRowId(0L); parent.setParentRowId(0L);
bomTree.add(parent); bomTree.add(parent);
EBomToPbomBase eBomToPBom =parent.getMaterialNo().startsWith("31")? new EBomToPBomFor31(parent, bomTree, paramDto.getFacCodes(), 0L):new EBomToPBom(parent, bomTree, paramDto.getFacCodes(), 0L); EBomToPbomBase eBomToPBom =parent.getMaterialNo().startsWith("31")? new EBomToPBomFor31(parent, bomTree, paramDto.getFacCodes(), 0L):new EBomToPBom(parent, bomTree
, parent.getMaterialNo().startsWith("31") ? Collections.singletonList("1010") : paramDto.getFacCodes()
, 0L);
eBomToPBom.convert(); eBomToPBom.convert();
if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) { if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) {

View File

@ -264,7 +264,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
// .lt(!PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus()),BomNewPbomParentEntity::getStatus,PBomStatusEnum.PUBLISH.getValue()) // .lt(!PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus()),BomNewPbomParentEntity::getStatus,PBomStatusEnum.PUBLISH.getValue())
// .eq(PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus()),BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue()) // .eq(PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus()),BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
.eq(PBomStatusEnum.PUBLISH.getValue() > parent.getStatus(), BomNewPbomParentEntity::getLastVersionIs, 1) .eq(PBomStatusEnum.PUBLISH.getValue() > parent.getStatus(), BomNewPbomParentEntity::getLastVersionIs, 1)
.gt(PBomStatusEnum.PUBLISH.getValue() <= parent.getStatus(), BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue()) .ge(PBomStatusEnum.PUBLISH.getValue() <= parent.getStatus(), BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
.list(); .list();
Map<String, BomNewPbomParentEntity> bomListMap= list.parallelStream() Map<String, BomNewPbomParentEntity> bomListMap= list.parallelStream()

View File

@ -3,10 +3,7 @@ package com.nflg.product.bomnew.service.domain.EBom;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.TypeReference; import cn.hutool.core.lang.TypeReference;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.*;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil; import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@ -198,7 +195,7 @@ public class EBomEdit {
EBomEdit.checkVirtualPackage(child); EBomEdit.checkVirtualPackage(child);
//新增数据 //新增数据
if (child.getRowId() == null || child.getRowId().longValue() == 0) { if (child.getRowId() == null || child.getRowId() == 0) {
child.setRowId(IdWorker.getId()); child.setRowId(IdWorker.getId());
child.setIdentityNo(StrUtil.join("_", parentEntity.getRowId(), child.getRowId())); child.setIdentityNo(StrUtil.join("_", parentEntity.getRowId(), child.getRowId()));
child.setSource(source); child.setSource(source);
@ -207,7 +204,7 @@ public class EBomEdit {
child.setSourceRowId(""); child.setSourceRowId("");
child.setParentRowId(parentEntity.getRowId()); child.setParentRowId(parentEntity.getRowId());
if(StrUtil.isEmpty(child.getOrderNumber())){ if(StrUtil.isEmpty(child.getOrderNumber())){
child.setOrderNumber("00"); child.setOrderNumber("001");
} }
if (dto.getOpType() == 2) { if (dto.getOpType() == 2) {
child.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue()); child.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
@ -218,6 +215,9 @@ public class EBomEdit {
child.setProjectType(child.getProjectType().toUpperCase()); child.setProjectType(child.getProjectType().toUpperCase());
} }
if (StrUtil.equals(BomConstant.PROJECT_TYPE_TEMPORARY, child.getProjectType(), true)) { if (StrUtil.equals(BomConstant.PROJECT_TYPE_TEMPORARY, child.getProjectType(), true)) {
String id = RandomUtil.randomNumbers(9);
child.setMaterialNo(BomConstant.PROJECT_TYPE_TEMPORARY + id);
child.setDrawingNo(BomConstant.PROJECT_TYPE_TEMPORARY + id);
if (StrUtil.isBlank(child.getMaterialUnit())) { if (StrUtil.isBlank(child.getMaterialUnit())) {
child.setMaterialUnit("PC"); child.setMaterialUnit("PC");
} }
@ -228,6 +228,9 @@ public class EBomEdit {
child.setNum(BigDecimal.ONE); child.setNum(BigDecimal.ONE);
} }
} }
if (parentEntity.getMaterialNo().startsWith("31")) {
child.setVirtualPartRootMaterialNo(parentEntity.getMaterialNo());
}
} }