|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
1 [& ~) D1 R* s: V% I- T5 H9 {5 I
4 q3 d) n% X( ]. w, N% O% BTeamcenter二次开发 判断当前对象是否被check out j* g. y: J$ `9 R
[mw_shl_code=cpp,true]#include <iostream>
) [; o! E5 [/ k/ x6 P#include <res/res_ITK.h>; o" Q1 l2 `: a
#include <sa/user.h>2 ]% \8 F X% ] A9 q
#include <base_utils/IFail.hxx>
8 z+ h" {9 \. ^' z, y h#include <base_utils/TCResultStatus.hxx>4 e9 E6 k; F- h! h. s# f/ m) g
#include <base_utils/ScopedSmPtr.hxx>
5 X8 e0 W5 `, [' Z2 `; A( V4 g% o% {0 Y U/ Q9 A
using namespace std;
2 |- z0 G) _6 y) z( K8 ?# susing namespace Teamcenter;2 d9 K, f" F+ Y! m% H. R" Z1 h$ E0 [
8 ^9 O/ P. T) ?5 g8 {
static logical is_instance_checked_out(tag_t object_tag)
4 j8 F+ s* e9 B4 w3 s2 s+ [{ v9 }% b# I& j1 s
int ifail = ITK_ok;
4 p+ O$ S* C1 X7 B2 [& y; | ResultStatus rstat;# U6 f& |5 E+ n) W+ n
logical is_checked_out = false;
% ~% b# \. y, c( D5 {# G try
$ X5 M& v% y' W5 V {5 y7 B, s. z2 L' z9 u7 T& ^
rstat = RES_is_checked_out(object_tag, &is_checked_out);) a1 ]+ c" x1 G- B7 i- ^
if (is_checked_out == true)
7 }9 [& C& l9 f' Y* c8 b) K {/ {7 v# A P$ t# O- U7 r8 H$ G
tag_t user_tag = NULLTAG;# j2 r$ s8 F' K6 z$ N( L
tag_t group_tag = NULLTAG;0 v4 ^0 _9 P' L' H; A' C1 g3 p
rstat = RES_who_checked_object_out(object_tag, &user_tag, &group_tag); 2 E0 s1 r- X: i9 _
& M ~3 b' y5 l& f) @+ @ scoped_smptr<char> user_id; ( L) C& f; o0 Q
rstat = SA_ask_user_identifier2(user_tag, &user_id);
* l; I1 X$ C9 F3 ]4 U7 Q' u d( r1 B: F. K1 D1 C& P
char msg[] = " Checked out by: ";
( E: e5 L2 [( @4 f' Y cout << endl << msg << user_id.get() << endl;
- w; ^* W# p+ U' ]3 U is_checked_out = true;# f& V# M4 {$ d8 J; ^' o
}2 } C% o# \6 n+ x
}3 d8 T% W, N+ }1 a; g1 j
catch( const IFail &e )5 m2 b8 ?9 \* f" b# t
{% V- f2 j! I2 i/ W4 H- f
cout << "error " << e.ifail() << endl;' @9 ^' R7 m a# w: }0 S0 i
cout << e.getMessage() << endl;
! e8 {1 M) C0 Z7 L2 r }
4 j6 |# P9 V1 q5 Y: q return is_checked_out;
6 Q( i; Z' r( i2 L3 @) e4 A6 w# J}[/mw_shl_code]8 ? x y% l" a! H: ^" F; B T
|
|