我以编程方式创建一个贷项凭证,然后由ARDocumentRelease.ReleaseDoc(rebateRelease, false);
发布,我收到了此错误。
{"Error: Another process has updated the 'ARRegister' record. Your changes will be lost."}
。
此错误的效果在日记帐事务中,创建的日记帐事务处于未过帐状态。请检查图片谢谢。 Unposted Journal Transaction,Closed Credit Memo,Error in code,Suggestion 1
我的代码如下:
`ARInvoice arInvoice = new ARInvoice();
arInvoice.DocType = "CRM";
arInvoice.CustomerID = loan.BAccountID;
arInvoice.CustomerLocationID = loan.CustomerLocation;
arInvoice.DocDesc = "";
arInvoice.OpenDoc = true;
arInvoice.Released = false;
arInvoice.Hold = false;
arInvoice.Status = "B";
if (arSetup.RequireControlTotal == true)
{
arInvoice.CuryOrigDocAmt = amount;
}
arInvoice = ARGraph.Document.Update(arInvoice);
ARGraph.Actions.PressSave();
ARTran arTran = new ARTran();
arTran.RefNbr = arInvoice.RefNbr;
arTran.LineNbr = 1;
arTran.SortOrder = 1;
arTran.TranDesc = description;
arTran.AccountID = accountID;
arTran.SubID = subID;
arTran.Qty = 1;
arTran.TaxCategoryID = other.TaxCategoryID;
arTran.CuryExtPrice = amount;
arTran.Released = false;
ARGraph.Transactions.Insert(arTran);
ARGraph.Actions.PressSave();
rebateRelease.Add(arInvoice);
ARDocumentRelease.ReleaseDoc(rebateRelease, false);`
答案 0 :(得分:1)
尝试将最后几行更改为此...
rebateRelease.Add(ARGraph.Document.Current);
ARDocumentRelease.ReleaseDoc(rebateRelease, false);
我猜您的问题是您保存了更新arInvoice记录的图表,并且您仍在使用该对象的旧arInvoice记录。完成印刷机保存后,您需要更新的值。
另外,为了节省一些开销,您可以在发送文档之前保存一次。无需在ARGraph.Document.Update(arInvoice)
行之后保存。