|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator 二次开发入门】5 创建对象Document
' j b1 H5 ?- ?9 ^# F0 b1 D7 g6 v2 b' S3 }1 f/ \( f
2 W& m" ]8 d' \, _9 A9 i' x使用代码创建对象:- q; F7 P% A! X5 t
可以结合SQL去查询下对应对象的表和字段,set property实际上就是去设置这些值。ok后,apply即可! @ N f6 k8 S$ S3 U Y
7 A! n8 M+ E( T! E6 P& c/ m' G
1 O2 a% s1 c: g$ N' L* }8 f
Console.WriteLine("4 =============Add a item ======================");
" Z0 Y0 \6 T- c5 c; J$ a8 d4 F //we select the information from sql ; G% `9 Q6 j/ b; ^- }- g: ~
//select item_number,name,classification,authoring_tool,effective_date from innovator.DOCUMENT4 ^6 q$ M3 D. Y/ U; }
//ITEM_NUMBER NAME CLASSIFICATION AUTHORING_TOOL EFFECTIVE_DATE! \, }# g2 [& V, j X( ] q
// testDoc NULL Process Text Editor 2018 - 07 - 05 02:25:27.0009 l9 A2 O* ?2 }4 @& [! c
Item newDocItem = newInnovator.newItem("Document", "add");
" a* F ?; A% H9 \ newDocItem.setProperty("item_number", "plmhomeTestDoc2222");
# }8 w9 V3 ?$ U$ y* Q newDocItem.setProperty("name", "plmhomeDocument");$ m* P1 q) a: b8 ]3 T
newDocItem.setProperty("classification", "Process");& P( q# n" \9 a: B9 j" k
newDocItem.setProperty("authoring_tool", "Text_Editor");% o/ D2 Z K# u( }4 P* t: i
newDocItem.setProperty("effective_date", "2018-07-06");4 `3 r- X) Y* g
+ X" U4 d3 ~6 ?
5 A; |$ t2 H% B( ~ newDocItem.apply();
/ D2 L, j5 f# K. i7 a" j3 X if (newDocItem.isError())/ \: }: S5 s" e
{
. p* _# _* n- S Console.WriteLine("Create error !");0 ], Z, P* f1 S5 k z
}- n0 W( k0 K$ h, e% |$ N+ ?$ A
else
i: G* s( t% M" F: z) @/ e$ T {8 @ M5 m( ]6 h+ Q+ g# J( t
Console.WriteLine("works fine to create the docuement");
9 Y& I! n4 {7 J S( H }
* e( R6 K2 o# d9 a* k& M( W8 Z& |
2 @, @, ` p K( ^2 N1 u0 |# @5 r9 G2 G
4 T3 V. l& Y. V, [( V6 L
& p5 X1 B0 c4 F' j4 r |
|