|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
; @# Z; m9 H3 y$ [0 x. F7 y2 `5 cTeamcenter二次开发源码分享:获取下一个Item ID的方法6 O* \# }% Z5 X, ? ~) v. a; F T9 Z
; c- j% _. H! e) u2 I8 z0 O9 E- o0 m
[mw_shl_code=cpp,true]#include <iostream>
4 Q- [! z6 f2 k! D# r" R2 o' c+ M( D' u* _1 A6 d4 y$ g
#include <property/nr.h>
! L# W f x) u% {#include <TC/tc.h>
- d2 E' ^. j F9 X. f1 S#include <tc/tc_startup.h>
8 K# l1 O- j/ w, I: e#include <tccore/item.h>
0 `+ z! B1 w i; k#include <tccore/tctype.h> Z* I# M5 i2 y6 ~
#include <base_utils/IFail.hxx>
; e0 H; [4 `3 N; E* O; k; o#include <base_utils/TcResultStatus.hxx>- ?: L' j7 h4 K: V! U" T
#include <mld/logging/TcMainLogger.hxx>
5 Q* {; m5 C7 y3 F' h* O# k) k& ^. x+ l/ t1 I
using namespace std;' N* g9 K# q6 x# f' {; Y) W* o
using Teamcenter::Main::logger;2 G* V! o$ K+ ?# s
# ^( ?7 Z2 m( s( I5 Z8 A W; D' C3 {
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)! |) \: C' K! Q8 Q2 K
{
% A$ ?- G p/ A8 n: F9 `: ~* U+ w int ifail = ITK_ok;
) C$ }0 p2 p! t' P% U ResultStatus stat;1 o7 C$ r1 t5 F$ |
try
6 ]( i! ~# {& T {
3 l! I$ A- w1 s tag_t item_type_tag = NULLTAG;& b4 Y' e0 t& i
stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
8 ~5 D" P8 L8 m' n" W l
$ i- K1 v1 X0 A( M2 I char *item_type_name = NULL;
& k4 ]; P! a5 S& q& k% Y Y stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);8 T! ~+ j. b; P
# s* S0 I* n! X. v! m2 _0 F
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);+ I2 g( o- E! g
if (item_type_name) MEM_free(item_type_name);2 a2 b8 m+ S z% N7 B% C
}4 j- H% D+ o6 J4 m: ?0 n
catch (const IFail &ex)/ ~! t2 \! K; y; o5 W
{: @4 Z' Z, n5 @% c
logger()->error(ex.ifail(), ex.getMessage());
! ~6 \$ A4 }; L; h) d3 p7 S cout << ex.getMessage() << endl;6 s1 R Y$ `9 w( P2 H
cout << "error " << ex.ifail() << endl;
4 f; Q; r; T3 F' D3 P- f% [ }1 I" p% H8 T" ~. A
return ITK_ok;. a6 y% r, x2 J! }0 h; i7 Q4 r
}[/mw_shl_code]- y) B- v. i9 U- X! G
|
|