在Acumatica Web服务上过滤Export的正确方法是什么?

时间:2015-02-17 16:59:13

标签: acumatica

我刚刚测试了如何使用Web服务在Acumatica上使用过滤器导出示例代码。但它完全忽略了过滤器。

DateTime syncDate = new DateTime(2016, 1, 1);
WebReference.Screen context = new WebReference.Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.AllowAutoRedirect = true;
context.EnableDecompression = true;
context.Timeout = 1000000;
context.Url = "http://<MYACUMATICAINSTANCE>/(W(64))/Soap/IN202500.asmx";
context.Login("<MYUSER>", "<MYPASS>");
WebReference.Content IN202500 = context.GetSchema();
context.Clear();
string[][] result = context.Export(
    new WebReference.Command[]{
        IN202500.StockItemSummary.ServiceCommands.EveryInventoryID,
        IN202500.StockItemSummary.InventoryID,
        IN202500.StockItemSummary.Description,
        IN202500.WarehouseDetails.WarehouseWarehouseID,
        IN202500.WarehouseDetails.QtyOnHand
    },
    new WebReference.Filter[]{
        new WebReference.Filter { Field = new WebReference.Field { ObjectName = IN202500.StockItemSummary.ItemStatus.ObjectName, FieldName = IN202500.StockItemSummary.ItemStatus.FieldName }, Condition = WebReference.FilterCondition.Equals, Value = "Activse", Operator = WebReference.FilterOperator.And },
        new WebReference.Filter { Field = new WebReference.Field { ObjectName = IN202500.StockItemSummary.InventoryID.ObjectName, FieldName = "LastModifiedDateTime" }, Condition = WebReference.FilterCondition.Equals, Value = syncDate.ToLongDateString(), Operator = WebReference.FilterOperator.And }
    },
    5, false, false
);
foreach (string[] item in result)
{
    Console.WriteLine(
        item[0] + ";" +
        item[1] + ";" +
        item[2] + ";" +
        item[3] + ";"
    );
}

请注意错误过滤的错误syncDate和错误条件值Activse,它应该不返回任何结果,而是返回所有结果。

1 个答案:

答案 0 :(得分:2)

我发现过滤器在默认屏幕上无法正常工作。如果您创建通用查询,则可以指定过滤器并将结果集缩小到所需的字段。此外,GI屏幕通常比标准默认屏幕运行得更快。