0
SOOrderEntryグラフオブジェクトを使用してPO画面から受注を作成しようとしています。このエラーが来ている理由を私は設定していますので、私は、把握することはできませんグラフオブジェクトを使用して受注を作成するときのエラー
:私は別のスタックオーバーフローのケースからの技術を使用してブランチを選択するよ、と私は継続的に次のエラーを取得しますCustomerID。ここでは、コードです:
public class POOrderEntryExt : PXGraphExtension<POOrderEntry>
{
public override void Initialize()
{
Base.action.AddMenuAction(CreateSO);
}
public PXAction<POOrder> CreateSO;
[PXUIField(DisplayName = "Create Sales Order", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
[PXButton]
protected virtual void createSO()
{
SOOrderEntry sograph = null;
SOOrder soorder = null;
SOLine soline = null;
//Let's get the current data from the screen we're in...
var poorder = (POOrder)Base.Document.Current;
PXResultset<POLine> res = PXSelect<POLine, Where<POLine.orderNbr, Equal<Required<POLine.orderNbr>>>>.Select(Base, poorder.OrderNbr);
using (PXLoginScope ls = new PXLoginScope("admin"))
{
//Create a new instance of the AP Bills screen graph..
sograph = PXGraph.CreateInstance<SOOrderEntry>();
//Get the branch...
var branch = (Branch)PXSelect<Branch, Where<Branch.branchCD, Equal<Required<Branch.branchCD>>>>.Select(Base, "WI-NVC VET");
//soorder.BranchID = branch.BranchID;
//This handler is added per RD from another Stack Overflow case. It's necessary to select the Branch...
sograph.FieldDefaulting.AddHandler<SOOrder.branchID>((s, e) =>
{
e.NewValue = branch.BranchID;
e.Cancel = true;
});
soorder = new SOOrder();
//The OrderType...
soorder.OrderType = SOOrderTypeConstants.SalesOrder;
sograph.Document.Insert(soorder);
soorder.OrderDate = (DateTime?)DateTime.Now;
soorder.RequestDate = (DateTime?)DateTime.Now;
//Get the customer id...
var bacct = (BAccountR)PXSelect<BAccountR, Where<BAccountR.acctCD, Equal<Required<BAccountR.acctCD>>>>.Select(Base, "NE-C003118");
soorder.CustomerID = bacct.BAccountID; // (int?)5454;
sograph.Document.Update(soorder);
sograph.Actions.PressSave();
、ルスラン - おかげで非常に! :D – pmfith
あなたは大歓迎です、ピーター! :-) – RuslanDev