Aras Innovator – Update parent ItemType Property by Relationship 透過單身欄位的 JavaScript 更新單頭欄位

,
// Sample: Update custom Part field [total_qty] by edit relationship item property [qty] on CellChange event.
var itmPart = typeof(parent.document.thisItem) == "object" ? parent.document.thisItem : parent.thisItem;
var rels = itmPart.getRelationships("Part BOM");
var count = rels.getItemCount();
var inn = itmPart.getInnovator();

var totalQty = 0;
for (var i = 0; i < count; i++) {
var rel = rels.getItemByIndex(i);
totalQty = totalQty + parseInt(rel.getProperty("qty", "0"));
}

var qty = getRelationshipProperty(relationshipID, "qty");
itmPart.setProperty("total_qty", totalQty);
setTimeout(function(){ aras.uiReShowItem(itmPart.getID(), itmPart.getID()); }, 100);

留言

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.