Merge remote-tracking branch 'origin/DM/PBOM-正式表查询BUG修复'

This commit is contained in:
10001392 2024-10-14 17:36:25 +08:00
commit 48b0e5cf98
6 changed files with 34 additions and 9 deletions

View File

@ -46,9 +46,9 @@ public interface BomNewPbomParentMapper extends BaseMapper<BomNewPbomParentEntit
void updatePBomMaterialUse();
List<BomNewPbomParentVO> getParentForMaterialNoSeach(@Param("userFac") String userFac,@Param("materialNoList") List<String> materialNoList);
List<BomNewPbomParentVO> getParentForMaterialNoSeach(@Param("userFac") String userFac,@Param("materialNoList") List<String> materialNoList,@Param("userCode")String userCode);
List<BomNewPbomParentVO> getChildForMaterialNoSeach(@Param("userFac") String userFac,@Param("materialNoList") List<String> materialNoList,@Param("materialNo")String materialNo);
List<BomNewPbomParentVO> getChildForMaterialNoSeach(@Param("userFac") String userFac,@Param("materialNoList") List<String> materialNoList,@Param("materialNo")String materialNo,@Param("userCode")String userCode);
Integer checkIsRoot(@Param("materialNo")String materialNo);

View File

@ -992,6 +992,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
parent.setBomRowId(parent.getRowId());
parent.setChildBomRowId(parent.getRowId());
parent.setParentRowId(0L);
parent.setUserRootIs(1);
bomTree.add(parent);
EBomToPbomBase eBomToPBom =parent.getMaterialNo().startsWith("31")? new EBomToPBomFor31(parent, bomTree, paramDto.getFacCodes(), 0L,EnumUtils.getValueEnum(ConvertToPBomModelEnum.class,paramDto.getConvertMode())):new EBomToPBom(parent, bomTree, paramDto.getFacCodes(), 0L,EnumUtils.getValueEnum(ConvertToPBomModelEnum.class,paramDto.getConvertMode()));
@ -1059,6 +1060,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) {
//将物料标记为用户跟节点
List<BomNewPbomParentEntity> rootParent = eBomToPBom.getPBomParentResult().stream().filter(u -> u.getMaterialNo().equals(parent.getMaterialNo())).collect(Collectors.toList());
if(CollUtil.isNotEmpty(rootParent)) {
rootParent.get(0).setUserRootIs(1);
}
pBomParentService.saveOrUpdateBatch(eBomToPBom.getPBomParentResult());
}
@ -1177,6 +1184,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
parent.setBomRowId(parent.getRowId());
parent.setChildBomRowId(parent.getRowId());
parent.setParentRowId(0L);
parent.setUserRootIs(1);
bomTree.add(parent);
FormalEBomToPbomBase eBomToPBom =parent.getMaterialNo().startsWith("31")? new EBomToPBomForFormal31New(parent, bomTree, paramDto.getFacCodes(), 0L,EnumUtils.getValueEnum(ConvertToPBomModelEnum.class,paramDto.getConvertMode())):new EBomToPBomForFormalNew(parent, bomTree, paramDto.getFacCodes(), 0L,EnumUtils.getValueEnum(ConvertToPBomModelEnum.class,paramDto.getConvertMode()));
eBomToPBom.convert();
@ -1256,6 +1264,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) {
//将物料标记为用户跟节点
List<BomNewPbomParentEntity> rootParent = eBomToPBom.getPBomParentResult().stream().filter(u -> u.getMaterialNo().equals(parent.getMaterialNo())).collect(Collectors.toList());
if(CollUtil.isNotEmpty(rootParent)) {
rootParent.get(0).setUserRootIs(1);
}
pBomParentService.saveOrUpdateBatch(eBomToPBom.getPBomParentResult());
}

View File

@ -145,8 +145,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
if (CollUtil.isNotEmpty(parentMaterialByMaterialNo)) {
String queryFac= StrUtil.isBlank(query.getFacCode())? userRoleService.getUserFactory():query.getFacCode();
List<BomNewPbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(queryFac , parentMaterialByMaterialNo);
List<BomNewPbomParentVO> childs = this.getBaseMapper().getChildForMaterialNoSeach(queryFac , parentMaterialByMaterialNo, materialNo);
List<BomNewPbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(queryFac , parentMaterialByMaterialNo,SessionUtil.getUserCode());
List<BomNewPbomParentVO> childs = this.getBaseMapper().getChildForMaterialNoSeach(queryFac , parentMaterialByMaterialNo, materialNo,SessionUtil.getUserCode());
List<BomNewPbomParentVO> data = new ArrayList<>();
data.addAll(parents);
data.addAll(childs);
@ -1156,9 +1156,9 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
this.delPBom(delNoReleaseBom);
}
List<Long> bomRowIds = allBom.stream().filter(u -> PBomStatusEnum.WAIT_PUBLISH.equalsValue(u.getStatus()) && u.getBomRowId() > 0 && !u.getDelIs().equals(1)).map(u -> u.getBomRowId()).collect(Collectors.toList());
List<Long> bomRowIds = allBom.stream().filter(u -> SessionUtil.getUserCode().equals(u.getCreatedBy()) && PBomStatusEnum.WAIT_PUBLISH.equalsValue(u.getStatus()) && u.getBomRowId() > 0 && !u.getDelIs().equals(1)).map(u -> u.getBomRowId()).collect(Collectors.toList());
List<String> parentMaterialNos = allBom.stream().filter(u -> PBomStatusEnum.WAIT_PUBLISH.equalsValue(u.getStatus()) && u.getBomRowId() > 0 && !u.getDelIs().equals(1)).map(u->u.getMaterialNo()).collect(Collectors.toList());
List<String> parentMaterialNos = allBom.stream().filter(u -> SessionUtil.getUserCode().equals(u.getCreatedBy()) && PBomStatusEnum.WAIT_PUBLISH.equalsValue(u.getStatus()) && u.getBomRowId() > 0 && !u.getDelIs().equals(1)).map(u->u.getMaterialNo()).collect(Collectors.toList());
//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();
@ -1241,7 +1241,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
Set<String> oldChildSet0 = oldBomNoTChildren.stream().map(u -> u.getMaterialNoAndNumAndProjectType()).collect(Collectors.toSet());
Set<String> newChildSet0 = newBomNoTChildren.stream().map(u -> u.getMaterialNoAndNumAndProjectType()).collect(Collectors.toSet());
if(oldChildSet0.equals(newChildSet0)){
if(oldChildSet0.equals(newChildSet0) && SessionUtil.getUserCode().equals(newPBom.getCreatedBy()) ){
newPBom.setStatus(PBomStatusEnum.PUBLISH.getValue());
newPBom.setDelIs(1);

View File

@ -200,6 +200,10 @@ public abstract class EBomToPbomBase {
oldParent.setDeptName(SessionUtil.getDepartName());
oldParent.setDeptRowId(SessionUtil.getDepartRowId());
oldParent.setEbomVersion(parentVo.getEbomVersion());
oldParent.setDeviseName(SessionUtil.getRealName());
oldParent.setDeviseUserCode(SessionUtil.getUserCode());
oldParent.setTechnologyUserCode(SessionUtil.getUserCode());
oldParent.setTechnologyUserName(SessionUtil.getUserName());
if(StrUtil.isNotBlank(parentVo.getEbomVersion())){
oldParent.setCurrentVersion(parentVo.getEbomVersion());
}
@ -332,6 +336,8 @@ public abstract class EBomToPbomBase {
pBomParent.setDeptRowId(SessionUtil.getDepartRowId());
pBomParent.setCreatedTime(LocalDateTime.now());
pBomParent.setCreatedBy(SessionUtil.getUserCode());
pBomParent.setDeviseName(SessionUtil.getRealName());
pBomParent.setDeviseUserCode(SessionUtil.getUserCode());
//版本=EBom版本
pBomParent.setCurrentVersion(bomVersion);
pBomParent.setEditStatus(PBomEditStatusEnum.HANDLER_CREATED.getValue());

View File

@ -200,6 +200,10 @@ public abstract class FormalEBomToPbomBase {
oldParent.setCreatedBy(SessionUtil.getUserCode());
oldParent.setDeptName(SessionUtil.getDepartName());
oldParent.setDeptRowId(SessionUtil.getDepartRowId());
oldParent.setDeviseUserCode(SessionUtil.getUserCode());
oldParent.setDeviseName(SessionUtil.getRealName());
oldParent.setTechnologyUserName(SessionUtil.getRealName());
oldParent.setTechnologyUserCode(SessionUtil.getUserCode());
if(StrUtil.isNotBlank(parentVo.getCurrentVersion()) && VersionUtil.compare(parentVo.getCurrentVersion(),oldParent.getCurrentVersion())>0){
oldParent.setCurrentVersion(parentVo.getCurrentVersion());
oldParent.setEbomVersion(parentVo.getCurrentVersion());
@ -320,6 +324,8 @@ public abstract class FormalEBomToPbomBase {
pBomParent.setCreatedBy(SessionUtil.getUserCode());
pBomParent.setSource(PbomSourceEnum.FROM_EBOM.getValue());
pBomParent.setSourceStatus(PbomSourceStatusEnum.EBOM.getValue());
pBomParent.setDeviseName(SessionUtil.getRealName());
pBomParent.setDeviseUserCode(SessionUtil.getUserCode());
//EBOM版本大于pbom版本则用EBOm版本
if( oldParent!=null && StrUtil.isNotBlank(parentVo.getCurrentVersion()) && VersionUtil.compare(parentVo.getCurrentVersion(),oldParent.getCurrentVersion())>0){
pBomParent.setCurrentVersion(parentVo.getCurrentVersion());

View File

@ -211,7 +211,7 @@
<!--物料编码搜索-父级-->
<select id="getParentForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
SELECT created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
FROM t_bom_new_pbom_parent a where a.last_version_is=1 and a.status=1
FROM t_bom_new_pbom_parent a where a.last_version_is=1 and a.status=1 and a.created_by=#{userCode}
<if test="userFac!=null and userFac!=''">
and fac_code=#{userFac}
</if> and material_no in
@ -227,7 +227,7 @@
from t_bom_new_pbom_parent a
join t_bom_new_pbom_child b on a.row_id =b.parent_row_id
left join t_bom_new_pbom_parent c on b.material_no=c.material_no and b.fac_code=c.fac_code and c.last_version_is=1
where a.last_version_is=1 and a.status=1
where a.last_version_is=1 and a.status=1 and a.created_by=#{userCode}
<if test="userFac!=null and userFac!=''">
and a.fac_code=#{userFac}
</if>