|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 j, _! R( ^8 w" z5 ~5 K
4 @' |, L( w' M3 d9 oTeamcenter二次开发 判断当前对象是否被check out( b8 L. u* S3 _7 G) E) z
[mw_shl_code=cpp,true]#include <iostream>
2 f( z) k1 ~ R/ V( o#include <res/res_ITK.h>7 d+ I2 B' z0 D
#include <sa/user.h>
2 M0 g V7 c1 E- S3 p# B/ p#include <base_utils/IFail.hxx>
" Q' E& e% t9 F, K( \/ Q k#include <base_utils/TCResultStatus.hxx>
" }/ Q# u9 [/ p+ L8 @#include <base_utils/ScopedSmPtr.hxx>. w7 f# f0 w3 D7 T0 B7 s" _
8 ]- k" m5 h& i/ ^, U# Rusing namespace std;8 `, w% C- Y% j; I, d
using namespace Teamcenter;
8 P+ x+ g$ R# }4 o- e4 L# w5 O c7 o% ?
static logical is_instance_checked_out(tag_t object_tag)
- g; w/ ` ~5 x2 ]5 F7 X$ t3 z" R" V{
* A& N- a- [% u. s! W( F" O) ^ int ifail = ITK_ok;0 p; ~% b, N& @& S. l
ResultStatus rstat;5 E7 L% m- ]* T3 P$ S
logical is_checked_out = false;
) ^$ P. `6 p8 u1 v4 Q0 b try
7 v( n0 A3 u6 _; W( F5 u {$ ?# S. @% j0 n4 h2 ^
rstat = RES_is_checked_out(object_tag, &is_checked_out);
/ u1 g/ J d7 b i% W0 s) A4 N if (is_checked_out == true)2 W% C' _, i8 }0 O1 p9 P, l, x' m2 V
{
1 }3 }! A8 e: T* C tag_t user_tag = NULLTAG;' Y/ a: P* g# i
tag_t group_tag = NULLTAG;
9 Y ~+ n3 L( M/ i; U rstat = RES_who_checked_object_out(object_tag, &user_tag, &group_tag); - g$ d2 F3 w5 e# z0 t- d2 \
, W( H r) a' Y scoped_smptr<char> user_id; : e% q. @; G- H' ^6 P
rstat = SA_ask_user_identifier2(user_tag, &user_id);
" D- N# A- v; W1 H- t% V) }" U; M# M5 j9 x
char msg[] = " Checked out by: ";
" P# p9 r: A; u6 Y3 T$ A, U1 a cout << endl << msg << user_id.get() << endl;8 g9 {1 o1 A/ u2 U3 W- O2 i
is_checked_out = true;
- N9 c1 t. w8 ], L# O }
! E d, `( R4 S3 r0 m+ }4 ] }! ~" o0 R5 L- L! r7 b* Y% o+ T. N
catch( const IFail &e )9 K# `9 A+ A' B1 u7 U) f5 v# Z
{
1 z9 A8 ]7 E% |/ j+ s cout << "error " << e.ifail() << endl;3 H4 l3 F2 l% l$ y+ _
cout << e.getMessage() << endl;, A# B1 g6 f# A, [+ [- k
}
( I3 J( F) h# S6 b+ p return is_checked_out;! ?; [8 _- N) o6 B
}[/mw_shl_code]( A8 g- C" M6 ^: {/ O9 T* C8 L
|
|