【工艺路线】获取PBOM列表,父级物料号和父级描述字段

This commit is contained in:
10001392 2024-12-10 13:52:48 +08:00
parent 82bcf6a421
commit 7a9dd2c4c9
3 changed files with 26 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import com.nflg.product.technology.pojo.vo.ProcessRouteTaskVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
/**
* <p>
@ -30,6 +31,7 @@ public interface ProcessRouteTaskMapper extends BaseMapper<ProcessRouteTaskEntit
List<BomNewPbomParentVO> selectPBomParentBatch(@Param("status") Integer status, @Param("factory") String factory, @Param("materialNoList") List<String> materialNoList);
BomNewPbomParentVO selectPBomParentByRowId(@Param("rowId") Long rowId);
List<BomNewPbomParentVO> selectPBomParentByRowIdList(@Param("rowIdList") Set<Long> rowIdList);
List<BomNewPbomParentVO> selectPBomChildByParentRowId(@Param("parentRowIdList") List<Long> parentRowIdList);
}

View File

@ -320,11 +320,21 @@ public class ProcessRouteTaskService extends ServiceImpl<ProcessRouteTaskMapper,
}
nodesList.addAll(nodeList);
if (CollUtil.isNotEmpty(nodesList)) {
Set<Long> parentRowIds = nodesList.stream().map(BomNewPBomVO::getParentRowId).collect(Collectors.toSet());
List<BomNewPbomParentVO> parentVOs = processRouteTaskMapper.selectPBomParentByRowIdList(parentRowIds);
nodesList.forEach(item -> {
// 从现有集合取父级
List<BomNewPBomVO> parents = nodesList.stream().filter(parent -> item.getParentRowId().equals(parent.getRowId())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(parents)) {
item.setParentMaterialNo(parents.get(0).getMaterialNo());
item.setParentMaterialDesc(parents.get(0).getMaterialDesc());
} else {
// 从数据库集合取父级
List<BomNewPbomParentVO> parents2 = parentVOs.stream().filter(parent -> item.getParentRowId().equals(parent.getRowId())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(parents2)) {
item.setParentMaterialNo(parents2.get(0).getMaterialNo());
item.setParentMaterialDesc(parents2.get(0).getMaterialDesc());
}
}
item.setSapOrderNum(BomUtil.generateSapOrderNum(item.getProjectType(), item.getMaterialCategoryCode()
, item.getFacCode(), item.getMaterialNo(), item.getBomExist()));

View File

@ -87,7 +87,20 @@
</select>
<select id="selectPBomParentByRowId" resultType="com.nflg.product.technology.pojo.vo.BomNewPbomParentVO">
select * from t_bom_new_pbom_parent where row_id = #{rowId}
select * from t_bom_new_pbom_parent where 1=1
<if test="rowId != null">
and row_id = #{rowId}
</if>
</select>
<select id="selectPBomParentByRowIdList" resultType="com.nflg.product.technology.pojo.vo.BomNewPbomParentVO">
select * from t_bom_new_pbom_parent where 1=1
<if test="rowIdList != null and rowIdList.size > 0">
and row_id in
<foreach collection="rowIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</select>
<select id="selectPBomChildByParentRowId" resultType="com.nflg.product.technology.pojo.vo.BomNewPbomParentVO">