使用 AX 2009 ReturnOrderInService Web 服务的 vb.Net 代码
需要在 vb.NET aspx 页面中使用 AX 2009 ReturnOrderInService Web 服务的 create 方法在 AX 中创建 RMA。
我在下面编写的代码在 AX 中创建 RMA,但不会在 AX RMA 表单中显示行详细信息,即使记录位于 SalesTable 和 SalesLine 中。
InventTrans 中是否需要记录,或者某处是否缺少 InventRefId 值?
Dim rmaClient As ReturnOrderInServiceClient = New ReturnOrderInServiceClient("WSHttpBinding_ReturnOrderInService1")
Dim roi As AxdReturnOrderIn = New AxdReturnOrderIn
Dim st As AxdEntity_SalesTable = New AxdEntity_SalesTable
st.CustAccount = "123"
st.ReturnReasonCodeId = "RRC1"
st.DlvMode = "01"
st.SalesType = 4 'return item
st.ReturnDeadline = DateAdd(DateInterval.Day, 15, Now())
Dim sl As AxdEntity_SalesLine = New AxdEntity_SalesLine
sl.ItemId = "ITEM 123"
sl.ExpectedRetQty = -2
sl.LineAmount = 0
sl.InventTransIdReturn = ""
st.SalesLine = New AxdEntity_SalesLine() {sl}
roi.SalesTable = New AxdEntity_SalesTable() {st}
txtFeedback.Text = ""
Try
Dim returnedSalesOrderEntityKey As EntityKey() = rmaClient.create(roi)
Dim returnedSalesOrder As EntityKey = CType(returnedSalesOrderEntityKey.GetValue(0), EntityKey)
txtFeedback.Text = GetRMANo(returnedSalesOrder.KeyData(0).Value)
Catch ex As Exception
txtFeedback.Text = ex.Message
End Try
rmaClient.Close()
Need to use the create method of the AX 2009 ReturnOrderInService web service in a vb.NET aspx page to create an RMA in AX.
The code I've written below creates the RMA in AX, but doesn't show the line details in the AX RMA form, even though the records are in SalesTable and SalesLine.
Is a record needed in InventTrans or is there a missing InventRefId value somewhere?
Dim rmaClient As ReturnOrderInServiceClient = New ReturnOrderInServiceClient("WSHttpBinding_ReturnOrderInService1")
Dim roi As AxdReturnOrderIn = New AxdReturnOrderIn
Dim st As AxdEntity_SalesTable = New AxdEntity_SalesTable
st.CustAccount = "123"
st.ReturnReasonCodeId = "RRC1"
st.DlvMode = "01"
st.SalesType = 4 'return item
st.ReturnDeadline = DateAdd(DateInterval.Day, 15, Now())
Dim sl As AxdEntity_SalesLine = New AxdEntity_SalesLine
sl.ItemId = "ITEM 123"
sl.ExpectedRetQty = -2
sl.LineAmount = 0
sl.InventTransIdReturn = ""
st.SalesLine = New AxdEntity_SalesLine() {sl}
roi.SalesTable = New AxdEntity_SalesTable() {st}
txtFeedback.Text = ""
Try
Dim returnedSalesOrderEntityKey As EntityKey() = rmaClient.create(roi)
Dim returnedSalesOrder As EntityKey = CType(returnedSalesOrderEntityKey.GetValue(0), EntityKey)
txtFeedback.Text = GetRMANo(returnedSalesOrder.KeyData(0).Value)
Catch ex As Exception
txtFeedback.Text = ex.Message
End Try
rmaClient.Close()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否按照 http:/ 中所述生成代理类/msdn.microsoft.com/en-us/library/cc652581(v=ax.50).aspx?
这应该创建所需的
AxdEntity
类。首先,我会尝试翻译 示例 到VB。我无法帮助您了解具体的语法,但这里没有什么花哨的东西,所以它应该相当简单。
关于 AX 中 Web 服务的使用,另请参阅:
Did you generate the proxy classes as stated in http://msdn.microsoft.com/en-us/library/cc652581(v=ax.50).aspx?
This should create the
AxdEntity
classes needed.First I would try to translate the example to VB. I cannot help you with the specific syntax, but there is nothing fancy here, so it should be rather simple.
Regarding the use of web services in AX, see also: