【工艺路线】获取PBOM列表,父级物料号和父级描述字段
This commit is contained in:
parent
82bcf6a421
commit
7a9dd2c4c9
|
|
@ -10,6 +10,7 @@ import com.nflg.product.technology.pojo.vo.ProcessRouteTaskVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <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);
|
List<BomNewPbomParentVO> selectPBomParentBatch(@Param("status") Integer status, @Param("factory") String factory, @Param("materialNoList") List<String> materialNoList);
|
||||||
|
|
||||||
BomNewPbomParentVO selectPBomParentByRowId(@Param("rowId") Long rowId);
|
BomNewPbomParentVO selectPBomParentByRowId(@Param("rowId") Long rowId);
|
||||||
|
List<BomNewPbomParentVO> selectPBomParentByRowIdList(@Param("rowIdList") Set<Long> rowIdList);
|
||||||
|
|
||||||
List<BomNewPbomParentVO> selectPBomChildByParentRowId(@Param("parentRowIdList") List<Long> parentRowIdList);
|
List<BomNewPbomParentVO> selectPBomChildByParentRowId(@Param("parentRowIdList") List<Long> parentRowIdList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -320,11 +320,21 @@ public class ProcessRouteTaskService extends ServiceImpl<ProcessRouteTaskMapper,
|
||||||
}
|
}
|
||||||
nodesList.addAll(nodeList);
|
nodesList.addAll(nodeList);
|
||||||
if (CollUtil.isNotEmpty(nodesList)) {
|
if (CollUtil.isNotEmpty(nodesList)) {
|
||||||
|
Set<Long> parentRowIds = nodesList.stream().map(BomNewPBomVO::getParentRowId).collect(Collectors.toSet());
|
||||||
|
List<BomNewPbomParentVO> parentVOs = processRouteTaskMapper.selectPBomParentByRowIdList(parentRowIds);
|
||||||
nodesList.forEach(item -> {
|
nodesList.forEach(item -> {
|
||||||
|
// 从现有集合取父级
|
||||||
List<BomNewPBomVO> parents = nodesList.stream().filter(parent -> item.getParentRowId().equals(parent.getRowId())).collect(Collectors.toList());
|
List<BomNewPBomVO> parents = nodesList.stream().filter(parent -> item.getParentRowId().equals(parent.getRowId())).collect(Collectors.toList());
|
||||||
if (CollUtil.isNotEmpty(parents)) {
|
if (CollUtil.isNotEmpty(parents)) {
|
||||||
item.setParentMaterialNo(parents.get(0).getMaterialNo());
|
item.setParentMaterialNo(parents.get(0).getMaterialNo());
|
||||||
item.setParentMaterialDesc(parents.get(0).getMaterialDesc());
|
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.setSapOrderNum(BomUtil.generateSapOrderNum(item.getProjectType(), item.getMaterialCategoryCode()
|
||||||
, item.getFacCode(), item.getMaterialNo(), item.getBomExist()));
|
, item.getFacCode(), item.getMaterialNo(), item.getBomExist()));
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,20 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectPBomParentByRowId" resultType="com.nflg.product.technology.pojo.vo.BomNewPbomParentVO">
|
<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>
|
||||||
|
|
||||||
<select id="selectPBomChildByParentRowId" resultType="com.nflg.product.technology.pojo.vo.BomNewPbomParentVO">
|
<select id="selectPBomChildByParentRowId" resultType="com.nflg.product.technology.pojo.vo.BomNewPbomParentVO">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue