【问题标题】:Exporting Locations for a Customer using Acumatica API使用 Acumatica API 为客户导出位置
【发布时间】:2015-03-25 05:58:56
【问题描述】:

我正在尝试使用 Acumatica Web 服务 API 导出客户的所有位置。我希望使用 Locations 屏幕我可以在 Customer ID 字段上设置一个过滤器,我认为它是 LocationSummary.Customer,这将返回该客户的所有 Locations。相反,我总是返回 0 个结果。代码如下,我还展示了 ID 为 012349 的测试客户存在的位置的屏幕截图,调试器结果显示返回 0 条记录。

Public Function GetAddressList(ByVal customerID As String) As String()()
    Dim address As CR303010Content = m_context.CR303010GetSchema()
    m_context.CR303010Clear()

    Dim customerFilter As Filter = New Filter()
    customerFilter.Field = address.LocationSummary.Customer
    customerFilter.Condition = FilterCondition.Equals
    customerFilter.Value = customerID

    Dim searchfilters() As Filter = {customerFilter}
    Dim searchCommands() As Command = {address.LocationSummary.Customer, address.LocationSummary.LocationID, address.GeneralInfoLocationAddress.AddressLine1, address.GeneralInfoLocationAddress.City}
    Dim searchResult As String()() = m_context.CR303010Export(searchCommands, searchfilters, 0, False, False)

    Return searchResult
End Function

调试器显示长度为 0 的 searchResult 数组

【问题讨论】:

  • 我会提供另一种方法。您可以创建自己的通用查询并在那里收集所有需要的数据,然后将 Web 服务与您自己的屏幕导出/过滤数据一起使用。

标签: acumatica


【解决方案1】:

我尝试了您的示例,但无法使用过滤器使其正常工作。我对其稍作修改,改为在搜索命令中传递customerID,并将ServiceCommands.EveryLocationID 添加到其中以指定我们希望系统循环遍历所有位置:

    Dim searchCustomer As New Value() With {.Value = customerID, .LinkedCommand = address.LocationSummary.BusinessAccount}
    Dim searchCommands() As Command = {searchCustomer,
                                       address.LocationSummary.ServiceCommands.EveryLocationID, address.LocationSummary.LocationID, address.GeneralInfoLocationAddress.AddressLine1, address.GeneralInfoLocationAddress.City}
    Dim searchResult As String()() = screen.Export(searchCommands, Nothing, 0, False, False)

【讨论】:

  • 谢谢@Gabriel。这解决了我的问题,我已将其标记为答案。恐怕我仍然不明白解决方案。是否总是这样,而不是过滤器,您可以添加一个带有 .LinkedCommand 作为第一个命令的值,它会达到相同的目的?这可以为多个过滤器字段完成吗?我也不明白第二个命令。为什么系统不会遍历所有位置?抱歉,我对 Acumatica 很陌生,如果有解释这一点的文档,那么我很想有一个链接。我还没有在我们的 Acumatica 系统中看到它。
  • @EricBarr,LocationSummary.BusinessAccount 是此页面中的关键字段。当您在此字段中输入内容时,Acumatica 的行为是搜索具有该值的对应记录。当您通过 Web 服务赋予价值时,也会发生同样的事情。这个屏幕有点特别,它有两个关键字段(企业帐户代码 + 位置代码)。
  • @EricBarr 如果你不输入 EveryLocationID,你只会得到第一个位置 ID。
猜你喜欢
  • 1970-01-01
  • 2020-04-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-12-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多