2017-07-07 122 views
0

我有一個顯示名爲「塗層」的項目屬性的字段。我通過佈局編輯器將此字段添加到兩個現有的我自定義的屏幕:銷售價格和銷售價格工作表頁面。在銷售價格工作表頁面,該塗層顯示就好了:屬性字段不顯示所有頁面上的屬性值

enter image description here

然而,銷售價格頁面上,他們不這樣做:

enter image description here

我有相同的元素在包含在相關網格中的佈局編輯器中進行頁面自定義:InventoryItem__COATING_Attributes。檢查元素的屬性選項卡,它們都具有相同的代碼:

protected string[] _Attributes; 

/// <summary> 
/// Reserved for internal use. 
/// Provides the values of attributes associated with the item. 
/// For more information see the <see cref="CSAnswers"/> class. 
/// </summary> 
[CRAttributesField(typeof(InventoryItem.itemClassID))] 

據我所知,一切是完全一樣的。我甚至檢查了爲這兩個頁面的select語句發送的查詢結果,並且他們正確地返回類似的語句來顯示每個元素的塗層。

任何想法,爲什麼這不工作?

+0

此字段是否保存在數據庫中? –

+0

是的,它被從CSAnswers表中拉出。它是一個項目屬性。 –

+0

屬性正在使用圖形的緩存。如果在緩存中沒有收集CSAnswers屬性將不起作用。嘗試添加'PXSelect '到屬性不起作用的圖表 –

回答

1

我假定屬性適用於銷售價格工作表爲使用的顯示器由於張貼在another thread樣品,並宣佈爲ARPriceWorksheetMaint.Details數據視圖中缺少委託:

public class ARPriceWorksheetMaint : PXGraph<ARPriceWorksheetMaint, ARPriceWorksheet> 
{ 
    ... 
    [PXImport(typeof(ARPriceWorksheet))] 
    public PXSelectJoin<ARPriceWorksheetDetail, 
      LeftJoin<InventoryItem, On<InventoryItem.inventoryID, Equal<ARPriceWorksheetDetail.inventoryID>>>, Where<ARPriceWorksheetDetail.refNbr, Equal<Current<ARPriceWorksheet.refNbr>>>, 
      OrderBy<Asc<ARPriceWorksheetDetail.priceType, Asc<ARPriceWorksheetDetail.priceCode, Asc<InventoryItem.inventoryCD, Asc<ARPriceWorksheetDetail.breakQty>>>>>> Details; 
    ... 
} 

在銷售價格屏幕不過,有一個記錄()代表返回只有ARSalesPrice DAC的情況下,防止屬性從數據庫中獲取其值:

public virtual IEnumerable records() 
{ 
    ... 
    foreach (PXResult<ARSalesPrice> res in QSelect(this, Records.View.BqlSelect, new object[] { filter.PriceType, filter.PriceType, filter.PriceType == PriceTypes.Customer ? priceCode : null, filter.PriceType == PriceTypes.CustomerPriceClass ? priceCode : null, priceCode, filter.InventoryID, filter.InventoryID, filter.EffectiveAsOfDate, filter.EffectiveAsOfDate, filter.EffectiveAsOfDate, filter.ItemClassID, filter.ItemClassID, filter.InventoryPriceClassID, filter.InventoryPriceClassID, filter.OwnerID, filter.OwnerID, filter.MyWorkGroup, filter.WorkGroupID, filter.WorkGroupID })) 
    { 
     ARSalesPrice price = res; 
     yield return price; 
    } 
    ... 
} 

爲了顯示銷售價格屏幕上的屬性,您應修改記錄數據視圖並覆蓋其委託以返回ARSalesPrice和InventoryItem DAC的實例:

public class ARSalesPriceMaintExt : PXGraphExtension<ARSalesPriceMaint> 
{ 
    [PXFilterable] 
    public PXSelectJoin<ARSalesPrice, 
     LeftJoin<InventoryItem, On<InventoryItem.inventoryID, Equal<ARSalesPrice.inventoryID>>>, 
     Where<InventoryItem.itemStatus, NotEqual<INItemStatus.inactive>, 
     And<InventoryItem.itemStatus, NotEqual<INItemStatus.toDelete>, 
     And2<Where<Required<ARSalesPriceFilter.priceType>, Equal<PriceTypes.allPrices>, Or<ARSalesPrice.priceType, Equal<Required<ARSalesPriceFilter.priceType>>>>, 
     And2<Where<ARSalesPrice.customerID, Equal<Required<ARSalesPriceFilter.priceCode>>, Or<ARSalesPrice.custPriceClassID, Equal<Required<ARSalesPriceFilter.priceCode>>, Or<Required<ARSalesPriceFilter.priceCode>, IsNull>>>, 
     And2<Where<ARSalesPrice.inventoryID, Equal<Required<ARSalesPriceFilter.inventoryID>>, Or<Required<ARSalesPriceFilter.inventoryID>, IsNull>>, 
     And2<Where2<Where2<Where<ARSalesPrice.effectiveDate, LessEqual<Required<ARSalesPriceFilter.effectiveAsOfDate>>, Or<ARSalesPrice.effectiveDate, IsNull>>, 
     And<Where<ARSalesPrice.expirationDate, GreaterEqual<Required<ARSalesPriceFilter.effectiveAsOfDate>>, Or<ARSalesPrice.expirationDate, IsNull>>>>, 
     Or<Required<ARSalesPriceFilter.effectiveAsOfDate>, IsNull>>, 
     And<Where2<Where<Required<ARSalesPriceFilter.itemClassID>, IsNull, 
       Or<Required<ARSalesPriceFilter.itemClassID>, Equal<InventoryItem.itemClassID>>>, 
      And2<Where<Required<ARSalesPriceFilter.inventoryPriceClassID>, IsNull, 
       Or<Required<ARSalesPriceFilter.inventoryPriceClassID>, Equal<InventoryItem.priceClassID>>>, 
      And2<Where<Required<ARSalesPriceFilter.ownerID>, IsNull, 
       Or<Required<ARSalesPriceFilter.ownerID>, Equal<InventoryItem.priceManagerID>>>, 
      And2<Where<Required<ARSalesPriceFilter.myWorkGroup>, Equal<False>, 
        Or<InventoryItem.priceWorkgroupID, InMember<CurrentValue<ARSalesPriceFilter.currentOwnerID>>>>, 
      And<Where<Required<ARSalesPriceFilter.workGroupID>, IsNull, 
       Or<Required<ARSalesPriceFilter.workGroupID>, Equal<InventoryItem.priceWorkgroupID>>>>>>>>>>>>>>>, 
      OrderBy<Asc<ARSalesPrice.inventoryID, 
        Asc<ARSalesPrice.priceType, 
        Asc<ARSalesPrice.uOM, Asc<ARSalesPrice.breakQty, Asc<ARSalesPrice.effectiveDate>>>>>>> Records; 


    public IEnumerable records() 
    { 
     var startRow = PXView.StartRow; 
     int totalRows = 0; 

     foreach (ARSalesPrice salesPrice in Base.Records.View.Select(PXView.Currents, PXView.Parameters, PXView.Searches, 
      PXView.SortColumns, PXView.Descendings, PXView.Filters, ref startRow, PXView.MaximumRows, ref totalRows)) 
     { 
      var item = PXSelectorAttribute.Select<ARSalesPrice.inventoryID>(Records.Cache, salesPrice) as InventoryItem; 
      var res = new PXResult<ARSalesPrice, InventoryItem>(salesPrice, item); 
      yield return res; 
     } 
     PXView.StartRow = 0; 
    } 
} 
+0

魯斯蘭,你是Acumatica嚮導!非常感謝!這很好用! –

+0

我的榮幸,埃裏克:-) – RuslanDev