|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- c! J, W& s: ?0 n8 n
Teamcenter二次开发源码分享:获取下一个Item ID的方法7 C# \8 S& `9 t I& {# b8 i
, d; Y) y; D% ?" w6 H/ ~' f5 L1 O[mw_shl_code=cpp,true]#include <iostream>1 {% H# z' E. ]8 o
: ^' t) y* ?1 m) _#include <property/nr.h>( k6 e4 g3 x0 c. r2 H3 C
#include <TC/tc.h>
7 \1 j2 l _/ H' n) A) Y2 k#include <tc/tc_startup.h>% p. L ]0 Z3 e9 E) M8 ?) b: p1 C
#include <tccore/item.h>0 [+ j$ m' }/ f o; s/ D. U5 I
#include <tccore/tctype.h>
% C _: I: S8 s, L+ e" _: @/ U#include <base_utils/IFail.hxx>
7 ?! E% P, d" s4 {6 W9 [#include <base_utils/TcResultStatus.hxx>
9 m8 f% U/ e+ j. ?- p' `) S$ m#include <mld/logging/TcMainLogger.hxx>
9 c. p1 k+ K- O+ g
7 M) N s' K, Q$ v8 |% lusing namespace std;/ ?/ [0 ~; o* \) a7 W
using Teamcenter::Main::logger;4 p/ J- _' Q R
. u4 P1 I; k. g& k! i
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)6 m# y3 n; Y7 Z d5 P
{* |! P% K. k/ G% G3 h( {
int ifail = ITK_ok;! X% E6 u F4 W0 H7 V: g# L
ResultStatus stat;
0 h) z) z% {; l; |5 V9 S try
/ p: G" k# N. k; } {4 p* F/ A$ x6 C/ ^
tag_t item_type_tag = NULLTAG;
$ P) G" {4 W9 t! _6 \0 i \# d stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);7 j8 q# p5 c" _5 }" V" p1 Y* c1 X- F
" @6 A3 Z1 H S2 h. x9 R
char *item_type_name = NULL;
* W, N4 M8 O) m3 l stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);
0 }* J) ~ ]' S, {# t7 v# x d j! [" l( V3 H0 ?0 L5 E$ |
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);; g' ]$ g" ^2 z+ l# F/ i* o) e. G# }
if (item_type_name) MEM_free(item_type_name);
( L7 W0 W; _+ ]+ ]0 K }
8 \" j5 u( ^; O) o7 H catch (const IFail &ex)' @" W! j5 M3 M: \# @/ O4 a
{, @/ x; d# e% ^: r2 O
logger()->error(ex.ifail(), ex.getMessage());
+ E$ l' |0 \ `# G) @1 d cout << ex.getMessage() << endl;5 I) |$ ]+ `7 k- b
cout << "error " << ex.ifail() << endl;
0 ~! c" Z6 Y9 M) {0 O' [/ } }
+ z4 b+ X" L: i; K: Z$ _$ r# a return ITK_ok;
/ \& k5 y d V! b. B: h5 S}[/mw_shl_code]
9 o# y1 o- p( ?# f; o8 q" o: b |
|