|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
1 Q" ~2 d* Y$ S ^4 ~
Teamcenter二次开发源码分享:获取下一个Item ID的方法
$ }, ~6 u/ z$ _& H2 T1 N) j0 x- K% S6 ?+ \. n" v$ o! b
[mw_shl_code=cpp,true]#include <iostream>+ L0 p# H5 V4 {8 V
! d t+ s0 N. l# w$ e* {6 @#include <property/nr.h>; ~9 H- N+ F; V9 S6 O
#include <TC/tc.h>
e1 h+ ?; E6 h#include <tc/tc_startup.h>
7 X% Y. G6 x7 Q, y5 n* n6 K8 y#include <tccore/item.h>
0 _4 j( K7 n$ y- @% S#include <tccore/tctype.h>
6 `1 X9 n! D+ s3 O; {#include <base_utils/IFail.hxx>
) x# N4 u1 s& a! x& H$ }. v#include <base_utils/TcResultStatus.hxx>
/ m1 B$ F- D* x$ A5 i' A#include <mld/logging/TcMainLogger.hxx># Z; o; C [2 y& ^2 l
2 Q3 r0 m2 R: vusing namespace std;
( ]) }5 t+ G m! i! o3 A% k8 Z; Xusing Teamcenter::Main::logger;
9 o# O! w: f7 r* z2 F( n& h* e& o5 m! b2 _+ [
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id): V8 j* }9 R: t8 ~' B" h" c. G
{
7 T( E4 U; ^' M; p' B int ifail = ITK_ok;8 ~9 Y8 V, j& l
ResultStatus stat;* F( O: P. _6 ~- }* `
try% |) F9 d+ J/ o; S
{
: V2 ], N+ s2 p0 ^7 u7 E* [ tag_t item_type_tag = NULLTAG;
& N3 v0 k- l2 g A) x+ P; I stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);( [- G' M3 ] F4 C# q9 c$ `
* e U2 q7 B! ]- U! k" ]5 Y0 k char *item_type_name = NULL;
. ?1 y+ n* t M5 V! H) R1 [ stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);
5 ?8 U8 x8 |1 h- I, O; S; {8 {: ^$ z G5 ?" u9 f
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);7 K8 g4 b4 U0 {- O8 w" K+ v5 ?
if (item_type_name) MEM_free(item_type_name);1 J) s; e( i. l* X. k2 w- S. y. b/ F
}
1 o% f1 K* ?5 T" \) {0 ?; N catch (const IFail &ex)( |* Y7 E2 M) N; v4 s- d$ N- a
{) ]/ z9 w, [) }( a7 T0 p
logger()->error(ex.ifail(), ex.getMessage());
& ^3 f# _9 }9 Y8 O cout << ex.getMessage() << endl;1 P2 X6 A+ _5 U9 q
cout << "error " << ex.ifail() << endl;; t( E5 G! F& h6 D& e7 [ C
}% z( y2 ? }6 S5 j
return ITK_ok;# R# k5 ?5 `7 A! q
}[/mw_shl_code]
" @3 p# O' b' I7 l( Q2 h% ] z% S |
|