1

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

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,它应该不返回任何结果,而是返回所有结果。

4

1 回答 1

2

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

于 2015-11-18T19:30:02.890 回答