【问题标题】:Getting error while deleting the Record in the "investigation screen"在“调查屏幕”中删除记录时出错
【发布时间】:2020-09-14 14:49:00
【问题描述】:

概念是:当我在调查屏幕上保存特定记录时,“investigationID”字段应该保存在另一个名为“偏差报告”的屏幕中(您可以看到下图)

调查画面

偏差屏幕图像(“调查ID”字段值存储)

但是在这里,当我试图删除调查屏幕上那个粒子“investigationID”的记录时,我遇到了问题。偏差屏幕上的值应为空(您可以看到上图...>黄色标记为“偏差屏幕”)

那个相关代码:

我在 RowPersisted 事件中编写了代码(保存时,此调查 ID 字段应保存在偏差屏幕中(您可以在“偏差屏幕图像”中看到...>它正在保存):

    protected void TSInvestigation_RowPersisted(PXCache cache, PXRowPersistedEventArgs e)
    {
        var row = (TSInvestigation)e.Row;
        if (row == null)
            return;

        if (row.InvestigationCD.Trim() != "<NEW>" /*row.InvestigationCD != null && TSInvestigationView.Cache.GetStatus(row) == PXEntryStatus.Inserted*/)
        {

            DeviationReportMaint DeviationReportMaintGraph = PXGraph.CreateInstance<DeviationReportMaint>();
            DeviationReportMaintGraph.Clear();

            //TSInvestigation get = this.TSInvestigationView.Current;

            //TSDeviationReport retbatch = DeviationReportMaintGraph.TSDeviationReportView.Insert(new TSDeviationReport());
            //TSDeviationReport retbatch = PXSelect<TSDeviationReport>.Select(DeviationReportMaintGraph);

            if (row.DeviationDocID != null /*&& get.InvestigationCD != null*/)
            {
                TSDeviationReport tSDeviation = PXSelect<TSDeviationReport, Where<TSDeviationReport.deviationCD,
                           Equal<Required<TSDeviationReport.deviationCD>>>>.Select(this, row.DeviationDocID);

                if (tSDeviation != null)
                {
                    tSDeviation.InvestigationID = row.InvestigationCD;
                    DeviationReportMaintGraph.TSDeviationReportView.Update(tSDeviation);
                    DeviationReportMaintGraph.Actions.PressSave();

                    //DeviationReportMaintGraph.TSDeviationReportView.Cache.Update(tSDeviation);
                    //DeviationReportMaintGraph.Actions.PressSave();
                }
            }
        }
    }

我在RowDeleted事件中编写了代码(当我删除调查屏幕上的行时,相关的调查CD字段应该在“偏差屏幕”上变为空值,您可以在“偏差屏幕图像”中看到)

    protected void TSInvestigation_RowDeleted(PXCache cache, PXRowDeletedEventArgs e)
    {

        var row = (TSInvestigation)e.Row;
        if (row == null)
            return;


        DeviationReportMaint DeviationReportMaintGraph = PXGraph.CreateInstance<DeviationReportMaint>();
        DeviationReportMaintGraph.Clear();

        //TSInvestigation get = this.TSInvestigationView.Current;

        if (row.DeviationDocID != null /*&& get.InvestigationCD != null*/)
        {
            TSDeviationReport tSDeviation = PXSelect<TSDeviationReport, Where<TSDeviationReport.deviationCD,
                   Equal<Required<TSDeviationReport.deviationCD>>>>.Select(this, row.DeviationDocID);

            if (tSDeviation != null /*|| tSDeviation == null*/)
            {
                tSDeviation.InvestigationID = null;

                DeviationReportMaintGraph.TSDeviationReportView.Update(tSDeviation);
                DeviationReportMaintGraph.Actions.PressSave();
            }
        }

    }

但是当我删除记录时,我收到以下错误:

在调查屏幕上删除记录时出现此错误

代码哪里出错了?

【问题讨论】:

    标签: acumatica acumatica-kb


    【解决方案1】:

    您在 InvestigationID 字段中设置了错误的值 - 它应该是 row.InvestigationID,而不是 row.InvestigationCD

    【讨论】:

      猜你喜欢
      • 2012-07-02
      • 2014-05-30
      • 1970-01-01
      • 1970-01-01
      • 2020-04-21
      • 2014-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多