2017-03-02 51 views
0

我正尝试在自己的DAC中创建一个字段来存储'VendorID'。在费用声明屏幕上创建供应商选择器

首先,我试着用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))] 

不幸的是,没有运气,从行为上看,这些记录似乎被自动过滤以显示员工信息。我无法弄清楚这是如何发生的。如何使选择器显示供应商信息?这是如何自动过滤此图中的员工?

回答

0

在我最近的项目之一,我已经使用,以获得VendorCD如下:

#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 
+0

同样的结果,我所提到的。 :( – Hybridzz

2

最有可能对Vendor DAC您BQL查询转换成SQL查询来EPEmployee表。此行为由EPEmployee缓存(并因此BAccount缓存)在Vendor缓存之前初始化而导致。

BAccountR DAC尝试使用PX.Objects.AP.VendorAttribute在一起 - 使用BAccountR将打破VendorBAccount' DACs and should be translated into SQL queries towards BAccount and Vendor`表之间的继承:

[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))] 
+0

这帮助我得到正确的选择器定义 – Hybridzz

+0

如果使用Vendor属性,它仍然不会按预期工作 – Hybridzz

0

感谢所有,

@鲁斯兰的回答有助于获得选择器的正确定义。当我们使用BAccountRVendorR DAC的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) })] 
+1

对于供应商选择器,请确保始终使用'PXDimensionSelectorAttribute(typeof(Search ),“VENDOR”,typeof(VendorR.acctCD))'而不是'PXSelectorAttribute'。这非常重要,因为供应商标识符是分段密钥,PXSelector不支持PXSelector。 ,但是如果您为** Vendor **分段键定义2nd +段,将会使您陷入困境。 – RuslanDev

+0

感谢此信息,我在我的答案中更新了它。 – Hybridzz