-->

How can I print custom ZPL labels from a mobile de

2019-08-19 22:44发布

问题:

I want to allow our storeroom attendants to perform routine tasks with a mobile device, which will include receiving packages and printing custom location and item labels in addition to a variety of custom tags for various uses. Device hub in Acumatica 2018R2 seems to be the perfect concept to enable this, but I cannot understand how to send a custom ZPL file to Device Hub.

It appears that PickPackShip does this with carrier labels, sending them to device hub behind the scenes from what I can read, but I don't have carrier labels configured and available to me and can't catch how it is sending the label file to device hub - looks like it sends the file to the browser instead, as I read the code.

When I create my own custom ZPL label file, how do I send that raw text file to device hub?

I can create a string of my label data and print it directly to a printer connected to the application server, but that breaks "cloud" rules.
I can create a report that prints my ZPL code and have device hub print that text (apparently as a PDF) to my laser printer. I can setup the printer in device hub as a raw printer, but running the report to device hub results in the error on Device Hub "Print job 7 contains a PDF file that can't be sent in raw mode". It appears sending it as an Acumatica report converts my text ZPL codes into a PDF document first, and I can't sort out how to send the raw command text file.

ZPL Label Data (can be seen when running the report manually):

^FO0,30^A0N,32,0^FDCHEMICAL, TEST^FS
^FO0,62^A0N,28,0^FD^FS
^FO0,85^BQN,2,5,Q^FDQA,18-00001^FS
^FO120,90^A0N,32,0^FD18-00001^FS
^FO120,120^A0N,20,0^FDStk UM: PIECE^FS
^FO120,142^A0N,20,0^FDSO UM: PIECE^FS
^FO120,164^A0N,20,0^FD^FS
^FO120,185^A0N,16,0^FD03/22/2019^FS
^PQ1,0,0,N
^XZ

Printing as a report to Device Hub:

Dictionary<string, string> printParams = new Dictionary<string, string>();
printParams["SSLBLabel.LabelID"] = graphLB.Labels.Current.LabelID.ToString();

PXReportRequiredException ex = null;
ex = PXReportRequiredException.CombineReport(ex, "SS601000", printParams);

PX.SM.SMPrintJobMaint.CreatePrintJobForRawFile(adapter, new NotificationUtility(Base).SearchPrinter, SONotificationSource.Customer, "SS601000",
    Base.Accessinfo.BranchID, new Dictionary<string, string> { { "LabelID", sSLBLabel.LabelID.ToString() } },
    PXMessages.LocalizeFormatNoPrefix(SSCS.LB.Messages.PrintLabels, "Label"));

PX.SM.SMPrintJobMaint.CreatePrintJobGroup("ZEBRA", ex, "Labels"); //Job1

Printer configuration on Device Hub:

When I use an "illegal" method of printing directly to a printer visible to the application server, the ZPL data provided results in a proper test label. I don't mind creating an actual file to send into Device Hub, but all the examples I see appear to merge the labels into 1 file and then redirect the browser to download the file instead of having device hub mange the raw label.

标签: acumatica