我注意到导出函数的最高计数[例如IN401000Export()]仅适用于最高级别(当需要多个级别时)。
例如,我们尝试从Bin Location Content中检索TOP 200行。在这种情况下,我们正在寻找一次检索200个项目/仓库/仓位置。但是,系统不是检索TOP 200项目/仓库/仓位置组合,而是尝试检索TOP 200项目。请注意,背后的原因是在软件中实现一些分页结构。
为了更好地说明这一点,假设下面是数据库中的数据:
Item Warehouse Bin Qty
AA MAIN 01 25
AA MAIN 02 20
AA MAIN 03 2
BB MAIN 01 10
BB MAIN 02 5
BB STORE S1 10
CC MAIN 01 50
CC STORE S1 10
CC STORE S2 10
DD MAIN 02 23

我想要实现的是检索表格的第3页,这样我就可以创建3条记录的页面,这些记录应该导致:
Page 1
AA MAIN 01 25
AA MAIN 02 20
AA MAIN 03 2
Page 2
BB MAIN 01 10
BB MAIN 02 5
BB STORE S1 10
Page 3
CC MAIN 01 50
CC STORE S1 10
CC STORE S2 10
Page 4
DD MAIN 02 23

然而,该系统正在抓取TOP 3项目及其所有尾随内容:
Page 1
AA MAIN 01 25
AA MAIN 02 20
AA MAIN 03 2
BB MAIN 01 10
BB MAIN 02 5
BB STORE S1 10
CC MAIN 01 50
CC STORE S1 10
CC STORE S2 10
Page 2
DD MAIN 02 23

下面是我用来检索数据的代码,我尝试从ServiceCommands添加EveryWarehouse和EveryLocation,但它没有帮助。 任何其他表格(采购订单和行,销售订单和行,仓库和仓位等)都会出现同样的问题 您能告诉我们代码中可以更改哪些内容以实现所需要的功能吗? 或者告诉我这是否应该如何检索数据?
Command[] oCmd = new Command[] {IN401000.Selection.ServiceCommands.EveryInventoryID,
IN401000.Selection.ServiceCommands.EveryWarehouse,
IN401000.Selection.ServiceCommands.EveryLocation,
IN401000.Selection.InventoryID,
IN401000.InventorySummary.Warehouse,
IN401000.InventorySummary.Location,
IN401000.InventorySummary.Available,
IN401000.InventorySummary.AvailableForShipment,
IN401000.InventorySummary.OnHand,
new Field {ObjectName = IN401000.Selection.InventoryID.ObjectName,
FieldName = "LastModifiedDateTime"}
};
Filter[] oFilter = new Filter[] {}
String[][] sReturn = oScreen.IN401000Export(oCmd, oFilter, 200, true, false);
答案 0 :(得分:0)
来这里猜测为什么查询窗口打破了导出方法。我在培训指南中找到了答案:如您所知,IN401000是一个查询窗口,因此您必须使用过滤数据“填充”“过滤器”字段内容(记得提交到最后一个)
从“基于屏幕的Web服务培训指南”,例2.2.2:检索库存项目的数量:
//Stock item data (FILTER FIELDS)
string inventoryID = "AALEGO500";
string warehouse = "MAIN";
using
(
//Connect to the web services and log in to Acumatica ERP
Screen context = WebServiceConnector.InitializeWebService()
)
{
try
{
//Get the schema of the form
IN401000Content invSummarySchema = context.IN401000GetSchema();
//Configure the list of commands
var commands = new Command[]
{
//Select the needed stock item
new Value
{
Value = inventoryID,
LinkedCommand = invSummarySchema.Selection.InventoryID
},
new Value
{
Value = warehouse,
LinkedCommand = invSummarySchema.Selection.Warehouse
},
//Get the necessary data
invSummarySchema.InventorySummary.InventoryID,
invSummarySchema.InventorySummary.Warehouse,
invSummarySchema.InventorySummary.OnHand,
invSummarySchema.InventorySummary.Available,
invSummarySchema.InventorySummary.AvailableForShipment
};
//Filter the records with non-zero quantities at the MAIN warehouse
var filters = new Filter[]
{
new Filter //Adicional Filter to "FILTER FIELDS"
{
Field = invSummarySchema.InventorySummary.OnHand,
Condition = FilterCondition.NotEqual,
Value = "0",
Operator = FilterOperator.And
}
};
//Retrieve the quantities and save them to a CSV file
String[][] items =
context.IN401000Export(commands, filters, 0, true, false);
IOHelper.SaveToCSVFile(items,
string.Format(@"StockItem_Qty_InventoryID_{0}.csv", inventoryID));
}