|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
" N, M$ T% c4 ~1 o3 }
Teamcenter二次开发源码分享:获取下一个Item ID的方法3 t7 Y2 e2 ~2 k: a! k% Z
7 N& I# X1 f$ u# P$ a* ^$ v/ H
[mw_shl_code=cpp,true]#include <iostream># ^8 I0 ?" V1 f, F5 E+ L
+ _. N: x* Z: u; u% R+ O
#include <property/nr.h>) _1 Y" O+ ^" g/ B4 R. k J
#include <TC/tc.h>
6 ]6 O3 r9 ]5 p5 D1 n2 u#include <tc/tc_startup.h>
2 \9 C( X) o) u#include <tccore/item.h>7 T. M' h, n' g6 V0 c& K
#include <tccore/tctype.h>
9 p. y* y5 s2 e" m- g4 Z4 F#include <base_utils/IFail.hxx>
0 w0 p6 u9 M, d#include <base_utils/TcResultStatus.hxx>
8 M2 p$ L3 @# M# T0 Y) d) ]; f2 Q#include <mld/logging/TcMainLogger.hxx>
7 [/ S- c, E2 M3 R/ T9 A' D$ A7 Y' l# ^, m2 O
using namespace std;
; x. f$ ^1 V" R) R4 _7 ~using Teamcenter::Main::logger;
, X! h9 b/ H9 J# Q0 _8 b) a3 V2 j5 y+ ]: K: g" d# U
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)1 \ f% q S( {8 B; n
{2 q4 h7 f3 ?, I9 L
int ifail = ITK_ok;, X( E0 C- @ `, ^
ResultStatus stat;4 T% g7 b7 n# q4 _- a: z
try
3 _" c( r# m- G. m+ C {
9 Z7 J6 M) h5 O) T tag_t item_type_tag = NULLTAG;
3 L1 ], O7 A/ l" }/ R9 B7 X5 q8 m stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
$ C8 Q4 V* t) ^6 F3 C8 L# ^# `
( e, d" o* P" R" t# p char *item_type_name = NULL;& f& i n9 [7 R/ J8 y8 ~
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);
2 ~. @$ n( Q8 `3 S# c, f0 @5 b) P2 E" U3 W6 j% E1 W
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
% c) |& \; b8 n6 f- y" s if (item_type_name) MEM_free(item_type_name);
F7 }8 Q1 ]2 |- t% c- u }
d/ p) v) }8 o& L s" v catch (const IFail &ex)
* O& M0 b. Z5 ~ {% K5 p( K$ v- _- W
logger()->error(ex.ifail(), ex.getMessage());9 w8 ^: m! N8 j5 r: J- m# X9 P: W
cout << ex.getMessage() << endl;
4 ^& s3 S: x" F& `6 F* `: H* u7 k, \ cout << "error " << ex.ifail() << endl;
0 j( s D7 Z% r C% R$ k }
# Q4 h {% X, J% o; p return ITK_ok;
" ?- q& W# l5 {}[/mw_shl_code]- X. O; @; b/ x% E7 ~4 m- \3 F
|
|