簡體   English   中英

在選擇器控制方面需要幫助

[英]Need help in selector control

我創建了一個選擇器控件,它顯示 INItemLotSerial 表中所有序列號的列表,它工作正常,問題是描述字段顯示 InventoryID,如何顯示 InventoryCD。 請看下面的示例代碼。

[PXSelector(typeof(Search<INItemLotSerial.lotSerialNbr>),
    new Type[] { typeof(INItemLotSerial.lotSerialNbr), typeof(INItemLotSerial.inventoryID) },
    SubstituteKey = typeof(INItemLotSerial.lotSerialNbr), DescriptionField = typeof(INItemLotSerial.inventoryID))]

// 我也加入了 InventoryItem 但這不起作用。

[PXSelector(typeof(Search2<INItemLotSerial.lotSerialNbr,
        LeftJoinSingleTable<InventoryItem, On<InventoryItem.inventoryID,Equal<INItemLotSerial.inventoryID>>>>),
    new Type[] { typeof(INItemLotSerial.lotSerialNbr), typeof(INItemLotSerial.inventoryID) },
    SubstituteKey = typeof(INItemLotSerial.lotSerialNbr), DescriptionField = typeof(InventoryItem.inventoryCD))]

在此處輸入圖片說明

DescriptionField屬性的主要問題是它正在等待從寫入Selector的同一個表中獲取字段。 但通常在ID/CD的情況下,除了主表外,CD不存在於ID存在的表中。

更新我已經刪除了以前的代碼(使用自定義屬性和 FieldSelecting 事件處理程序實現),因為它帶來了性能問題。 下面的代碼產生了相同的查找,但使用一個內部連接而不是前一個代碼所做的所有請求來獲取數據。

您可以執行以下操作以獲取帶有描述的查找:

  1. INItemLotSerialInventoryItem表上創建一個PXProjection ,如下所示:

     [PXCacheName("Lot Serials with Inventory CD")] [PXProjection(typeof(Select2<INItemLotSerial, InnerJoin<InventoryItem, On<INItemLotSerial.inventoryID, Equal<InventoryItem.inventoryID>>>>))] public class INItemLotSerialWithInventoryItem : IBqlTable { [PXDBInt(BqlField = typeof(INItemLotSerial.inventoryID))] [PXUIField(DisplayName = "Inventory ID", Visibility = PXUIVisibility.Visible, Visible = false)] public virtual int? InventoryID { get; set; } public abstract class inventoryID : IBqlField { } [PXDBString(InputMask = "", IsUnicode = true, BqlField = typeof(InventoryItem.inventoryCD))] [PXUIField(DisplayName = "Inventory ID")] public virtual string InventoryCD { get; set; } public abstract class inventoryCD : IBqlField { } [PXDBString(InputMask = "", IsUnicode = true, BqlField = typeof(INItemLotSerial.lotSerialNbr))] [PXUIField(DisplayName = "Lot/Serial Nbr")] public virtual string LotSerialNbr { get; set; } public abstract class lotSerialNbr : IBqlField { } }
  2. 將選擇器設置為使用此PXProjection如下所示:

     [PXSelector(typeof(Search<INItemLotSerialWithInventoryItem.lotSerialNbr>), new Type[] { typeof(INItemLotSerialWithInventoryItem.lotSerialNbr) }, SubstituteKey = typeof(INItemLotSerialWithInventoryItem.lotSerialNbr), DescriptionField = typeof(INItemLotSerialWithInventoryItem.inventoryCD))]

結果,您將得到如下查找: 在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM