• 替代件操作


    1、添加替代件的方法

      TCComponentBomLine.add(null, substituteItemRev, null, true);

    2、移除替代件

    public void removelAllSubstitutes(TCComponentBOMLine bomLine) throws TCException{
    		TCComponentItemRevision itemRev = bomLine.getItemRevision();
    		TCComponent[] tccomps3 = itemRev.whereUsed(TCComponentItemRevision.WHERE_USED_ALL);
    		for(TCComponent tcCom : tccomps3){
    			TCComponentItemRevision itemRevIndex = (TCComponentItemRevision) tcCom;
    			TCComponentBOMLine parentBomLine = BOMUtil.getInstance().createWindow().setWindowTopLine(null, itemRevIndex, null, null);
    			AIFComponentContext[] contexts = parentBomLine.getChildren();
    			if(contexts != null && contexts.length > 0){
    				for(AIFComponentContext context : contexts){
    					InterfaceAIFComponent interfaceAIFComIndex = context.getComponent();
    					if(interfaceAIFComIndex instanceof TCComponentBOMLine){
    						TCComponentBOMLine bomLineIndex = (TCComponentBOMLine) interfaceAIFComIndex;
    						if(itemRev == bomLineIndex.getItemRevision()){
    							bomLine = bomLineIndex;
    						}
    					}
    				}
    			}
    		}
    		TCComponentBOMLine[] bomLineSubstitutes = bomLine.listSubstitutes();
    		if(bomLineSubstitutes != null && bomLineSubstitutes.length > 0){
    			for(TCComponentBOMLine bomLineIndex : bomLineSubstitutes){
    				try
    		        {
    		          RelatedSubstituteComp[] arrayOfRelatedSubstituteComp1 = bomLineIndex.getRelatedSubstitutes();
    		          if ((arrayOfRelatedSubstituteComp1 != null) && (arrayOfRelatedSubstituteComp1.length > 0))
    		          {
    		            StringBuilder localStringBuilder = new StringBuilder();
    		            RelatedSubstituteComp[] arrayOfRelatedSubstituteComp2;
    		            int m = (arrayOfRelatedSubstituteComp2 = arrayOfRelatedSubstituteComp1).length;
    		            for (int k = 0; k < m; k++)
    		            {
    		              RelatedSubstituteComp localRelatedSubstituteComp = arrayOfRelatedSubstituteComp2[k];
    		              localStringBuilder.append(localRelatedSubstituteComp.toDisplayString());
    		              localStringBuilder.append("
    ");
    		            }
    		            if (true)
    		            {
    		              removeRelatedSubstitute(bomLineIndex);
    		              bomLineIndex.cut();
    		            }
    		          }
    		          else
    		          {
    		        	  bomLineIndex.cut();
    		          }
    		        }
    		        catch (TCException e)
    		        {
    		          e.printStackTrace();
    		          return;
    		        }
    			}
    		}
    	}
    

      

  • 相关阅读:
    replace和translate的用法
    java中静态方法和静态类的学习
    rank()函数的使用
    orcle函数的使用,及其调用
    父子级菜单的查询
    Centos7 安装K8S 小记
    三剑客之三 Awk小记
    三剑客之二 Sed小记
    三剑客之一 Grep小记
    ssh与telnet区别 小记
  • 原文地址:https://www.cnblogs.com/wwssgg/p/15213930.html
Copyright © 2020-2023  润新知