|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
; j+ I7 U4 l" i- D
, o' g' g3 `6 k
Teamcenter二次开发 判断当前对象是否被check out! f& `, P( t7 v; t% D9 B
[mw_shl_code=cpp,true]#include <iostream>
/ u/ @+ {& m, ^* c8 Q$ H; x#include <res/res_ITK.h>; {( x' Y! e' s& q: }, w
#include <sa/user.h>
+ r% T; i# o) Q% t9 h: Z- S( {#include <base_utils/IFail.hxx>
7 F8 k. j7 z' n* p% P0 M0 ~) q, t#include <base_utils/TCResultStatus.hxx>3 ~1 [- Q$ Z& M
#include <base_utils/ScopedSmPtr.hxx>
# S/ N: E- E; @. w8 {3 c, Z p8 M+ j7 _& R' Q4 [
using namespace std;# `8 j, z/ x; J4 T, U q
using namespace Teamcenter;
+ e. A3 N0 O' l/ s
0 K& \5 z, e, P# w ?static logical is_instance_checked_out(tag_t object_tag)" w9 Z$ J8 z' ~' O; F: `& X, w# n
{2 v. v# d- {$ Y7 r; _
int ifail = ITK_ok; i% L" ^! ^& `3 x7 }/ R
ResultStatus rstat;
- g6 g9 i$ x2 N4 A, x5 y P logical is_checked_out = false;" Q1 a N; V$ J! i+ S4 ]/ r+ d
try: y: D" l6 u% |8 e! u- L
{4 x1 B7 ^/ p# f' L: [: h" | o' u! n
rstat = RES_is_checked_out(object_tag, &is_checked_out);$ T9 w( I N2 _- `: Y
if (is_checked_out == true): B# d2 @5 C" R! N/ B
{
" C/ ^' W: b: A, ] tag_t user_tag = NULLTAG;
" ]7 M; g; p8 a2 f& q8 i tag_t group_tag = NULLTAG;
- P7 e4 h8 N. L* l. N rstat = RES_who_checked_object_out(object_tag, &user_tag, &group_tag);
F- }5 w+ h8 r4 p" B: f
( r5 l( b* s6 f2 R) Y6 Y scoped_smptr<char> user_id;
* x. j6 R! y5 g5 L1 Y9 q rstat = SA_ask_user_identifier2(user_tag, &user_id);
2 h) _) B0 y* L1 ~' T* O: G
& ]2 f7 j" x- `/ i$ u7 i char msg[] = " Checked out by: ";# V0 a% {; g2 ~& z5 T! m
cout << endl << msg << user_id.get() << endl;
/ O. ]4 R, }2 ]/ D, F- L is_checked_out = true;
% }) h4 K, k, n; |0 s/ ~6 w }
" s- Z1 |! S8 t" N7 l }
/ W5 I; N4 Y& w& O9 z" Q; W E catch( const IFail &e )7 H+ N+ E A- Y3 n2 f5 A- E
{
x1 a2 [9 G$ |2 W8 H0 P j cout << "error " << e.ifail() << endl;# K- g" ]: j/ k4 m+ Z8 i4 Z
cout << e.getMessage() << endl;1 g! a$ v c! l8 {, T* |/ Y6 w- W) {% U
}- j3 r% E$ u r% o; L* O
return is_checked_out;
7 C% R1 X6 w, W1 A: T}[/mw_shl_code]7 |! b t8 g, v
|
|