2016-04-14 5 views
0

在庫オーダーの属性を受注と購買発注に追加したいのですが、どのように知っていますか?または任意のアイデア?在庫照会の属性フィールドの追加

+1

何を試しましたか? –

+0

私はSales Orderで作業しようとしましたが、SOSiteFilterStatus DACを定数値に設定しようとしましたが、アイテムクラスに必要な属性に応じて動的に追加する場所はありません。 – xxxAcuGeekxxx

+0

在庫値の属性値ですか? – Hybridzz

答えて

3

アウトオブボックスを利用したSelectorとGrid Controlに属性列を含めるには、次のコード例を参照してください。CRAttributesFieldAttribute

CRAttributesFieldAttributeから継承したPXAddAtttributeColumnsを宣言するクラス。 Inventory Look up内の列などの属性を含めるには

public class PXAddAtttributeColumns : CRAttributesFieldAttribute 
{ 
    string[] _names; 
    bool _IsForSelector; 

    public PXAddAtttributeColumns(string[] names, Type entityType, Type entityIDField, Type classIDField, bool IsForSelector = true) 
     : base(entityType, entityIDField, classIDField) 
    { 
     _names = names; 
     _IsForSelector = IsForSelector; 
    } 

    public override void CacheAttached(PXCache sender) 
    { 
     this._IsActive = true; 
     base.CacheAttached(sender); 
    } 

    protected override void AttributeFieldSelecting(PXCache sender, PXFieldSelectingEventArgs e, PXFieldState state, string attributeName, int idx) 
    { 
     if (_names.Any(attributeName.Equals)) 
     { 
      //Out-of-box DisplayName is prefixed with "$Attributes$-" - if you need to take that off. 
      state.DisplayName = (!String.IsNullOrEmpty(state.DisplayName)) ? (state.DisplayName.Replace("$Attributes$-", "")) : attributeName; 
      state.Visible = true; 
      //Requires AutoGenerateColumns="AppendDynamic" for PXGrid Control for dynamic Attribute columns creation 
      state.Visibility = (_IsForSelector) ? PXUIVisibility.SelectorVisible : PXUIVisibility.Dynamic; 
     } 
     base.AttributeFieldSelecting(sender, e, state, attributeName, idx); 
    } 

    public override void CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e) 
    { 
     base.CommandPreparing(sender, e); 

     if (e.BqlTable == null && aggregateAttributes && sender.GetItemType().IsDefined(typeof(PXProjectionAttribute), true)) 
     { 
      e.BqlTable = _BqlTable; 
     } 
    } 
} 

、以下のようにDAC拡張を宣言します。

public class InventoryItemPXExt : PXCacheExtension<PX.Objects.IN.InventoryItem> 
{ 
    #region Attributes 

    public abstract class attributes : IBqlField { } 

    [PXAddAtttributeColumns(new[] { "ASSETID", "HWMODEL" }, 
      typeof(CSAnswerType.inventoryAnswerType), 
      typeof(InventoryItem.inventoryID), 
      typeof(InventoryItem.itemClassID))] 
    public virtual string[] Attributes { get; set; } 

    #endregion 
} 

フィールドは以下のように表示されます:

enter image description here

検索が属性に有効にすることができます設定した列数FilterByAllFieldsTrue

内の列などの属性を含めるには

enter image description here

、以下のようにDAC拡張を宣言します。

public class SOLineExtension : PXCacheExtension<SOLine> 
{ 
    public abstract class itemAttributes : IBqlField { } 

    [PXAddAtttributeColumns(new[] { "ASSETID", "HWMODEL" }, 
      typeof(CSAnswerType.inventoryAnswerType), 
      typeof(SOLine.inventoryID), 
      typeof(InventoryItem.itemClassID), false)] 
    public virtual string[] ItemAttributes { get; set; } 
} 

PXGrid制御の動的属性列の作成

enter image description here

ためAutoGenerateColumns="AppendDynamic"を指定してくださいフィールドは次のように表示されます:

ダイアログのグリッド内の列などの属性を含めるには

enter image description here

、以下のようにDAC拡張を宣言します。

public class SOSiteStatusSelectedExtension : PXCacheExtension<SOSiteStatusSelected> 
{ 
    public abstract class itemAttributes : IBqlField { } 

    [PXAddAtttributeColumns(new[] { "ASSETID", "HWMODEL" }, 
      typeof(CSAnswerType.inventoryAnswerType), 
      typeof(InventoryItem.inventoryID), 
      typeof(InventoryItem.itemClassID), false)] 
    public virtual string[] ItemAttributes { get; set; } 
} 

PXGrid制御の動的属性列の作成

enter image description here

ため AutoGenerateColumns="AppendDynamic"を指定してください

フィールドは次のように表示されます:

enter image description here

注:この例では、5.3シリーズに適用される - 1367年5月30日以降をビルドします。

+0

ありがとう!これは問題を解決しました!! – xxxAcuGeekxxx

関連する問題