|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
6 K! U# j* ?8 |# u/ ?, }
Teamcenter二次开发源码分享:获取下一个Item ID的方法9 L$ g, |% A. Y3 T" f$ n6 i: N
3 ^! L: L; c3 E. F
[mw_shl_code=cpp,true]#include <iostream>8 V3 X8 l# A$ _# O# a+ ]: l3 T
6 ?7 K4 G/ ?1 r7 V5 }. K
#include <property/nr.h>
8 A3 Z0 d# B5 B8 b; {#include <TC/tc.h>; j* s' @# q7 O( i8 {
#include <tc/tc_startup.h>
* @" _% @7 a1 o. c$ N#include <tccore/item.h>
( B- V) J2 p) B#include <tccore/tctype.h>
5 [" T; G, H3 C P1 M8 X#include <base_utils/IFail.hxx>$ N2 @& t- H/ Q! \/ W
#include <base_utils/TcResultStatus.hxx>
+ Y- z) C2 A' C* V# H( g9 R#include <mld/logging/TcMainLogger.hxx>
8 n2 s w; a" I$ s/ R
, L* X% l5 w2 M- ausing namespace std;, {) Z' \ ]; J5 b
using Teamcenter::Main::logger;: ?% x8 e' G$ ~- s7 _3 `% ?3 _/ H
! y( m) e; N1 X5 N( `
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)
( `1 @% ]7 w2 ]3 J{/ G1 G9 g/ `4 F7 J/ J9 `: i
int ifail = ITK_ok;3 M" N6 _- _; `
ResultStatus stat;9 J: s) G7 j0 @
try6 [* Z. t/ \% h3 J: B3 g
{
0 q- ?) C5 y$ | T% P3 I9 d4 J, a9 K tag_t item_type_tag = NULLTAG;
; O1 f* b- \/ R9 W% z stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);: v! o) _" P; K+ |
' c* ^" o$ Y/ W1 d* T4 s, \5 V char *item_type_name = NULL;; U0 x' O/ e$ |) r1 ]2 N. C
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);+ w0 A0 f1 C. D6 D' S1 i( F: A
% n* T8 T9 y% {. H0 z
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
: f2 W% M q. h( }, e if (item_type_name) MEM_free(item_type_name);. ^) L7 Y0 e! z. V) R
}, P0 e7 [* Z0 M" C3 z
catch (const IFail &ex)
4 h% V3 n! b5 |9 j" i {" I: {+ x. V: n3 S9 T
logger()->error(ex.ifail(), ex.getMessage());
2 g; m- X" W; L+ ~3 N, ~5 v cout << ex.getMessage() << endl;" C. M9 M, V- n) c$ P1 F" y6 c3 I
cout << "error " << ex.ifail() << endl;& e) t. L4 ]5 O" t, P; q# q
}
& C. w' ]% y6 D2 d. M- W$ r return ITK_ok;6 h: R. D- Q6 e' F% a
}[/mw_shl_code]
- U& [5 J4 E7 _& c! ^* A K9 @* S4 C |
|