|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
7 Z0 a( p9 h9 J) P! c# M' q
/ O n7 t$ g0 {# i* o% U+ LTeamcenter二次开发 判断当前对象是否被check out# Q" ^, R# B0 N
[mw_shl_code=cpp,true]#include <iostream># F! m% c4 g3 S: O" U
#include <res/res_ITK.h>
& m' H) ~7 p2 X% H9 H% z$ S% K#include <sa/user.h>5 l* M1 M `4 V' K1 }5 B9 c1 G a; T
#include <base_utils/IFail.hxx>; r3 q5 t* j R+ w- J9 {
#include <base_utils/TCResultStatus.hxx>
3 W! o/ P; N: ^$ ~& Q# c#include <base_utils/ScopedSmPtr.hxx>5 D! N: t) f- _& m
! E2 r' s& w" C: e& Z8 E8 k6 k
using namespace std;5 S' S5 a* n+ E: ?- ?
using namespace Teamcenter;0 }: V- s0 T+ ?' s
5 \+ r6 l$ l# a: H3 j0 c
static logical is_instance_checked_out(tag_t object_tag): u; v$ y# q3 O* e) \/ [
{/ l+ N& c9 W- ?! J
int ifail = ITK_ok;. k* R- N: [$ v8 ?4 ]6 t2 h
ResultStatus rstat;9 }" Z& g. a! ^, `/ _
logical is_checked_out = false;
9 M$ N* Z1 w7 I try5 V7 B$ J9 E' P/ `- @9 I* z& B
{# u" B! D5 M7 G L v- G
rstat = RES_is_checked_out(object_tag, &is_checked_out);
" p \+ F1 F0 v1 z- E( P7 ~ if (is_checked_out == true)1 ?/ }3 x; D3 a: k$ t1 _
{- `$ o: Q# i) M3 ]& |
tag_t user_tag = NULLTAG;
% j9 W ?! b5 g n tag_t group_tag = NULLTAG;" x; A+ B8 L6 w& V
rstat = RES_who_checked_object_out(object_tag, &user_tag, &group_tag);
! j5 q# j& D" N2 x m7 m: o* D- y( ~, R8 s* U6 a, D
scoped_smptr<char> user_id;
3 u- }( _' e: L* t! q rstat = SA_ask_user_identifier2(user_tag, &user_id);
7 G5 o2 N' {" I8 n. `# a/ t
) i2 e: T* Z! M2 W9 L char msg[] = " Checked out by: ";
! p4 C U6 n( Y+ B cout << endl << msg << user_id.get() << endl;
" V. t% ?/ i; j0 z5 E$ M% l. H is_checked_out = true;& B$ S- F# i- Y
}
9 w0 u: r1 D- L }/ E2 K: x+ g3 a& n; b+ h
catch( const IFail &e )
# y6 i6 e" ?1 @: k* b0 V8 S {
" c2 O4 _* D8 f, F# j ` cout << "error " << e.ifail() << endl;
$ |# k- _. e" Z4 P" c3 y$ m cout << e.getMessage() << endl;
1 K# w! E. l1 j9 H0 w2 M, K& } }* `6 T3 V. O1 f( v& ~2 {
return is_checked_out;
9 m# U5 G% O. {}[/mw_shl_code]
# T3 L9 r; T8 c4 d& }$ R4 i4 \ |
|