|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator 二次开发入门】5 创建对象Document! Q( t6 `1 j% K7 c! p% q
* e9 |+ y: B6 n8 Z& _$ a& n4 ]$ K% s* i0 H
使用代码创建对象:
5 [8 P* h! T8 M% o$ h可以结合SQL去查询下对应对象的表和字段,set property实际上就是去设置这些值。ok后,apply即可!0 M9 Y9 Q; P/ r3 t ]/ B
: j% S+ H. }* M. Z7 l0 O9 w) }2 ?' n, P" V/ d8 F1 J
Console.WriteLine("4 =============Add a item ======================");
" C9 d" O# m+ Z, S4 X& D //we select the information from sql
. f E( A& D1 f3 C+ m //select item_number,name,classification,authoring_tool,effective_date from innovator.DOCUMENT8 { n/ C* D# o f
//ITEM_NUMBER NAME CLASSIFICATION AUTHORING_TOOL EFFECTIVE_DATE+ N3 M0 N" _4 t! J
// testDoc NULL Process Text Editor 2018 - 07 - 05 02:25:27.000) {+ O" T, q( e: d
Item newDocItem = newInnovator.newItem("Document", "add");2 A9 A" F$ } O
newDocItem.setProperty("item_number", "plmhomeTestDoc2222");
: ?! c3 X1 N. g- N* a2 K3 M" G. _ newDocItem.setProperty("name", "plmhomeDocument");/ |3 y* E( [, ^' ^8 A4 i
newDocItem.setProperty("classification", "Process");
1 O+ k8 ^7 u0 w1 O& U newDocItem.setProperty("authoring_tool", "Text_Editor");6 f" J3 C5 g3 W: q
newDocItem.setProperty("effective_date", "2018-07-06");/ @! L2 |+ ?& k: `) Z8 o
3 w" `9 L8 j& A& l: B
7 a0 k4 R& j( {& Z; q newDocItem.apply(); o. ^7 r! M% W$ C
if (newDocItem.isError())
3 A) f$ c& g- y3 F. j5 |+ u {
5 T! B4 s1 [2 L$ |( ~ Console.WriteLine("Create error !");
/ Y+ y) X+ q( `! k }2 q9 u4 w% H1 z% a
else1 \6 r( Z" E8 ? J; g
{
. s P6 b: _6 H* z- x% b$ j Console.WriteLine("works fine to create the docuement");
: W% J w1 |1 e5 R" ~8 n" B }
4 o: I `8 C7 |* B9 A- z
/ [! C* b$ x) [3 k/ M) @/ V' y7 F/ y& p. P0 ]! q: c9 I- O
% F3 V) S, u2 v: l% f1 X; R
" ^2 j0 C) s# G( \6 E |
|