Teamcenter SOA Service : Expand BOM

Problem Statement : Given top bom line, you need to expand and store all of it's child line in HashMap.

Answer is ...Checkout the below code

 

Load property by default when object loaded.Get the item_id against which we store the bom line
SessionService sessionService = SessionService.getService( connection );

//Set Property Policy to get the required property as default

ObjectPropertyPolicy objectpropertypolicy = new ObjectPropertyPolicy();
PolicyType policytype = new PolicyType( "BOMLine", new String []    { "bl_item_item_id" } );
objectpropertypolicy.addType(policytype );

sessionService.setObjectPropertyPolicy(objectpropertypolicy);
Expand the topline and get all child lines
StructureManagementService structureManagementService = StructureManagementService.getService(connection);

com.teamcenter.services.strong.cad._2008_06.StructureManagement.ExpandPSAllLevelsInfo info = new com.teamcenter.services.strong.cad._2008_06.StructureManagement.ExpandPSAllLevelsInfo();


info.parentBomLines = new BOMLine[]{ (BOMLine) topline };
info.excludeFilter = "None2";

com.teamcenter.services.strong.cad._2008_06.StructureManagement.ExpandPSAllLevelsPref pref = new com.teamcenter.services.strong.cad._2008_06.StructureManagement.ExpandPSAllLevelsPref();

ExpandPSAllLevelsResponse2 expandPSAllLevelsResponse = structureManagementService.expandPSAllLevels(info, pref);

for (int i = 0; i < expandPSAllLevelsResponse.output.length; i++) 
{

  try 
  {

 BOMLine childline = expandPSAllLevelsResponse.output[i].parent.bomLine;
           hmstructureLine.put( childline.get_bl_item_item_id(), childline );
   } 
   catch (NotLoadedException e) 
   {
 StringBuilder sErrorMessage = new StringBuilder();

   sErrorMessage.append( "Exception occurred while fetching the item id for loaded structure. " );

throw new Exception( sErrorMessage.toString() );
   }

}

Important thing above is info.excludeFilter = "None2";
if you see help document it has mention about using 'None' but it won't work (Error : Invalid enum value)

If you  check service reference guide it has mentioned 'None2' value for BOMLineFilter2

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值