我发送的SOAP消息是这样的:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.acumatica.com/typed/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:Export>
<ns1:commands>
<ns1:Command xsi:type="ns1:Field">
<ns1:FieldName>InventoryCD</ns1:FieldName>
<ns1:ObjectName>Item</ns1:ObjectName>
<ns1:Value>InventoryID</ns1:Value>
<ns1:Commit>true</ns1:Commit>
<ns1:LinkedCommand xsi:type="ns1:Action">
<ns1:FieldName>Cancel</ns1:FieldName>
<ns1:ObjectName>Item</ns1:ObjectName>
<ns1:LinkedCommand xsi:type="ns1:Key">
<ns1:FieldName>InventoryCD</ns1:FieldName>
<ns1:ObjectName>Item</ns1:ObjectName>
<ns1:Value>=[Item.InventoryCD]</ns1:Value>
</ns1:LinkedCommand>
</ns1:LinkedCommand>
</ns1:Command>
<ns1:Command xsi:type="ns1:Field">
<ns1:FieldName>Descr</ns1:FieldName>
<ns1:ObjectName>Item</ns1:ObjectName>
<ns1:Value>Description</ns1:Value>
</ns1:Command>
</ns1:commands>
<ns1:filters>
<ns1:Filter>
<ns1:Field>
<ns1:FieldName>Descr</ns1:FieldName>
<ns1:ObjectName>Item</ns1:ObjectName>
</ns1:Field>
<ns1:Condition>Contain</ns1:Condition>
<ns1:Value>TEST</ns1:Value>
<ns1:OpenBrackets>0</ns1:OpenBrackets>
<ns1:CloseBrackets>0</ns1:CloseBrackets>
<ns1:Operator>And</ns1:Operator>
</ns1:Filter>
</ns1:filters>
<ns1:topCount>5</ns1:topCount>
<ns1:includeHeaders>false</ns1:includeHeaders>
<ns1:breakOnError>false</ns1:breakOnError>
</ns1:Export>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
我发送此消息的PHP代码就是这个:
<?php
$context = new Screen("<URL>", array('trace' => TRUE));
$login = new Login();
$login->name = "<LOGINUSER>";
$login->password = "<LOGINPASS>";
$context->Login($login);
$IN202500 = $context->GetSchema(new GetSchema());
$clear = $context->Clear(new Clear());
$IN202500content = $IN202500->GetSchemaResult;
$field = new Field();
$field->FieldName = $IN202500content->StockItemSummary->Description->FieldName;
$field->ObjectName = $IN202500content->StockItemSummary->Description->ObjectName;
$filter = new Filter();
$filter->Field = $field;
$filter->Condition = FilterCondition::Contain;
$filter->Value = "TEST";
$filter->Operator = FilterOperator::_And;
$filter->OpenBrackets = 0;
$filter->CloseBrackets = 0;
$export = new Export();
$export->commands = array(
$IN202500content->StockItemSummary->InventoryID,
$IN202500content->StockItemSummary->Description
);
$export->topCount = 5;
$export->includeHeaders = false;
$export->breakOnError = false;
$export->filters = array(
$filter
);
$export_result = $context->Export($export);
?>
我收到的回复结果与未设置过滤器的结果相同。如何过滤描述的子字符串的结果?
答案 0 :(得分:0)
DateTime syncDate = new DateTime(2013,1,1);
context.IN202500Clear();
result = context.IN202500Export(
new Command[]
{
IN202500.StockItemSummary.ServiceCommands.EveryInventoryID,
IN202500.StockItemSummary.InventoryID,
IN202500.StockItemSummary.Description,
IN202500.WarehouseDetails.WarehouseWarehouseID,
IN202500.WarehouseDetails.QtyOnHand
},
new Filter[]
{
new Filter { Field = new Field { ObjectName = IN202500.StockItemSummary.ItemStatus.ObjectName, FieldName = IN202500.StockItemSummary.ItemStatus.FieldName }, Condition = FilterCondition.Equals, Value = "Active", Operator = FilterOperator.And },
new Filter { Field = new Field { ObjectName = IN202500.StockItemSummary.InventoryID.ObjectName, FieldName = "LastModifiedDateTime" }, Condition = FilterCondition.GreaterOrEqual, Value = syncDate.ToLongDateString(), Operator = FilterOperator.And },
},
0,false,false
);
//results
foreach (string[] item in result)
{
Console.WriteLine(
item[0] + ";" +
item[1] + ";" +
item[2] + ";" +
item[3] + ";"
);
}
答案 1 :(得分:0)
问题在于过滤器,最后是如何发送的。
发送的内容是:
<ns1:Value>TEST</ns1:Value>
而是需要指定一个类型和命名空间:
<ns1:Value xsi:type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema">TEST</ns1:Value>
否则,Acumatica将不会检测过滤器的值。
答案 2 :(得分:0)
我发现过滤器在默认屏幕上无法正常工作,它们仅适用于id字段。如果您创建了通用查询,则可以指定更多过滤器并将结果集缩小到所需的字段。此外,通用查询屏幕通常比标准默认屏幕运行得更快。