|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
5 ]' C, o" P j3 YTeamcenter二次开发源码分享:获取下一个Item ID的方法
' g7 E4 J. t7 {8 x0 l+ @. X- T: [% Z/ B
[mw_shl_code=cpp,true]#include <iostream>" [0 B3 H; K3 G3 a! W
+ @( }( r' @1 {: W3 `#include <property/nr.h>
5 `7 _ q: ]# m- p1 S8 s# T#include <TC/tc.h>+ _7 S1 K( l) F. k, O
#include <tc/tc_startup.h>
, F" b+ e z! S#include <tccore/item.h>
$ E8 l7 S9 N* J% y' t5 F#include <tccore/tctype.h>) p& G; T- h4 c6 d0 B" w
#include <base_utils/IFail.hxx>
4 p4 z! ?/ M$ x3 P#include <base_utils/TcResultStatus.hxx>
/ z R- `) N/ C; o2 n9 B#include <mld/logging/TcMainLogger.hxx>
9 z% a! y/ w( z3 b4 u& ]# N9 c4 e: U$ v! e
using namespace std;2 D6 a) u4 N& G
using Teamcenter::Main::logger;: S; E& V" N' P( C$ T% B( Z
* k! p, O c, T7 fint get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)
) O/ D) a, R; d9 ^{
+ g1 f% q0 r0 y/ d9 c int ifail = ITK_ok; c. _, t# S l F2 [, \6 y
ResultStatus stat;! Z, g- g+ t5 C5 A) G% B7 l ]4 f
try
; G' `9 x9 m! ~1 j9 k {+ g8 O" z8 T: ]) \, \( t
tag_t item_type_tag = NULLTAG;9 |8 t, i+ C7 @* x) X5 E
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
+ Z) O- Z; v: y" ]0 \4 `; B d* V; N
char *item_type_name = NULL;
/ ~* j' z" f" _# ? stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);
0 w! g+ v2 L& _- f1 p* f, i
8 q+ G7 s- z/ }* w- e6 ~. R4 V9 Q stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
* ~, p1 [& d; L4 g( ` if (item_type_name) MEM_free(item_type_name);
- g1 H( i$ d. m }2 _3 [1 K0 }- R1 k/ B
catch (const IFail &ex)
! [0 G2 f; h. v {
3 w \ C8 c" ` logger()->error(ex.ifail(), ex.getMessage());3 F4 n$ _, J" v$ N
cout << ex.getMessage() << endl;
) K% N3 x$ p \7 V) a; _ cout << "error " << ex.ifail() << endl;% e3 i* U4 f1 M
}3 F9 Y- F4 N* H1 `
return ITK_ok;& i, X9 t3 T0 _0 }# o# r5 ]: U" M
}[/mw_shl_code]6 c7 w" b' }- A% h/ b
|
|