|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator 二次开发入门】5 创建对象Document
8 B- h6 y; `4 D$ o7 G. Y5 x- T
3 d5 ^/ [$ K% l9 @5 J9 g5 N P; h; _" {
使用代码创建对象:( ?8 c- c; }' _( k5 y
可以结合SQL去查询下对应对象的表和字段,set property实际上就是去设置这些值。ok后,apply即可!- U9 c, O% |2 H$ w: A
5 d. d- D5 d8 @8 I! p: b% r
# h0 T8 S, C0 Y+ b9 L
Console.WriteLine("4 =============Add a item ======================");4 K, q( a$ c" a
//we select the information from sql d2 x/ F; b* ]( x& p" x
//select item_number,name,classification,authoring_tool,effective_date from innovator.DOCUMENT1 L; V+ S# W2 v$ d
//ITEM_NUMBER NAME CLASSIFICATION AUTHORING_TOOL EFFECTIVE_DATE
- f' {( Y5 Y! |. e6 Z- R( p" L // testDoc NULL Process Text Editor 2018 - 07 - 05 02:25:27.000" ~6 r; [1 q# e7 [. K, @) c6 c% a9 A
Item newDocItem = newInnovator.newItem("Document", "add");
& d1 |2 i9 @: y2 A& o/ ~& { newDocItem.setProperty("item_number", "plmhomeTestDoc2222");
/ \# ?4 n* f8 y newDocItem.setProperty("name", "plmhomeDocument");
0 q8 u$ H6 p0 S3 u- M! J* z j newDocItem.setProperty("classification", "Process");# \, \3 e7 D6 X0 E
newDocItem.setProperty("authoring_tool", "Text_Editor");1 v( i' `2 \" f+ J E" u5 J
newDocItem.setProperty("effective_date", "2018-07-06");
. J* S/ a; c: M' C' n0 Z# i
, d, c) \7 |8 d& `7 s) h
, n5 R: \0 M: w' t: [5 b W newDocItem.apply();9 ^3 P% _! X6 |& V& F3 i
if (newDocItem.isError())+ Z/ M5 ~+ O+ a. k! l! O3 P+ z1 z
{$ o, B. D& _3 i2 m: k
Console.WriteLine("Create error !");' l1 d& ?$ ^ G3 s
}% B# m7 Q! h7 }4 c' r
else
5 ~& B' g" {/ n- b {
9 j1 _# e" s |) {: p5 | Console.WriteLine("works fine to create the docuement"); C9 E. N" ?: U! R" d
}! m5 S6 D- e8 n8 ?7 ?9 w, u
3 Z/ l( r3 R1 e: ~* y. z, V/ C
1 ]; s) q0 ]6 X2 @4 w; a
$ l H& C' P+ r, k4 ~
|
|