如何将自定义 ZPL 标签从移动设备打印到连接到设备集线器的打印机? [英] How can I print custom ZPL labels from a mobile device to a printer connected to device hub?

查看:18
本文介绍了如何将自定义 ZPL 标签从移动设备打印到连接到设备集线器的打印机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让我们的储藏室服务员使用移动设备执行日常任务,其中包括接收包裹和打印自定义位置和物品标签以及用于各种用途的各种自定义标签.Acumatica 2018R2 中的设备集线器似乎是实现此功能的完美概念,但我无法理解如何将自定义 ZPL 文件发送到设备集线器.

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.

似乎 PickPackShip 使用承运人标签执行此操作,将它们从我可以读取的内容发送到幕后的设备集线器,但我没有配置可供我使用的承运人标签,并且可以't 了解它如何将标签文件发送到设备集线器 - 在我阅读代码时,它看起来像是将文件发送到浏览器.

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.

当我创建自己的自定义 ZPL 标签文件时,如何将该原始文本文件发送到设备中心?

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

我可以创建一串标签数据并将其直接打印到连接到应用服务器的打印机上,但这违反了云"规则.
我可以创建一个打印我的 ZPL 代码的报告,并让设备集线器将该文本(显然是 PDF)打印到我的激光打印机.我可以将设备集线器中的打印机设置为原始打印机,但是将报告运行到设备集线器会导致设备集线器出现错误 <代码>打印作业 7 包含无法以原始模式发送的 PDF 文件".似乎将它作为 Acumatica 报告发送,首先将我的文本 ZPL 代码转换为 PDF 文档,而我无法弄清楚如何发送原始命令文本文件.

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 标签数据(手动运行报告时可以看到):

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:

当我使用非法"方法直接打印到应用程序服务器可见的打印机时,提供的 ZPL 数据会生成正确的测试标签.我不介意创建一个实际文件发送到设备中心,但我看到的所有示例似乎都将标签合并为 1 个文件,然后重定向浏览器以下载文件,而不是让设备中心管理原始标签.

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.

推荐答案

我问这个问题已经 18 个月了,所以在 Acumatica 版本升级中可能有也可能没有修复.我现在使用 Acumatica ERP 2019R2.文件上传到 Acumatica 后,使用 PXGraph.CreateInstance().CreatePrintJob 将原始文件打印到 Device Hub 上的打印机.如 HB 所述,您需要 FILEID 的 Dictionary 参数、打印作业的一些描述(这最终流入 Windows 打印队列)和一个 PrintSettings 对象来定义要使用的打印机.

It has been 18 months since I asked the question, so there may or may not have been a fix in an Acumatica version upgrade. I am now on Acumatica ERP 2019R2. After the file is uploaded into Acumatica, use PXGraph.CreateInstance().CreatePrintJob to print the raw file to the printer on Device Hub. You need the Dictionary parameter for FILEID as HB stated, some description for the print job (this ultimately flows into the Windows Print Queue) and a PrintSettings object to define the printer to use.

protected void DHPrint(PXAdapter adapter, FileInfo mergedFile, SMPrinter printer)
{
    Dictionary<string, string> parameters =
        new Dictionary<string, string> { { "FILEID", mergedFile.UID.ToString() } };
    string description = "Label";
    PrintSettings printSettings = new PrintSettings() {
        PrinterID = printer.PrinterID,
        NumberOfCopies = 1,
        PrintWithDeviceHub = true,
        DefinePrinterManually = false };
    PXGraph.CreateInstance<SMPrintJobMaint>().CreatePrintJob(
        printSettings,
        (string)null,
        parameters,
        description);
}

感谢 Hugues Beauséjour 的协助.

Thanks to Hugues Beauséjour for the assist.

这篇关于如何将自定义 ZPL 标签从移动设备打印到连接到设备集线器的打印机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆