|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator 二次开发入门】5 创建对象Document8 d' l5 O, J( F) R& _1 ]
1 @8 x2 N* |2 t1 } S8 L. a: k# Q9 r( [
使用代码创建对象:, V4 M( z& B6 l5 r
可以结合SQL去查询下对应对象的表和字段,set property实际上就是去设置这些值。ok后,apply即可!* v$ D. F1 p/ F% Y) C9 j
- K* N/ u' V* A) n% P' E& B% ], N9 s" S) ^& g
Console.WriteLine("4 =============Add a item ======================");
- g% ^! A9 w9 G //we select the information from sql
( ~ [4 o9 N+ ?+ K$ a3 [ //select item_number,name,classification,authoring_tool,effective_date from innovator.DOCUMENT
. B1 k3 U( B4 e! t6 h //ITEM_NUMBER NAME CLASSIFICATION AUTHORING_TOOL EFFECTIVE_DATE( }2 |# H3 `) }1 [% |; ~
// testDoc NULL Process Text Editor 2018 - 07 - 05 02:25:27.0004 {7 p' _6 k% V& b4 p ~5 x
Item newDocItem = newInnovator.newItem("Document", "add");# Y @ b2 O4 x) H4 d
newDocItem.setProperty("item_number", "plmhomeTestDoc2222");
" K) k# v8 |0 j newDocItem.setProperty("name", "plmhomeDocument");
6 L9 W- ]% k2 ^0 X$ a% ?6 @ newDocItem.setProperty("classification", "Process");
J3 M4 b% ^& P newDocItem.setProperty("authoring_tool", "Text_Editor");5 U+ k5 Z, O" Y/ S& l- d
newDocItem.setProperty("effective_date", "2018-07-06");# q, S6 [; e. P; @% a
$ P) V c- K6 c9 F" k/ J
1 X$ E. `3 R& P5 }- D! {7 x newDocItem.apply();" j* q4 b) d; r/ K
if (newDocItem.isError())
" Z C, S. ^ \& S1 p {! c4 j0 t3 o6 p. X+ G& c6 F( w# \1 \' @% H" R
Console.WriteLine("Create error !");
0 a& |1 V8 s& Z) M }. S6 |9 M* a& h* c
else; g/ l$ |/ R3 Q) t a. q; a
{
. G# Z+ V% i% B5 r Console.WriteLine("works fine to create the docuement");
_; B9 G- W n# G0 h" b }' c4 e3 |* l# L, p- W
3 Y. Q8 k; u/ `" s( V) _9 l
' Z0 K8 E1 x( o2 w; E0 F1 {6 g6 D" q: r& [; r, z7 j9 P. g
9 K: @( i6 A! S1 U# e! d) q |
|