Acumatica使用.net API创建销售订单
我正在使用Acumaticas基于合同的API,我需要创建一个新的销售订单。我正在使用C#,并已导入AcumaticaAPI服务参考。到目前为止,我已经能够查询一些数据,例如获取所有销售订单的列表。但我不知道如何通过API创建销售订单,也不知道如何在API中创建销售订单。以下是我获取销售订单列表的代码:Acumatica使用.net API创建销售订单,acumatica,Acumatica,我正在使用Acumaticas基于合同的API,我需要创建一个新的销售订单。我正在使用C#,并已导入AcumaticaAPI服务参考。到目前为止,我已经能够查询一些数据,例如获取所有销售订单的列表。但我不知道如何通过API创建销售订单,也不知道如何在API中创建销售订单。以下是我获取销售订单列表的代码: public HttpResponseMessage AddSalesOrder(int id) { var binding = new System.ServiceModel.Bas
public HttpResponseMessage AddSalesOrder(int id)
{
var binding = new System.ServiceModel.BasicHttpBinding()
{
AllowCookies = true,
MaxReceivedMessageSize = 655360000,
MaxBufferSize = 655360000
};
var address = new System.ServiceModel.EndpointAddress("http://acumaticasandbox.mydomain.com/TestCompany/entity/Default/5.30.001");
using (DefaultSoapClient client = new DefaultSoapClient(binding, address))
{
client.Login("myuser", "mypass", "Test Company", null, null);
Entity[] items = client.GetList(new SalesOrder(), false);
client.Logout();
return Request.CreateResponse(HttpStatusCode.OK, items);
}
}
-如何修改此代码以创建新的销售订单
-另外,是否有一种方法可以创建一批新的销售订单,例如通过销售订单对象数组或通过API导入的文件(csv)?您首先必须创建要插入系统中的销售订单对象
SalesOrder so = new SalesOrder
{
OrderType = new StringValue { Value = "SO" },
CustomerID = new StringValue { Value = "ABARTENDE" },
Details = new SalesOrderDetail[]
{
new SalesOrderDetail
{
InventoryID = new StringValue {Value = "AACOMPUT01" },
Quantity = new DecimalValue {Value = 2m }
},
new SalesOrderDetail
{
InventoryID = new StringValue {Value = "AALEGO500" },
Quantity = new DecimalValue {Value = 4m }
}
}
};
SalesOrder result = (SalesOrder)client.Put(so);
这些库存值取自演示数据
然后,您必须使用Put调用在系统中插入新的销售订单
SalesOrder so = new SalesOrder
{
OrderType = new StringValue { Value = "SO" },
CustomerID = new StringValue { Value = "ABARTENDE" },
Details = new SalesOrderDetail[]
{
new SalesOrderDetail
{
InventoryID = new StringValue {Value = "AACOMPUT01" },
Quantity = new DecimalValue {Value = 2m }
},
new SalesOrderDetail
{
InventoryID = new StringValue {Value = "AALEGO500" },
Quantity = new DecimalValue {Value = 4m }
}
}
};
SalesOrder result = (SalesOrder)client.Put(so);
当然,这是一个非常基本的销售订单。
如果查看销售订单端点定义中的所有字段,则可以将这些字段添加到正在创建的对象中,并同时插入
如果您可以访问Acumatica大学,那么与基于合同的API相关的课程是I210。
正如samol518所提到的,T210课程中有很多例子,包括阅读和写作给销售人员orders@Brendan,我现在正在经历它。谢谢你们的回复,伙计们!感谢您提供的代码和指向该资源的链接。我现在正在复习这门课。我相信这将是一个很大的帮助。一旦我确认答案有效,我就会接受。