|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 I+ A: a. q, I
Teamcenter二次开发源码分享:获取下一个Item ID的方法
" n+ @ ?2 E; ~: L- ^2 V9 H; U/ w- W6 t
[mw_shl_code=cpp,true]#include <iostream>
$ c; x; u4 q; f# _- h/ P- x3 f) N8 @8 M/ H
#include <property/nr.h>
3 x/ T3 M! B# ^" p v#include <TC/tc.h>, I+ ^" o( L; v: Q9 T1 ]
#include <tc/tc_startup.h>
- o! Z. H, Y6 G1 r4 g#include <tccore/item.h>
, J4 w( V6 O% L7 M& ]4 W#include <tccore/tctype.h># z( |$ }, C1 M, Z6 K, A
#include <base_utils/IFail.hxx>8 P+ Y4 Z6 P4 N
#include <base_utils/TcResultStatus.hxx>
/ a+ v% S. \8 w V5 R#include <mld/logging/TcMainLogger.hxx>
% T2 S8 z! E% C6 U1 u$ C: c% Y. N0 C% C
" h- X% K0 h( q. kusing namespace std;
1 U- L" g/ y8 [ H" \7 [9 busing Teamcenter::Main::logger;" h9 ?, m! _' U h2 }4 q
$ a7 I8 o: W/ P, B% m
int get_naming_rule_next_rev_id(tag_t item_tag, char **next_rev_id)% n; s8 m8 T1 V5 R- W% h
{
0 s1 y: A9 X; E. S6 v) _$ B int ifail = ITK_ok;8 n/ p2 O% A% u+ e# v, a" Y. o
ResultStatus stat;, z2 O0 |0 \2 Y' r
try
% U7 t2 B* i! R3 b l: q {
, }" m# ~0 X8 m) ^4 j9 i tag_t item_type_tag = NULLTAG;
6 h- p* f0 K4 H* u stat = TCTYPE_ask_object_type(item_tag, &item_type_tag);
% s" \0 s: b6 g& P* f- k9 s7 j H% ], T) J
char *item_type_name = NULL;' B9 K' @5 k8 t- P( [4 d5 n
stat = TCTYPE_ask_name2(item_type_tag, &item_type_name);0 X% a* Z6 r9 M2 ?9 J
( |- W3 ?* S3 J0 C7 Z/ T M2 J
stat = NR_next_value(item_type_name, "item_revision_id", item_tag, "", "", "", NULLTAG, "", "", next_rev_id);
5 a, R |! A2 w9 ` if (item_type_name) MEM_free(item_type_name);. u0 b$ X" x6 A) _
}
' T# j; ]% _4 Z S* E' s. R' V catch (const IFail &ex)5 f! Q0 `0 M# C
{
7 k# Y" n) `) @5 W+ l3 A/ n logger()->error(ex.ifail(), ex.getMessage());
- }. f$ w2 G6 A" d9 p# J cout << ex.getMessage() << endl;
$ b! W5 U0 V% k/ \ cout << "error " << ex.ifail() << endl;( n# |, u: a& x0 l
}5 S5 L }7 ?+ u/ r
return ITK_ok;
" T+ }. h& k7 A+ p}[/mw_shl_code], h+ l# o% y. c( \
|
|