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

发布于 2024-11-25 11:21:49 字数 1373 浏览 1 评论 0原文

需要在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

原来是傀儡 2024-12-02 11:21:49

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:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文