我如何搜索"位置"基于主要密钥,如BAccountID和LocationID通过Web服务API?

时间:2015-05-07 18:56:25

标签: c# acumatica

正如我在Is there any way to get BAccountID when searching Business Account, or update Business Account based on those primary keys through Web Service API?的另一个问题中指出的那样,我试图从BAccountID表中获取主要值,例如BAccount,这是我做的 - 感谢@Stan&# 39;帮助 - 现在我需要搜索"位置"基于BAccountIDLocationID,它们是"位置"中的两个主键。表;但是,我无法让它发挥作用。

有人可以帮我告诉我如何让它发挥作用吗? @Stan,你能帮我一次吗?

谢谢!

正如@ryanyuyu建议的那样,以下是我尝试但没有工作的内容:

CR303010Content CR303010 = context.CR303010GetSchema();
context.CR303010Clear();

List<Command> cmds = new List<Command>();
cmds.Add(CR303010.LocationSummary.ServiceCommands.EveryLocationID);

cmds.Add(CR303010.LocationSummary.LocationID);
cmds.Add(CR303010.LocationSummary.LocationName);

List<Filter> filters = new List<Filter>();

filters.Add(new Filter()
{             
   Field = NewA4Field(CR303010.LocationSummary.BusinessAccount.ObjectName, "BAccountID"), 
   Value = "8145",
   Condition = FilterCondition.Equals,
   Operator = FilterOperator.And
});
filters.Add(new Filter()
{
  Field = NewA4Field(CR303010.LocationSummary.LocationID.ObjectName, "LocationID"),
  Condition = FilterCondition.Equals,
  Value = "9488",
});
 var CR303010Export = context.CR303010Export(cmds.ToArray(), filters.ToArray(), 0, false, false);
public static apisalesorder.Field NewA4Field(string objName, string fldName)
{
        apisalesorder.Field nv = new apisalesorder.Field();
        nv.ObjectName = objName;
        nv.FieldName = fldName.TrimEnd();
        return nv;
}

1 个答案:

答案 0 :(得分:0)

正如@Gabriel建议的那样,我将使用客户代码和位置代码来获取位置信息,如果我确实需要获取基于主键的位置数据,我将使用通用查询。感谢Gabriel的帮助!