【发布时间】:2017-05-25 04:54:04
【问题描述】:
我想通过顶部数据获得顶部,“首先是 100,然后是 101 到 200”,是否存在某种方式可以通过 Acumatica 上的 web 服务获取这样的结果?因为我只看到 API“topCount”参数,而且我只可以获取静态数据数。
请帮助我不知道这是否适用于网络服务
【问题讨论】:
我想通过顶部数据获得顶部,“首先是 100,然后是 101 到 200”,是否存在某种方式可以通过 Acumatica 上的 web 服务获取这样的结果?因为我只看到 API“topCount”参数,而且我只可以获取静态数据数。
请帮助我不知道这是否适用于网络服务
【问题讨论】:
Acumatica 始终通过按关键字段升序排序的 API 导出记录。为了批量导出记录,您应该简单地将$top 参数与附加的GreaterThen 条件结合起来以获取最后检索的关键字段:
http://localhost/051989/entity/Default/6.00.001/StockItem?$top=10&$filter=InventoryID gt 'CONGOLFR1'
结合$top 和$skip 参数,Acumatica 总是首先请求$top 参数指定的记录数,然后从结果集的开头排除$skip 参数指定的记录数:
http://localhost/051989/entity/Default/6.00.001/StockItem?$top=10$skip=5
跳过参数不适用于 SOAP。要使用 SOAP 批量导出记录,您应该将 RowNumber 属性的 LessThan 条件与最后检索的关键字段的 GreaterThen 条件结合起来:
using (DefaultSoapClient client = new DefaultSoapClient())
{
client.Login("login", "password", null, null, null);
try
{
var items = client.GetList(
new StockItem
{
RowNumber = new LongSearch
{
Condition = LongCondition.IsLessThan,
Value = 10
}
},
false);
int count = items.Length;
Console.WriteLine("InventoryID | Description | ItemClass | BaseUOM | LastModified");
foreach (StockItem stockItem in items)
{
Console.WriteLine(
string.Format("{0} | {1} | {2} | {3} | {4}",
stockItem.InventoryID.Value,
stockItem.Description.Value,
stockItem.ItemClass.Value,
stockItem.BaseUOM.Value,
stockItem.LastModified.Value));
}
while (items.Length == 10)
{
StockItem filter = new StockItem
{
RowNumber = new LongSearch
{
Condition = LongCondition.IsLessThan,
Value = 10
},
InventoryID = new StringSearch
{
Condition = StringCondition.IsGreaterThan,
Value = (items[items.Length - 1] as StockItem).InventoryID.Value
}
};
items = client.GetList(filter, false);
count = count + items.Length;
foreach (StockItem stockItem in items)
{
Console.WriteLine(
string.Format("{0} | {1} | {2} | {3} | {4}",
stockItem.InventoryID.Value,
stockItem.Description.Value,
stockItem.ItemClass.Value,
stockItem.BaseUOM.Value,
stockItem.LastModified.Value));
}
}
Console.WriteLine();
Console.WriteLine(string.Format("Stock Items exported: {0}", count));
Console.WriteLine();
}
finally
{
client.Logout();
}
}
【讨论】:
RowNumber 的提示!我一直在寻找。