使用Acumatica API为客户导出位置

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

我正在尝试使用Acumatica Web服务API为客户导出所有位置。我希望使用Locations屏幕可以在Customer ID字段上设置一个过滤器,我认为它是LocationSummary.Customer,这将返回该客户的所有位置。相反,我总是返回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数组的调试器

我尝试了您的示例,但无法使用过滤器使其正常工作。我稍微修改了它,在搜索命令中传递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)

我会提供另一种方法。您可以创建自己的通用查询并在那里收集所有必需的数据,然后使用Web服务和您自己的屏幕导出/筛选数据。谢谢@Gabriel。这解决了我的问题,我把它标记为答案。恐怕我还是不明白解决办法。您可以添加一个值,将.LinkedCommand作为第一个命令,而不是筛选器,这样做是否总是正确的,并且它将达到相同的目的?可以对多个筛选器字段执行此操作吗?我也不明白第二个命令。为什么系统不会在所有位置循环?对不起,我对Acumatica非常陌生,如果有文档可以解释这一点,那么我希望有一个链接。我还没有在我们的Acumatica系统中看到它。@Ericbar,LocationSummary.BusinessAccount是本页的关键字段。当您将某些内容放入此字段时,Acumatica的行为是搜索具有此值的相应记录。当您通过web服务输入值时,也会发生同样的情况。这个屏幕有点特别,因为它有两个关键字段“业务帐户代码+位置代码”。@Ericbar如果你不输入EveryLocationID,你只会得到第一个位置ID。