本文介绍了扩展基于 Acumatica 投影的 DAC 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以扩展/修改投影 DAC 的投影查询.

Is there any way to extend/modify the projection query of a projected DAC.

例如,如果我需要在投影中添加连接语句,然后将新连接的表用于可用字段.

For example, if I need to add a join statement to the projection and then use the newly joined table to the available fields.

向 PXCacheExtension 添加自定义字段按预期工作,但在 PXCacheExtension DAC 顶部指定 PXProjection 查询似乎没有任何效果.

Adding a custom field to the PXCacheExtension works as expected, but specifying the PXProjection query at the top of the PXCacheExtension DAC don't seems to have any effect.

原文:

[Serializable]
    [PXProjection(typeof(Select5<EPApproval, InnerJoin<Note,
                                    On<Note.noteID, Equal<EPApproval.refNoteID>,
                                 And<EPApproval.status, Equal<EPApprovalStatus.pending>>>,>,
                                 Where2<Where<EPApproval.ownerID, IsNotNull, And<EPApproval.ownerID, Equal<CurrentValue<AccessInfo.userID>>>>, 
                                        Or2<Where<EPApproval.workgroupID, InMember<CurrentValue<AccessInfo.userID>>,
                                        Or<EPApproval.workgroupID, IsNull>>,
                                        Or<EPApproval.workgroupID, Owned<CurrentValue<AccessInfo.userID>>>>>,
                                 Aggregate<GroupBy<EPApproval.refNoteID, 
        GroupBy<EPApproval.curyInfoID, 
        GroupBy<EPApproval.bAccountID, 
        GroupBy<EPApproval.ownerID, 
        GroupBy<EPApproval.approvedByID,
        GroupBy<EPApproval.curyTotalAmount>>>>>>>>))]
    public partial class EPOwned : EPApproval{

扩展:

[Serializable]
[PXProjection(typeof(Select5<EPApproval, InnerJoin<Note,
                                   On<Note.noteID, Equal<EPApproval.refNoteID>,
                                And<EPApproval.status, Equal<EPApprovalStatus.pending>>>,
                                LeftJoin<RQRequest, On<RQRequest.noteID, Equal<Note.noteID>>>>,
                                Where2<Where<EPApproval.ownerID, IsNotNull, And<EPApproval.ownerID, Equal<CurrentValue<AccessInfo.userID>>>>,
                                       Or2<Where<EPApproval.workgroupID, InMember<CurrentValue<AccessInfo.userID>>,
                                       Or<EPApproval.workgroupID, IsNull>>,
                                       Or<EPApproval.workgroupID, Owned<CurrentValue<AccessInfo.userID>>>>>,
                                Aggregate<GroupBy<EPApproval.refNoteID,
       GroupBy<EPApproval.curyInfoID,
       GroupBy<EPApproval.bAccountID,
       GroupBy<EPApproval.ownerID,
       GroupBy<EPApproval.approvedByID,
       GroupBy<EPApproval.curyTotalAmount>>>>>>>>))]
public class EPOwnedExt : PXCacheExtension<EPApprovalProcess.EPOwned> {

谢谢

推荐答案

要修改投影 DAC 的投影查询,您应该创建一个继承的 DAC 并使用 PXSubstituteAttribute 对其进行修饰.以下是 FAAccrualTran DAC 的示例:

To modify the projection query of a projected DAC, you should create an inherited DAC and decorate it with the PXSubstituteAttribute. Below is the sample for the FAAccrualTran DAC:

[Serializable]
[PXProjection(typeof(Select2<GLTran,
    LeftJoin<FAAccrualTran, On<GLTran.tranID, Equal<FAAccrualTran.tranID>>>,
    Where<GLTran.module, NotEqual<BatchModule.moduleFA>, And<GLTran.released, Equal<True>>>>), new Type[] { typeof(FAAccrualTran) })]
[PXSubstitute(GraphType = typeof(AssetGLTransactions))]
...
[PXSubstitute(GraphType = typeof(AssetMaint))]
public partial class FAAccrualTranCst : FAAccrualTran
{
    ...
}

您可以多次使用 PXSubstituteAttribute 修饰 DAC:每 1 个 BLC 1 个 PXSubstituteAttribute,为此将使用自定义 FAAccrualTranCst 而不是基础 FAAccrualTran 类.

You can decorate a DAC with PXSubstituteAttribute multiple times: 1 PXSubstituteAttribute per 1 BLC, for which custom FAAccrualTranCst will be used instead of the base FAAccrualTran class.

如果您没有为 PXSubstituteAttribute 的 GraphType 属性指定任何值,您的自定义 DAC 将在所有 BLC 中替换其基础 DAC.

If you specify no value for GraphType property of the PXSubstituteAttribute, your custom DAC will replace its base DAC in all BLCs.

这篇关于扩展基于 Acumatica 投影的 DAC 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-17 00:09