您的位置:首页 > 其它

把一个物料发送到结构管理器中(bom行很大 20000行),遍历bomline行,然后输出报表,但是最后报表也出来了。但tc的结构管理器卡死了,随之整个tc卡死了.解决办法

2018-05-21 16:32 639 查看
这个是客户的要求,现在已经解决了
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先发送到结构管理其中,然后在清缓存,关闭掉,就不会有卡顿的情况了 阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐