I want to update the InventoryItem based on the logic How can I do it. and Refresh the UI
if (row != null) {
ALLInventory InventoryItem = PXSelect<ALLInventory, Where<ALLInventory.inventoryID, Equal<Required<ALLInventory.inventoryID>>>>.Select(e.Cache.Graph, row.InventoryID);
if (InventoryItem != null) // Details related Material Allocation is available
{
// IF - Total Consuemd Qty + Order Oty <= Maximum Allocated Quantity
if(InventoryItem.TotalConsumedQty + row.OrderQty <= InventoryItem.MaxAllowedQty)
{
InventoryItem.TotalConsumedQty += (int?)row.OrderQty;
}
else // ELSE - Place Order for Total Consuemd Qty + Order Oty - Maximum Allocated Quantity
{
InventoryItem.TotalConsumedQty = InventoryItem.MaxAllowedQty;
row.OrderQty = InventoryItem.TotalConsumedQty + row.OrderQty - InventoryItem.MaxAllowedQty;
}
// Update the Inventory Item in the Database ------------------------------
}
}