|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& g6 U0 u! N) J通过IOM
. c, B$ {) a8 D
* F, z3 C8 W0 s1 I4 f7 [JavaScript 6 H3 v. w" p( `) B, O
, v$ Y2 e8 x- R) N& F
% [! s: f; S6 S: A0 T6 f$ _% Pvar innovator = new Innovator();
8 n& z4 P! K0 s( Q% {" D* {7 Tvar partItem = innovator.newItem("Part","add");
+ ~3 \, Q( k# [% l7 J. PpartItem.setAttribute("leaveLocked","0");
1 `' t4 t! G% \4 \! P8 }partItem.setProperty("item_number", "123-456");
5 l5 y, A% }6 f' ^+ f% `7 opartItem.setProperty("description", "Blah blah");
2 P7 j+ V6 L. X) a$ e+ y , m& C- o( o, f) ?! }
var bomItem = new Item("Part BOM","add");
& @. O# B. i* V7 TbomItem.setProperty("quantity", "10"); - m% _( r0 C' C2 R1 L* F5 E0 o1 b3 r
4 f; m/ w& h) J9 k3 n) ^4 ]var relatedItem = new Item("Part","get"); , h. y$ C+ `9 R9 F+ E k
relatedItem.setProperty("item_number", "555-555");
# z6 r; U- \' i2 R5 M. f( h + N l' Z2 t) |
bomItem.setRelatedItem(relatedItem); k, L8 x2 H0 ~* X
partItem.addRelationship(bomItem) ;
/ e8 x- `0 C) ^) {" ~ 7 k* R7 ]7 L ^' s
var resultItem = partItem.apply();
& G2 r7 y0 D* I& ~" ~' fif (resultItem.isError()) { ' M3 p3 B2 @: J; i" U) Z2 z+ e
top.aras.AlertError(resultItem.getErrorDetail());
$ R+ y. ]- n3 D, s* g return; , H5 O2 a* u5 R5 R/ W+ W
} 1 f+ x+ Y$ C" q: L& R* b0 M3 q# S
9 O/ C4 U' `& a2 ^7 }7 g- Q
% Y: g" @, m, Y
! L/ _7 v( O3 s4 H% O! l$ q- ^5 o7 p3 l$ ]/ K v3 o
, P6 w8 T2 B& e% g6 i
AOM方式
8 g& A. r* o# {/ t: W0 T: k0 u
8 G% X1 g/ T/ n- W) ]" |
" m% i; |$ C( v- e7 L7 EJavaScript
1 J1 l, u5 a. J( k1 h5 Z0 bvar innovator = new Innovator();
3 ?2 m U7 J$ V* c% B; yvar partItem = innovator.newItem();
( j% A$ A2 \7 X, b K6 UpartItem.loadAML( 7 Q0 b. I/ E: f# y5 i! r) q2 p
"<Item type='Part' action='add' leaveLocked='0'>" + + o7 q' a n' }6 G* g% ~
"<item_number>123-456</item_number>" +
) V7 [( ?2 c/ \ "<description>Blah blah</description>" + ' F* _4 g( r1 n+ d8 w& a" f
"<Relationships>" +
/ I$ T9 u% d( `* C9 I2 y3 Y# [ "<Item type='Part BOM' action='add'>" +
4 O/ l* x) g M "<quantity>10</quantity>" +
9 a$ \6 R- [% A+ n. h5 ?" b. R "<related_id>" + 2 q9 c4 q3 N& `' H8 r
"<Item type='Part' action='get'>" +
# f7 M) y1 A1 u# L# g "<item_number>555-555</item_number>" + 2 p: D' }$ Q5 n$ R& V1 B
"</Item>" + ' F7 L0 `$ j4 W; L4 m8 N4 z
"</related_id>" +
; ^ j2 s( C- L: W4 u$ w+ | "</Item>" + 7 ?( n9 W: I: j x# W
"</Relationships>" +
3 s. C; V/ m6 @ "</Item>"
! l! x! U, z7 r4 O A);
( o% l- x6 ~( }- c1 [/ g ) m5 |: H( C* z
var resultItem = partItem.apply(); ; H* X1 A7 q: s0 B3 \( u3 ~; N
if (resultItem.isError()) {
) s. x" K5 E0 T# f, T top.aras.AlertError (resultItem.getErrorDetail()); / v5 ?; ~/ }3 @: [( ~! r, D0 ^, l
return; , L4 A1 J ~5 Z, f! u/ h0 a% A
} E: H# H2 q' \' \6 r3 B6 C3 m
* |+ z3 p$ Z! r% `( ^2 v. G, F
|
|