如何将新的过滤器字段添加到“按项目运行分配”屏幕

时间:2019-10-08 20:58:09

标签: acumatica

我正在自定义“按项目运行分配”屏幕,以向标题/过滤器部分添加另一个字段,并使用该字段过滤网格数据。我已经成功地使用“项目状态”字段作为模板为“状态”添加了一个PXString字段:

Public Sub TestAndWeep()
    Dim foo As New Collection
    foo.Add 42
    Debug.Print foo.Count
    Set foo = Nothing
    Debug.Print foo Is Nothing '<~ expecting True, are you?
End Sub

然后我通过如下扩展BLC将字段添加到“项目”视图的定义中(显示添加的行与中间的块分开):

public class AllocationFilterExt : PXCacheExtension<AllocationFilter>
{
    #region UsrStatus
    [PXString(1, IsFixed = true)]
    [ProjectStatus.List()]
    [PXDefault(ProjectStatus.Active)]
    [PXUIField(DisplayName = "Status", Required = true, Visibility = PXUIVisibility.SelectorVisible)]
    public virtual string UsrStatus { get; set; }
    public abstract class usrStatus : IBqlField { }
    #endregion
}

这很好地过滤了网格,直到我尝试实际处理选定的(选中的)行为止,此时出现以下错误。我无法弄清楚是什么原因/缺少什么:

enter image description here

对为什么会发生这种情况有任何想法吗?我是否需要在业务逻辑中添加一些内容才能使用“用户”字段?

非常感谢...

1 个答案:

答案 0 :(得分:0)

在您的aspx页面检查中,您已将CommitChanges设置为true.

using PX.Objects.PM;
using static PX.Objects.PM.AllocationProcessByProject;
namespace ExampleDB.DAC
{
public sealed class AllocationFilterExt : PXCacheExtension<AllocationFilter>
{
    #region UsrStatus
    [PXString(1, IsFixed = true)]
    [ProjectStatus.List()]
    [PXDefault(ProjectStatus.Active, PersistingCheck = PXPersistingCheck.Nothing)]
    [PXUIField(DisplayName = "Status", Required = true, Visibility = PXUIVisibility.SelectorVisible)]
    public string UsrStatus { get; set; }
    public abstract class usrStatus : IBqlField { }
    #endregion
}
}  

在图形扩展名

using ExampleDB.DAC;
using PX.Data;
using PX.Objects.CT;
using PX.Objects.PM;
namespace ExampleDB
{
public class AllocationProcessByProjectExt : PXGraphExtension<AllocationProcessByProject>
{
    public PXFilteredProcessingJoin<PMProject, AllocationProcessByProject.AllocationFilter, LeftJoin<AllocationProcessByProject.Customer, On<AllocationProcessByProject.Customer.bAccountID, Equal<PMProject.customerID>>>
        , Where2<Where<Current<AllocationProcessByProject.AllocationFilter.allocationID>, IsNull, Or<PMProject.allocationID, Equal<Current<AllocationProcessByProject.AllocationFilter.allocationID>>>>
            , And2<Where<Current<AllocationProcessByProject.AllocationFilter.projectID>, IsNull, Or<PMProject.contractID, Equal<Current<AllocationProcessByProject.AllocationFilter.projectID>>>>
                ,And2<Where<Current<AllocationFilterExt.usrStatus>, IsNull, Or<PMProject.status, Equal<Current<AllocationFilterExt.usrStatus>>>>
                , And2<Where<Current<AllocationProcessByProject.AllocationFilter.customerID>, IsNull, Or<PMProject.customerID, Equal<Current<AllocationProcessByProject.AllocationFilter.customerID>>>>
                    , And2<Where<Current<AllocationProcessByProject.AllocationFilter.customerClassID>, IsNull, Or<AllocationProcessByProject.Customer.customerClassID, Equal<Current<AllocationProcessByProject.AllocationFilter.customerClassID>>>>
                        , And2<Where<Current<AllocationProcessByProject.AllocationFilter.customerClassID>, IsNull, Or<AllocationProcessByProject.Customer.customerClassID, Equal<Current<AllocationProcessByProject.AllocationFilter.customerClassID>>>>
                            , And2<Match<Current<AccessInfo.userName>>, And<PMProject.nonProject, Equal<False>, And<PMProject.baseType, Equal<CTPRType.project>>>>>>>>>>> Items;
}
}