Teamcenter13.3-RCP开发调用TC原生界面

本文详细介绍了如何调用Teamcenter的分类、查询构建器、查询结果界面及相关TC应用。通过Java代码展示了各个功能的实现,包括分类界面的获取、查询构建器的展示以及查询操作。同时,列出了多个TC应用的ID及其在系统中的定位。

一、分类

1、调用分类界面

com.teamcenter.rac.classification.icm

  1. public VPPSAttributeFillingBOMDialog(Frame frame,TCSession session) throws Exception {
  2.     super(frame);
  3.     this.setTitle("选择分类");
  4.     this.setResizable(true);
  5.     this.setLayout(new BorderLayout());
  6.     //框的大小 widehigh
  7.     this.setPreferredSize(new Dimension(400, 750));
  8.     Panel panel = new Panel();
  9.     JButton sureButton=new JButton("确定");
  10.     sureButton.setBounds(110, 210, 100, 40);
  11.     panel.add(sureButton);
  12.     //获取分类界面
  13.     ClassificationService classificationService = new ClassificationService();
  14.     //展示分类主页面
  15.     G4MApplicationPanel mainPanel = classificationService.getMainPanel();
  16.     this.getContentPane().add(mainPanel, BorderLayout.CENTER);
  17.     this.getContentPane().add(panel,BorderLayout.SOUTH);
  18.     this.pack();
  19.     this.setVisible(true);
  20. }

二、查询构建器

1、调用查询构建器界面

com.teamcenter.rac.querybuilder

  1. public CompletedTaskBoxDialog(Frame frame) throws Exception {
  2.     super(frame);
  3.     this.setTitle("创建查询");
  4.     this.setResizable(true);
  5.     this.setLayout(new BorderLayout());
  6.     //框的大小 widehigh
  7.     this.setPreferredSize(new Dimension(750, 750));
  8.     Panel panel = new Panel();
  9.     sureButton=new JButton("确定");
  10.     sureButton.setBounds(110, 210, 100, 40);
  11.     //获取查询构建器界面
  12.     QueryBuilderService classificationService = new QueryBuilderService();
  13.     //展示查询构建器页面
  14.     JPanel mainPanel = classificationService.getMainPanel();
  15.     this.getContentPane().add(mainPanel, BorderLayout.CENTER);
  16.     this.add(sureButton,BorderLayout.SOUTH);
  17.     this.pack();
  18.     this.setVisible(true);
  19.     sureButton.addActionListener(this);
  20. }

三、查询

1、打开查询结果界面

com.teamcenter.rac.search

  1. /**
  2. * 打开查询结果面板代码
  3. * 通过条件查询,打开条件相对应的查询结果面板
  4. * @param findName:查询值,如查询5开头的零组件则findName=5*
  5. * @param findValue:查询条件真实名称,如object_name
  6. * @param name:查询名称,如"数据集名称"
  7. * @author huyanling
  8. * 2021-10-16
  9. * */
  10. public void openSearchResultPage(String[] findName,String[] findValue,String name){
  11.     try {
  12.         if(findName.length>findValue.length){
  13.             MessageBox.post("查询条件与查询值不对应,请检查!", "提示", 2);
  14.             return ;
  15.         }
  16.         TCComponentQueryType typeComponent = (TCComponentQueryType) session.getTypeComponent("ImanQuery");
  17.         TCComponentQuery find = (TCComponentQuery) typeComponent.find(name);
  18.         if(find == null){
  19.             MessageBox.post("TC中没有【" + name + "】这个查询,请定义该查询后使用!", "提示", 2);
  20.             return ;
  21.         }
  22.         TCQueryClause[] describe = find.describe();//获取查询结果集
  23.         String[] strings = new String[findValue.length];
  24.         String[] value = findName;
  25.         for(int v = 0; v < findValue.length; v++){
  26.             for (int i = 0; i < describe.length; i++) {
  27.                 String attributeName = describe[i].getAttributeName();
  28.                 if(attributeName.equals(findValue[v])){
  29.                     //获取用户条目名称
  30.                     strings[v] = describe[i].getUserEntryNameDisplay();
  31.                 }
  32.             }
  33.         }
  34.         TCComponent[] execute = find.execute(strings, value);
  35.         if(execute.length<=0){
  36.             MessageBox.post("没有查询到值哦,请检查自己的查询条件,或者确定TC中是否有数据!", "提示", 2);
  37.             return ;
  38.         }
  39.         TcSearchUI tcSearchUI = new TcSearchUI();
  40.         //获取查询对象
  41.         TCComponentSearch tcComponentSearch = new TCComponentSearch(find, strings, value,
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Mr_GGI

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值