iT邦幫忙

2021 iThome 鐵人賽

DAY 20
0
自我挑戰組

從Agile PLM 移轉 Aras PLM大小事系列 第 20

20.移轉 Aras PLM大小事-自製快速新增專案工作產出文件

在11sp12仍然有個問題,在代理商這邊始終無法解決
因此又自行新增按鈕來處理問題

1.在表單Activity Completion Worksheet新增按鈕
https://ithelp.ithome.com.tw/upload/images/20210920/20106503Kji6xvM0Jg.png

2.當按鈕Click時,自動新增文件

var inn = new Innovator();

var itm = document.item;
var act2 = inn.applyAML("<AML><Item type='Activity2' action='get' id='"+itm.getAttribute("id")+"'></Item></AML>");
var projItem = inn.applyAML("<AML><Item type='Project' action='get' where=\"[Project].project_number='"+ act2.getProperty("proj_num","") +"'\"></Item></AML>");

//-----------新增文件但不存檔----------
// var itmDoc = top.aras.newItem("Document","add");
// top.aras.setItemProperty(itmDoc,"name",projItem.getProperty("cn_project_number","")+":");
// top.aras.setItemProperty(itmDoc,"classification","Project_Document(專案文件)");
// top.aras.setItemProperty(itmDoc,"cn_factory","1_台北");
// top.aras.setItemProperty(itmDoc,"cn_lifecycle","Preliminary");
// top.aras.setItemProperty(itmDoc,"cn_revision","00");
// top.aras.setItemProperty(itmDoc,"project",projItem.getAttribute("id"));
// itmDoc = itmDoc.apply();
//------------------------------------
var itmDoc = inn.newItem("Document","add");
itmDoc.setProperty("name",projItem.getProperty("cn_project_number","")+":");
itmDoc.setProperty("classification","Project_Document(專案文件)");
itmDoc.setProperty("cn_factory","1_台北");
itmDoc.setProperty("cn_lifecycle","Preliminary");
itmDoc.setProperty("cn_revision","00");
itmDoc.setProperty("project",projItem.getAttribute("id"));
itmDoc = itmDoc.apply();

var body = "<sid>"+itm.getAttribute("id")+"</sid>";
    body += "<rid>"+itmDoc.getProperty("id")+"</rid>";
var act2_delivery = inn.applyMethod("JPC_Add_Deliverable",body);
if(act2_delivery.isError()){
    top.aras.AlertError("System Error:"+act2_delivery.getErrorString());
}
//top.aras.uiShowItemEx(itmDoc,"tab view",true);
top.aras.uiShowItem("Document",itmDoc.getProperty("id"),'tab view',true);
//新增工作產出JPC_Add_Deliverable
Innovator inn = this.getInnovator();
Aras.Server.Security.Identity plmIdentity = Aras.Server.Security.Identity.GetByName("Administrators");
Boolean PermissionWasSet = Aras.Server.Security.Permissions.GrantIdentity(plmIdentity);
Item act2_delivery = inn.newItem("Activity2 Deliverable","add");
act2_delivery.setProperty("source_id",this.getProperty("sid"));
act2_delivery.setProperty("related_id",this.getProperty("rid"));
act2_delivery = act2_delivery.apply();
if (PermissionWasSet) Aras.Server.Security.Permissions.RevokeIdentity(plmIdentity);
return act2_delivery;

上一篇
19.移轉 Aras PLM大小事-表單團隊權限
下一篇
21.移轉 Aras PLM大小事-回復料號
系列文
從Agile PLM 移轉 Aras PLM大小事30

尚未有邦友留言

立即登入留言