|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator 二次开发入门】5 创建对象Document+ d7 n, C2 f5 A2 r4 M% S% h/ N
, L6 E0 `# V4 r: t$ t B
1 s- Q. P# r' J" D$ e) H1 u3 e
使用代码创建对象:1 T& T a0 {0 Y
可以结合SQL去查询下对应对象的表和字段,set property实际上就是去设置这些值。ok后,apply即可!
! x( m# ]* u- U; a5 B/ j4 b& B1 l3 A$ U' t' }' w0 {
9 K) E7 {7 D4 @3 M+ C0 f
Console.WriteLine("4 =============Add a item ======================");' H* _. O. H1 R# t- t" z' j5 o
//we select the information from sql
- f5 L* S+ E; P //select item_number,name,classification,authoring_tool,effective_date from innovator.DOCUMENT, S: `2 A1 z6 }8 J6 J
//ITEM_NUMBER NAME CLASSIFICATION AUTHORING_TOOL EFFECTIVE_DATE u5 U4 \4 u# Z1 e
// testDoc NULL Process Text Editor 2018 - 07 - 05 02:25:27.000
- V K o) B# V, R Item newDocItem = newInnovator.newItem("Document", "add");
& M; p& ] E( u) F4 ^* _# S newDocItem.setProperty("item_number", "plmhomeTestDoc2222");- b; P/ T" Y, [2 ~
newDocItem.setProperty("name", "plmhomeDocument");3 X8 Y) k1 g7 E- c9 ^' N
newDocItem.setProperty("classification", "Process");
4 r P2 W" ]0 a4 | newDocItem.setProperty("authoring_tool", "Text_Editor");
2 g2 d" [$ I+ X. q newDocItem.setProperty("effective_date", "2018-07-06");
$ _+ c* ~7 n* F( \# z
2 M$ j1 j8 P+ z- k) D" H/ e& B, H0 m7 i, L
newDocItem.apply();5 f* } R0 q( l. X
if (newDocItem.isError())
0 n7 f! d! _: o, G9 u4 Q9 I {- w9 P0 E/ S0 U' D- h# _, N
Console.WriteLine("Create error !");, C' [( M* H7 d# X) Y
}( Z% }7 R" d# h, Y
else: A+ q3 l J$ I1 l- B6 H% ]. t
{
( C( {% G0 E5 K* @: T! ~ Console.WriteLine("works fine to create the docuement");
, o8 ~/ c7 O1 N! J! o K4 | }5 U3 [3 i7 }3 n
: u5 i z7 M! o! z: k, z0 f+ c. H5 H l9 S
3 \# X8 I3 u3 S' A! h; e
1 V3 A7 @4 ^6 a" Y8 Z$ ` |
|