Acumatica 运行项目计费屏幕上的拦截进程

Acumatica 运行项目计费屏幕上的拦截进程,acumatica,Acumatica,我们正在使用“运行项目账单”屏幕在应收账款/发票和备忘录中创建记录 在发票和备忘屏幕中,我们需要填充标题客户Ord的过程。编号,以及已添加到“文档详细信息”选项卡上网格部分的用户字段。目前,该进程并没有这样做 我想使用我熟悉的技术截取屏幕上的处理操作,即使用“AddHandler”: [PXOverride] protected virtual IEnumerable Items (PXAdapter adapter) { PXGraph.InstanceCreated.AddHandle

我们正在使用“运行项目账单”屏幕在应收账款/发票和备忘录中创建记录

在发票和备忘屏幕中,我们需要填充标题客户Ord的过程。编号,以及已添加到“文档详细信息”选项卡上网格部分的用户字段。目前,该进程并没有这样做

我想使用我熟悉的技术截取屏幕上的处理操作,即使用“AddHandler”:

[PXOverride]
protected virtual IEnumerable Items (PXAdapter adapter)
{
   PXGraph.InstanceCreated.AddHandler<BillingProcess>((graph) =>
   {
       graph.RowInserting.AddHandler<BillingProcess.ProjectsList>((sender, e) =>
       {

           //Custom logic goes here

       });
   });
   return Base.action.Press(adapter);
}
[PXOverride]
受保护的虚拟IEnumerable项(PXAdapter)
{
PXGraph.InstanceCreated.AddHandler((图形)=>
{
graph.rowinting.AddHandler((发送方,e)=>
{
//这里是自定义逻辑
});
});
返回基地。行动。按下(适配器);
}
我看不出有什么基础。这些行为与“比尔”或“比尔-所有人”有几分相似

这显然不是我需要的代码,但我认为这是一个开始

在回顾了源业务逻辑之后,我没有看到任何“Bill”或“Bill All”操作,也没有看到任何“action”(令人困惑)。我看到一个名为“items”的IEnumerable方法,这就是我从上面开始的

这是正确的方法吗

更新:2/14/2017

使用提供的答案re:the Overrided method InsertTransaction(…),我尝试使用以下逻辑设置我们的ARTran用户字段(这是必需的):

        PMProject pmproj = PXSelect<PMProject, Where<PMProject.contractID, Equal<Required<PMProject.contractID>>>>.Select(Base, tran.ProjectID);
        if (pmproj == null) return;

        PMProjectExt pmprojext = PXCache<PMProject>.GetExtension<PMProjectExt>(pmproj);
        if (pmprojext == null) return;

        ARTranExt tranext = PXCache<ARTran>.GetExtension<ARTranExt>(tran);
        if (tranext == null) return;

        tranext.UsrContractID = pmprojext.UsrContractID;
PMProject pmproj=PXSelect.Select(Base,tran.projectd);
如果(pmproj==null)返回;
PMProjectExt pmprojext=PXCache.GetExtension(pmproj);
if(pmprojext==null)返回;
ARTranExt tranext=PXCache.GetExtension(tran);
if(transext==null)返回;
tranext.usrcontracid=pmprojext.usrcontracid;

即使这将用户字段设置为正确的值,它仍然会给我一个错误,即当流程完成时,必填字段为空。我有限的知识使我无法理解原因。

在运行项目计费屏幕上,BLC constructor中的过程过程所有按钮的标题分别更改为账单账单所有。 为所选处理程序中的项目数据视图设置流程委托:

public class BillingProcess : PXGraph<BillingProcess>
{
    ...

    public BillingProcess()
    {
        Items.SetProcessCaption(PM.Messages.ProcBill);
        Items.SetProcessAllCaption(PM.Messages.ProcBillAll);
    }

    ...

    protected virtual void BillingFilter_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
    {
        BillingFilter filter = Filter.Current;

        Items.SetProcessDelegate<PMBillEngine>(
            delegate (PMBillEngine engine, ProjectsList item)
            {
                if (!engine.Bill(item.ProjectID, filter.InvoiceDate, filter.InvFinPeriodID))
                {
                    throw new PXSetPropertyException(Warnings.NothingToBill, PXErrorLevel.RowWarning);
                }
            });
    }

    ...
}
运行项目计费流程调用
InsertNewInvoiceDocument
方法在AR发票和备忘录屏幕上创建新记录,调用
InsertTransaction
方法添加新发票交易

需要注意的一点是:当用户从处理运行项目计费屏幕或数据输入项目屏幕启动运行项目计费操作时,将调用重写的
InsertNewInvoiceDocument
InsertTransaction
方法


有关如何覆盖虚拟BLC方法的更多信息,请参阅帮助->自定义->自定义业务逻辑->图形->覆盖每个Acumatica ERP 6.1网站中可用的虚拟方法

我尝试使用InsertTransactions覆盖方法,但这并不奏效。请参阅我编辑的原始帖子…进一步协助此请求的唯一可能方法是调试自定义项。显然,这需要一个支持案例。Ruslan已经解决了这一问题-错误在于我在定制项目的扩展库和代码窗口中复制了DAC字段。谢谢你,罗斯兰!。。。
public class PMBillEngineExt : PXGraphExtension<PMBillEngine>
{
    public delegate ARInvoice InsertNewInvoiceDocumentDel(string finPeriod, string docType, Customer customer,
        PMProject project, DateTime billingDate, string docDesc);

    [PXOverride]
    public ARInvoice InsertNewInvoiceDocument(string finPeriod, string docType, Customer customer, PMProject project,
        DateTime billingDate, string docDesc, InsertNewInvoiceDocumentDel del)
    {
        var result = del(finPeriod, docType, customer, project, billingDate, docDesc);
        // custom logic goes here
        return result;
    }

    [PXOverride]
    public void InsertTransaction(ARTran tran, string subCD, string note, Guid[] files)
    {
        // the system will automatically invoke base method prior to the customized one
        // custom logic goes here
    }
}