|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
|% z+ U6 [. u
通过IOM
2 x+ m9 l! b: U( ^: n
8 u3 v5 W7 N" X1 \JavaScript + c* a g! s2 j" u
* t& L2 J8 _2 ]1 W* ]+ Y! V$ X) r! ^
8 ]$ `" C8 I! C0 r) n. ~: T4 p
var innovator = new Innovator(); " ?0 m! o H6 `7 X
var partItem = innovator.newItem("Part","add");
0 e1 M7 E( P& ~3 q& X2 Z5 QpartItem.setAttribute("leaveLocked","0");
, h3 @- I% Q0 x4 }( D* qpartItem.setProperty("item_number", "123-456"); - X E5 A. [ D
partItem.setProperty("description", "Blah blah");
) z* g/ v. ?( b
# {) G" }5 B) ]0 Q% p7 Lvar bomItem = new Item("Part BOM","add"); 3 x" `7 q) x' ]3 {! m c
bomItem.setProperty("quantity", "10"); . D" M& i4 F2 l& v* f
, j; w1 P2 W! H- H) S7 M2 k0 uvar relatedItem = new Item("Part","get"); ; z& I2 {% @: B% H/ i
relatedItem.setProperty("item_number", "555-555"); $ J! f, C, u4 {! r: J
; f% K: T( ]- R, abomItem.setRelatedItem(relatedItem);
: x$ d( B: I2 Z$ T' vpartItem.addRelationship(bomItem) ; 3 x0 V4 b4 ]' ^
2 @0 ^3 v+ Z7 h+ A
var resultItem = partItem.apply(); ' L- k2 X7 \2 P" o1 l; p
if (resultItem.isError()) {
+ Z; X) c# X9 i4 y2 a& Y top.aras.AlertError(resultItem.getErrorDetail()); , M& m$ H% Q5 C* v0 n
return;
! L/ A7 P0 O* g1 d} / ~; s m! p. ?# v' @
" H1 `: @% b" f$ S5 U
8 H# M5 \ a' M# a, N3 [
0 Z9 o4 \; N7 b: K* A; R7 [3 v# |
$ N2 Y' n' u% J3 m; \8 I' ~! T8 G' {4 z
AOM方式
( O+ U! j N: k( b+ k: p* @! s. h" \3 y, l8 e' a
' f2 w& w3 z9 M: }/ qJavaScript ) O( n5 r1 p/ B: Q
var innovator = new Innovator(); 7 \; {# U; A/ B, j; ?
var partItem = innovator.newItem();
" L) b7 {& d* |partItem.loadAML(
& F* _* _& W7 F7 j$ Z) v "<Item type='Part' action='add' leaveLocked='0'>" +
2 n$ k9 D: u" M; X "<item_number>123-456</item_number>" + . B* d6 g' d+ \, [) F5 G
"<description>Blah blah</description>" +
" O7 N( v( d3 m0 W "<Relationships>" +
% V( x" H5 A, p+ `' v "<Item type='Part BOM' action='add'>" + 4 _7 l6 n+ V+ H
"<quantity>10</quantity>" +
+ ?7 p6 m# r) Z( p' E8 n "<related_id>" + ! t9 \, k ~2 m; a5 `+ I
"<Item type='Part' action='get'>" + + v! ?! ?, q- X; e5 H( V0 b
"<item_number>555-555</item_number>" +
/ @4 t0 n- v0 O, e! }1 E4 W "</Item>" + 4 r. o; B4 k. |, o3 ^) a7 @: Y. K
"</related_id>" + 1 \! c! |- G# M3 c3 t
"</Item>" + ) D: O. |" G) ]6 o
"</Relationships>" + # X/ j6 a: F' C" R
"</Item>"
- ~: A1 U5 A, w! T, f, I); + Y% _9 n# P' t
( L9 t/ x+ @ q3 ?' s# H6 `6 Cvar resultItem = partItem.apply();
. P1 w& ]$ S2 J, R# y+ V: j1 jif (resultItem.isError()) {
7 d+ a: q# S9 V* Q* I1 I9 c' V( i1 i top.aras.AlertError (resultItem.getErrorDetail()); C' h9 h$ u/ C% W7 M% T @% |* `' I
return; 4 n$ ^! p Y5 I8 M$ b. k$ g! Z; Z
}
' k* L+ L) B0 G C) H% I; g
6 D5 O+ Z5 f! F9 ^% r2 E |
|