2017-03-02 67 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