acumatica - 选择器控件显示错误的列值

标签 acumatica

我创建了一个选择器控件,它显示 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))]

enter image description here

最佳答案

DescriptionField 属性的主要问题是它正在等待从写入 Selector 的同一个表中获取字段。但在ID/CD的情况下,通常除了主表之外,ID所在的表中不存在CD。

已更新我删除了以前的代码(使用自定义属性和 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))]
    

结果,您将得到如下所示的查找: enter image description here

关于acumatica - 选择器控件显示错误的列值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56977665/

相关文章:

acumatica - 从 REST API 获取组合框值集

acumatica - 注意 InventoryItem DAC 中的属性

c# - 我如何使用不同的提供商从 Acumatica ERP 发送短信?

acumatica - 创建代发货 PO 时更新 POOrder 中的用户定义字段

c# - 如何制作库存元素标签 (IN619200) 为收到的每件元素打印一个标签?

acumatica - 当我使用 Acumatica 代码在销售订单屏幕上单击自定义操作时,我们如何附加报告 PDF/Excel 文件

acumatica - 传递给 Avalara 的覆盖送货地址

json - Acumatica - 通过 Rest API 将必需的属性添加到新案例

acumatica - 如何在选择器查找中显示图像?

acumatica - 如何将操作和处理程序添加到“处理货件”屏幕?