I did not get Process Shipments Print Pick List to work without the preview screen, but I was only using that to test my Device Hub setup for my custom program. I did get it to work in my custom program that retrieves x number of open orders from the oldest to the newest, it then creates the shipment and prints the pick list. Here are the steps I took to get it all working.
Device Hub
Once you have installed Device Hub make sure you enter the program by right clicking on the app and selecting Run as Administrator. It lets you setup the printer without that but it will not work. Once in the app enter the Device ID under the General tab, enter the Url and credentials on the Connection tab, and enter Name and Select your printer under the Printer tab.
Setup Printer in Acumatica: System Maintenance==>Printers (GI000100)
Use Update Printer List action, if your printer does not load with this action then it is not setup correctly in Device Hub. Manually entering the printer information is a waste of time, the printer will not show as active when manually entered.
Setup Restriction Groups for Printer Access: Configuration==>Printer Access (SM106000)
Setup Default Printer and or assign Printer to specific printer under the User’s Profile (SM203010)
Code:
[Serializable]
[PXCacheName("PrintPickTicketFilter")]
public class PrintPickTicketFilter : IBqlTable
{
#region UsrBranchID
[PXDBInt()]
[PXDefault(typeof(AccessInfo.branchID))]
public virtual Int32? UsrBranchID { get; set; }
public abstract class usrBranchID : PX.Data.BQL.BqlInt.Field<usrBranchID> { }
#endregion
#region PrintWithDeviceHub
[PXDBBool]
[PXDefault(typeof(FeatureInstalled<FeaturesSet.deviceHub>))]
[PXUIField(DisplayName = "Print with DeviceHub")]
public virtual bool? PrintWithDeviceHub { get; set; }
public abstract class printWithDeviceHub : PX.Data.BQL.BqlBool.Field<printWithDeviceHub> { }
#endregion
#region DefinePrinterManually
[PXDBBool]
[PXDefault(true)]
[PXUIField(DisplayName = "Define Printer Manually")]
public virtual bool? DefinePrinterManually { get; set; }
public abstract class definePrinterManually : PX.Data.BQL.BqlBool.Field<definePrinterManually> { }
#endregion
#region PrinterID
[PXPrinterSelector]
public virtual Guid? PrinterID { get; set; }
public abstract class printerID : PX.Data.BQL.BqlGuid.Field<printerID> { }
#endregion
#region NumberOfCopies
[PXDBInt(MinValue = 1)]
[PXDefault(1)]
[PXFormula(typeof(Selector<SOShipmentFilter.printerID, PX.SM.SMPrinter.defaultNumberOfCopies>))]
[PXUIField(DisplayName = "Number of Copies", Visibility = PXUIVisibility.SelectorVisible)]
public virtual int? NumberOfCopies { get; set; }
public abstract class numberOfCopies : PX.Data.BQL.BqlInt.Field<numberOfCopies> { }
#endregion
}
public PXFilter<PrintPickTicketFilter> Filter;
#region Print Pick Ticket
public void PrintPickTicketWithDeviceHub(string shipNbr)
{
SOShipment ship = SOShipment.PK.Find(this, shipNbr);
if (ship != null)
{
var printSettings = new PrintSettings
{
PrintWithDeviceHub = Filter.Current.PrintWithDeviceHub,
DefinePrinterManually = Filter.Current.DefinePrinterManually,
PrinterID = Filter.Current.PrinterID,
NumberOfCopies = Filter.Current.NumberOfCopies
};
Dictionary<string, string> parametersDictionary = new Dictionary<string, string>();
parametersDictionary["Shipment Nbr"] = shipNbr;
Object cstmr = Customer.PK.Find(this, ship.CustomerID);
string actualReportID = new NotificationUtility(this).SearchReport(SONotificationSource.Customer, cstmr, SOReports.PrintPickList, Filter.Current.UsrBranchID);
PXReportRequiredException ex = null;
ex = PXReportRequiredException.CombineReport(ex, actualReportID, parametersDictionary);
SMPrintJobMaint.CreatePrintJobGroup(printSettings, ex, actualReportID);
}
}
#endregion