|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
【Aras Innovator 二次开发入门】5 创建对象Document
: U3 U. q T$ R. R* W8 H+ Z& S) T+ c* I, T- E& J# C: e2 q0 [$ A3 _
$ P. {8 L9 l9 l: y: t8 Y( ^9 y
使用代码创建对象:8 l* ?. D' k0 O' e- U1 x0 _8 K
可以结合SQL去查询下对应对象的表和字段,set property实际上就是去设置这些值。ok后,apply即可!; c. h V+ o* u2 Z
0 r9 X2 V" Q5 Y/ e
* K, V4 ?8 ^% h, x Console.WriteLine("4 =============Add a item ======================");9 B; M; M8 V# a& Q) o: [! m# I
//we select the information from sql % {8 p1 G8 ]$ |0 ?' r8 o
//select item_number,name,classification,authoring_tool,effective_date from innovator.DOCUMENT7 c! p! C \. W
//ITEM_NUMBER NAME CLASSIFICATION AUTHORING_TOOL EFFECTIVE_DATE
% H$ F' {. O0 N, c // testDoc NULL Process Text Editor 2018 - 07 - 05 02:25:27.000
6 q) j, f" ?/ M Item newDocItem = newInnovator.newItem("Document", "add");
; S" `8 n) l+ y9 C3 Z newDocItem.setProperty("item_number", "plmhomeTestDoc2222");
' q2 Q2 t7 v- Q& E7 u newDocItem.setProperty("name", "plmhomeDocument");
: D3 u# l9 f$ C. h( l8 n1 S newDocItem.setProperty("classification", "Process");
9 z4 C$ ~3 b0 {5 t l newDocItem.setProperty("authoring_tool", "Text_Editor");
, J* E! H/ n& F8 V newDocItem.setProperty("effective_date", "2018-07-06");
* ]+ r: H7 s! @, i$ v% ~# f
) Q9 Y8 }6 i( N0 k1 |! p4 F
) g/ [; r$ h! F& d newDocItem.apply();
7 J5 W: I) j) p$ n if (newDocItem.isError()). Z0 U* n$ @9 b8 Y% ?+ O
{7 L: F& A t6 {! p
Console.WriteLine("Create error !");4 ? w& o9 _' h- Y) X
}
. J$ u* m; N% q- d' b6 _& G else4 x; t3 `! b+ y# q2 n, M
{
7 a: g7 Z R2 V& G8 s, o Console.WriteLine("works fine to create the docuement");
* F! A4 D' H6 j4 d" p } Q! A# c3 n/ W2 v+ f
9 s( T" Q" e% f* q( B |0 _# v0 A, I( s3 a& P: l0 G2 R# ]8 d A
6 \ `# V6 q6 y
0 M1 g# a- c; L- U- |5 r4 A; c- i! k |
|