2016-08-29 9 views

答えて

0

がSOOrderEntryためのグラフの拡張を作成し、このようにアクションメソッドを追加します。SOOrderEntryのアクションのいずれかが(でも、プロセス指図画面を通じて)実行されると

using PX.Data; 
using System.Collections; 

namespace PX.Objects.SO 
{ 

    public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry> 
    { 
     public PXAction<SOOrder> action; 
     [PXUIField(DisplayName = "Actions", MapEnableRights = PXCacheRights.Select)] 
     [PXButton] 
     protected virtual IEnumerable Action(PXAdapter adapter, 
      [PXInt] 
      [PXIntList(new int[] { 1, 2, 3, 4, 5 }, new string[] { "Create Shipment", "Apply Assignment Rules", "Create Invoice", "Post Invoice to IN", "Create Purchase Order" })] 
      int? actionID, 
      [PXDate] 
      DateTime? shipDate, 
      [PXSelector(typeof(INSite.siteCD))]   
      string siteCD, 
      [SOOperation.List] 
      string operation, 
      [PXString()] 
      string ActionName) 
     { 
      //actionID = 1 means the CreateShipment action was the one invoked 
      if (actionID == 1) 
      { 
       PXGraph.InstanceCreated.AddHandler<SOShipmentEntry>((graph) => 
       { 
        graph.RowInserting.AddHandler<SOShipment>((sender, e) => 
        { 
         //Custom logic goes here 
         var shipment = (SOShipment)e.Row; 
         var shipmentExt = PXCache<SOShipment>.GetExtension<SOShipmentExt>(shipment); 
         if (Base.Document.Current != null && shipmentExt != null) 
         { 
          shipmentExt.UsrPriority = Base.Document.Current.Priority; 
         } 
        }); 
       }); 
      } 

      //calls the basic action that was invoked 
      return Base.action.Press(adapter); 
     } 
    } 
} 

、このメソッドが呼び出されます。アクションは実際にはactionID == 1でCreateShipmentであることを確認し、SOShipmentEntryグラフの作成とSOShipment RowInsertingのイベントハンドラを追加します。カスタムロジックがRowInsertingイベントの内部に追加されます。

+0

同様に、承認ボタンにカスタムロジックを追加できますか?例:請求画面(RQ302000) – Hybridzz

+0

http://stackoverflow.com/questions/39261417/how-to-confirm-the-action-clicked-is-the-expected-action-when-we-add-custom-logi – Hybridzz

関連する問題