Hello Community,
I need to add two nearly identical actions to the move screen. Each one points to a specific printer. I am then going to have a business event execute the action. I am having issues with getting both to show up. I have tried a few different ways to make it work and they arent both posting. Only one will post. i tried separate customization projects (with different names) and i tried putting them both in the same project but only one will be available. Could someone tell me what i need to do so that both will show up? Code is below. Any help would be greatly appreciated. Im pretty sure its something simple that i am just overlooking.
using PX.Data;
using PX.Objects.CS;
using PX.Objects.AM.Attributes;
using System;
using System.Collections.Generic;
using System.Collections;
using PX.Objects;
using PX.Objects.AM;
using System.Threading;
using PX.SM;
namespace PX.Objects.AM
{
public class MoveEntry_Extension2 : PXGraphExtension<PX.Objects.AM.MoveEntry>
{
#region Event Handlers
public PXAction<AMBatch> print;
[PXUIField(DisplayName = "Print 1010 Move with DeviceHub", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select, Enabled = true, Visible = false)]
[PXButton]
public virtual IEnumerable Print(PXAdapter adapter)
{
AMBatch batch = Base.batch.Current;
Dictionary<string, string> parametersDictionary = new Dictionary<string, string>();
parametersDictionary["DocType"] = batch.DocType;
parametersDictionary["Batch"] = batch.BatNbr;
SMPrinter printer = PXSelect<SMPrinter, Where<SMPrinter.printerName,
Equal<Required<SMPrinter.printerName>>>>.Select(Base, "1010SAW");
PrintSettings printSettings = new PrintSettings()
{
PrinterID = printer.PrinterID,
NumberOfCopies = 1,
PrintWithDeviceHub = true,
DefinePrinterManually = true
};
PXGraph.CreateInstance<SMPrintJobMaint>().CreatePrintJob(printSettings,"AM615130",parametersDictionary,"Saw Move Verify",CancellationToken.None);
return adapter.Get();
}
#endregion
}
}
namespace PX.Objects.AM
{
public class MoveEntry_Extension4 : PXGraphExtension<PX.Objects.AM.MoveEntry>
{
#region Event Handlers
public PXAction<AMBatch> print;
[PXUIField(DisplayName = "Print 2400 batch with DeviceHub", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select, Enabled = true, Visible = false)]
[PXButton]
public virtual IEnumerable Print(PXAdapter adapter)
{
AMBatch batch = Base.batch.Current;
Dictionary<string, string> parametersDictionary = new Dictionary<string, string>();
parametersDictionary["DocType"] = batch.DocType;
parametersDictionary["Batch"] = batch.BatNbr;
SMPrinter printer = PXSelect<SMPrinter, Where<SMPrinter.printerName,
Equal<Required<SMPrinter.printerName>>>>.Select(Base, "2400SAW");
PrintSettings printSettings = new PrintSettings()
{
PrinterID = printer.PrinterID,
NumberOfCopies = 1,
PrintWithDeviceHub = true,
DefinePrinterManually = true
};
PXGraph.CreateInstance<SMPrintJobMaint>().CreatePrintJob(printSettings,"AM615130",parametersDictionary,"Saw Move Verify",CancellationToken.None);
return adapter.Get();
}
#endregion
}
}