|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
6 s6 m% ~& Z- e" C/ Y- K
$ T0 m: h% O$ m8 ?$ A4 ITeamcenter二次开发 判断当前对象是否被check out
. t. o, ~4 ~/ ][mw_shl_code=cpp,true]#include <iostream>
" K" R. O# y4 ]; E+ R( E5 Z#include <res/res_ITK.h>
3 j- n% [- b/ X! x1 D) ^#include <sa/user.h>7 q- f0 q" \& l) g* ?+ [9 C- }
#include <base_utils/IFail.hxx>
6 \# A& m& _$ z* q- {( J#include <base_utils/TCResultStatus.hxx>5 X' T3 u7 j4 B9 N' Z
#include <base_utils/ScopedSmPtr.hxx>
; p: m, Y6 F! Y( A' ^2 B& r L( d/ i) y% N5 K8 ?
using namespace std;
; V2 [5 F6 [/ H* e6 G0 A4 d) Susing namespace Teamcenter;
6 P7 N- m) n% w& p( p& o8 b% v' } [
static logical is_instance_checked_out(tag_t object_tag)4 k D6 [2 M4 ?. l9 U/ b
{% ~+ S( y( n8 l! G
int ifail = ITK_ok;
. @+ }) z( X3 U/ v* A1 c ResultStatus rstat;
4 I: K+ p# e0 @" D+ M logical is_checked_out = false;) x+ G4 A) l4 J, s4 A) Y1 D0 m6 P
try
, f/ Q( r* A$ j; W, v% ?6 s2 Z7 x! r% G {: y" a3 m4 \* G3 t V4 n3 E: H4 v
rstat = RES_is_checked_out(object_tag, &is_checked_out);0 H, W: m+ _" _' s
if (is_checked_out == true)
* s5 L+ M2 j6 x" e7 U& U* ?4 ~2 C M {' p2 L# S7 B$ S* W' e
tag_t user_tag = NULLTAG;( ^/ ~2 y# F! \5 R; e: w& n0 Q4 z- d
tag_t group_tag = NULLTAG;, _ ?8 m6 l( w8 f/ W5 N8 D+ t* J
rstat = RES_who_checked_object_out(object_tag, &user_tag, &group_tag);
* t% X- u8 }: p, _1 |5 m
2 [4 U" D" D; r& E" k& m& \, A6 z scoped_smptr<char> user_id; 0 c" L0 s/ [, C' ]6 v" \' Y
rstat = SA_ask_user_identifier2(user_tag, &user_id);
$ s; L8 _$ u3 u! K: Z V+ {5 Q7 J8 e/ {
char msg[] = " Checked out by: ";1 o, X. P4 s+ z) c
cout << endl << msg << user_id.get() << endl;* T9 W9 F% R9 T$ h% C* V) C3 X
is_checked_out = true;0 z0 C; l+ ]! ~- [* z
}3 P0 o8 J7 F. ~, E
}: p5 T/ M3 `" G2 G$ t, ]
catch( const IFail &e )
$ }3 B) x" K6 w: v& L2 A {% b. N4 ?8 U( s. M. L" Q
cout << "error " << e.ifail() << endl;
' n' G7 D2 F$ `- ?- w" d6 ^ cout << e.getMessage() << endl;1 B3 i; Y8 d5 T
}4 p$ z. D) }/ Z
return is_checked_out;" O3 ?. i X9 |. j1 s: F
}[/mw_shl_code]& B6 m' ^! R9 [/ a
|
|