【问题标题】:Acumatica - PXSelector Value Cannot be Found in the SystemAcumatica - 在系统中找不到 PXSelector 值
【发布时间】:2022-01-15 10:54:47
【问题描述】:

Acumatica 版本 21.203.0026

我在查询屏幕上有一个过滤器 DAC,其中有一个用于支付组的 PXSelector 和一个用于支付周期的 PXSelector。 Pay Period PXSelector 被禁用,直到 Pay Group PXSelector 有一个值,以便用户只能选择属于该 Pay Group 的 Pay Periods。 PXSelector 的 AutoRefresh 属性设置为 true。

由于某种原因,每当我选择支付周期时,支付周期 ID 与 DescriptionField 一起显示在 PXSelector 中,并且在值显示后,DescriptionField 立即消失,并且在支付周期 ID PXSelector 上抛出 PXSetPropertyException消息“系统中找不到‘支付周期’”。

如果它出现在 PXSelector 中并暂时显示在控件中,我不确定为什么在系统中找不到它。

这是跟踪错误:

Error: 'Pay Period' cannot be found in the system.

   at PX.Data.PXSelectorAttribute.throwNoItem(String[] restricted, Boolean external, Object value)
   at PX.Data.PXSelectorAttribute.Verify(PXCache sender, PXFieldVerifyingEventArgs e, Object& item)
   at PX.Data.PXSelectorAttribute.FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
   at PX.Data.PXCache.OnFieldVerifying(String name, Object row, Object& newValue, Boolean externalCall)
   at PX.Data.PXCache`1.FillWithValues(TNode item, TNode copy, IDictionary values, PXCacheOperation operation, Boolean externalCall)

这是跟踪信息:

The item PayPeriodID is not found (restricted:False,external:True,value:112020)

这是我的过滤器 DAC:

    [PXHidden]
    public class EarningDetailFilter : IBqlTable
    {
        #region EmployeeID
        [PXInt]
        [PXUIField(DisplayName = "Employee")]
        [PXSelector(typeof(SearchFor<EPEmployee.bAccountID>), 
            SubstituteKey = typeof(EPEmployee.acctCD), 
            DescriptionField = typeof(EPEmployee.acctName))]
        public virtual int? EmployeeID { get; set; }
        public abstract class employeeID : PX.Data.BQL.BqlInt.Field<employeeID> { }
        #endregion

        #region PayGroupID
        [PXString(15, IsUnicode = true)]
        [PXUIField(DisplayName = "Pay Group")]
        [PXSelector(typeof(SearchFor<PRPayGroup.payGroupID>.
            Where<MatchWithPayGroup<PRPayGroup.payGroupID>>), 
        DescriptionField = typeof(PRPayGroup.description))]
        public virtual string PayGroupID { get; set; }
        public abstract class payGroupID : PX.Data.BQL.BqlString.Field<payGroupID> { }
        #endregion

        #region PayPeriodID
        [PXString(6, InputMask = "CC-####")]
        [PXUIField(DisplayName = "Pay Period")]
        [PXSelector(typeof(SearchFor<PRPayGroupPeriod.finPeriodID>.
            Where<PRPayGroupPeriod.payGroupID.
                IsEqual<EarningDetailFilter.payGroupID.FromCurrent>>),
            DescriptionField = typeof(PRPayGroupPeriod.descr))]
        public virtual string PayPeriodID { get; set; }
        public abstract class payPeriodID : PX.Data.BQL.BqlString.Field<payPeriodID> { }
        #endregion
    }

更新:

在数据库中,FinPeriodID 按年份和 PeriodNbr 的顺序存储。出于某种原因,选择记录时带入 PXSelector 的值是 PeriodNbr 和 Year 的串联,按该顺序。

所以,当 PXSelector 的 Verify 方法被执行时,它首先寻找带有 PeriodNbr 的 FinPeriodID。在它在数据库中查找记录但未找到后,它将 FinPeriodID 的内部值切换回正确的值,并首先使用 Year。我不是很肯定,但这似乎是 Acumatica 的一个逻辑错误。

我通过使用 PRPayGroupPeriodIDAttribute 并为 StartDate、EndDate 和 TransactionDate 使用虚拟字段来解决此问题,这些是属性的必需参数。

【问题讨论】:

  • 我的第一个想法是您可能没有在 PayGroupID 字段上设置提交更改,因此服务器端验证失败并导致该字段被清除。
  • CommitChanges 已设置

标签: acumatica acumatica-kb


【解决方案1】:

PayPeriodID 在查询中引用EarningDetailFilter.payGroupID

SearchFor<PRPayGroupPeriod.finPeriodID>.
    Where<PRPayGroupPeriod.payGroupID.
        IsEqual<EarningDetailFilter.payGroupID.FromCurrent>>

PayGroupID 使用MatchWithPayGroup BQL 运算符:

SearchFor<PRPayGroup.payGroupID>.
    Where<MatchWithPayGroup<PRPayGroup.payGroupID>>

方法MatchWithPayGroup&lt;Field&gt;.Verify 可能会引发异常。

尝试简化表达式并确保数据库表中存在预期的数据:

SearchFor<PRPayGroupPeriod.finPeriodID>

【讨论】:

    猜你喜欢
    • 2016-08-31
    • 2022-12-15
    • 2021-05-12
    • 1970-01-01
    • 2016-02-27
    • 1970-01-01
    • 1970-01-01
    • 2021-11-12
    • 2016-02-04
    相关资源
    最近更新 更多