728x90
1. Aras Innovator Object 생성하기
newReuslt()나 newError() Item의 return값으로 얻기 위한 Aras Innovator Object
Innovator myInnovator = this.getInnovator();
2. Item Object 생성하기
적용할 query나 Item을 추가하는 Item Object 생성하기
Item myItem = this.newItem(myItem, myAction);
Innovator myInnovator = this.getInnovator();
Item myItem = myInnovator.newResult(resultText);
Item myError = myInnovator.newError(errorMessage);
3. 하나의 Item을 취득하는 Query
id나 type을 통해 취득하고자하는 Item에 대한 쿼리
Item qryItem = this.newItem(myType, "get");
qryItem.setID(myId);
Item results = qryItem.apply();
Innovator myInnovator = this.getInnovator();
Item results = myInnovator.getItemById(myType, myId);
4. 아이템을 테이블 형태로 출력하기
Item qryItem = this.newItem("Part","get");
qryItem.setAttribute("select","item_number,description,cost");
qryItem.setProperty("cost", "100");
qryItem.setPropertyCondition("cost", "gt");
Item results = qryItem.apply();
int count = results.getItemCount();
int i;
string content = "<table>";
for (i=0; i<count; ++i)
{
Item item = results.getItemByIndex(i);
content += "" +
"<tr>" +
"<td>" + item.getProperty("item_number") + "</td>" +
"<td>" + item.getProperty("description") + "</td>" +
"<td>" + item.getProperty("cost") + "</td>" +
"</tr>";
}
content += "</table>";
Innovator innovator = this.getInnovator();
5. Item과 그 구성의 return값에 대한 Query
Innovator Innovator = this.getInnovator();
// Set up the query Item.
Item qryItem = this.newItem("Part", "get");
qryItem.setAttribute("select", "item_number, description, cost");
qryItem.setID(myId);
// Add the BOM structure.
Item bomItem = this.newItem("Part BOM", "get");
bomItem.setAttribute("select", "quantity, related_id(item_number, description, cost)");
qryItem.addRelationship(bomItem);
// Perform the query.
Item results = qryItem.apply();
// Test for an error.
if (results.isError()){
return innovator.newError("Item not found:" + results.getErrorDetail());
}
// Get a handle to the BOM Items.
Item bomItems = results.getRelationships();
int count = bomItems.getItemCount();
int i;
// Create the results content.
string content = "<table border = '1'>" +
"<tr>" +
"<td>Part Number</td>" +
"<td>Description</td>" +
"<td>Cost</td>" +
"<td>Quantity</td>" +
"</tr>"
// Iterate over th BOM Items.
for (i=0 ; i <count; ++i)
{
//Get a handle to the relationship Item by index.
Item bom = bomItems.getItemByIndex(i);
//Get a handle to the related Item for this relationship Item.
Item bomPart = bom.getRelatedItem();
content += "" +
"<tr>" +
"<td>" + bomPart.getProperty("item_number") + "</td>" +
"<td>" + bomPart.getProperty("description") + "</td>" +
"<td>" + bomPart.getProperty("cost") + "</td>" +
"<td>" + bom.getProperty("quantity") + "</td>" +
"</tr>"
}
6. Generic Method 적용하기
Innovator inn = this.getInnovator();
Item results = inn.applyMethod("Reverse String", "<string>abc</string>");
//Return a result item with "cba" as the contents of the Result tag
return inn.newResult(results.getResult());
7. text를 하나의 File로 저장하기
Innovator myInnovator = this.getInnovator();
string path = CCO.Server.MapPath("temp/yoyo.txt");
try
{
if (File.Exists(path)) File.Delete(path);
StreamWriter sw = File.CreateText(path);
sw.Write(this.dom.InnerXml);
sw.Close();
}
catch (Exception e)
{
return myInnovator.newError(e.Message);
}
return myInnovator.newResult("ok");
8. CAD파일을 Vault에 저장하기
Item d = this.newItem("CAD", "add");
d.setProperty("item_number", "007");
d.setFileProperty("native_file", @"C:\myFile.txt");
return d.apply();
9. Item 라이프사이클 이동 방지
Innovator innovator = this.getInnovator();
if (Convert.ToDecimal(this.getProperty("cost")) > 500) {
Item error = innovator.newError("Error promoting: Item costs more than
$500.00");
return error;
}
return this;
10. Date 속성 값 다루기
Innovator inn = this.getInnovator();
// Get yesterday's date
DateTime myDate = DateTime.Today.AddDays(-1);
// Find all methods edited in the past 24 hours
Item myItem = inn.newItem("Method","get");
myItem.setAttribute("select","name");
myItem.setProperty("modified_on",myDate.ToString("yyyy-MM-ddThh:mm:ss"));
myItem.setPropertyAttribute("modified_on","condition","gt");
myItem = myItem.apply();
// Loop through the returned methods and return the list
string methodList = "";
int myItemCount = myItem.getItemCount();
for(int i = 0; i < myItemCount; i++){
methodList += myItem.getItemByIndex(i).getProperty("name","") + ", ";
}
return inn.newError("The following methods were modified In the past 24
hours: " + methodList);
참고자료
728x90
'IT > PLM시스템' 카테고리의 다른 글
[PLM] Aras Innovator의 메소드 작성법 (0) | 2021.02.14 |
---|---|
[PLM] Aras Innovator의 AML이란? (2) | 2021.02.12 |
[PLM] E-BOM 과 M-BOM의 차이 (0) | 2021.01.27 |
[PLM] E-BOM(설계 부품표)과 M-BOM(제조 부품표)의 관계성 (0) | 2021.01.26 |
[PLM] PDM이란? (0) | 2021.01.07 |