如何使用Webservices从屏幕IN401000获取数据

时间:2017-03-08 22:25:10

标签: c# php acumatica webservices-client

大家好我有这个问题我试图从这个表中获取信息(例如一个inventoryID和所有子文章),但是咨询会崩溃,因为这需要花费很多时间。

我现在卡住了,我在php中有这个但是如果有人可以帮助我,那么如果是C#

$Gate = new AcumaticaGate($user, $pass);
$schema = $Gate->Client->IN401000GetSchema(new IN401000GetSchema())->GetSchemaResult;
$Gate->Client->IN401000Clear(new IN401000Clear());

$export = new IN401000Export();
$export->commands = array
(
$schema->Selection->ServiceCommands->EveryInventoryID,
$schema->Selection->InventoryID,
//$schema->InventorySummary->DisplayName ,
//$schema->InventorySummary->InventoryID ,
//$schema->InventorySummary->Subitem ,
//$schema->InventorySummary->Warehouse ,
//$schema->InventorySummary->Available ,
//$schema->InventorySummary->BaseUnit,
);
$field = new Field();
$field->FieldName = "InventoryID";
$field->ObjectName = $schema->Selection->InventoryID->ObjectName;

$export->filters = array();

$filter_command = $Gate->PrepareSimpleFilter($field, FilterCondition::Contain, "10091"); // Filtro para buscar los 15 articulos Anteriores
array_push($export->filters,$filter_command);

$export->breakOnError = true;
$export->includeHeaders = false;
$export->topCount = 10;

try
{
    $export_result = $Gate->Client->IN401000Export($export)->ExportResult;
    unset($Gate->Client);
}
catch (Exception $e) {
    console($e);
}

return $export_result->ArrayOfString;

1 个答案:

答案 0 :(得分:0)

使用查询屏幕时,您始终必须使用Submit代替Export。下面是C#中的示例,显示如何通过基于屏幕的API从库存摘要(IN401000)屏幕为给定的库存项目导出数据:

IN401000WebRef.Content itemSumSchema = IN401000context.GetSchema();
var itemSumCommands = new IN401000WebRef.Command[]
{
    new IN401000WebRef.Value
    {
        LinkedCommand = itemSumSchema.Selection.InventoryID,
        Value = item[0]
    },
    new IN401000WebRef.Value
    {
        LinkedCommand = itemSumSchema.Selection.ExpandByLotSerialNumber,
        Value = "True"
    },
    itemSumSchema.InventorySummary.Warehouse,
    itemSumSchema.InventorySummary.Location,
    itemSumSchema.InventorySummary.OnHand,
    itemSumSchema.InventorySummary.EstimatedTotalCost,
    itemSumSchema.InventorySummary.LotSerialNumber
};
var serials = IN401000context.Submit(itemSumCommands);