2017-07-07 79 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