如何使用API​​在Acumatica中添加货件(SO302000)

时间:2015-01-08 23:34:52

标签: acumatica

有人可以通过在Acumatica(版本4或更高版本)中添加销售订单来帮助我创建货件。 我尝试了以下代码但没有成功:



SO302000Content SO302000 = context.SO302000GetSchema();
context.SO302000Clear();

Command[] commands = new Command[] {
  new Value { Value = "ABCSTUDIOS", LinkedCommand = SO302000.ShipmentSummary.Customer },
  new Value { Value = "09/01/2015", LinkedCommand = SO302000.ShipmentSummary.ShipmentDate },
  new Value { Value = "MAIN", LinkedCommand = SO302000.ShipmentSummary.Location },
  new Value { Value = "RESALE", LinkedCommand = SO302000.ShipmentSummary.WarehouseID },

  new Value { Value = "SO", LinkedCommand = SO302000.AddSalesOrderOperation.OrderType },
  new Value { Value = "000211", LinkedCommand = SO302000.AddSalesOrderOperation.OrderNbr },
    
  SO302000.AddSalesOrder.InventoryID,
  SO302000.AddSalesOrder.Location,
  SO302000.AddSalesOrder.OpenQty,
  SO302000.AddSalesOrder.OrderQty                
};

var results = context.SO302000Submit(commands);
if (results != null && results.Length > 0)
{
  int line = 0;
  List<Command> cmds = new List<Command>();
  foreach (var row in results)
  {
    cmds.Add(new Value { 
                 Value = line.ToString(), 
                 LinkedCommand = SO302000.AddSalesOrder.ServiceCommands.RowNumber }
            );
    cmds.Add(new Value { 
                 Value = "True", 
                 LinkedCommand = SO302000.AddSalesOrder.Selected, 
                 Commit = true }
            );
    line++;
  }

  cmds.Add(SO302000.Actions.AddSO);
  context.SO302000Submit(cmds.ToArray());                

  cmds.Clear();                
  cmds.Add(SO302000.Actions.Save);
  cmds.Add(SO302000.Actions.ActionConfirmShipment);                
  results = context.SO302000Submit(cmds.ToArray());                
}
&#13;
&#13;
&#13;

结果是来自Acumatica的错误,例如&#34;查看AddSOFilter不存在&#34;如下所述:

System.Web.Services.Protocols.SoapException:服务器无法处理请求。 ---&GT; PX.Data.PXException:错误#97:查看addsofilter不存在。    位于c:\ Builders \ 4_10-2013_12_2-4_0_9-Auto \ Scripts \ BuildTemp \ NetTools \ PX.Data \ Graph \ Collection.cs中的PX.Data.PXViewCollection.get_Item(String key):第806行    at PX.Api.SyImportProcessor.SyStep.SelectRows(String viewName,PXFilterRow [] filters,Int32 topCount,Boolean bypassInserted)在c:\ Builders \ 4_10-2013_12_2-4_0_9-Auto \ Scripts \ BuildTemp \ NetTools \ PX.Data \ Api \ Export \ SyImport \ ImportProcessor.cs:第2521行    位于c:\ Builders \ 4_10-2013_12_2-4_0_9-Auto \ Scripts \ BuildTemp \ NetTools \ PX中的PX.Api.SyImportProcessor.ExportTableHelper.a(SyStep A_0,GrowingTable A_1,SyCommand A_2,PXFilterRow [] A_3,Int32 A_4)。 Data \ Api \ Export \ SyImport \ ImportProcessor.cs:第1212行    位于c:\ Builders \ 4_10-2013_12_2-4_0_9-Auto \ Scripts \ BuildTemp \ NetTools \ PX.Data \ Api \ Export \ SyImport \ ImportProcessor.cs:line 675中的PX.Api.SyImportProcessor.ExportTableHelper.ExportTable()    在ScreenApi.ScreenGate.Submit(Command []命令,SchemaMode schemaMode,PXGraph图表)c:\ Builders \ 4_10-2013_12_2-4_0_9-Auto \ Scripts \ BuildTemp \ NetTools \ PX.Data \ Api \ Export \ ScreenGate.cs: 1323行    在ScreenApi.ScreenGate.Submit(Command []命令)中的c:\ Builders \ 4_10-2013_12_2-4_0_9-Auto \ Scripts \ BuildTemp \ NetTools \ PX.Data \ Api \ Export \ ScreenGate.cs:第1027行    ---内部异常堆栈跟踪结束---

谢谢, ģ

1 个答案:

答案 0 :(得分:0)

尝试下一个例子

            SO302000Content SO302000 = context.SO302000GetSchema();
        context.SO302000Clear();

        SO302000.Actions.AddSO.Commit = true;
        //SO302000.AddSalesOrder.Selected.LinkedCommand = null;
        //SO302000.DocumentDetails.InventoryID.LinkedCommand = null;

        var result2 = context.SO302000Submit(new Command[]
            {
                new Value { Value = "000332", LinkedCommand = SO302000.ShipmentSummary.ShipmentNbr }, //navigate

                new Value { Value = "SO", LinkedCommand = SO302000.AddSalesOrderOperation.OrderType },                    
                new Value { Value = "000531", LinkedCommand = SO302000.AddSalesOrderOperation.OrderNbr, Commit = true  },                      

                new Value { Value = "OK", LinkedCommand = SO302000.AddSalesOrderOperation.ServiceCommands.DialogAnswer, Commit = true },
                new Value { Value = "OK", LinkedCommand = SO302000.AddSalesOrder.ServiceCommands.DialogAnswer, Commit = true },
                new Key { Value = "='CPU00004'", FieldName = SO302000.AddSalesOrder.InventoryID.FieldName, ObjectName = SO302000.AddSalesOrder.InventoryID.ObjectName },                    
                new Value { Value = "True", LinkedCommand = SO302000.AddSalesOrder.Selected, Commit = true },                    
                SO302000.Actions.AddSO,                     
                SO302000.Actions.Save
            });