|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
( C) S- Z8 \( K6 u# x* @$ dTeamcenter二次开发源码分享:获取下一个Item ID的方法
0 o+ ~' I, I6 N
$ p- [2 e8 S! O L* C[mw_shl_code=cpp,true]#include <iostream>
; Y( i- }) q& @" _" g$ m/ M/ t8 m. s5 i, K% t- g$ s0 w
#include <property/nr.h>
! w$ _; @! v6 a#include <TC/tc.h>9 @5 H; f. s! I3 N7 f/ D* h
#include <tc/tc_startup.h>, @; }. f3 k: [1 W3 o
#include <tccore/item.h>/ }3 K' {( Q+ a8 G) M! W
#include <tccore/tctype.h>
( `6 G( L' }* T: M, ^) m#include <base_utils/IFail.hxx>
3 U5 o- F$ y" ]( w# O" Y#include <base_utils/TcResultStatus.hxx>
* x1 Y/ V& D; @" w( n+ b#include <mld/logging/TcMainLogger.hxx>
' L! Q' F; f% N
2 Q# h3 x, S; U, T, k$ X" a: ~using namespace std;
% Y" k% D" k( S1 Ousing Teamcenter::Main::logger;
7 p# ~4 U" z* o7 a, Z' y1 l! `8 z- O( i* h' G6 ?9 ]: e
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)2 W; q3 C" T* `3 u
{6 m. E4 |' t$ t! o2 _' H. q
int ifail = ITK_ok;
4 Q1 e t3 R, W1 @* f ResultStatus stat;2 ~1 Y* M& x3 u+ \5 v
try
1 O( s1 e: @8 Y' ? {
5 {! k0 N- y/ ^, j T; {# k1 S tag_t item_type_tag = NULLTAG;6 s. E H2 {+ G1 W3 ]* P! _
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);2 }) E2 o/ f A: N
2 D! _- ~) I5 ~* a char *item_type_name = NULL;
Q5 y+ j+ [: C. ?# g- o stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);
* a8 p/ t/ U" q4 s' I" @ B1 e: p$ c1 A! V( h' \
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
, M9 z) n$ Z1 b+ A- k! p if (item_type_name) MEM_free(item_type_name);
2 L- }3 n2 e0 A/ x& c0 J }. X7 N0 T& M% s. A, g
catch (const IFail &ex)
$ T6 i! z+ [# W/ B {
& d2 u: x2 r! G9 n/ [8 K2 C- G/ J logger()->error(ex.ifail(), ex.getMessage());" z, w& ?, l7 y
cout << ex.getMessage() << endl;$ k& n/ c+ ]2 t4 ?7 I" V( M6 Q
cout << "error " << ex.ifail() << endl;1 e4 Z w! y: x/ ~0 [; Y
}* e* ] x; K8 C7 `" f$ P& t( D
return ITK_ok;
' |# a! w1 w3 l$ a}[/mw_shl_code]* A. `! h; x" ]! s! ]& X
|
|