替代件操作

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("\n");
		            }
		            if (true)
		            {
		              removeRelatedSubstitute(bomLineIndex);
		              bomLineIndex.cut();
		            }
		          }
		          else
		          {
		        	  bomLineIndex.cut();
		          }
		        }
		        catch (TCException e)
		        {
		          e.printStackTrace();
		          return;
		        }
			}
		}
	}

  

替代件操作

上一篇:AttributeError: 'Rectangle' object has no property 'normed'


下一篇:leetcode103 二叉树的锯齿形层序遍历