|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Q7 Q4 h1 j# y+ BTeamcenter二次开发源码分享:获取下一个Item ID的方法- ?: {; F! w" y6 z4 L
" T$ ]) q* z! i9 h7 w9 L( r
[mw_shl_code=cpp,true]#include <iostream>! a) p1 p8 \2 B
5 A k4 [; U* G#include <property/nr.h>
: V* E( T& {% J) {#include <TC/tc.h>- {& }4 m2 u- u T" e
#include <tc/tc_startup.h>
" A. h6 a4 w( g2 D8 Y |#include <tccore/item.h>3 y& `' W- L, m# w9 [% O2 z' T
#include <tccore/tctype.h>6 W8 O$ Q% X% O) `& P
#include <base_utils/IFail.hxx>- I* Y: y4 ~6 c$ l( n* n3 ^; V* A+ F
#include <base_utils/TcResultStatus.hxx>5 e, V4 V ?' S4 [& e5 P. d% |
#include <mld/logging/TcMainLogger.hxx>
; h; D) f8 E9 Q' o- b
/ E, \4 R" r n3 n: L; t+ B9 N4 Lusing namespace std;
7 `8 I8 w7 L3 G8 Z+ b$ h, nusing Teamcenter::Main::logger;
1 g# {) [* y6 O6 o, O, @" T& d6 \ R$ Y
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)7 }/ x6 _7 {; K: w; `6 V' `. d
{
2 E- ?* t+ C( S2 p9 K% u+ @ int ifail = ITK_ok;% B! G N0 \0 r+ S
ResultStatus stat;7 M) \8 l7 K3 o* _3 z% W
try
; ~: b3 g9 \( G6 c0 Y {
9 s9 f, g; f J1 ]4 { tag_t item_type_tag = NULLTAG;
& x( q+ l }2 Y stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
1 Z9 l$ m9 y; Y* h0 f( l
1 W$ q' d, m5 }) k2 W char *item_type_name = NULL; z d# | R& f, }: c. B
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);1 D( {, G0 \. }
h: q3 J# K) @, k
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
7 K9 |* C; m% {: K4 q$ m1 f$ o4 w" x if (item_type_name) MEM_free(item_type_name);4 D2 \, V7 G7 ?8 L S9 i' @
}
) y% {# J# [9 Z% e% C1 [9 B( [; T catch (const IFail &ex)
8 ~3 `6 f" l# L+ }4 g { T! I8 T% i- @ u- e) n
logger()->error(ex.ifail(), ex.getMessage());& o! F. a0 ~; M
cout << ex.getMessage() << endl;
' j9 l/ Z# S( j' |# i+ C cout << "error " << ex.ifail() << endl;' B2 {/ Y, T8 H2 B1 x( e
}
& Y0 m# \$ \. ~; i Z return ITK_ok;2 X0 U! M* s" _
}[/mw_shl_code]
, V4 ^9 w, v1 h# Q G7 z |
|