vb.Net代码以使用AX 2009 ReturnOrderInService Web服务 [英] vb.Net code to use AX 2009 ReturnOrderInService web service

查看:79
本文介绍了vb.Net代码以使用AX 2009 ReturnOrderInService Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要在vb.NET aspx页面中使用AX 2009 ReturnOrderInService Web服务的创建方法,才能在AX中创建RMA.

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.

我下面编写的代码在AX中创建RMA,但是即使记录在SalesTable和SalesLine中,也不会以AX RMA形式显示行详细信息.

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.

InventTrans中是否需要一条记录,或者某个地方是否缺少InventRefId值?

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()

推荐答案

您是否生成了

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.

首先,我将尝试翻译示例到VB.我无法为您提供特定的语法,但是这里没有花哨的内容,因此它应该很简单.

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.

关于在AX中使用Web服务,另请参见:

Regarding the use of web services in AX, see also:

  • http://www.axaptapedia.com/Webservice
  • http://blogs.msdn.com/b/aif/archive/2011/06/15/microsoft-dynamics-ax-2012-services-and-aif-white-papers.aspx
  • http://blogs.msdn.com/b/aif/archive/2007/11/28/consuming-the-customer-service-from-a-c-client.aspx (last part)
  • http://channel9.msdn.com/blogs/sanjayjain/microsoft-dynamics-ax-2009-aif-web-services-screencast

这篇关于vb.Net代码以使用AX 2009 ReturnOrderInService Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆