You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Acumatica的PXSelector中通过BQL JOIN显示默认仓库名称

解决方案:在PXSelector中显示默认激活仓库名称

要实现显示勾选的默认激活仓库名称,需在现有BQL查询中关联Site表(仓库名称存储于Site.descr字段),并调整PXSelector的显示字段配置,具体步骤如下:

1. 扩展BQL JOIN关联Site表

在原有的InventoryItem、INItemClass、INItemSite关联基础上,新增Site表的左连接,关联条件为INItemSite.SiteID = Site.SiteID,确保能获取到仓库名称。

2. 调整PXSelector的显示字段

将原显示的INItemSite.siteID替换为Site.descr;若需同时保留仓库ID和名称,可将两者都加入显示字段列表。

代码示例

原PXSelector代码(仅获取SiteID)

[PXSelector(
    typeof(Search<InventoryItem.inventoryID, 
        LeftJoin<INItemClass, On<INItemClass.itemClassID, Equal<InventoryItem.itemClassID>>,
        LeftJoin<INItemSite, On<INItemSite.inventoryID, Equal<InventoryItem.inventoryID>, 
            And<INItemSite.defaultSite, Equal<True>, And<INItemSite.active, Equal<True>>>>>>),
    typeof(InventoryItem.inventoryCD),
    typeof(InventoryItem.descr),
    typeof(INItemClass.itemClassCD),
    typeof(INItemClass.descr),
    typeof(INItemSite.siteID),
    DescriptionField = typeof(InventoryItem.descr)
)]
public virtual int? InventoryID { get; set; }

修改后的PXSelector代码(显示仓库名称)

[PXSelector(
    typeof(Search<InventoryItem.inventoryID, 
        LeftJoin<INItemClass, On<INItemClass.itemClassID, Equal<InventoryItem.itemClassID>>,
        LeftJoin<INItemSite, On<INItemSite.inventoryID, Equal<InventoryItem.inventoryID>, 
            And<INItemSite.defaultSite, Equal<True>, And<INItemSite.active, Equal<True>>>>,
        LeftJoin<Site, On<Site.siteID, Equal<INItemSite.siteID>>>>>),
    typeof(InventoryItem.inventoryCD),
    typeof(InventoryItem.descr),
    typeof(INItemClass.itemClassCD),
    typeof(INItemClass.descr),
    typeof(Site.descr), // 替换为仓库名称字段
    DescriptionField = typeof(InventoryItem.descr)
)]
public virtual int? InventoryID { get; set; }

关键说明

  • 保留原有的INItemSite.defaultSite = True和INItemSite.active = True筛选条件,确保只加载默认激活的仓库。
  • 若业务需要同时存储仓库ID(INItemSite.SiteID)并显示名称,无需修改绑定字段,PXSelector会自动处理存储值与显示值的映射,仅需在DisplayFields中加入Site.descr即可。

内容的提问来源于stack exchange,提问作者vachmir

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 12:35:20