在"费用报告"屏幕中创建供应商选择器



我正在尝试创建一个字段来存储"供应商ID",在我自己的DAC中。

首先,我尝试使用 Acumatica 属性来显示选择器,如下所示

[VendorNonEmployeeActive(Visibility = PXUIVisibility.SelectorVisible, DescriptionField = typeof(Vendor.acctName), CacheGlobal = true, Filterable = true)]

[POVendor(Visibility = PXUIVisibility.SelectorVisible, DescriptionField = typeof(Vendor.acctName), CacheGlobal = true, Filterable = true)]

和其他几个属性。 但它要么显示员工数据,要么什么都不显示。我甚至尝试编写一个我自己的选择器,如下所示,其中BAccountRef是从BAccount派生的类。

[PXSelector(typeof(Search2<Vendor.bAccountID,
InnerJoin<BAccountRef, On<Vendor.bAccountID, Equal<BAccountRef.bAccountID>>>,
Where<Vendor.status, Equal<BAccountRef.status.active>,
And<Vendor.type, Equal<BAccountType.vendorType>>>>), new Type[] { typeof(BAccountRef.acctCD), typeof(BAccountRef.acctName) },
SubstituteKey = typeof(BAccountRef.acctCD))]

不幸的是,从行为来看,记录似乎是自动过滤以显示员工信息。我不知道这是怎么回事。如何使选择器显示供应商信息?如何自动筛选此图中的员工?

很可能您对 DAC 的 BQL 查询Vendor转换为对EPEmployee表的 SQL 查询。此行为是由EPEmployee缓存(因此BAccount缓存)在缓存之前初始化Vendor引起的。

尝试将PX.Objects.AP.VendorAttributeBAccountRDAC 一起使用 - 使用BAccountR将中断VendorBAccount' DACs and should be translated into SQL queries towardsBAccountand供应商表之间的继承:

[Vendor(typeof(Search<BAccountR.bAccountID,
Where<BAccountR.type, Equal<BAccountType.companyType>, 
Or<Vendor.type, NotEqual<BAccountType.employeeType>>>>), 
Visibility = PXUIVisibility.SelectorVisible, CacheGlobal = true, Filterable = true)]
[PXRestrictor(typeof(Where<Vendor.status, IsNull, 
Or<Vendor.status, Equal<BAccount.status.active>, 
Or<Vendor.status, Equal<BAccount.status.oneTime>>>>),
AP.Messages.VendorIsInStatus, typeof(Vendor.status))]

谢谢大家,

@Ruslan的回答有助于获得选择器的正确定义。当我们使用BAccountRVendorRDAC时,SQL不会转换为EPEmployee,因此我能够获得正确的信息。

[PXDimensionSelectorAttribute("VENDOR", typeof(Search<VendorR.bAccountID, Where<VendorR.type, Equal<BAccountType.vendorType>,
And<VendorR.status, Equal<BAccount.status.active>>>>), typeof(VendorR.acctCD), new Type[] { typeof(VendorR.acctCD), typeof(VendorR.acctName) })]

在我最近的一个项目中,我使用了以下内容来获取供应商CD:

#region vendor
public abstract class vendor : PX.Data.IBqlField
{
}
protected string _Vendor;
[VendorRaw(typeof(Where<Vendor.vendorClassID, Equal<Current<VendorFilter.vendorClassID>>>), 
DescriptionField = typeof(Vendor.acctName), DisplayName = "Vendor ID")]
[PXDefault("", PersistingCheck = PXPersistingCheck.Nothing)]
public virtual string Vendor
{
get
{
return this._Vendor;
}
set
{
this._Vendor = value;
}
}
#endregion

最近我不得不在ExpenseClaimsDetails DAC上添加一个供应商选择器,在尝试了几个选项之后,这是对我有用的选项:

[PXDBInt()]
[PXUIField(DisplayName = "Vendor", Enabled = true)]       
[PXDimensionSelector("VENDOR", typeof(Search<VendorR.bAccountID, Where<VendorR.vStatus, Equal<VendorStatus.active>>>),
typeof(VendorR.acctCD),
new Type[] { typeof(VendorR.acctCD), 
typeof(VendorR.acctName), 
typeof(VendorR.vendorClassID),
typeof(VendorR.taxRegistrationID)},
Filterable = true, 
SelectorMode = PXSelectorMode.TextModeSearch,
DescriptionField = typeof(VendorR.acctName))]
public int? UsrEVVendorID { get; set; }
public abstract class usrEVVendorID : PX.Data.BQL.BqlInt.Field<usrEVVendorID> { }

最新更新