|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 j2 J9 ], R$ z2 G( {0 d) `' k$ xTeamcenter二次开发源码分享:获取下一个Item ID的方法
2 ]2 C: o- I" `8 f. I3 M2 e
1 M6 |5 U. ^# o( e9 \4 ]1 [[mw_shl_code=cpp,true]#include <iostream>
1 X0 }- ?4 V0 k) x! i
% I$ S* E1 L% {- i2 |3 t' z5 M#include <property/nr.h>
/ X6 F7 v! ]5 m+ s#include <TC/tc.h>
( j; C( L$ P2 ~( F#include <tc/tc_startup.h>3 u$ k" \' H/ r) x9 p
#include <tccore/item.h>
: m, X) `8 \0 |3 C#include <tccore/tctype.h>
& n; N2 W/ O2 v+ i" s0 V5 l#include <base_utils/IFail.hxx>
) i. V; g" W0 w. @/ n; Z" A#include <base_utils/TcResultStatus.hxx>- s& P w# A/ u" I9 t6 s0 M
#include <mld/logging/TcMainLogger.hxx>
, ~$ B8 ~% b5 f2 j- H+ e3 y, l/ h X+ m$ B! P. e
using namespace std;
3 p0 C- m& e: z+ eusing Teamcenter::Main::logger;
9 N9 K$ A& L, p5 h, \+ h# T2 M! g& k" x" D5 @9 v7 T7 p6 U- K
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)5 r8 a7 T0 J Q& I; j" |* O& ?
{
" X* o- O/ l9 H' B' ?1 z9 z int ifail = ITK_ok;
* N; B* B' F1 x# H$ b' N& @$ v8 Z C ResultStatus stat;
4 P0 l X$ G" R) _/ N try
) l; L0 J( k5 K3 _$ Z3 ^ {4 O% H) o5 k* Q
tag_t item_type_tag = NULLTAG;$ p7 {, v4 w; J# O8 [2 }
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
5 y s# _; F6 V4 j. f3 t @8 n/ u. f! q" f7 ]
char *item_type_name = NULL;6 Z& f/ B9 P: y% ~. b
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);0 N0 |: y1 j; q0 g' b* ^! \9 l, Q
: s! M. t6 W) K* k7 Q stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
- F7 q1 \8 g9 J j0 L* L/ z if (item_type_name) MEM_free(item_type_name); u9 p5 L0 R# S
}; x2 d# p+ H, ^2 [
catch (const IFail &ex)
- B( \ Y' ^& E4 C' C+ Z$ l2 M {, k8 L1 x- T8 w7 Q
logger()->error(ex.ifail(), ex.getMessage());
( y8 b4 d5 E9 t/ W# f. }+ k cout << ex.getMessage() << endl;
8 a8 b4 g! c8 j; t( c cout << "error " << ex.ifail() << endl;
9 G9 s0 k4 y* M* J }! i, W+ `* O1 L! H: G' b
return ITK_ok;
. w% o% q$ \% O. ~% l}[/mw_shl_code]8 s$ c3 C0 @0 ], _/ \' B
|
|