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

This commit is contained in:
luoliming 2024-08-28 21:58:47 +08:00
commit 6e79ebe3ff
6 changed files with 38 additions and 29 deletions

View File

@ -383,7 +383,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollUtil.isNotEmpty(materialNos)) {
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos)
// .eq(!EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()), BomNewEbomParentEntity::getLastVersionIs, 1)
.eq(EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()), BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
.eq(type.equals(1), BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
// if (EBomStatusEnum.CHECKED.equalsValue(parent.getStatus())) {
// list = list.stream().filter(u -> EBomStatusEnum.CHECKED.equalsValue(u.getStatus())).collect(Collectors.toList());
// }

View File

@ -326,11 +326,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
List<String> materialNos = parentChild.stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toList());
if (CollUtil.isNotEmpty(materialNos)) {
List<BomNewPbomParentEntity> list = this.lambdaQuery().in(BomNewPbomParentEntity::getMaterialNo, materialNos)
// .eq(PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus()), BomNewPbomParentEntity::getLastVersionIs, 1)
// .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.getValue() > parent.getStatus(), BomNewPbomParentEntity::getLastVersionIs, 1)
.ge(PBomStatusEnum.PUBLISH.getValue() <= parent.getStatus(), BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
.eq(type.equals(0), BomNewPbomParentEntity::getLastVersionIs, 1)
.ge(type.equals(1), BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
.eq(BomNewPbomParentEntity::getFacCode,parent.getFacCode())
.list();
@ -1138,7 +1135,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
List<Long> bomRowIds = allBom.stream().filter(u -> PBomStatusEnum.WAIT_PUBLISH.equalsValue(u.getStatus()) && u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
List<String> parentMaterialNos = allBom.stream().filter(u -> PBomStatusEnum.WAIT_PUBLISH.equalsValue(u.getStatus()) && u.getBomRowId() > 0).map(u->u.getMaterialNo()).collect(Collectors.toList());
parentMaterialNos.add(parent.getMaterialNo());
//Integer state = (parent.getMaterialNo().startsWith("31") && parent.getFacCode().equals(EBomConstant.MAIN_FACTORY_CODE_1010)) ? PBomStatusEnum.WAIT_FACTORY.getValue() : PBomStatusEnum.PUBLISH.getValue();
Integer state = parent.getMaterialNo().startsWith("31") ? PBomStatusEnum.FACTORY_CONFIRM.getValue() : PBomStatusEnum.PUBLISH.getValue();
@ -1153,25 +1150,25 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
}
else {
bomRowIds.add(bomRowId);
parentMaterialNos.add(parent.getMaterialNo());
}
this.getBaseMapper().bomRelease(state, SessionUtil.getUserName(), bomRowIds);
//同步sap
// saySyncDEMO();
// importSap(parent,allBom);
//记录-BOM版本RowId
List<BomNewPbomChildEntity> pBomChildren = new ArrayList<>();
allBom.forEach(k -> {
BomNewPbomChildEntity entChild = new BomNewPbomChildEntity();
entChild.setRowId(k.getRowId());
entChild.setBomVersionRowId(k.getBomRowId());
pBomChildren.add(entChild);
});
if (CollUtil.isNotEmpty(pBomChildren)) {
pbomChildService.updateBatchById(pBomChildren);
}
if(CollUtil.isNotEmpty(bomRowIds)) {
this.getBaseMapper().bomRelease(state, SessionUtil.getUserName(), bomRowIds);
//记录-BOM版本RowId
List<BomNewPbomChildEntity> pBomChildren = new ArrayList<>();
allBom.forEach(k -> {
BomNewPbomChildEntity entChild = new BomNewPbomChildEntity();
entChild.setRowId(k.getRowId());
entChild.setBomVersionRowId(k.getBomRowId());
pBomChildren.add(entChild);
});
if (CollUtil.isNotEmpty(pBomChildren)) {
pbomChildService.updateBatchById(pBomChildren);
}
//历史版本转移到formal正式工作表
pBomToFormal(bomRowIds, parentMaterialNos,parent.getFacCode());
//历史版本转移到formal正式工作表
pBomToFormal(bomRowIds, parentMaterialNos, parent.getFacCode());
}
// SpringUtil.getBean(BomNewPbomParentFormalService.class).copyPbomFormal(bomRowId);
} catch (Exception ex) {

View File

@ -77,7 +77,7 @@ public class EBomToPBom extends EBomToPbomBase {
List<BomNewEbomParentVO> child = result.stream().filter(u -> u.getParentRowId().equals(vo.getBomRowId()) && !childDelMaterialNos.contains(u.getMaterialNo())).distinct().collect(Collectors.toList());
List<BomNewEbomParentVO> mergeChild = mergeChild(child);
//判断pbom 是否一致
if( compareContentIsSame(vo, mergeChild, facCode)){
if( compareContentIsSame(vo, mergeChild, facCode) && !vo.getMaterialNo().equals(parent.getMaterialNo())){
continue;
}
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode,parentList);

View File

@ -117,7 +117,7 @@ public class EBomToPBomFor31 extends EBomToPbomBase {
//子级
List<BomNewEbomParentVO> child = facBomDataMp.get(facCode).stream().filter(u -> u.getParentRowId().equals(vo.getBomRowId()) && !childDelMaterialNos.contains(u.getMaterialNo())).distinct().collect(Collectors.toList());
List<BomNewEbomParentVO> mergeChild = mergeChild(child);
if(compareContentIsSame(vo, mergeChild, facCode)){
if(compareContentIsSame(vo, mergeChild, facCode) && !vo.getMaterialNo().equals(parent.getMaterialNo())){
continue;
}
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode, parentList);

View File

@ -3,12 +3,14 @@ package com.nflg.product.bomnew.service.domain.EBom.topbomnew;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.excel.enums.BooleanEnum;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.bomnew.constant.ConvertToPBomModelEnum;
import com.nflg.product.bomnew.constant.EBomConstant;
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
import com.nflg.product.bomnew.mapper.master.BomNewPbomParentMapper;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
@ -125,6 +127,13 @@ public class EBomToPBomForFormal31New extends FormalEBomToPbomBase {
if(Objects.isNull(parentEnt)){
continue;
}
//检查是否用户跟用户节点
if(parentEnt.getMaterialNo().equals(parent.getMaterialNo())) {
List<String> childMaterialNos = SpringUtil.getBean(BomNewPbomParentMapper.class).getPBomExistMaterialInChildForWorkList(parent.getMaterialNo());
if (CollUtil.isEmpty(childMaterialNos)) {
parentEnt.setUserRootIs(1);
}
}
//子级
if (CollUtil.isNotEmpty(child)) {

View File

@ -89,10 +89,13 @@ public class EBomToPBomForFormalNew extends FormalEBomToPbomBase {
continue;
}
//检查是否用户跟用户节点
List<String> childMaterialNos = SpringUtil.getBean(BomNewPbomParentMapper.class).getPBomExistMaterialInChildForWorkList(parentEnt.getMaterialNo());
if(CollUtil.isEmpty(childMaterialNos)){
parentEnt.setUserRootIs(1);
if(parentEnt.getMaterialNo().equals(parent.getMaterialNo())) {
List<String> childMaterialNos = SpringUtil.getBean(BomNewPbomParentMapper.class).getPBomExistMaterialInChildForWorkList(parent.getMaterialNo());
if (CollUtil.isEmpty(childMaterialNos)) {
parentEnt.setUserRootIs(1);
}
}
//子级
if (CollUtil.isNotEmpty(child)) {
//合并子级