这个是客户的要求,现在已经解决了
public void getallChild(TCComponentItemRevision topItemRev) throws Exception
{
TCComponent BOMViewRev[] = topItemRev.getRelatedComponents("structure_revisions");
TCComponentBOMViewRevision bomViewRev =null;
for (int i = 0; i < BOMViewRev.length; i++)
{
TCComponent view = BOMViewRev[i].getReferenceProperty("bom_view");
String type = view.getReferenceProperty("view_type").toString();
System.out.println("view type----------------"+type);
if (type.toLowerCase().equals("view")||"组成".equalsIgnoreCase(type))
{
bomViewRev = (TCComponentBOMViewRevision) BOMViewRev[i];
}
}
TCComponentBOMWindow win = Common.GetBomWindows("Lastest Working");
TCComponentBOMLine topBomLine = win.setWindowTopLine(null, topItemRev, bomViewRev, null);
readline(topBomLine);
win.clearCache();
win.close();
}
/**
* 获得BOM窗口
* @param ruleStr bom版本规则
* @return
*/
public static TCComponentBOMWindow GetBomWindows(String ruleStr) {
TCSession session = (TCSession) AIFUtility.getDefaultSession();
TCComponentBOMWindow bomWindows = null;
try {
TCComponentRevisionRule rule = null;
TCComponentRevisionRule rrs[] = TCComponentRevisionRule.listAllRules(session);
for (int i = 0; i < rrs.length; i++) {
if (rrs[i].getProperty("object_name").equals(ruleStr)) {
rule = rrs[i];
break;
}
}
TCTypeService typeService = session.getTypeService();
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) typeService.getTypeComponent("BOMWindow");
bomWindows = winType.create(rule);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return bomWindows;
}
通过以上代码把较大的bom先发送到结构管理其中,然后在清缓存,关闭掉,就不会有卡顿的情况了
public void getallChild(TCComponentItemRevision topItemRev) throws Exception
{
TCComponent BOMViewRev[] = topItemRev.getRelatedComponents("structure_revisions");
TCComponentBOMViewRevision bomViewRev =null;
for (int i = 0; i < BOMViewRev.length; i++)
{
TCComponent view = BOMViewRev[i].getReferenceProperty("bom_view");
String type = view.getReferenceProperty("view_type").toString();
System.out.println("view type----------------"+type);
if (type.toLowerCase().equals("view")||"组成".equalsIgnoreCase(type))
{
bomViewRev = (TCComponentBOMViewRevision) BOMViewRev[i];
}
}
TCComponentBOMWindow win = Common.GetBomWindows("Lastest Working");
TCComponentBOMLine topBomLine = win.setWindowTopLine(null, topItemRev, bomViewRev, null);
readline(topBomLine);
win.clearCache();
win.close();
}
/**
* 获得BOM窗口
* @param ruleStr bom版本规则
* @return
*/
public static TCComponentBOMWindow GetBomWindows(String ruleStr) {
TCSession session = (TCSession) AIFUtility.getDefaultSession();
TCComponentBOMWindow bomWindows = null;
try {
TCComponentRevisionRule rule = null;
TCComponentRevisionRule rrs[] = TCComponentRevisionRule.listAllRules(session);
for (int i = 0; i < rrs.length; i++) {
if (rrs[i].getProperty("object_name").equals(ruleStr)) {
rule = rrs[i];
break;
}
}
TCTypeService typeService = session.getTypeService();
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) typeService.getTypeComponent("BOMWindow");
bomWindows = winType.create(rule);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return bomWindows;
}
通过以上代码把较大的bom先发送到结构管理其中,然后在清缓存,关闭掉,就不会有卡顿的情况了