I have got a UD field called JobSQM_c in OrderDtl where our draftsman will update this square meter based on what is drawn in CAD.
So I have created a Data BPM, so that the SellingQuantity and OrderQty will be updated through the BPM. I followed the trace closely and the two calls that are important are
ChangeSellingQtyMaster
and
MasterUpdate
I ran both of them with the exact parameters, the OrderDtl will update correctly, but the OrderHed Total Charge will not update at all. What did I do wrong here?
foreach(var ttOrderDtlRow in (from row in ttOrderDtl where row.Updated() select row))
{
decimal sellingQty = ttOrderDtlRow.JobSQM_c;
this.PublishInfoMessage("Updating SQM in Sales Order Line Qty to: " + sellingQty , Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "OrderDtl", "Update");
Erp.Contracts.SalesOrderSvcContract salesOrderSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.SalesOrderSvcContract>(Db);
string opWarningMsg;
bool morePages = false;
Erp.Tablesets.SalesOrderTableset sods = salesOrderSvc.GetRows("OrderNum="+ ttOrderDtlRow.OrderNum.ToString(),
"","","OrderLine=" + ttOrderDtlRow.OrderLine.ToString(),
"","","","","","","","","","","","",0,1, out morePages);
string cResponseMsg, cDisplayMsg, cCompliantMsg, cResponseMsgOrdRel;
bool lContinue = false;
if(sods.OrderDtl.Count > 0)
{
sods.OrderDtl[0].RowMod = "U";
string pcMessage, pcNegQtyAction,cSellingQtyChangeMsgText;
salesOrderSvc.ChangeSellingQtyMaster(ref sods, sellingQty, true , true, true, true, true, true, ttOrderDtlRow.PartNum, "","","",ttOrderDtlRow.SalesUM, 1,
out pcMessage,out pcNegQtyAction, out opWarningMsg, out cSellingQtyChangeMsgText);
sods.OrderDtl[0].CurrencySwitch = false;
sods.TaxConnectStatus[0].ETCOffline = true;
sods.TaxConnectStatus[0].RowMod = "U";
salesOrderSvc.MasterUpdate(false, "OrderDtl", sods.OrderHed[0].CustNum, sods.OrderHed[0].OrderNum, false, out lContinue, out cResponseMsg, out cDisplayMsg, out cCompliantMsg, out cResponseMsgOrdRel, ref sods);
}
}