|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
+ N# J+ V- H" @' o
7 r7 c7 j9 j# F; X0 J9 VTeamcenter二次开发 判断当前对象是否被check out
G* w) a# K* a[mw_shl_code=cpp,true]#include <iostream>. b g( s( Q: Z+ k+ u: Z- O
#include <res/res_ITK.h>. p3 u3 y& r: U& `# f. A0 }- X
#include <sa/user.h>1 q5 W( V/ B) M+ L9 m. V
#include <base_utils/IFail.hxx>$ G+ k v2 a! G- m, c& O
#include <base_utils/TCResultStatus.hxx>3 G; y$ r+ \ M. g
#include <base_utils/ScopedSmPtr.hxx>
' I- X& i. T- J1 J1 e! Y
( B. C( }2 O: ^using namespace std;# w. J1 V% Z( H# j2 |7 v& Q
using namespace Teamcenter;
# J* h1 j4 I& K! r( D; }+ k& s# C
5 L7 a0 _% f) B, i6 o& p0 fstatic logical is_instance_checked_out(tag_t object_tag) r7 ^& }3 X. l! v4 c
{# t. J3 J/ u/ b1 k$ d6 B2 [
int ifail = ITK_ok;
7 r5 E9 P2 P/ o/ J6 C! ~ ResultStatus rstat;" J! G8 a) T9 K" L' F4 j7 r+ w
logical is_checked_out = false;4 X8 s+ S( B! E D( i- @* |; I! i
try4 o+ i3 o- s. o0 j% z
{5 ?5 m8 {1 W" V$ G6 Z
rstat = RES_is_checked_out(object_tag, &is_checked_out);/ d& F6 l1 B- \& Q
if (is_checked_out == true)* g7 x0 F% _( n
{+ _* R* k5 L6 K0 h
tag_t user_tag = NULLTAG;
( c, X; s4 A! C) [. I, h4 P3 n* M tag_t group_tag = NULLTAG;
, k6 }! K2 g3 W9 ` rstat = RES_who_checked_object_out(object_tag, &user_tag, &group_tag); / q# ~4 h3 Q0 C: I1 q s) Z
* O; {) [! }5 x- J0 z9 [. k8 Z! t; f
scoped_smptr<char> user_id; 9 m6 b W' z" m2 k# V
rstat = SA_ask_user_identifier2(user_tag, &user_id);
, C3 m5 t2 d* O8 J4 ]
& O+ j" w3 K/ _0 H" w3 S. I char msg[] = " Checked out by: ";/ O) j+ X9 n6 O Q: f/ K- ]* `
cout << endl << msg << user_id.get() << endl;
& S" _# z* S8 w" P* k" t& p is_checked_out = true;
+ z- ]) y/ R( s2 F. T* f* N# U! `. M }
, l G+ j5 ` s, X' G }9 f2 A5 G! G& q2 R( ?9 |! x1 w
catch( const IFail &e )
8 L- L6 P# a' `0 v {) |5 r0 s% x0 n
cout << "error " << e.ifail() << endl;
1 q$ r$ L1 B) H' l/ v cout << e.getMessage() << endl;7 Y5 E- i' z0 F/ w( y: K! V! W+ @2 v
}' h+ u- r- H, Z$ p
return is_checked_out;
0 [" k% U: q* a$ q2 q+ g5 E}[/mw_shl_code]
$ {9 E( x' s* B |
|