1、BUG修复

This commit is contained in:
大米 2024-04-13 16:38:41 +08:00
parent 840de12bfe
commit 7639ec8dc1
4 changed files with 32 additions and 16 deletions

View File

@ -52,9 +52,9 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
Set<String> getSelfParentMaterialNo(@Param("createdBy") String createdBy ,@Param("list") Set<String> list);
List<BomNewEbomParentVO> getParentForMaterialNoSeach(@Param("materialNoList") List<String> materialNoList ,@Param("dataType") Integer dataType);
List<BomNewEbomParentVO> getParentForMaterialNoSeach(@Param("materialNoList") List<String> materialNoList ,@Param("dataType") Integer dataType , @Param("createdBy") String createdBy);
List<BomNewEbomParentVO> getChildForMaterialNoSeach(@Param("materialNoList") List<String> materialNoList,@Param("bomRowIds") Collection<Long> bomRowIds );
List<BomNewEbomParentVO> getChildForMaterialNoSeach(@Param("materialNoList") List<String> materialNoList,@Param("bomRowIds") Collection<Long> bomRowIds , @Param("createdBy") String createdBy );
void updateRootState();

View File

@ -126,12 +126,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
List<String> materialNos = new ArrayList<>();
// List<String> parentMaterialByMaterialNo = getParentMaterialByMaterialNo(materialNo, !userRoleService.technician()).stream().collect(Collectors.toList());
//获取父级物料
List<String> parentMaterialByMaterialNo = getParentMaterial(ImmutableList.of(materialNo), !userRoleService.technician()).stream().collect(Collectors.toList());
Boolean getSelfIs=!userRoleService.technician();
List<String> parentMaterialByMaterialNo = getParentMaterial(ImmutableList.of(materialNo),(getSelfIs && query.getDataType().equals(0) ) ).stream().collect(Collectors.toList());
// materialNos.add(materialNo);
materialNos.addAll(parentMaterialByMaterialNo);
if (CollUtil.isNotEmpty(materialNos)) {
List<BomNewEbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(materialNos, query.getDataType());
List<BomNewEbomParentVO> childs = this.getBaseMapper().getChildForMaterialNoSeach(materialNos, parents.stream().map(u->u.getRowId()).collect(Collectors.toSet()));
List<BomNewEbomParentVO> childs=new ArrayList<>();
List<BomNewEbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(materialNos, query.getDataType() ,(getSelfIs && query.getDataType().equals(0) )?SessionUtil.getUserCode():null );
if(CollUtil.isNotEmpty(parents)) {
childs = this.getBaseMapper().getChildForMaterialNoSeach(materialNos, parents.stream().map(u -> u.getRowId()).collect(Collectors.toSet()), (getSelfIs && query.getDataType().equals(0)) ? SessionUtil.getUserCode() : null);
}
List<BomNewEbomParentVO> data = new ArrayList<>();
data.addAll(parents);
data.addAll(childs);

View File

@ -189,17 +189,20 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
List<String> parentDrawingNos = new ArrayList<>(getParentMaterialByDrawingNo(queryDrawingNos));
// parentDrawingNos.addAll(queryDrawingNos);
if (CollUtil.isNotEmpty(parentDrawingNos)) {
List<BomOriginalListVO> childs=new ArrayList<>();
List<BomOriginalListVO> parents = this.getBaseMapper().getParentForDrawingNoSeach(parentDrawingNos, query.getStatus());
materialMainService.intiMaterialInfo(parents, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
List<BomOriginalListVO> childs = this.getBaseMapper().getChildForDrawingNoSeach(parentDrawingNos,parents.stream().map(u->u.getRowId()).collect(Collectors.toSet()));
materialMainService.intiMaterialInfo(childs, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
childs.stream().filter(f -> StrUtil.isBlank(f.getCurrentVersion())).forEach(f -> {
if (MaterialshouldBomExistUtil.checkShouldBomExist(f.getMaterialCategoryCode(), f.getMaterialGetType())) {
f.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
} else {
f.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
}
});
if(CollUtil.isNotEmpty(parents)) {
childs = this.getBaseMapper().getChildForDrawingNoSeach(parentDrawingNos, parents.stream().map(u -> u.getRowId()).collect(Collectors.toSet()));
materialMainService.intiMaterialInfo(childs, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
childs.stream().filter(f -> StrUtil.isBlank(f.getCurrentVersion())).forEach(f -> {
if (MaterialshouldBomExistUtil.checkShouldBomExist(f.getMaterialCategoryCode(), f.getMaterialGetType())) {
f.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
} else {
f.setCurrentVersion(OriginalConstant.DEFAULT_BOM_VERSION);
}
});
}
// List<BomOriginalListVO> data = new ArrayList<>();
// data.addAll(parents);
// data.addAll(childs);

View File

@ -102,10 +102,14 @@
FROM t_bom_new_ebom_parent a
join (select material_no,max(current_version) current_version from t_bom_new_ebom_parent where
<if test="dataType==1" >
a.status = 4
status = 4
</if>
<if test="dataType==0" >
and a.status &lt; 4
status &lt; 4
<if test="createdBy!=null and createdBy!=''">
and created_by=#{createdBy}
</if>
</if>
and material_no in
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
@ -171,9 +175,14 @@
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="createdBy!=null and createdBy!=''">
and b.created_by=#{createdBy}
</if>
</select>
<!--BOM-正式工作表-->
<select id="formalWorksheet" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
select * , row_id as bomRowId from t_bom_new_ebom_parent a