我们如何在 Acumatica 中添加对自定义新屏幕的通用搜索

How can we add universal search for the custom new screens in Acumatica

用户要求为新屏幕添加通用搜索,在库存模块下添加了我们的新屏幕,新屏幕也不是入口屏幕,它就像用户视图屏幕一样,所以在 DAC 中我们添加了注释 id 字段可搜索属性,但它不起作用。

谁能帮我提供示例代码或纠正我做错的地方。 另外让我知道是否可以在 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

您绝对可以将通用搜索添加到自定义 table 中。搜索被添加到 DAC,而不是屏幕,因此在 "user view screen" 中使用并不重要。当重建全文索引时,你的 NoteID 字段被处理到 SearchIndex table.

我可能错了,但我也认为您需要将 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

同时通过 "Rebuild Full-Text Entity" 屏幕检查您的 DAC 是否为 "known"。检查屏幕 SM209500 以确保您的 DAC 已列出,如果是,请尝试在其上重建全文索引。