将INItemXRef添加到带有库存物料的全局搜索

时间:2019-01-06 23:33:56

标签: acumatica

我正在尝试将INItemXRef的替代ID添加到库存项目配置文件的全局搜索中。这是一对多的关系,因为可以有不同的替代ID的各种供应商和度量单位。

对于每个Acumatica,我尝试用带有以下代码的join匹配项来替换库存商品的NoteID:

[PXSearchable(SM.SearchCategory.IN, "{0}: {1}", new Type[] { 
  typeof(InventoryItem.itemType), typeof(InventoryItem.inventoryCD) },
  new Type[] { typeof(InventoryItem.descr) },
  NumberFields = new Type[] { typeof(InventoryItem.inventoryCD) },
  Line1Format = "{0}{1}{2}", Line1Fields = new Type[] { 
    typeof(INItemClass.itemClassCD), typeof(INItemClass.descr), 
    typeof(INItemXRef.alternateID) },
  Line2Format = "{0}", Line2Fields = new Type[] { 
    typeof(InventoryItem.descr)},
  MatchWithJoin = typeof(RightJoin<INItemXRef, On<INItemXRef.inventoryID, 
    Equal<InventoryItem.inventoryID>>>),
  WhereConstraint = typeof(Where<Current<InventoryItem.itemStatus>, 
  NotEqual<InventoryItemStatus.unknown>>)
)]
[PXNote(PopupTextEnabled = true)]

我还遵循了问题How to include field from a linked entity into Full-Text Entity Index?

中的示例

我在库存商品的DAC扩展中对此的代码是:

public partial class INItemXRef: PX.Data.IBqlTable
{  
  //, IPaymentTypeDetailMaster, ILocation
    public abstract class inventoryID: IBqlField { }
    [PXDBInt()]
    [PXDBChildIdentity(typeof(INItemXRef.inventoryID))]
    [PXUIField(DisplayName = "Xref ID", Visibility = PXUIVisibility.Invisible)]
    [PXSelector(typeof(Search<INItemXRef.inventoryID>), DirtyRead = true)]
    public virtual int? InventoryID{ get; set; } 
    //public virtual void InventoryItem_InventoryID_CacheAttached(PXCache sender)
    //{
    //} 

    public abstract class alternateID: IBqlField { }
    [PXDBString()]
    [PXUIField(DisplayName = "Alternate ID")]
    public virtual int? AlternateID{ get; set; }              
}

但是,正确的方法仍然存在并且存在问题。有建议使用CacheAttached,但我也无法使它工作。

是否确实需要附加高速缓存,或者我是否缺少包含链接实体的内容?

目的是搜索特定的库存物料并获取它们所具有的物料和备用ID,这意味着一个物料在全局搜索中可能会出现多次。如果出现问题,我还要确保重置IIS并重建全文本索引。

0 个答案:

没有答案