|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
2 y9 b7 k! Z- v. y8 q, Z8 t7 ^& o3 P" R
Teamcenter二次开发 判断当前对象是否被check out* d# a p, R/ p8 W: s5 R8 f
[mw_shl_code=cpp,true]#include <iostream>
# Q6 ?; C8 e) ?3 e! Z2 F#include <res/res_ITK.h>9 K9 N& x3 `% r% i4 n
#include <sa/user.h>
, M7 [" w$ |! O& A#include <base_utils/IFail.hxx>: A+ ?; ~! \4 I, j$ T
#include <base_utils/TCResultStatus.hxx>% Y/ g- G, v9 `
#include <base_utils/ScopedSmPtr.hxx>
6 b) @; Z1 H) L$ Z" v& c- S9 U9 P$ C: C1 m
using namespace std;
) F5 _$ Y: K$ {) e3 A2 _using namespace Teamcenter;' h" e D6 t3 Y# U$ ~) ?
4 I+ S5 |+ |) g5 U! Ostatic logical is_instance_checked_out(tag_t object_tag)/ T- s @ r, ]# U
{# ?. S) y. z0 f% e
int ifail = ITK_ok;
+ U; c( [3 m9 A6 |8 Z ResultStatus rstat;
) ?* a! n; q9 ]/ {# I) d' V logical is_checked_out = false;8 m- X4 R( n V2 x9 B
try
A, p3 o; m! I' J _4 y/ @! O {; C8 T/ b4 t& v/ F
rstat = RES_is_checked_out(object_tag, &is_checked_out);
$ F9 A, D& I. k7 P if (is_checked_out == true)/ F, p& P6 s' [" I1 y8 p
{
* c' V% k4 f6 d2 y7 }% O, n7 p6 X tag_t user_tag = NULLTAG;% t+ Q: v& V3 a9 i; m6 w N4 l
tag_t group_tag = NULLTAG;3 ^3 _. U3 @1 [& x+ X
rstat = RES_who_checked_object_out(object_tag, &user_tag, &group_tag);
- g8 q( l$ N* V. X5 L& L! i0 y ?% s& m# f; }$ h: H) l& s
scoped_smptr<char> user_id; ! ]6 Z8 j6 b+ P) j! }
rstat = SA_ask_user_identifier2(user_tag, &user_id);' i O/ A2 w7 D- n' C; d. e, w2 i; V
& v$ e# h9 ^9 q+ v0 j& d+ G char msg[] = " Checked out by: ";5 E: T$ ]) b: \7 Y! h3 v
cout << endl << msg << user_id.get() << endl;/ L% W' I. b# r9 T) t) Z
is_checked_out = true;
$ `) r' w. i, A4 R7 ` m v } j' V4 k7 g+ d+ B
}0 a X7 V* u& B+ a
catch( const IFail &e )
) [( {! B$ n3 F8 R% f- A {2 z1 S# S3 b) W6 E0 O+ `0 [: u
cout << "error " << e.ifail() << endl;
/ |! r: R/ J; H. C cout << e.getMessage() << endl;! ^7 j8 v9 `- R
}
6 u: S5 b$ u2 b return is_checked_out;
$ v9 O/ l+ X% G' `$ ?. I) ^}[/mw_shl_code]& ]9 A0 S* H! E9 v% L' p" f/ M
|
|