PrintBase
  • Product
  • Pricing
  • Docs
  • Resources
PrintBase/专题/平台打印接入

WMS 或 OMS 如何自动打印 SKU 条码标签

在 WMS 复核或上架动作里把 SKU 标签打到工位打印机。没有 WMS 插件,按工位发送 printer_code。调用 POST /v1/print-jobs,API Key 只放在服务端。

面向 仓储和跨境系统里负责条码的开发

说明

WMS 复核台扫描完成时,标签应该从该工位的标签机出来,而不是弹出浏览器对话框。本产品没有某款 WMS 的插件。在复核接口里生成 TSPL、ZPL 或 PDF,POST 到该工位的 printer_code。打印机由门店电脑上的 Agent 主动连出,不需要公网 IP,也不需要把 9100 端口映射到互联网。

批量 SKU 不要合成一个巨大的 PDF 再让驱动慢慢栅格化。能发打印机指令就发 raw,一张标签一个任务或合理的 copies。1000 张标签分成多批,避免一次请求过大,也便于某一张失败后重打。

Idempotency-Key 用波次号、SKU 和序号。重复提交同一张不会再吐一张纸。换 key 才是补打。

创建任务使用 POST /v1/print-jobs,请求头 Authorization: Bearer,正文包含 printer_code、content_type(pdf 或 raw)以及 content 或 content_url 二者之一。免费套餐是一台电脑每月 100 个任务。

创建任务使用 POST /v1/print-jobs,请求头 Authorization: Bearer,正文包含 printer_code、content_type(pdf 或 raw)以及 content 或 content_url 二者之一。免费套餐是一台电脑每月 100 个任务。

接入步骤

  1. 01

    工位绑定打印机

    每台复核电脑运行 Agent,或一台电脑挂多台标签机并用 code 区分。请求使用 POST /v1/print-jobs,请求头为 Authorization: Bearer,printer_code 来自 GET /v1/printers。

  2. 02

    按机型选指令

    佳博、TSC 常见 TSPL。斑马用 ZPL。不确定时用尺寸正确的 PDF。请求使用 POST /v1/print-jobs,请求头为 Authorization: Bearer,printer_code 来自 GET /v1/printers。

  3. 03

    在复核事务提交后打印

    不要在数据库事务里等待物理出纸。POST 返回 queued 就可以结束请求。请求使用 POST /v1/print-jobs,请求头为 Authorization: Bearer,printer_code 来自 GET /v1/printers。

  4. 04

    分批发送

    失败的那一张用新 key 重打,不要整批无条件重放。请求使用 POST /v1/print-jobs,请求头为 Authorization: Bearer,printer_code 来自 GET /v1/printers。

  5. 05

    界面显示 job id

    现场人员能区分排队、缺纸类 PRINT_ERROR 和电脑离线。请求使用 POST /v1/print-jobs,请求头为 Authorization: Bearer,printer_code 来自 GET /v1/printers。

Java

// WMS 复核:一张 SKU 标签
var json = """
{"printer_code":%d,"content_type":"raw",\"content\":\"" + labelBase64 + "\","copies":1}
""".formatted(printerCode);
var req = HttpRequest.newBuilder(URI.create("https://api.printbase.cloud/v1/print-jobs"))
    .header("Authorization", "Bearer " + apiKey)
    .header("Content-Type", "application/json")
    .header("Idempotency-Key", idempotencyKey)
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();
var res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
if (res.statusCode() >= 300) throw new IllegalStateException(res.body());
// {"id":"job_abc","status":"queued"}

这一套的细节

不要把 PDF 当 raw

载荷以 %PDF- 开头会被拒绝,原因是 INVALID_CONTENT。条码指令和 PDF 必须分清 content_type。Agent 只打印你提交的内容,不会替你向平台拉取单据。

怎样确认已经打出来

创建接口返回 id 和 status queued。之后是 queued、dispatched、printing、completed。失败原因包括 AGENT_OFFLINE、PRINTER_OFFLINE、DOWNLOAD_FAILED、PRINT_ERROR、INVALID_CONTENT。用 GET /v1/print-jobs/{id} 查询。Webhook 只在付费套餐提供,且只有 print_job.completed 和 print_job.failed。

常见问题

有 WMS 插件吗?(详见本页)

没有。在你的复核或上架服务里调用。调用的仍是 POST /v1/print-jobs,请求头为 Bearer API Key。HTTP 201 只表示已排队,不表示已经出纸。

一次打 1000 个 SKU?

拆成多批任务。每批仍用稳定的幂等键。单次超大 base64 容易让调用方超时。调用的仍是 POST /v1/print-jobs,请求头为 Bearer API Key。HTTP 201 只表示已排队,不表示已经出纸。

多个货主隔离?(详见本页)

可以用不同组织的 API Key。Enterprise 接口允许创建子组织和子密钥,前提是账号具备 Enterprise 能力。

标签尺寸不对?(详见本页)

指令里的宽高要跟纸和 dpi 一致。接口不改你的坐标。调用的仍是 POST /v1/print-jobs,请求头为 Bearer API Key。HTTP 201 只表示已排队,不表示已经出纸。

相关页面

  • 跨境 WMS 批量打印 SKU 标签

    复核或上架时按批发送 SKU 标签。每批使用稳定的幂等键,失败的一张单独补打。调用 POST /v1/print-jobs,API Key 只放在服务端。调用 POST /v1/print-jobs,API Key 只放在服务端。

  • 佳博 GP-1324D 远程打印 TSPL 或 ZPL 标签

    GP-1324D 常见指令是 TSPL,部分机器可切到 ZPL。先在厂商工具里确认,再按 raw 发送。调用 POST /v1/print-jobs,API Key 只放在服务端。

  • TSC TTP-244 Pro 远程打印条码标签

    TTP-244 Pro 是 TSC 的 203 dpi 桌面机,指令用 TSPL。SIZE 和 GAP 写在指令里,不是 JSON 字段。调用 POST /v1/print-jobs,API Key 只放在服务端。

  • 微信小程序如何自动打印标签

    小程序订单需要标签时,在服务端生成 PDF 或 ZPL/TSPL,再发给门店标签机。没有小程序打印插件。调用 POST /v1/print-jobs,API Key 只放在服务端。

免费套餐:一台电脑每月 100 个任务,不需要信用卡。

免费注册查看 API 文档
PrintBase

PrintBase connects your applications to physical printers anywhere - securely, reliably, and in real time.

Product
Receipt PrintingLabel PrintingDashboardDevicesWebhooks
Resources
DocsBlogStatusAPI ReferenceDownloadPrintBase vs PrintNodePrintNode PricingFAQ
Guides
All guidesIntegrationsPrintersCode samplesComparisonsUse casesTroubleshooting
Company
ContactSecurityPrivacy

© 2026 Aveniq Technologies OÜ. All rights reserved. PrintBase is a service of Aveniq Technologies OÜ.

PrivacyTermsRefunds