首页 > 解决方案 > 我们如何在 Acumatica 中为自定义新屏幕添加通用搜索

问题描述

用户要求是为新屏幕添加通用搜索,在库存模块下添加了我们的新屏幕,新屏幕不是输入屏幕,它就像用户视图屏幕一样,因此在注释 id 字段的 DAC 中,我们添加了可搜索属性,但它确实不行。

有人可以帮我提供示例代码或纠正我做错的地方。还让我知道是否可以在 Acumatica 中为新屏幕添加可搜索属性?

提前致谢。

 #region Noteid
        public new abstract class noteid : PX.Data.BQL.BqlGuid.Field<noteid> { }
        protected Guid? _Noteid;
        [PXSearchable(PX.Objects.SM.SearchCategory.All , "{0}", new Type[] { typeof(KWLotSerialDetails.lotSerialNbr) },
            new Type[] { typeof(KWLotSerialDetails.lotSerialNbr), typeof(KWLotSerialDetails.inventoryID)},
            NumberFields = new Type[] { typeof(KWLotSerialDetails.lotSerialNbr) },
              Line1Format = "{0}{1}", Line1Fields = new Type[] { typeof(KWLotSerialDetails.lotSerialNbr), typeof(KWLotSerialDetails.inventoryID)},
              Line2Format = "{1}{2}", Line2Fields = new Type[] { typeof(KWLotSerialDetails.lotSerialNbr), typeof(KWLotSerialDetails.inventoryID) })]

        public virtual Guid? Noteid
        {
            get
            {
                return this._Noteid;
            }
            set
            {
                this._Noteid = value;
            }
        }
        #endregion

标签: acumaticaacumatica-kb

解决方案


您绝对可以将通用搜索添加到自定义表中。搜索被添加到 DAC,而不是屏幕,因此在“用户视图屏幕”中使用并不重要。重建全文索引时,您的 NoteID 字段将被处理到 SearchIndex 表中。

我可能错了,但我也认为您需要将 Noteid 字段转换为 NoteID/noteID 才能正常工作。C# 区分大小写,并且 FullIndexRebuild.cs 包含: entity.GetNestedType("noteID") ... 所以我认为它因此找不到您的 Noteid/noteid 字段。

我的自定义 PXSearchable NoteID 字段之一:

#region NoteID
[PXNote]
[PXSearchable(PX.Objects.SM.SearchCategory.IN, "{0}",
    new Type[] { typeof(SSINItemManufacturer.manufacturerItem) },
    new Type[] { typeof(SSINItemManufacturer.manufacturerItem) },
    NumberFields = new Type[] { typeof(SSINItemManufacturer.manufacturerItem) },
    Line1Format = "{0}", Line1Fields = new Type[] { typeof(SSINItemManufacturer.manufacturerItem) },
    Line2Format = "{0}", Line2Fields = new Type[] { typeof(SSINItemManufacturer.manufacturerItem) },
    WhereConstraint = typeof(Where<Current<SSINItemManufacturer.isActive>, NotEqual<False>>),
    MatchWithJoin = typeof(InnerJoin<InventoryItem, On<InventoryItem.inventoryID, Equal<SSINItemManufacturer.inventoryID>>>),
    SelectForFastIndexing = typeof(Select2<SSINItemManufacturer, InnerJoin<InventoryItem, On<SSINItemManufacturer.inventoryID, Equal<InventoryItem.inventoryID>>>>)
    )]
public virtual Guid? NoteID { get; set; }
public abstract class noteID : PX.Data.BQL.BqlGuid.Field<noteID> { }
#endregion

还要通过“重建全文实体”屏幕检查您的 DAC 是否“已知”。检查屏幕 SM209500 以确保您的 DAC 已列出,如果是,请尝试在其上重建全文索引。


推荐阅读