2017-05-12 33 views
0

同じロット/シリアル番号(スクリーンショット1)を使用して、シリアル化されたアイテムのユニット単価からSOLineのカスタム列(ユーザー定義コスト)を購入する必要があります。商品がロット/シリアルナンバー(スクリーンショット2)に分割されている場合、ロット/シリアルナンバーに基づいて読み取らなければならない単位コストは、ユーザーがSOLineアイテムに入力します。カスタムフィールドのシリアライズされたアイテムの単価を計算するSOLine

私はすでに、項目が分割されていないのに、分割された直列化項目があるかどうかを調べる方法がわからない場合は、処理するSOLine_RowPersistingイベントを記述しています。以下はSOLine_RowPersistingイベントのコードです。提案してください。

protected virtual void SOLine_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) 
{ 
    SOLine row = (SOLine)e.Row; 
    if (row == null) 
     return; 

    if (!string.IsNullOrEmpty(row.LotSerialNbr)) 
    { 
     SOOrderEntry graph = PXGraph.CreateInstance<SOOrderEntry>(); 

     //select UnitCost, * from POReceiptLine where CompanyID = 2 and ReceiptNbr = 'PR004082' and InventoryID = '8502' and LotSerialNbr = 'SUB365' 
     //select LotSerialNbr, * from POReceiptLineSplit where CompanyID = 2 and InventoryID = '8502' and LotSerialNbr = 'SUB1704270366' 

     //TODO : How to get it from POReceiptLineSplit also 

     POReceiptLine poRow = PXSelect<POReceiptLine, 
         Where<POReceiptLine.inventoryID, Equal<Required<POReceiptLine.inventoryID>>, 
          And<POReceiptLine.lotSerialNbr, Equal<Required<POReceiptLine.lotSerialNbr>>, 
          And<POReceiptLine.pOType, Equal<Required<POReceiptLine.pOType>>>>>>.Select(graph, row.InventoryID, row.LotSerialNbr, "RO"); 

     SOLineExtension ext = PXCache<SOLine>.GetExtension<SOLineExtension>(row); 
     ext.UsrUserDefinedCost = poRow.UnitCost; 
    } 
} 

スクリーンショット1: - enter image description here スクリーンショット2: - enter image description here

+0

現在の行の割り当てを取得し、あなたが必要なものを行うためにBQLを使用することができますPOReceiptLines.YouためソリンとPOReceiptLineSplitの配分であるSOLineSplitsがあります。 –

答えて

0

はPOReceiptEntry拡張にSOOrder拡張とPOReceiptLine_RowSelectedに拡張する必要があります。以下のコードは、購買領収書から単価を得るのに役立ちます。

POReceiptLine poRow = PXSelectJoin<POReceiptLine, 
 
\t LeftJoin<POReceiptLineSplit, 
 
\t \t On<POReceiptLine.receiptNbr, Equal<POReceiptLineSplit.receiptNbr>, 
 
\t \t \t And<POReceiptLine.inventoryID, Equal<POReceiptLineSplit.inventoryID>, 
 
\t \t \t And<POReceiptLine.lineNbr, Equal<POReceiptLineSplit.lineNbr>>>>>, 
 
\t Where<POReceiptLine.inventoryID, Equal<Required<POReceiptLine.inventoryID>>, 
 
\t \t \t And<POReceiptLineSplit.lotSerialNbr, Equal<Required<POReceiptLineSplit.lotSerialNbr>>, 
 
\t \t \t And<POReceiptLine.receiptType, Equal<Required<POReceiptLine.receiptType>>>>>>.Select(graph, row.InventoryID, row.LotSerialNbr, "RT");

0

あなたがベースDACの '分割' のDataViewからPOReceiptLineSplitレコードに繰り返すことができます。

これを行うには、Acumaticaでグリッドを開き、Ctrl + Altを押しながらクリックします。これにより、グリッドに含まれるレコードのDAC名がポップアップ表示されます。 DAC

カスタマイズプロジェクトを選択します。 'Grid:split'をクリックすると、グリッドのDataMemberプロパティが 'split'になります。これは、BaseクラスのDataViewの名前です。 DataView

この情報を使用すると、グリッドの内容をグラフ拡張から反復できます。拡張子の中からベースグラフを参照するため、Baseプレフィックスを使用することに注意してください。これは、イベントSOLineSplit_LotSerialNbr_FieldUpdatedさ

       foreach (POReceiptLineSplit split in Base.splits.Select()) 
       { 
          PXTrace.WriteInformation("ReceiptNbr: {0}{1}LineNbr: {2}{3}SplitLineNbr: {4}", 
                                   split.ReceiptNbr, Environment.NewLine, 
                                   split.LineNbr, Environment.NewLine, 
                                   split.SplitLineNbr); 
       } 
+0

この情報で、SOのカスタムフィールドの値を更新するには – Krunal

+0

フィールドがバインドされているかどうかにかかわらず、ユースケースによって異なります。私はあなたが持っていると見る:SOLineExtension ext = PXCache .GetExtension (行); ext.UsrUserDefinedCost = poRow.UnitCost; –

+0

データベースに保持するには、次のものを追加する必要があります。PXCache .Update(row);これらの行の下。 –

関連する問題