Acumatica错误通过SOAP发送SO

时间:2018-02-23 21:22:05

标签: vb.net soap-client acumatica

在尝试将SO发送到Acumatica时,我收到以下错误:

PX.Api.ContractBased.OutcomeEntityHasErrorsException: PX.Data.PXException: Error: The system failed to commit the Transactions row.
   at PX.Api.SyImportProcessor.SyStep.a(Object A_0, PXFilterRow[] A_1, PXFilterRow[] A_2)
   at PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()
   at PX.Api.ContractBased.Soap.WebApiSoapController.Post(ISoapSystemContract systemContract, XmlReader requestReader, String serviceNamespace, String internalNamespace, MethodInfo method, Func`1 serviceFactory, IEdmModel edmModel)
   at PX.Api.ContractBased.Soap.WebApiSoapController.<Post>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at PX.Api.ContractBased.Soap.WebApiSoapController.<Login>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()

我正在使用此代码发送SO:

     Dim inv As SalesOrder = DirectCast(con.SoapClient.Put(BuildSO(con, trans)), SalesOrder)


 Protected Function BuildSO(con As AcumaticaConnection, inv As Transaction) As SalesOrder
        Dim out As New SalesOrder
        With inv
            out.OrderType = New StringValue With {.Value = "SO"}
            If .Customer.HasID Then out.CustomerID = New StringValue With {.Value = inv.Customer.NameString}
            If .TxnDate.HasValue Then out.Date = New DateTimeValue With {.Value = inv.TxnDate}
            If .RefNumber.HasFullName Then
                out.OrderNbr = New StringValue With {.Value = inv.RefNumber.FullName}
                out.CustomerOrder = New StringValue With {.Value = inv.RefNumber.FullName}
                out.Description = New StringValue With {.Value = inv.RefNumber.FullName}
            End If
            If .HasMemo Then out.Note = .Memo
            If .HasShipVia Then out.ShipVia = New StringValue With {.Value = inv.ShipVia}

            Dim details As New List(Of SalesOrderDetail)
            Dim lnum As Integer = 1
            For Each l As TransactionLine In inv
                Dim detail As New SalesOrderDetail
                detail.LineNbr = New IntValue With {.Value = lnum}
                lnum += 1

                detail.InventoryID = New StringValue With {.Value = l.ItemKey}
                If l.Qty <> 0 Then
                    detail.Quantity = New DecimalValue With {.Value = l.Qty}
                End If
                If l.HasUnit Then
                    detail.UOM = New StringValue With {.Value = l.UnitofMeasure}
                Else
                    detail.UOM = New StringValue With {.Value = "EA"}
                End If

                details.Add(detail)
            Next
            out.Details = details.ToArray
        End With
        Return out
    End Function

我已经尝试确保i210课程中填写的所有字段都填写在我的代码中(因此是UOM位),但我改变的任何内容似乎都有所作为。我能做些什么来至少获得有关错误可能的更多信息,以便我可以进一步排除故障吗?

1 个答案:

答案 0 :(得分:-1)

在传递订单类型后尝试添加以下行。这是C#代码。

inv.Actions.Insert,