我正在尝试通过图形插入销售订单我的代码可以使用,但无法插入数据库这是我创建销售订单的代码。我正在使用 Acumatica 4.0
void genSO(string outletCD,string salesmanCD)
{
Customer cus =
PXSelect<Customer, Where<Customer.acctCD, Equal<Required<Customer.acctCD>>>>
.Select(this, outletCD);
SalesPerson salesman=
PXSelect<SalesPerson, Where<SalesPerson.salesPersonCD, Equal<Required<SalesPerson.salesPersonCD>>>>
.Select(this, salesmanCD);
if (cus != null && cus.BAccountID != null )
{
SOOrderEntry graph = PXGraph.CreateInstance<SOOrderEntry>();
SOOrder newOrder = graph.Document.Insert();
newOrder.OrderType = "SO";
newOrder.OrderDate=DateTime.Now;
newOrder.RequestDate = DateTime.Now;
newOrder.CustomerID = cus.BAccountID;
graph.Document.Cache.RaiseFieldUpdated<SOOrder.customerID>(newOrder, null);
newOrder.SalesPersonID = smNPP.SalesPersonID;
graph.Document.Cache.RaiseFieldUpdated<SOOrder.salesPersonID>(newOrder, null);
newOrder.Status = "N";
graph.Document.Current = newOrder;
graph.Document.Cache.Update(newOrder);
graph.Actions.PressSave();
}
}
谢谢你的帮助。