|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator 二次开发入门】5 创建对象Document( S! v7 e! s/ L8 g; x
. U7 O( ^/ ]8 S0 ?9 q+ Q6 }9 S
& L' z2 ]. E. R' {8 w使用代码创建对象:
' _4 J9 ^# U) L5 N* P) `( b' w8 o7 t可以结合SQL去查询下对应对象的表和字段,set property实际上就是去设置这些值。ok后,apply即可!
5 d2 A! q' h) |* V0 v' G/ B' b" w7 e5 @, }6 |4 S
1 A3 B8 j$ R. [4 `
Console.WriteLine("4 =============Add a item ======================");9 g. P" }( e8 y# T) r. l
//we select the information from sql ; Z4 T) d: w8 ~5 L- j
//select item_number,name,classification,authoring_tool,effective_date from innovator.DOCUMENT& ^' r5 k6 D- q" E [9 ^; `- A
//ITEM_NUMBER NAME CLASSIFICATION AUTHORING_TOOL EFFECTIVE_DATE& @, @' n5 e( U6 }; w8 E7 f6 r Q% W2 ^
// testDoc NULL Process Text Editor 2018 - 07 - 05 02:25:27.000
$ o3 a4 g: S) b Item newDocItem = newInnovator.newItem("Document", "add");
# G( |; l" n# n$ E, Z7 E/ C# t3 x newDocItem.setProperty("item_number", "plmhomeTestDoc2222");8 G2 f# `5 p, d) B
newDocItem.setProperty("name", "plmhomeDocument");
' m3 N" h, h! b& t& ?+ c newDocItem.setProperty("classification", "Process");+ I6 t" f4 f# u. o
newDocItem.setProperty("authoring_tool", "Text_Editor");
; y# ~) \7 L! ~ newDocItem.setProperty("effective_date", "2018-07-06");8 R2 V- ?3 B" a% ^
7 O0 f B7 E0 H, J9 L' o
- E$ h. S# s& S) L: h& \; o newDocItem.apply();* a& O1 M' W- d4 h
if (newDocItem.isError()). m B0 E2 N+ K; _4 A4 q& p
{
% N' I& Q. A6 G% B Console.WriteLine("Create error !");9 z7 Y5 }, D" p9 S5 H5 a
}4 m) \1 F, A8 F; X, e, T3 U9 g
else
# R ~+ F4 K! d" f, L; ]+ r { N3 N: C: ?$ @5 @9 [
Console.WriteLine("works fine to create the docuement");5 N5 r, m: N5 Z
}
/ a* \/ Z5 @3 w7 v) b& @6 d g$ y- k* X# e4 X
! C# b: M& W3 ~( D: \& c; R6 T
7 D: O: }( D2 R) _' N2 B
- z1 W* P0 n( Y: v9 R3 t
|
|