Acumatica - Add Reports dropdown to Kit Assembly Screen

江枫思渺然 提交于 2019-12-11 18:07:31

问题


I have been trying to add a Reports dropdown to the Kit Assembly screen (IN307000). We have custom reports that are based on the KitInventoryID that will be generated to print a tag essentially and these reports need to be added to the actions of the screen. I noticed that there is normally a transfer in most Report screens that will be used to transfer data so I did write my own statement at the top. Here is what I have so far:

using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using PX.Data;
using PX.Objects.CS;
using PX.Objects.IN.Overrides.INDocumentRelease;
using PX.Objects.GL;
using PX.Objects.CM;
using System.Diagnostics;
using PX.Objects;
using PX.Objects.IN;

namespace PX.Objects.IN
{

  public class KitAssemblyEntry_Extension:PXGraphExtension<KitAssemblyEntry>
  {
  public PXSelect<INKitRegister, Where<INKitRegister.docType, Equal<Current<INKitRegister.docType>>, And<INKitRegister.kitInventoryID, Equal<Current<INKitRegister.kitInventoryID>>>>> transfer;
  public override void Initialize()
    {
        Report.AddMenuAction(MasterTag);
        Report.MenuAutoOpen = true;
    }

    #region Event Handlers

    public PXAction<INKitRegister> Report;
    [PXButton]
    [PXUIField(DisplayName = "Print Tag", MapEnableRights = PXCacheRights.Select)]
    protected void report()
    { }

    public PXAction<INKitRegister> MasterTag;
    [PXUIField(DisplayName = "Sample/Value Tag", MapEnableRights = PXCacheRights.Select)]
    [PXLookupButton]
    public virtual IEnumerable masterTag(PXAdapter adapter)
    {
      INKitRegister doc = Base.transfer.Current;
        if (doc != null)
        {
        Dictionary<string, string> parameters = new Dictionary<string, string>();
        parameters["DocType"] = this.transfer.Current.DocType;
        parameters["ItemNumber"] = this.transfer.Current.KitInventoryID.ToString();
        throw new PXReportRequiredException(parameters, "IN610004", "Sample/Value Tag");
        }

    }

    #endregion

  }


}

However, when I try to publish I get this error:

Building directory '\WebSiteValidationDomain\App_RuntimeCode\'.
\App_RuntimeCode\KitAssemblyEntry.cs(39): error CS1061: 'PX.Objects.IN.KitAssemblyEntry' does not contain a definition for 'transfer' and no extension method 'transfer' accepting a first argument of type 'PX.Objects.IN.KitAssemblyEntry' could be found (are you missing a using directive or an assembly reference?)
\App_RuntimeCode\KitAssemblyEntry.cs(39): error CS1061: 'PX.Objects.IN.KitAssemblyEntry' does not contain a definition for 'transfer' and no extension method 'transfer' accepting a first argument of type 'PX.Objects.IN.KitAssemblyEntry' could be found (are you missing a using directive or an assembly reference?)

I have also tried changing the INKitRegister doc = Base.transfer.Current;to INKitRegister doc = Base.Document.Current; but get this error:

\App_RuntimeCode\KitAssemblyEntry.cs(37): error CS0161: 'PX.Objects.IN.KitAssemblyEntry_Extension.masterTag(PX.Data.PXAdapter)': not all code paths return a value
\App_RuntimeCode\KitAssemblyEntry.cs(37): error CS0161: 'PX.Objects.IN.KitAssemblyEntry_Extension.masterTag(PX.Data.PXAdapter)': not all code paths return a value

回答1:


Here is the fixed coded and it is working properly.

using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using PX.Data;
using PX.Objects.CS;
using PX.Objects.IN.Overrides.INDocumentRelease;
using PX.Objects.GL;
using PX.Objects.CM;
using System.Diagnostics;
using PX.Objects;
using PX.Objects.IN;

namespace PX.Objects.IN
{

  public class KitAssemblyEntry_Extension:PXGraphExtension<KitAssemblyEntry>
  {
  public PXSelect<INKitRegister, Where<INKitRegister.docType, Equal<Current<INKitRegister.docType>>, And<INKitRegister.kitInventoryID, Equal<Current<INKitRegister.kitInventoryID>>>>> transfer;
  public override void Initialize()
    {
        Report.AddMenuAction(MasterTag);
        Report.MenuAutoOpen = true;
    }

    #region Event Handlers

    public PXAction<INKitRegister> Report;
    [PXButton]
    [PXUIField(DisplayName = "Print Tag", MapEnableRights = PXCacheRights.Select)]
    protected void report()
    { }

    public PXAction<INKitRegister> MasterTag;
    [PXUIField(DisplayName = "Sample/Value Tag", MapEnableRights = PXCacheRights.Select)]
    [PXLookupButton]
    public virtual IEnumerable masterTag(PXAdapter adapter)
    {
      INKitRegister doc = Base.Document.Current;
        if (doc != null)
        {
        Dictionary<string, string> parameters = new Dictionary<string, string>();
        parameters["DocType"] = this.transfer.Current.DocType;
        parameters["ItemNumber"] = this.transfer.Current.KitInventoryID.ToString();
        throw new PXReportRequiredException(parameters, "IN610004", "Sample/Value Tag");
        }
     return adapter.Get();
    }

    #endregion

  }


}


来源:https://stackoverflow.com/questions/49519132/acumatica-add-reports-dropdown-to-kit-assembly-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!