|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
' S2 H" i; k2 H- r1 Y
5 k$ }9 Z. B) i8 Z4 FTeamcenter二次开发 判断当前对象是否被check out
3 T4 n% F, F2 T[mw_shl_code=cpp,true]#include <iostream>. x; h0 Z& B2 s8 J+ _& B5 I
#include <res/res_ITK.h>
+ ~' W! H4 G5 j2 B#include <sa/user.h>
) @1 H0 [9 y2 R( v& r* }#include <base_utils/IFail.hxx>
0 j7 o0 t5 [. O1 T7 y3 T: q#include <base_utils/TCResultStatus.hxx>
; z: Y2 V1 c% N) j$ O: D#include <base_utils/ScopedSmPtr.hxx>8 X4 g' f [+ k9 }/ e
5 i+ i" k7 o& o
using namespace std;
: T# X4 f$ q. d( \+ `using namespace Teamcenter;1 L% K8 k' \1 ^( N2 Z$ h
" j" ]) C: F/ \* n8 o5 Qstatic logical is_instance_checked_out(tag_t object_tag)
/ t/ H- S: _- Q" [9 f n/ K{
' k( c) j# a0 G' C' N( ]& g int ifail = ITK_ok;. V7 }. z; N# P. ^, v# @/ ?
ResultStatus rstat;# n1 i3 a8 ~5 X
logical is_checked_out = false;! I5 y w# c" B/ m
try3 s7 L1 ^4 N. |: ~, m" Y
{; W. s1 S' z& P2 @) ^2 F3 l
rstat = RES_is_checked_out(object_tag, &is_checked_out);; ^7 O2 j) t- s1 D9 i) N$ `& d
if (is_checked_out == true)
% I, x, V- d7 @ {
/ n5 i4 G# R% l4 f w Q( L tag_t user_tag = NULLTAG;
7 R- d3 s8 b0 C) I tag_t group_tag = NULLTAG;+ Z' J5 S% H: r( b
rstat = RES_who_checked_object_out(object_tag, &user_tag, &group_tag); 1 i5 W7 f5 m6 k% c1 A5 D; j
4 ]. g9 d- ~. n9 {6 H6 y
scoped_smptr<char> user_id; 6 o) \# u0 E) ?8 T
rstat = SA_ask_user_identifier2(user_tag, &user_id);
! u/ u. P7 L( P+ r+ e) P9 i
2 J; L2 H. I1 h( W char msg[] = " Checked out by: ";
2 Y: i5 G3 I) v! m' l0 J g cout << endl << msg << user_id.get() << endl;, I0 u6 n/ p1 P' A9 N
is_checked_out = true;
6 a$ F& Z& c/ E u }
+ y! Q' k2 E, w; _/ W# W } D" S6 K0 x: I$ I8 g; e
catch( const IFail &e )5 X" l, I% q# _$ }4 s
{
E; g. Q% x' Q5 B/ z9 c. D cout << "error " << e.ifail() << endl;
) }' `5 z& ~. ]. K+ R6 w5 ~1 G cout << e.getMessage() << endl;
5 W8 U# f& v3 a" g# v d }
3 t8 O$ S' \! R return is_checked_out;
% q8 D' M6 X0 [' z: M- x}[/mw_shl_code]
5 s* a4 o: o5 g) f/ g |
|