这是在 MS Dynamics AX 2012 中创建 SalesOrder 的最简单的代码,但它对我不起作用。目前我正在调试代码。这篇文章的目的是请有人告诉我代码中突出显示(粗体或括在**中)字段的详细信息/描述。从细节我的意思是
- 这些字段是否相关。如果是,那么如何。
- 这些是用户定义的字段(输入)还是来自其他表。
- 如果这些字段来自其他表,那么那是什么表。
我应该如何验证其他表中的这些字段。
SalesOrderServiceClient _Client; using (_Client = new SalesOrderServiceClient()) { CallContext _callContext = new CallContext(); _callContext.Company = "ART"; AxdSalesOrder salesOrder = new AxdSalesOrder(); AxdEntity_SalesTable salesTable = new AxdEntity_SalesTable(); salesTable.CurrencyCode = "USD"; **salesTable.CustAccount = "00036";** salesTable.DeliveryDate = Convert.ToDateTime("11/13/2017"); salesTable.ReceiptDateRequested = Convert.ToDateTime("11/14/2017"); salesTable.Payment = "N30"; **salesTable.PurchOrderFormNum = "1AB7567";** AxdEntity_SalesLine salesLine = new AxdEntity_SalesLine(); **salesLine.ItemId = "PF507028";** salesLine.SalesQty = 1; salesLine.SalesUnit = "ea"; AxdEntity_InventDim inventDim = new AxdEntity_InventDim(); inventDim.InventSiteId = "1"; inventDim.InventLocationId = "13"; **inventDim.ConfigId = "153081-DF-00046";** **inventDim.InventDimId = "ART00720252";** salesLine.InventDim = new AxdEntity_InventDim[1] { inventDim }; salesTable.SalesLine = new AxdEntity_SalesLine[1] { salesLine }; salesOrder.SalesTable = new AxdEntity_SalesTable[1] { salesTable }; _Client.create(_callContext, salesOrder); lblOutput.Text += "<br />Success"; }
我得到的错误非常普遍,即在验证记录时发现错误。更新已取消。. 从错误来看,很明显它是某种验证错误,这就是我发表这篇文章的原因。
谢谢,