根据客户选择进行联系查找

时间:2017-02-14 14:09:13

标签: acumatica

我需要在SO屏幕(SO301000)中创建联系人查找。我已经创建了用户定义的自定义字段,如下所示。我列出了所有联系人,但根据选择客户的情况,它不会刷新。我是否必须为CustomerID编写任何事件以刷新这些联系人查找?有没有人有任何想法?



[PXDBInt]
[PXUIField(DisplayName = "Contact")]
[PXSelector(typeof(Search2<Contact.contactID,
	LeftJoin<BAccount, On<BAccount.bAccountID, Equal<Contact.bAccountID>>>>),
	DescriptionField = typeof(Contact.displayName), Filterable = true, DirtyRead = true)]
[PXRestrictor(typeof(Where<Contact.isActive, Equal<True>>), PX.Objects.CR.Messages.ContactInactive, typeof(Contact.displayName))]
[PXDBChildIdentity(typeof(Contact.contactID))]
public virtual int? UsrCustContactID { get; set; }
public abstract class usrCustContactID : IBqlField { }
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:1)

您错过了Where子句,您需要使用BAccount2而不是BAccountSOOrderEntry图表具有使用Vendor DAC定义的数据视图,该视图在BAccount之前/之前初始化,框架将用Vendor DAC替换它。为防止这种情况,您需要在BQL中使用BAccount2 DAC。

    using System;
    using PX.Data;
    using PX.Objects.SO;
    using PX.Objects.CR;

    namespace DemoPkg
    {
        public class SOOrderPXExt : PXCacheExtension<SOOrder>
        {
            #region UsrContactID

            public abstract class usrContactID : IBqlField { }

            [PXDBInt()]
            [PXUIField(DisplayName = "Contact", Visibility = PXUIVisibility.Visible)]
            [PXSelector(typeof(Search2<Contact.contactID,
                LeftJoin<BAccount2, On<BAccount2.bAccountID, Equal<Contact.bAccountID>>>>),
                DescriptionField = typeof(Contact.displayName), Filterable = true, DirtyRead = true)]
            [PXDefault(PersistingCheck = PXPersistingCheck.Nothing)]
            [PXFormula(typeof(Default<CRCase.customerID>))]
            [PXRestrictor(typeof(Where<Contact.contactType, NotEqual<ContactTypesAttribute.bAccountProperty>,
                    And<Where<BAccount2.bAccountID, Equal<Current<SOOrder.customerID>>,
                            Or<Current<SOOrder.customerID>, IsNull>>>>), PX.Objects.CR.Messages.ContactBAccountDiff)]
            [PXRestrictor(typeof(Where<Contact.isActive, Equal<True>>), PX.Objects.CR.Messages.ContactInactive,
                          typeof(Contact.displayName))]
            public virtual Int32? UsrContactID { get; set; }

            #endregion
        }
    }

并确保在aspx中将AutoRefresh设置为true,以便对此字段进行PXSelector控制。

答案 1 :(得分:0)

我发现您的选择器中没有where条件基于给定的客户。尝试更新您的选择器以匹配此类内容......

[PXSelector(typeof(Search2<Contact.contactID,
    LeftJoin<BAccount, On<BAccount.bAccountID, Equal<Contact.bAccountID>>>,
    Where<BAccount.bAccountID, Equal<Current<SOOrder.customerID>>>>),
DescriptionField = typeof(Contact.displayName), Filterable = true, DirtyRead = true)]

在您的页面中,还要确保您的选择器具有AutoRefresh =&#34; true&#34;

示例:

<px:PXSelector ID="edWeightUOM" runat="server" 
    DataField="WeightUOM" Size="S" AutoRefresh="true" />