|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
+ A3 q# j! L9 F0 o) @! l3 W, k& A0 Z% z$ c" L1 B
Teamcenter二次开发 判断当前对象是否被check out
- V. ~' y$ @3 @) Y4 s[mw_shl_code=cpp,true]#include <iostream>5 H3 a# i: S+ g6 m5 b
#include <res/res_ITK.h>( X q0 G' m. l1 b2 k. c
#include <sa/user.h>
1 [8 I& ]8 j, I) b: Q( ?$ _#include <base_utils/IFail.hxx>
7 i' B5 B) m% m; {; H, Z#include <base_utils/TCResultStatus.hxx>
! J% K6 q) Z$ j3 S; u; k#include <base_utils/ScopedSmPtr.hxx>& m( p6 c' g) N) _4 F0 S
0 V) I. c. d$ z- S( fusing namespace std;. }- ^- x9 }0 m- R/ R4 t
using namespace Teamcenter;
+ t. d7 F4 g" u& J, u" X* ? R! s- c4 F, N n- Y- _' y& Y
static logical is_instance_checked_out(tag_t object_tag). d5 {' @: G* _% I, P
{
4 b: v" [% ?; S! K y) r# O, m int ifail = ITK_ok;1 A3 c o0 e& l, _$ c6 i1 ^
ResultStatus rstat;# k6 B( G y' |7 {: R* i
logical is_checked_out = false;
7 p; H# O: o% ~ try
3 K$ ]4 l) _# ~" Z {5 o6 ], R% f4 m. R9 N
rstat = RES_is_checked_out(object_tag, &is_checked_out);
1 T1 U* `0 X _" V( Y if (is_checked_out == true)
$ J/ Z, Z$ ~$ I' w. J7 N/ ~ {
4 B; e$ _& O9 [' @2 | tag_t user_tag = NULLTAG;, j& h8 V. C) f/ y- z! Y
tag_t group_tag = NULLTAG;4 a1 r# `, b2 s: g7 E9 U
rstat = RES_who_checked_object_out(object_tag, &user_tag, &group_tag); & l5 I( p$ K! b+ X7 P
9 i. J" x, x) S. _5 x3 J" ^7 O i scoped_smptr<char> user_id; , A# }$ H7 w2 m& J% y$ N
rstat = SA_ask_user_identifier2(user_tag, &user_id);
& @7 d' R* |% i0 X3 Q3 I0 x# l6 C" r% a! P5 o, Y6 S/ p+ z1 o
char msg[] = " Checked out by: ";% B( `, N& F$ W& j' T/ k
cout << endl << msg << user_id.get() << endl;
- ?$ E) c1 p y is_checked_out = true;0 ?# X- U* s( M5 x
}
0 {- b7 h a: n* g! i3 g: U# ]; R }
' w Q. A) G, [$ J- a& S catch( const IFail &e )
# Q& K! W% X7 [ {' Y; u2 a+ b8 @; P) u% a/ s! [
cout << "error " << e.ifail() << endl;
! `8 f) S. I9 [* t cout << e.getMessage() << endl;
) b6 w( P% J* O9 Y }
' o% d+ O- K7 i* [- V: T return is_checked_out;- Q% `6 v3 P7 ^7 m2 \+ w8 q
}[/mw_shl_code]
7 H* E5 {: B4 V2 ] |
|