2015-05-06 107 views
1

你好,我試圖通過使用SOOrderEntry圖表來保存銷售訂單,但我相信我在我的字段中缺少一些阻止它插入的東西。使用圖表插入銷售訂單

這裏是我的代碼中插入銷售訂單,客戶和項目,我從代碼較早使用PXSelect得到

PX.Objects.SO.SOOrderEntry graph = PXGraph.CreateInstance<PX.Objects.SO.SOOrderEntry>(); 
      graph.Clear(PXClearOption.ClearAll); 

      PX.Objects.SO.SOOrder order = new PX.Objects.SO.SOOrder(); 

      graph.Document.Current = order; 
      order.OrderType = "SO"; 
      order = graph.Document.Insert(order); 

      order.OrderDate = DateTime.Now; 
      order.RequestDate = DateTime.Now; 
      order.Status = "N"; 

      order.CustomerID = cust.BAccountID; 
      order.ProjectID = project.ID; 

      graph.Document.Update(order); 
      graph.Actions.PressSave(); 
+1

你是否收到任何錯誤信息? – HDanh

回答

0

試試這個

 PX.Objects.SO.SOOrderEntry graph = PXGraph.CreateInstance<PX.Objects.SO.SOOrderEntry>();   

     PX.Objects.SO.SOOrder Sorder = new PX.Objects.SO.SOOrder(); 

     Sorder.OrderType = SOOrderTypeConstants.SalesOrder; 
     Sorder = graph.Document.Insert(Sorder); 

     Sorder.OrderDate = DateTime.Now; 
     Sorder.RequestDate = DateTime.Now; 
     Sorder.Hold = false; 

     Sorder.CustomerID = cust.BAccountID; 
     Sorder.ProjectID = project.ID; 

     graph.Document.Update(Sorder); 
     graph.Actions.PressSave(); 

如果有錯誤,請提什麼是嗎。