Acumatica 如何从另一个项目中获取自定义字段的值

Acumatica 如何从另一个项目中获取自定义字段的值,acumatica,acumatica-kb,Acumatica,Acumatica Kb,早上好 我在项目屏幕的第一个自定义项目中自定义了两个字段。除了在另外两个定制的项目中,一个pxselector将UsrBaseIndex字段作为参数传递给“pmAddressText.usrCounty”字段,但我注意到它没有显示信息,这可能表明我做得不对 附加图像,以便更好地理解 提前谢谢 项目1 namespace PX.Objects.PM { public class PMAddressExt : PXCacheExtension<PX.Objects.PM.PMAddre

早上好

我在项目屏幕的第一个自定义项目中自定义了两个字段。除了在另外两个定制的项目中,一个pxselector将UsrBaseIndex字段作为参数传递给“pmAddressText.usrCounty”字段,但我注意到它没有显示信息,这可能表明我做得不对

附加图像,以便更好地理解

提前谢谢

项目1

namespace PX.Objects.PM
{
    public class PMAddressExt : PXCacheExtension<PX.Objects.PM.PMAddress>
    {
        #region UsrGeocode
                                                                        [PXDBString(30)]
        [PXUIField(DisplayName="Geo code")]

        public virtual string UsrGeocode { get; set; }
        public abstract class usrGeocode : PX.Data.BQL.BqlString.Field<usrGeocode> { }
        #endregion

        #region UsrCounty

[PXDBInt]
        [PXUIField(DisplayName="County")]

[PXSelector(
        typeof(PESKCounty.countyID),
        typeof(PESKCounty.countyCD),
        typeof(PESKCounty.countyName),
        DescriptionField = typeof(PESKCounty.countyName),
        SubstituteKey = typeof(PESKCounty.countyCD))]

        [PXRestrictor(typeof(Where<PESKCounty.stateID, Equal<Current<PMSiteAddress.state>>>), "", typeof(PESKCounty.stateID))]
        public virtual int? UsrCounty { get; set; }
        public abstract class usrCounty : PX.Data.BQL.BqlInt.Field<usrCounty> { }
        #endregion
    }
}
namespace PX.Objects.PM
{
公共类pmAddressText:PXCacheExtension
{
#区域UsrGeocode
[PXDBString(30)]
[PXUIField(DisplayName=“地理代码”)]
公共虚拟字符串UsrGeocode{get;set;}
公共抽象类usrGeocode:PX.Data.BQL.BqlString.Field{}
#端区
#美国地区
[PXDBInt]
[PXUIField(DisplayName=“County”)]
[PX选择器(
类型(PESKCounty.countyID),
类型(PESKCounty.countyCD),
类型(PESKCounty.countyName),
DescriptionField=typeof(PESKCounty.countyName),
SubstituteKey=typeof(PESKCounty.countyCD))]
[PXRestrictor(typeof(Where),“”,typeof(PESKCounty.stateID))]
公共虚拟int?UsrCounty{get;set;}
公共抽象类usrCounty:PX.Data.BQL.BqlInt.Field{}
#端区
}
}
项目2

namespace PX.Objects.CT
{
    public class ContractExt : PXCacheExtension<PX.Objects.CT.Contract>
    {
        #region UsrSPriceIndex
                        [PXDBBool]
        [PXUIField(DisplayName = "Subject to Price Index")]

        public virtual bool? UsrSPriceIndex { get; set; }
        public abstract class usrSPriceIndex : PX.Data.BQL.BqlBool.Field<usrSPriceIndex> { }
        #endregion

        #region UsrPRCNumber
                
        [PXDBInt]
        [PXUIField(DisplayName = "PRC Number")]
        [PXSelector(typeof(Search2<PESKPRC.recordID,
                InnerJoin<PESKCountyPriceIndexDetail, On<PESKCountyPriceIndexDetail.recordID, Equal<PESKPRC.recordID>>>,
                Where<PESKPRC.availabletoAll, Equal<True>,
                     And<PESKPRC.active, Equal<True>
                         //And<PESKCountyPriceIndexDetail.countyID, Equal<Current<PMAddressExt.usrCounty>>>
                         >>>),
                typeof(PESKPRC.prcnbr),
                typeof(PESKCountyPriceIndexDetail.pRCPriceIndexCD),
                SubstituteKey = typeof(PESKPRC.prcnbr)
                )]

        public virtual int? UsrPRCNumber { get; set; }
        public abstract class usrPRCNumber : PX.Data.BQL.BqlInt.Field<usrPRCNumber> { }
        #endregion

        #region UsrBaseIndex

        [PXDBInt]
        [PXUIField(DisplayName = "Base Index")]
        [PXSelector(typeof(Search<PESKViewBaseIndex.priceIndexID,
            Where<PESKViewBaseIndex.recordID, IsNull
                ,And<PESKViewBaseIndex.countyID, Equal<Current<PMAddressExt.usrCounty>>,
                    Or<PESKViewBaseIndex.countyID,IsNull>
                    >
                >>),
        typeof(PESKViewBaseIndex.pRCPriceIndexCD),
        SubstituteKey = typeof(PESKViewBaseIndex.pRCPriceIndexCD),ValidateValue =false)]
        public virtual int? UsrBaseIndex { get; set; }
        public abstract class usrBaseIndex : PX.Data.BQL.BqlInt.Field<usrBaseIndex> { }
        #endregion

        #region UsrPCNumber
                        [PXDBString(60)]
        [PXUIField(DisplayName = "PCNumber")]

        public virtual string UsrPCNumber { get; set; }
        public abstract class usrPCNumber : PX.Data.BQL.BqlString.Field<usrPCNumber> { }
        #endregion
    }
}
名称空间PX.Objects.CT
{
公共类ContractExt:PXCacheExtension
{
#地区美国零售价格指数
[PXDBBool]
[PXUIField(DisplayName=“以价格指数为准”)]
公共虚拟bool?UsrSPriceIndex{get;set;}
公共抽象类usrSPriceIndex:PX.Data.BQL.BqlBool.Field{}
#端区
#区域UsrPRCNumber
[PXDBInt]
[PXUIField(DisplayName=“PRC编号”)]
[PX选择器(类型)(搜索2),
类型(PESKPRC.prcnbr),
类型(PESKCountyPriceIndexDetail.pRCPriceIndexCD),
替换键=类型(PESKPRC.prcnbr)
)]
公共虚拟整数?UsrPRCNumber{get;set;}
公共抽象类usrPRCNumber:PX.Data.BQL.BqlInt.Field{}
#端区
#UsrBaseIndex地区
[PXDBInt]
[PXUIField(DisplayName=“基本索引”)]
[PX选择器(类型)(搜索),
类型(PESKViewBaseIndex.pRCPriceIndexCD),
SubstituteKey=typeof(PESKViewBaseIndex.pRCPriceIndexCD),ValidateValue=false)]
公共虚拟int?UsrBaseIndex{get;set;}
公共抽象类usrBaseIndex:PX.Data.BQL.BqlInt.Field{}
#端区
#区域UsrPCNumber
[PXDBString(60)]
[PXUIField(DisplayName=“PCNumber”)]
公共虚拟字符串UsrPCNumber{get;set;}
公共抽象类usrPCNumber:PX.Data.BQL.BqlString.Field{}
#端区
}
}

您应该在第二个项目中为
PMAdress
添加一个新扩展名,然后在该扩展名中添加一个新字段,以从第一个项目中获取县的值

public sealed class PMAddressCountyExt : PXCacheExtension<PMAddress>
    {
        public static bool IsActive() { return true; }
        #region UsrGetCounty
        [PXDBInt]
        [BaseIndexSelectorAttribute]
        public int? UsrGetCounty { get; set; }
        public abstract class usrGetCounty : BqlInt.Field<usrGetCounty> { }
        #endregion
    }
    public sealed class BaseIndexSelectorAttribute : AcctSubAttribute, IPXFieldSelectingSubscriber
    {
        public void FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
        {
            if (e.Row is PMAddress)
            {
                sender.SetValue(e.Row, "UsrGetCounty", sender.GetValue(e.Row, "UsrCounty"));
            }
        }
        public override void RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
        {
            base.RowSelecting(sender, e);
            if (e.Row is PMAddress)
            {
                sender.SetValue(e.Row, "UsrGetCounty", sender.GetValue(e.Row, "UsrCounty"));
            }
        }
    }  

由于您在第二个项目中使用第一个项目,这意味着您已将其引用。因此,您不需要将第一个字段复制到第二个字段中,因为您可以访问它的值。您的“County”字段是否设置了CommitChanges=“True”?“基本索引”字段是否设置了AutoRefresh=“True”(这是基于County字段的新值在选择器中重新加载值)?您是否可以使用SQL探查器检查查询,以查看选择器正在查找什么,以及直接在数据库中执行查询时,查询是否良好并有结果?
typeof(Search<PESKViewBaseIndex.priceIndexID, Where<PESKViewBaseIndex.recordID, IsNull, And<PESKViewBaseIndex.countyID, Equal<Current<PMAddressCountyExt.usrGetCounty>>, Or<PESKViewBaseIndex.countyID, IsNull>>>>)