vb.Net代码使用AX 2009 ReturnOrderInService Web服务

时间:2011-07-22 22:01:39

标签: vb.net axapta dynamics-ax-2009 aif

需要在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()

1 个答案:

答案 0 :(得分:0)

您是否按照http://msdn.microsoft.com/en-us/library/cc652581(v=ax.50).aspx中的说明生成了代理类? 这应该创建所需的AxdEntity类。

首先,我会尝试将example翻译成VB。我无法帮助你了解具体的语法,但这里没什么特别的,所以它应该相当简单。

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