首页 > 其他 > 详细

替代件操作

时间:2021-09-02 15:27:56      阅读:10      评论:0      收藏:0      [点我收藏+]

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;
		        }
			}
		}
	}

  

替代件操作

原文:https://www.cnblogs.com/wwssgg/p/15213930.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!