|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
+ v/ y3 d5 o7 S) l3 @* y
0 `, L- a8 G$ K$ K( K( E0 I5 J
Teamcenter二次开发 判断当前对象是否被check out
7 a0 n! ?" H$ i1 ?- V7 Z[mw_shl_code=cpp,true]#include <iostream>
# `9 x' W$ l' W9 @* }#include <res/res_ITK.h>
# v8 ~2 r7 H' X5 Z- X; ~6 D+ ?#include <sa/user.h>3 n7 \* D+ I2 H6 U' x# [8 m
#include <base_utils/IFail.hxx>* a2 n5 C& S, m% q8 A8 `2 q/ |
#include <base_utils/TCResultStatus.hxx>4 b, e, `, o% ?! E
#include <base_utils/ScopedSmPtr.hxx>. b, b4 @% F0 j) d
! r' y9 V# Q! B% `5 y
using namespace std;
" T, ] @) i0 K$ r9 r) Rusing namespace Teamcenter;
: v& j8 c# D2 I" [9 ~! Q4 r; E- d6 C9 X! O+ R0 h
static logical is_instance_checked_out(tag_t object_tag)
9 ` a6 H/ A* f' t1 Q: r{
" W8 }% O b" o. I- @ int ifail = ITK_ok;
1 O! }, [5 K( r- Q( R" h, v7 k9 [ ResultStatus rstat;. g, u$ H! X, [& \- E
logical is_checked_out = false;
# W" u# g9 m' m try8 @" v, l# `. h ]- L/ S P6 I% m
{
+ s7 m; H" F8 a, V1 G rstat = RES_is_checked_out(object_tag, &is_checked_out);
" |; }3 q4 L3 v6 s if (is_checked_out == true)! l) Y% Q5 u# k8 ^5 c5 a7 L
{
3 [! Q: ^2 z2 J% |+ O5 Z1 K7 l tag_t user_tag = NULLTAG;
/ X5 D! V) f2 l) D1 f tag_t group_tag = NULLTAG;
/ R) ~0 B/ c7 g& t rstat = RES_who_checked_object_out(object_tag, &user_tag, &group_tag);
9 c' k3 Y$ m1 J$ b" ?: a. E- J) U- V
+ D4 u: F5 B) ?4 M8 g( i) d$ M4 b1 ^ scoped_smptr<char> user_id; 4 F6 n9 z1 B. [+ o6 b, I
rstat = SA_ask_user_identifier2(user_tag, &user_id);
/ {: ~! d ?0 N7 ?' N- p" `% k# q! y5 D7 z; g& S6 L
char msg[] = " Checked out by: ";: y2 P7 E. q( ]7 T
cout << endl << msg << user_id.get() << endl;, c& } t- A# p ?
is_checked_out = true;
4 V' _9 R) c' f' P* F0 H }
$ V# _( f) ^! M8 u }
0 b- j: o8 K7 e Z8 O7 g/ ^( m catch( const IFail &e ): q9 I# P" N% M, j' }: _
{
z6 o3 c% E" I5 w: O cout << "error " << e.ifail() << endl;/ D1 ~3 `# {; v; P8 h
cout << e.getMessage() << endl;
) \2 ~( y0 `3 m, J }8 c2 n0 k( x' G2 m
return is_checked_out;
2 w1 l8 C. {% z8 y, J( K- K. b0 w2 M' q4 v}[/mw_shl_code]" i! I; n) t. C( d8 `- ^
|
|