|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
" K4 Q9 a5 C1 |6 x1 i+ A; l4 S$ p% K
, ~& y: W% @3 E0 o# v+ l' m; V2 [4 {% j
Teamcenter二次开发 判断当前对象是否被check out4 n; `5 ]1 k9 C# k2 A1 `/ I3 y
[mw_shl_code=cpp,true]#include <iostream>
8 U) i. i: j- V- V#include <res/res_ITK.h>& k4 W& ~( l, q' E" `8 B
#include <sa/user.h>8 J$ F3 z* c* h; Q% y, A
#include <base_utils/IFail.hxx>
Q b- g9 z& R+ k6 s1 O5 c#include <base_utils/TCResultStatus.hxx>
$ j4 `- O, Q+ Z- R4 j9 U0 [#include <base_utils/ScopedSmPtr.hxx>
# Z' x: ~. S1 |$ S7 x
8 H2 e, a# f( P6 c8 J2 _using namespace std;
6 O6 T5 T" w w0 Eusing namespace Teamcenter;/ K1 [- Q3 q9 x
: W& f. A+ D# M }6 E3 \static logical is_instance_checked_out(tag_t object_tag)0 a/ h6 T) r$ O0 |! c
{
1 J' q' q, i" ~# b) h' d6 E7 m& Z int ifail = ITK_ok;- z. X1 R( T( ?( I8 E$ v9 p3 J
ResultStatus rstat;
( f! w) r- F- Q% j# J) N2 y logical is_checked_out = false;
4 m% E/ Z/ h4 u8 m2 B try
6 Q1 t. `5 c! d {
M7 n7 F7 h8 w& }5 ~) I rstat = RES_is_checked_out(object_tag, &is_checked_out);- N1 R3 ]" v# E) s8 [5 j. F. e
if (is_checked_out == true)2 }. ?' _/ V* H5 g. }! h0 v2 X) M
{
6 f* ^' i6 E4 y! u tag_t user_tag = NULLTAG;5 ^+ T. Q% Y$ H7 X) T& l; h
tag_t group_tag = NULLTAG;" t! @; v4 u. H5 ^: F! y; L
rstat = RES_who_checked_object_out(object_tag, &user_tag, &group_tag); + S+ L( u2 J; {+ u/ x+ \2 {: D" W
& H5 x5 ?- e+ l- g( M/ T) B scoped_smptr<char> user_id; 4 L0 _8 c4 ]/ \0 t$ B* L
rstat = SA_ask_user_identifier2(user_tag, &user_id);
/ p/ r, j) {. D8 P1 `2 i6 o/ u/ w# a# R
char msg[] = " Checked out by: ";4 r4 I: O' q4 M5 o* D
cout << endl << msg << user_id.get() << endl;
4 w J4 B! y$ k, o is_checked_out = true;$ X9 i0 k6 v% [
}' d$ C0 o! c s! ^ E: }2 @7 |
}* A" z" V2 ^0 N1 E. b" F
catch( const IFail &e )
" S, z2 ]" k: v. Z, D {9 T/ B& g7 F) T7 a* i" C; Q! E
cout << "error " << e.ifail() << endl;' ? u3 c/ s% i/ _* ?; f, s. u
cout << e.getMessage() << endl;
' [# _+ \& |; _# d. n' _4 ~( U }. e) d) }" L5 |' l& Z5 n6 f' Q' o2 B
return is_checked_out;9 \5 v& Q+ O* i+ M
}[/mw_shl_code]
' I* w I7 ^ k2 E |
|