Printing method, printing server, user terminal, printer, and printing system
By adopting a long-connection communication mechanism in the cloud printing system, bidirectional data transmission of printing commands and device status information is achieved, solving the problems of lagging printing progress monitoring and incomplete anomaly tracing in existing technologies, and improving the reliability and management efficiency of the printing system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOLAR POWER NETWORK TECHNOLOGY (ZHEJIANG) CO LTD
- Filing Date
- 2025-09-26
- Publication Date
- 2026-06-16
AI Technical Summary
Existing cloud printing systems collect printer status through periodic polling mechanisms, which makes it impossible to monitor printing progress in real time and lacks a robust anomaly tracking mechanism, thus reducing the reliability and management efficiency of the printing system.
Employing a long-connection communication mechanism, the print server establishes a long-term connection with the printer, enabling bidirectional data transmission of printing commands and device status information. It also returns printing results to the user terminal through device status information and supports continuous recording of abnormal situations.
It improves the real-time performance and system reliability of printing progress monitoring, ensuring the accuracy of printing tasks and rapid response to abnormal situations.
Smart Images

Figure CN122219861A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud printing technology, and in particular to a printing method, a print server, a user terminal, a printer, and a printing system. Background Technology
[0002] Cloud printing or remote printing technology refers to the ability for users to remotely control and operate printing devices from different geographical locations via an internet connection. It can be used for document printing in corporate offices, as well as label printing on production lines in logistics management, manufacturing, and the food industry.
[0003] Cloud printing systems, through user-operated terminals, are responsible for receiving, processing, and managing print jobs, and then sending them to designated printing devices via print servers and printing devices. In related solutions, the print server typically collects the printer's printing status based on a periodic polling mechanism. This results in the inability to monitor printing progress in real time and an inadequate anomaly tracking mechanism, reducing printing reliability. Summary of the Invention
[0004] This application provides a printing method, a print server, a user terminal, a printer, and a printing system to improve the reliability of the printing system.
[0005] In a first aspect, embodiments of this application provide a printing method applied to a print server. The method includes the following steps: after receiving a print request sent by a user terminal, establishing a long-term communication connection with the printer; wherein the print request includes at least one sequence label; based on the long-term communication connection, sending a print instruction to the printer to cause the printer to print the corresponding sequence label; based on the long-term communication connection, collecting the printer's device status information, and returning the print result to the user terminal based on the device status information; wherein the device status information indicates whether the corresponding sequence label of the printer was successfully printed.
[0006] In one possible implementation, before receiving a print request, the steps further include: establishing a short connection with the printer; and after receiving a print request from the user terminal, establishing a long communication connection with the printer, including: after receiving a print request from the user terminal, sending a communication upgrade command to the printer to make the printer respond, thereby establishing a long communication connection with the printer.
[0007] In one possible implementation, after establishing a long communication connection with the printer, the step further includes sending a device authentication message to the printer to cause the printer to return a set of device capabilities.
[0008] In one possible implementation, before sending a print command to the printer based on a long-lived communication connection, the following steps are also included: establishing a virtual queue including multiple sequence tags; wherein each sequence tag corresponds to an identifier; after collecting the printer's device status information based on the long-lived communication connection, the following steps are also included: establishing a mapping relationship between the identifier corresponding to the sequence tag and the device status information, so as to locate the sequence tag in the virtual queue that was successfully printed or failed to print.
[0009] In one possible implementation, returning the printing result to the user terminal based on device status information includes the following steps: when device status information indicating printing failure is collected from the printer, an alarm is sent to the user terminal; the method also includes the following steps: receiving a reprint request from the user terminal and locating the failed printing sequence label in the virtual queue according to the mapping relationship; and sending a reprint instruction to the printer based on a long communication connection so that the printer prints the failed sequence label.
[0010] In one possible implementation, the device status information includes the following steps: real-time printing status and error codes; based on a long communication connection, the device status information of the printer is collected, including: based on frame splitting technology, the real-time printing status of the printer is collected in the first channel, and the error codes of the printer are collected in the second channel; wherein the first channel has a higher priority than the second channel.
[0011] Secondly, embodiments of this application provide a printing method applied to a user terminal. The method includes the following steps: sending a print request to a print server to cause the print server to perform: establishing a long-term communication connection with the printer; and sending a print instruction to the printer based on the long-term communication connection to cause the printer to print a corresponding sequence label; wherein the print request includes at least one sequence label; and receiving a print result returned by the print server; wherein the print result is determined by the print server based on the long-term communication connection, collecting the printer's device status information, and determining the result based on the device status information; wherein the device status information indicates whether the corresponding sequence label of the printer was successfully printed.
[0012] In one possible implementation, the method further includes the following steps: obtaining a serial label and a configuration file; wherein the serial label includes part number information, machine model information, and expiration date information, and the configuration file includes the correspondence between part numbers and machine models and historical serial labels; based on the configuration file, performing at least one of the following verifications on the serial label: verifying whether the machine model information of the serial label exists in the configuration file, verifying whether the correspondence between the part number information of the serial label and the machine model information exists in the configuration file, verifying whether the format of the expiration date information is correct, and verifying whether the expiration date information overlaps with the expiration date information of historical serial labels; when each of the at least one verification passes, a print request is sent to the print server based on the serial label.
[0013] In one possible implementation, the method further includes the following steps: when at least one verification fails, obtain the corrected sequence label corresponding to the sequence label; broadcast a change event to the print server, the change event indicating that the sequence label is changed to the corrected sequence label.
[0014] Thirdly, embodiments of this application provide a printing method applied to a printer, the method comprising the following steps: receiving a printing instruction and printing a corresponding sequence label; the printing instruction is that after receiving a print request sent by a user terminal, the print server establishes a long communication connection with the printer and, based on the long communication connection, establishes a long communication connection; wherein, the print request includes at least one sequence label; based on the long communication connection, sending device status information to the print server, so that the print server returns the printing result to the user terminal based on the device status information; wherein, the device status information indicates whether the corresponding sequence label printing was successful.
[0015] Fourthly, embodiments of this application provide a print server for performing the following process: after receiving a print request sent by a user terminal, establishing a long-term communication connection with the printer; wherein the print request includes at least one sequence label; based on the long-term communication connection, sending a print instruction to the printer to cause the printer to print the corresponding sequence label; based on the long-term communication connection, collecting the printer's device status information, and returning the print result to the user terminal based on the device status information; wherein the device status information indicates whether the corresponding sequence label of the printer was successfully printed.
[0016] Fifthly, embodiments of this application provide a user terminal for executing the following process: sending a print request to a print server, causing the print server to: establish a long-term communication connection with the printer; and, based on the long-term communication connection, send a print instruction to the printer to cause the printer to print a corresponding sequence label; wherein the print request includes at least one sequence label; and receiving a print result returned by the print server; wherein the print result is determined by the print server based on the long-term communication connection, collecting the printer's device status information, and determining the result based on the device status information; wherein the device status information indicates whether the corresponding sequence label of the printer was successfully printed.
[0017] Sixthly, embodiments of this application provide a printer for performing the following process: receiving a print instruction and printing a corresponding sequence label; the print instruction is that after receiving a print request sent by a user terminal, the print server establishes a long-term communication connection with the printer and, based on the long-term communication connection, prints the corresponding sequence label; wherein the print request includes at least one sequence label; based on the long-term communication connection, the printer sends device status information to the print server, so that the print server returns the printing result to the user terminal based on the device status information; wherein the device status information indicates whether the corresponding sequence label printing was successful.
[0018] In a seventh aspect, embodiments of this application provide a printing system, which includes the above-mentioned print server, user terminal, and printer.
[0019] The printing method, print server, user terminal, printer, and printing system provided in this application include: after receiving a print request from the user terminal, the print server establishes a long-term communication connection with the printer; based on the long-term communication connection, it sends a print command to the printer to print a corresponding sequence label; based on the long-term communication connection, it collects the printer's device status information and returns the printing result to the user terminal based on the device status information; wherein, the device status information indicates whether the corresponding sequence label of the printer was successfully printed. The solution of this application, based on the established long-term communication connection, enables bidirectional data transmission of print commands and device status information, as well as continuous recording of abnormal situations, improving the real-time performance of printing progress monitoring and thus improving the reliability of the printing system. Attached Figure Description
[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0021] Figure 1 A schematic flowchart illustrating the printing method provided in an embodiment of this application;
[0022] Figure 2 A schematic flowchart illustrating the printing method provided in an embodiment of this application;
[0023] Figure 3 A schematic flowchart illustrating the printing method provided in an embodiment of this application;
[0024] Figure 4 A schematic flowchart illustrating the printing method provided in an embodiment of this application;
[0025] Figure 5 A schematic flowchart illustrating the printing method provided in an embodiment of this application;
[0026] Figure 6 A schematic flowchart illustrating the printing method provided in an embodiment of this application;
[0027] Figure 7 This is a schematic diagram of the printing system provided in an embodiment of this application;
[0028] Figure 8 An interactive flowchart of the printing system provided in this application embodiment;
[0029] Figure 9 The interactive flowchart of the printing system provided in the embodiments of this application is shown.
[0030] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0031] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0032] It should be noted that the brief descriptions of terms in this application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning. In addition, the terms "comprising" and "having," and any variations thereof, are intended to be omnipresent but not exclusive. For example, a product or device that comprises a series of components is not necessarily limited to those components that are explicitly listed, but may include other components that are not explicitly listed or that are inherent to such product or device.
[0033] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection between two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0034] The following disclosure provides many different embodiments or examples for implementing various structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the invention. Furthermore, reference numerals and / or letters may be repeated in different examples; such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed. In addition, examples of various specific processes and materials are provided in this invention, but those skilled in the art will recognize the application of other processes and / or the use of other materials.
[0035] With globalization and the development of the digital economy, enterprises have increasingly demanded efficiency and flexibility. Traditional printing methods can no longer meet the challenges of cross-regional, distributed office work and real-time data output. Cloud printing, also known as remote printing, has emerged to address this need, relying on cloud computing technology to enable remote submission and management of print jobs. Its core components include: a user terminal that initiates a print job, a cloud-based print management platform that receives and processes job instructions, and networked physical printers distributed in various locations that receive cloud instructions and execute the actual printing.
[0036] In industrial manufacturing, engineers can directly upload label templates with precise barcodes and unique equipment serial numbers to the cloud. Networked label printers in the factory workshop can then instantly receive the instructions, print, and affix the labels to the equipment. In warehousing and logistics, remote printing allows workers to trigger printing via mobile devices, with on-site printers in the warehouse immediately outputting package labels or inbound lists. Cloud printing, by transforming physical printing equipment into network services, improves resource utilization efficiency and the convenience of business collaboration, breaking down spatial limitations.
[0037] While cloud printing enhances flexibility, current systems relying on traditional print server architectures have certain drawbacks. These systems typically use periodic polling to collect printer status data, meaning the print server must periodically and actively "question" each networked device. This polling interval introduces communication delays, causing the system to be slow to perceive printing progress and unable to provide real-time feedback. Users or administrators struggle to grasp the exact task execution status. Secondly, in the event of printing anomalies, the delayed status information makes fault tracing mechanisms ineffective, making it difficult to accurately pinpoint the time and specific cause of the problem, such as network interruption or device malfunction, thus reducing maintenance response speed and the accuracy of problem diagnosis. These technical issues reduce the reliability and management efficiency of printing systems.
[0038] The technical content provided in this application aims to solve the aforementioned technical problems in related technologies. The printing method, print server, user terminal, printer, and printing system provided in the embodiments of this application include: after receiving a print request from the user terminal, the print server establishes a long-term communication connection with the printer; based on the long-term communication connection, it sends a print command to the printer to print a corresponding sequence label; based on the long-term communication connection, it collects the printer's device status information and returns the printing result to the user terminal based on the device status information; wherein, the device status information indicates whether the corresponding sequence label of the printer was successfully printed. The solution of this application, based on the established long-term communication connection, can realize bidirectional data transmission of print commands and device status information, as well as continuous recording of abnormal situations, improving the real-time performance of printing progress monitoring, thereby improving the reliability of the printing system.
[0039] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0040] Figure 1 This is a flowchart illustrating a printing method provided in an embodiment of this application, which is applied to a print server. Figure 1 As shown, the method includes the following steps:
[0041] S101. After receiving a print request from the user terminal, establish a long-term communication connection with the printer; wherein the print request includes at least one sequence tag;
[0042] S102. Based on the long communication connection, send a print command to the printer so that the printer can print the corresponding sequence label;
[0043] S103. Based on the long-term communication connection, collect the printer's device status information and return the printing result to the user terminal based on the device status information; wherein, the device status information indicates whether the corresponding sequence label of the printer was successfully printed.
[0044] For example, the print server can be a local server or a cloud server; this application does not limit this. In practical applications, based on the high availability and processing power requirements of the actual application scenario, the print server can be deployed in a cluster. For instance, the front end of the cluster uses a load balancer to distribute user terminal requests to multiple print server instances within the cluster, and each instance is responsible for handling the print tasks assigned to it. Optionally, the print server can also be a single node.
[0045] In some embodiments, the user terminal is a device that initiates a print request, and it can take various forms. For example, it may be a fixed desktop computer configured at a workstation, a portable mobile terminal used by management personnel, an industrial tablet device held by a production line operator, or a wearable device. Specifically, the user terminal needs to run a client application with print initiation capabilities, such as a web interface or a native application. The user terminal connects to the print server via a network. Optionally, the user terminal can also be a pre-configured terminal that periodically sends print requests.
[0046] For example, a print request sent from a user terminal to a print server can be a structured data message. A print request typically contains one or more sequence label data that need to be printed.
[0047] As another example, this approach allows specifying the "print type" within the request. For instance, the user terminal can select the desired print type in the print request, including encoding combination options (e.g., barcode only, QR code only, barcode + QR code combination). For example, selecting "barcode + QR code" instructs the print server to require the printer to print both barcode and QR code representations for the same serial number when generating subsequent print instructions. This example solution satisfies two key aspects of the production line: high-speed barcode scanning for its fast reading speed, and quality inspection requiring more comprehensive information traceability based on the large information capacity of QR codes.
[0048] In some embodiments, the print server first completes the initial handshake, authentication, and preliminary verification of the target printer's reachability through a short connection. Only after successful verification does the print server proactively initiate the establishment of a long connection with the specified target printer and maintain this connection for subsequent continuous printing command transmission and device status information collection. In practical applications, the long connection is usually not immediately closed after the printing task is completed, but rather maintained for a period of time to await subsequent possible tasks, or closed by the print server according to a preset timeout policy.
[0049] In some optional embodiments, the print server can also establish a short connection with the printer before receiving a print request from the user terminal. This connection is used for low-requirement or low-frequency non-real-time printing tasks such as printer status detection, configuration queries, and consumable level checks. In practical applications, the short connection can be established based on the Hypertext Transfer Protocol (HTTP), while the corresponding long connection can be established based on the WebSocket protocol to support full-duplex real-time communication. Besides using the WebSocket protocol to directly establish a real-time communication channel between the user terminal and the print server, middleware can also be deployed using the MQTT (Message Queuing Telemetry Transport) protocol to achieve more flexible and efficient real-time data transmission. Optionally, the short connection can be based on the Simple Mail Transfer Protocol (SMTP), while the corresponding long connection can be established based on the Internet Message Access Protocol (IMAP).
[0050] In this example, a print instruction refers to a set of specific operation commands issued by the print server to the target printer through an established long-lived communication connection, based on the received print request, such as specific sequence label data and print type requirements. For instance, the print instruction not only carries the text content of the sequence label to be printed, such as the serial number, but may also include detailed information such as layout format, font, size, and graphic requirements, so that the printer can accurately output the label according to preset requirements.
[0051] In practical applications, in a single-printer scenario, the sequence label is printed by that printer. However, in actual deployments, to improve printing efficiency and reliability, a print array consisting of multiple printers of the same or compatible model is often used. In this case, the sequence label corresponding to the printer can be determined through a task allocation strategy.
[0052] For example, a print server, or a dedicated task scheduler, can dynamically allocate print requests carrying sequence label information to an idle or lightly loaded printer in the array based on preset strategies such as round-robin, load balancing based on printer queue length and status, printer preset priorities, or label physical placement requirements. In this case, the print server needs to manage the mapping relationship between label data and specific physical printers in the print array internally or through a task scheduling service.
[0053] In some embodiments, the print server can initiate a status query request to the printer via a long-lived communication connection, or the printer can send device status information such as printing progress in real time via the long-lived communication connection. Optionally, the printer can be pre-configured to proactively push status information to the print server when specific events, such as status changes, occur.
[0054] For example, device status information is a feedback message sent by the printer back to the print server via the aforementioned long-lived communication connection. Its specific form depends on the printer model and communication protocol, and is typically structured data fields or predefined status codes. For instance, device status information may include one or more combinations of the following: printing status such as ready, printing in progress, printing complete, out of paper, printhead overheating, paper jam, buffer overflow, etc.; task execution result: the response result to the most recent print command (success, failure, and if it fails, it may include an error code); network connection status: whether communication is normal (connection maintained, disconnected); consumable status: paper / label balance, ribbon percentage, or estimated length, etc.
[0055] For example, sending print commands and collecting device status information can be done through the same physically established long-lived communication connection. The communication protocol design can support bidirectional interaction over this connection: the print server sends print commands, and the printer responds with its status and results. Specifically, print commands and device status information share the same channel, but are processed separately at the application layer logic.
[0056] The printing method provided in this application includes: after receiving a print request from a user terminal, the print server establishes a long-term communication connection with the printer; based on the long-term communication connection, it sends a print command to the printer to print the corresponding sequence label; based on the long-term communication connection, it collects the printer's device status information and returns the printing result to the user terminal based on the device status information; wherein, the device status information indicates whether the corresponding sequence label of the printer was successfully printed. The solution of this application, based on the established long-term communication connection, can realize bidirectional data transmission of print commands and device status information, as well as continuous recording of abnormal situations, improving the real-time performance of print progress monitoring, thereby improving the reliability of the printing system.
[0057] Figure 2 This is a flowchart illustrating the printing method provided in an embodiment of this application. Figure 2 As shown, before receiving the print request in step S101, the following steps are also included:
[0058] S201. Establish a short connection with the printer;
[0059] After receiving a print request from the user terminal, S101 establishes a long-lived communication connection with the printer, including:
[0060] S202. After receiving the print request from the user terminal, send a communication upgrade command to the printer to make the printer respond and establish a long communication connection with the printer.
[0061] In some embodiments, the print server communicates with the target printer by proactively initiating a one-time, short connection. Specifically, this process typically involves a standard network protocol handshake; after the connection is established, it is used only to transmit a small amount of data, such as status query commands or simple configuration reads, and then the connection resources are immediately released. In practical applications, this short connection establishment operation can be triggered periodically by the print server or performed in advance when a print request is anticipated.
[0062] In this example, after receiving a print request from the user terminal, the print server does not directly establish a new persistent connection. Instead, it sends a special communication upgrade command to the printer based on the existing short connection. This command can be understood as a negotiation message, notifying both the printer and the server that the current temporary short connection needs to be upgraded to a persistent long-lived connection. Upon receiving this command, the printer must return a specific response to confirm its upgrade intention. Only after receiving a successful response from the printer does the print server officially convert the connection to a persistent state for subsequent intensive print command transmissions and status information queries. This example optimizes connection establishment efficiency by upgrading the short connection, reducing the overhead of repeatedly creating new connections.
[0063] For example, a standard short TCP connection is pre-established between the print server and the printer for basic HTTP communication. When the print server receives a print request from the user's terminal, it sends an HTTP Upgrade request with a WebSocket header to the printer via the TCP connection. This request indicates that the connection protocol should be upgraded to WebSocket. After parsing the instruction, if the printer supports the protocol conversion, it returns an HTTP 101 Switching Protocols response. This response indicates that the printer accepts the upgrade request and agrees to switch the communication protocol.
[0064] This example demonstrates a solution that dynamically upgrades pre-established short connections to long-lived connections on demand. This reduces the network handshake latency and resource consumption required to establish a new long connection each time a print request is processed. It also improves the printer's basic accessibility before the actual print job begins, thereby enhancing the printing system's response speed and resource utilization efficiency.
[0065] As yet another example, based on any example, after establishing a long communication connection with the printer in step S101, the following steps are also included: sending a device authentication message to the printer so that the printer returns a set of device capabilities.
[0066] For example, a device authentication message refers to a security credential message sent by the print server to the printer immediately after successfully establishing a long-lived communication connection, used to verify identity and permissions. In practical applications, this device authentication message may include: a pre-set hardware identification code of the printer, signature information based on a digital certificate, or other encrypted credentials required by security policies, to determine that the printer is a legitimate and controlled device authorized by the system.
[0067] For example, a device capability set refers to a structured data set that a printer returns to the print server via a long connection after receiving and verifying a device authentication message. This set describes the printer's physical attributes, functional characteristics, and current availability. For instance, a device capability set may include: printer model and specifications, supported label size range, acceptable print media types, resolution capabilities, loaded label library template names, maximum print speed, buffer size, real-time consumable balance, and health status indicators for various physical components. The device capability set allows determination of the printer's actual operational capability boundaries.
[0068] The solution in this example establishes a long-term communication connection and promptly performs device authentication and capability set collection. This solution ensures that print jobs are only assigned to legitimate devices that have passed security authentication, and that subsequent print commands are limited to the functions that the printer has declared to support and the real-time available resources. This improves printing security and reduces the risk of print failures caused by incompatible functions or insufficient resources.
[0069] Figure 3 This is a flowchart illustrating the printing method provided in an embodiment of this application. Figure 3 As shown, before sending the print command to the printer based on the long-lived communication connection in S102, the following steps are also included:
[0070] S301. Establish a virtual queue that includes multiple sequence tags; wherein each sequence tag corresponds to an identifier.
[0071] After collecting the printer's device status information based on the long-lived communication connection in step S102, the following steps are also included:
[0072] S302. Establish a mapping relationship between the identifier corresponding to the sequence tag and the device status information to locate the sequence tag that was printed successfully or failed to print in the virtual queue.
[0073] In some embodiments, before sending a print command to the printer, the print server organizes multiple sequence tags in the print request—for example, a batch of tags containing 20 different sequence numbers—into a logical virtual queue. It should be understood that this virtual queue does not actually exist in the printer's physical buffer, but rather is a data structure built by the print server in its own memory or a dedicated cache service. Each sequence tag is assigned a globally unique identifier, such as a UUID or a composite key generated from the request ID and the tag sequence number, when it enters the virtual queue. This identifier is bound to the sequence tag throughout the entire print job lifecycle, facilitating accurate tracking later.
[0074] In some embodiments, when the print server generates a print instruction based on the sequence tags in the virtual queue, it encrypts the instruction packet using the Advanced Encryption Standard 256-bit (AES-256) encryption algorithm before sending it to the printer via a long communication connection. For batch printing tasks, the user terminal can specify the unified identifier header and printing range of the sequence tags in the print request. The print server processes the sequence tags within the range based on a hybrid encryption strategy to generate non-contiguous SN sequences, ensuring the uniqueness of each SN sequence and the security of transmission.
[0075] In some embodiments, after the print server collects the device status information returned by the printer via a long-lived communication connection, it immediately establishes a mapping relationship between this status information and specific sequence tags on the server side. Specifically, the print server parses the association identifier implicitly or explicitly carried in the device status information and associates it with the preset identifier of the corresponding sequence tag in the virtual queue. Subsequently, this association relationship is recorded in a status mapping table or a task log library. In practical applications, through this mapping relationship, the print server can clearly locate which sequence tags in the virtual queue have been printed successfully (i.e., the device status information has been confirmed) and which have failed to print (e.g., a paper outage error caused a specific tag not to be printed), thereby achieving fine-grained task status management.
[0076] For example, suppose a user terminal submits a print request containing three sequence labels (SN123, SN456, SN789). The print server creates a virtual queue, adds the three labels to the queue sequentially, and assigns them identifiers: A (corresponding to SN123), B (corresponding to SN456), and C (corresponding to SN789). Subsequently, the print server sends a print command containing these three labels to the printer via a persistent communication connection. During printing, the printer fails to print SN123 and SN456 (identifiers A and B) successfully due to a broken ribbon; SN789 fails to print. The printer then returns device status information, which reveals the location of the failure, such as the failure of the third label. Based on the built-in logical location and identifier correspondence in the command, or the specific error label index information returned by the printer, the print server accurately establishes a status mapping: "A: Success", "B: Success", "C: Ribbon Failure". Through this mapping, the print server can directly locate the failed sequence label in the virtual queue as C (i.e., SN789) and report to the user terminal: "Sequence label SN789 printing failed, reason: ribbon exhausted". This example helps with problem tracing and reprinting of failed labels without having to reprint the entire batch.
[0077] The solution in this example establishes a virtual queue with identifiers for the sequence labels and maps it to device status information, thereby enabling independent tracking and location of whether a single sequence label is successfully or unsuccessfully printed in a batch printing task. This effectively avoids the waste of resources caused by re-sending the entire task due to local failures and improves the fault tolerance of the printing system.
[0078] Figure 4 This is a flowchart illustrating the printing method provided in an embodiment of this application. Figure 4 As shown, step S103, which returns the printing result to the user terminal based on the device status information, includes the following steps:
[0079] S401. When the device status information of the printer indicating printing failure is collected, an alarm is sent to the user terminal.
[0080] The method also includes the following steps:
[0081] S402, Receive the reprint request from the user terminal and locate the sequence label that failed to print in the virtual queue according to the mapping relationship;
[0082] S403. Based on the long-term communication connection, send a reprint command to the printer so that the printer can print the failed sequence label.
[0083] After the print server collects the device status information indicating printing failure, it first automatically records the identifier of the failure sequence label and the current printing task progress, and continues to execute the remaining printing tasks in the virtual queue. After the remaining tasks are completed, it sends a reprint prompt (including the failure label identifier and fault type) to the user terminal. After receiving the reprint request from the user terminal, it locates the printing failure sequence label in the virtual queue according to the mapping relationship, and sends a reprint instruction to the printer based on the long communication connection so that the printer can print the failure sequence label.
[0084] It should be understood that the reprint request in this example is an active reprint request triggered by the user terminal after receiving an alarm from the print server for a specific sequence label (indicating printing failure). This reprint request only contains the specific sequence label data (not the entire batch) already marked as printing failure in the virtual queue, and relies on a pre-established mapping relationship between sequence label identifiers and device status information by the print server to accurately locate the label object that needs reprinting. In contrast, a normal print request is initiated by the user, includes the initial complete batch of sequence label data, and does not rely on historical failed label location.
[0085] For example, a printer returning a status code "0x11" indicates successful printing, while any status code other than "0x11" is considered a printing failure. Optionally, the status codes can also be encrypted. Further optionally, when the user terminal sends consecutive sequence tags, the sequence tag data can be encrypted to generate non-consecutive sequence tags, thereby improving data transmission and storage security.
[0086] In practical applications, the reprint request can be a reprint request for a single sequence tag that failed to print, or a reprint request for all sequence tags that failed to print before the reprint request was sent.
[0087] For example, suppose a user terminal initiates a print request containing five serial labels (SN001 to SN005). During the print server's execution of the task, the ribbon in the first printer in the print array breaks, causing label SN004 to fail to print, and the device status information returns a "ribbon exhausted" error. The print server, through the mapping relationship, locates the failed label as SN004 and immediately sends an alarm message to the user terminal: "Serial label SN004 printing failed, reason: ribbon exhausted."
[0088] Furthermore, the user terminal initiates a reprint request based on the alarm, the request containing only the SN004 tag information. The print server, based on this request, reuses existing identifier-status mappings, such as the original identifier D of the failed tag SN004 in the virtual queue, to locate the object to be reprinted.
[0089] Furthermore, based on a load balancing strategy, the print server selects the second printer in the print array that is functioning normally and sends a reprint command for SN004 (excluding other labels) through a long-lived communication connection with that printer. Once the second printer successfully prints the SN004 label, the partial repair is complete. The first and second printers can be the same printer or different printers; this example does not impose such limitations.
[0090] The solution in this example triggers a targeted reprint process by alarming and reuses the mapping relationship to locate the failed label, thus achieving rapid closed-loop processing of abnormal printing tasks. This avoids the waste of resources caused by re-issuing the entire batch due to local failures, and maintains the integrity and traceability of the sequence label batch through accurate reprinting, thereby improving the execution efficiency of the production line printing process.
[0091] As yet another example, building upon any previous example, the device status information includes: real-time printing status and error codes; based on a long-lived communication connection, the printer's device status information is collected, including:
[0092] Based on Frame Shunting Technology (FST), which is a transmission technology that distributes device status data to different logical sub-channels according to data type, the real-time printing status of the printer is collected in the first channel, and the error code of the printer is collected in the second channel; the first channel has higher priority than the second channel.
[0093] In some embodiments, the real-time printing status is characterized by a dynamic data stream continuously acquired in the first channel, representing the process details of the printer's current task execution. Specifically, the real-time printing status can be a frequently updated structured data field, including but not limited to: the identifier or logical position of the sequence label being printed, and the percentage progress of the number of completed labels relative to the total number of labels. Optionally, the real-time printing status may also include: real-time printhead temperature, current printing speed, cumulative length of physically printed labels, and motor load factor, etc. In practical applications, this data is continuously transmitted at millisecond or second intervals, forming a real-time visual monitoring stream of the printing task execution process.
[0094] For example, error codes are predefined standardized combinations of numbers or alphanumeric values, encoded from events acquired in the second channel. For instance, error codes might include: 001: Ribbon depleted, 002: Media loading error, etc.
[0095] In this example, based on frame splitting technology, within the same long-lived communication connection's physical channel, different types of data streams (real-time printing status and error codes) are divided into logically isolated virtual sub-channels—the first channel and the second channel—through application layer protocol design. Specifically, within this physical channel, all transmitted data packets carry a preset frame type identifier. The print server splits the data packets in real-time according to the frame type identifier: packets containing "status frames" are preferentially routed to the high-priority first channel processing virtual queue, while packets containing "error frames" enter the lower-priority second channel processing virtual queue. In practical applications, the print server can also allocate higher computing resources and network scheduling weight to the first channel to improve the zero-blocking transmission of real-time printing status.
[0096] The solution in this example uses frame splitting technology to isolate and transmit real-time printing status and error codes through dual channels and set differentiated priorities. This ensures that critical process monitoring data arrives with low latency, while reducing interference from lower-priority error codes, thereby improving the system's sensitivity to printing process anomalies.
[0097] The printing method provided in this application includes: after receiving a print request from a user terminal, the print server establishes a long-term communication connection with the printer; based on the long-term communication connection, it sends a print command to the printer to print the corresponding sequence label; based on the long-term communication connection, it collects the printer's device status information and returns the printing result to the user terminal based on the device status information; wherein, the device status information indicates whether the corresponding sequence label of the printer was successfully printed. The solution of this application, based on the established long-term communication connection, can realize bidirectional data transmission of print commands and device status information, as well as continuous recording of abnormal situations, improving the real-time performance of print progress monitoring, thereby improving the reliability of the printing system.
[0098] This application also provides a printing method for use on a user terminal, the method comprising the following steps:
[0099] Send a print request to the print server so that the print server can perform the following actions: establish a long-lived communication connection with the printer, and send a print command to the printer based on the long-lived communication connection so that the printer can print the corresponding sequence label; wherein, the print request includes at least one sequence label;
[0100] Receive the printing result returned by the print server; the printing result is determined by the print server based on the printer's device status information collected through a long communication connection; the device status information indicates whether the corresponding sequence label of the printer was printed successfully.
[0101] In this example, the printing method executed by the user terminal can be referred to the printing method executed by the printing server mentioned above. The implementation principle and technical effect are similar, and will not be described in detail here.
[0102] Figure 5 This is a flowchart illustrating the printing method provided in an embodiment of this application. Figure 5 As shown, the method also includes the following steps:
[0103] S501. Obtain the serial number tag and configuration file; wherein, the serial number tag includes: part number information, machine model information and expiration date information, and the configuration file includes the correspondence between part number and machine model and historical serial number tags;
[0104] S502. Based on the configuration file, perform at least one of the following verifications on the serial label: verify that the model information of the serial label exists in the configuration file, verify that the correspondence between the part number information and the model information of the serial label exists in the configuration file, verify that the format of the validity period information is correct, and verify that the validity period information overlaps with the validity period information of historical serial labels.
[0105] S503. If each of the at least one verification passes, a print request is sent to the print server based on the sequence tag.
[0106] In practical applications, sequence tags can initially be automatically generated by the factory and captured by the user terminal, or the user can send the automatically generated sequence tags to the user terminal.
[0107] In some embodiments, before performing a printing operation, the user terminal needs to acquire two types of key input data simultaneously. The first is the serial label data package or serial label string to be printed, whose structured fields must include: specific material code (part number information), applicable equipment type (machine model information), and label validity period range (expiration date information); the second is a configuration file, which stores: a mandatory binding relationship table between material codes and equipment types (the correspondence between part numbers and machine models), and a record set of all existing serial labels in the system (historical serial labels), used for uniqueness and compliance verification.
[0108] Specifically, the user terminal performs structured verification on the serial label based on the configuration file. The verification logic supports the following single or combined checks: verifying whether the model information in the serial label exists in the whitelist of valid device types declared in the configuration file; verifying whether the combination of the part number information and the model information of the serial label matches the legal binding relationship defined in the configuration file, such as part number A being allowed only for model X; verifying whether the format of the validity period information conforms to the preset specification, such as YYYY-MM-DDHH:MM format; and verifying whether the validity period information of the current label overlaps or conflicts with the validity period of any historical serial label in the configuration file on the timeline, in order to prevent duplicate authorization or time overwriting.
[0109] It should be noted that the number of items verified in this example is the same as the number of items in the pass / fail criteria. For example, when at least one item in the verification is three (A, B, C), the pass / fail criterion is that all three items pass, not just any one of them. Optionally, when at least one item in the verification is A and B, both A and B must pass to satisfy the pass / fail criterion. In practical applications, the number of items to be verified can be selected according to the verification requirements. It can be all the items in step S502, or only a few items in step S502. The step of sending a print request to the print server based on the sequence tag is only executed when all the selected items pass.
[0110] In some embodiments, a standardized print request message is constructed based on the sequence tag data and sent to the print server only after the user terminal has completed all configured verification items and all verifications have passed. In practical applications, if any verification fails, the process is interrupted and an error is displayed.
[0111] The solution presented in this example reduces the inflow of high-risk label data such as model mismatch, incorrect material binding, invalid expiration dates, and conflicts into the printing process by performing multi-dimensional pre-verification based on configuration files on the user terminal. This reduces the label rejection rate caused by data defects and improves the reliability of serial label printing.
[0112] Figure 6 This is a flowchart illustrating the printing method provided in an embodiment of this application. Figure 6 As shown, the method also includes the following steps:
[0113] S601. If at least one verification fails, obtain the corrected sequence label corresponding to the sequence label.
[0114] S602. Broadcast a change event to the print server, indicating that the sequence label should be changed to the corrected sequence label.
[0115] In the example above, when at least one of the verification items is three (A, B, C), the pass condition is that all three items pass. If verification of A fails, or verification of B fails, or verification of C fails, the subsequent step of obtaining the corrected sequence label corresponding to the sequence label is executed.
[0116] In some embodiments, the correction tag may originate from local processing on the user terminal: the user terminal automatically generates the correction value based on preset rules. For example, to address the expiration date conflict problem, the algorithm automatically calculates the first time point after the expiration of the historical sequence tag as the new start date.
[0117] Optionally, the correction label may also be corrected manually: the user terminal pops up an interactive interface prompting the operator to enter a valid value, such as manually selecting a new model or resetting the validity period, and a correction sequence label is generated after confirmation.
[0118] In practical applications, since print server clusters, other terminals, or databases may have already cached the original sequence tag data, single-point updates cannot guarantee global synchronization. Broadcast change events are distributed through message queues (such as RabbitMQ). Broadcasting publishes the change event (including the original tag identifier and the corrected value) to the message queue or event bus and simultaneously triggers a cache refresh, forcing other terminals, print servers, storage services, etc., to synchronously update the sequence tag values in their local caches or databases. This ensures that all terminals and print servers obtain the latest configuration and that subsequent operations are performed based on the corrected data, avoiding secondary verification failures.
[0119] The solution in this example, based on correcting the sequence label and broadcasting change events to force sequence label synchronization, achieves real-time closed-loop repair of failed verification labels and maintenance of global data consistency.
[0120] As yet another example, building upon any previous example, the method specifically includes the following steps:
[0121] Receive alarms from the print server; where the alarm is executed by the print server after collecting device status information of the printer indicating printing failure.
[0122] The method also includes the following steps:
[0123] A reprint request is sent to the print server, causing the print server to: locate the failed sequence label in the virtual queue according to the mapping relationship; and send a reprint instruction to the printer based on the long communication connection, so that the printer can print the failed sequence label.
[0124] The above combination Figure 5 and Figure 6 The implementation method is briefly described as follows: When each verification in at least one verification passes, the user terminal triggers the configuration update process: First, update the local associated database and cached data, and then send a change event to the system message queue to notify other associated user terminals to synchronize the latest part number-model-expiration date associated configuration to ensure the consistency of the configuration of the entire system; if the verification fails, in addition to obtaining the correction sequence tag and broadcasting the change event, it is also necessary to record the error type of the original sequence tag (such as part number format error, overlapping expiration dates, etc.) to the local log for subsequent traceability.
[0125] In the printing method provided in this application embodiment, after receiving a print request from a user terminal, the print server establishes a long-term communication connection with the printer; based on the long-term communication connection, it sends a print command to the printer to print the corresponding sequence label; based on the long-term communication connection, it collects the printer's device status information and returns the printing result to the user terminal based on the device status information; wherein, the device status information indicates whether the corresponding sequence label of the printer was successfully printed. The solution of this application, based on the established long-term communication connection, can realize bidirectional data transmission of print commands and device status information, as well as continuous recording of abnormal situations, improving the real-time performance of printing progress monitoring, thereby improving the reliability of the printing system.
[0126] This application also provides a printing method applied to a printer, the method comprising the following steps:
[0127] The system receives print instructions and prints the corresponding sequence labels. The print instruction is a long-term communication connection established between the print server and the printer after the print server receives a print request from the user terminal. The print request includes at least one sequence label.
[0128] Based on a long-lived communication connection, device status information is sent to the print server so that the print server can return the printing results to the user terminal based on the device status information; wherein, the device status information indicates whether the corresponding sequence label printing was successful.
[0129] In one example, the printing method also includes the following steps: establishing a short connection with the print server.
[0130] The printing method specifically includes the following steps: receiving a communication upgrade instruction from the print server and responding to the print server to establish a long communication connection with the print server; wherein, the communication upgrade instruction is sent by the print server after receiving a print request from the user terminal.
[0131] In one example, the printing method also includes the following steps: receiving a device authentication message from the print server and returning a set of device capabilities.
[0132] In one example, the printing method further includes the following steps: receiving a reprint instruction from the print server based on a long communication connection, and printing the failed sequence labels; wherein, the reprint instruction is generated by the print server after receiving a reprint request from the user terminal, and locating the failed sequence labels in the virtual queue according to the mapping relationship.
[0133] In this example, the printing method executed by the printer can be referred to the printing method executed by the print server mentioned above. The implementation principle and technical effect are similar, and will not be described in detail here.
[0134] This application also provides a print server for performing the following processes:
[0135] Upon receiving a print request from the user terminal, a long-lived communication connection is established with the printer; wherein the print request includes at least one sequence tag;
[0136] Based on a long-lived communication connection, a print command is sent to the printer so that the printer can print the corresponding sequence label;
[0137] Based on a long-lived communication connection, the device status information of the printer is collected, and the printing result is returned to the user terminal based on the device status information; among them, the device status information indicates whether the corresponding sequence label of the printer was printed successfully.
[0138] In one example, the aforementioned print server is also used to perform the following process: establishing a short connection with the printer;
[0139] The aforementioned print server is specifically used to perform the following process: after receiving a print request from a user terminal, it sends a communication upgrade command to the printer so that the printer can respond and establish a long-term communication connection with the printer.
[0140] In one example, the aforementioned print server is also used to perform the following process: sending a device authentication message to the printer so that the printer returns a set of device capabilities.
[0141] In one example, the aforementioned print server is also used to perform the following process: establishing a virtual queue including multiple sequence tags; wherein each sequence tag corresponds to an identifier; establishing a mapping relationship between the identifier corresponding to the sequence tag and the device status information, so as to locate the sequence tag in the virtual queue that was printed successfully or failed to print.
[0142] In one example, the aforementioned print server is specifically used to perform the following process: when it collects device status information indicating a printing failure from the printer, it sends an alarm to the user terminal;
[0143] The aforementioned print server is also used to perform the following processes: receiving reprint requests from user terminals, locating failed sequence labels in the virtual queue according to the mapping relationship; and sending reprint instructions to the printer through a long communication connection so that the printer can print the failed sequence labels.
[0144] In one example, the aforementioned device status information includes: real-time printing status and error codes; the print server is specifically used to: collect the printer's real-time printing status in the first channel and collect the printer's error codes in the second channel based on frame splitting technology; wherein the first channel has a higher priority than the second channel.
[0145] This application also provides a user terminal for executing the following process:
[0146] Send a print request to the print server so that the print server can perform the following actions: establish a long-lived communication connection with the printer, and send a print command to the printer based on the long-lived communication connection so that the printer can print the corresponding sequence label; wherein, the print request includes at least one sequence label;
[0147] Receive the printing result returned by the print server; the printing result is determined by the print server based on the printer's device status information collected through a long communication connection; the device status information indicates whether the corresponding sequence label of the printer was printed successfully.
[0148] In one example, the aforementioned user terminal is also used to execute the following process:
[0149] Obtain the sequence tag and configuration file; the sequence tag includes: part number information, machine model information and expiration date information, and the configuration file includes the correspondence between part number and machine model and historical sequence tags;
[0150] Based on the configuration file, perform at least one of the following verifications on the serial label: verify that the model information of the serial label exists in the configuration file, verify that the correspondence between the part number information of the serial label and the model information exists in the configuration file, verify that the format of the validity period information is correct, and verify that the validity period information overlaps with the validity period information of historical serial labels. Through the above verifications, ensure that the model, part number and validity period of the serial label conform to the preset binding relationship and avoid configuration errors.
[0151] If each of the at least one verification passes, a print request is sent to the print server based on the sequence tag.
[0152] In one example, the aforementioned user terminal is also used to execute the following process:
[0153] If at least one verification fails, obtain the corrected sequence label corresponding to the sequence label; broadcast a change event to the print server, indicating that the sequence label should be changed to the corrected sequence label.
[0154] In one example, the aforementioned user terminal is specifically used to: receive an alarm from the print server; wherein the alarm is executed by the print server after collecting device status information indicating printing failure;
[0155] The aforementioned user terminal is also used to: send a reprint request to the print server so that the print server can perform the step of locating the failed sequence label in the virtual queue according to the mapping relationship; and send a reprint instruction to the printer based on the long communication connection so that the printer can print the failed sequence label.
[0156] This application also provides a printer for performing the following process:
[0157] The system receives print instructions and prints the corresponding sequence labels. The print instruction is a long-term communication connection established between the print server and the printer after the print server receives a print request from the user terminal. The print request includes at least one sequence label.
[0158] Based on a long-lived communication connection, device status information is sent to the print server so that the print server can return the printing results to the user terminal based on the device status information; wherein, the device status information indicates whether the corresponding sequence label printing was successful.
[0159] In one example, the aforementioned printer is also used to perform the following process: establishing a short connection with the print server;
[0160] The aforementioned printer is specifically used to perform the following process: receiving a communication upgrade instruction from the print server and responding to the print server to establish a long communication connection with the print server; wherein, the communication upgrade instruction is sent by the print server after receiving a print request from the user terminal.
[0161] In one example, the aforementioned printer is also used to perform the following process: receiving a device authentication message from the print server and returning a set of device capabilities.
[0162] In one example, the aforementioned printer is also used to perform the following process: receiving a reprint instruction from the print server based on a long communication connection, and printing the failed sequence labels; wherein, the reprint instruction is generated by the print server after receiving a reprint request from the user terminal, and locating the failed sequence labels in the virtual queue according to the mapping relationship.
[0163] The print server, user terminal, and printer provided in the above embodiments can execute the methods provided in the above method embodiments. Their implementation principles and technical effects are similar, and will not be described in detail here.
[0164] Figure 7 This is a schematic diagram of the structure of a printing system provided in an embodiment of this application. The printing system includes: a print server as described in any of the above embodiments, a user terminal as described in any of the above embodiments, and a printer as described in any of the above embodiments.
[0165] Figure 8 This is an interactive flowchart of the printing system provided in an embodiment of this application. Figure 8 As shown, the user terminal sends a print request including a batch sequence label to the print server (batch request in the figure). After receiving the batch request, the print server sends a print command to the printer, collects the printer's real-time printing status under the first channel (status confirmation in the figure), collects the printer's error code under the second channel, and sends an abnormal alarm to the user terminal upon receiving the error code. Further, the user terminal sends a reprint request to the print server, causing the print server to send a reprint command to the printer, collect the printer's real-time printing status under the first channel (completion confirmation in the figure), and send the printing result to the user terminal (completion notification in the figure).
[0166] Figure 9 This is an interactive flowchart of the printing system provided in an embodiment of this application. Figure 9As shown, the user terminal first performs "connection initialization," initiating a "TCP handshake" to establish a basic network connection. It then upgrades to a bidirectional long-connection state via the "WebSocket handshake protocol." After the connection is established, it enters the "heartbeat maintenance state," sending a heartbeat packet every 1500 milliseconds for keep-alive monitoring. When "timeout without response" occurs continuously, it enters the "abnormal disconnection state" processing branch, executing a reconnection strategy: triggering a "retry counter +1" operation and setting a "maximum of 5" reconnection limit. In the state of successfully maintaining the connection, if a "received print command" event is detected, it enters the "data transmission state" stage. In this stage, a "message encryption transmission" security mechanism is implemented, specifically employing a dual encryption and integrity protection scheme of "TLS 1.3 + custom verification." After data is sent, a continuous "data verification" process is initiated. When verification fails and "retry count < 5," it returns to the transmission stage to continue the retransmission process, recording "retransmitted data +1," also adhering to the "maximum of 5" limit. If all retransmission attempts fail, resulting in "Maximum retry count reached" or "Maximum retransmission count reached," the process will display an "Error message" and terminate. Conversely, if the verification succeeds, the printer will "output print content" and the printing progress will be displayed in real time on the user terminal interface, eventually reaching the "End" node. The entire process improves the reliability of the interaction between the user terminal and the printer through systematic timeout control, encryption verification, and retry strategies.
[0167] In the printing system provided in this application embodiment, after receiving a print request from a user terminal, the print server establishes a long-term communication connection with the printer. Based on this long-term communication connection, it sends a print command to the printer to print the corresponding sequence label. Based on the long-term communication connection, it collects the printer's device status information and returns the printing result to the user terminal based on this information. The device status information indicates whether the corresponding sequence label was successfully printed. This application's solution, based on the established long-term communication connection, enables bidirectional data transmission of print commands and device status information, as well as continuous recording of abnormal situations, improving the real-time performance of print progress monitoring and thus enhancing the reliability of the printing system.
[0168] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A printing method, characterized in that, Applied to a print server, the method includes the following steps: Upon receiving a print request from a user terminal, a long-lived communication connection is established with the printer; wherein, the print request includes at least one sequence tag; Based on the long-lived communication connection, a print command is sent to the printer to cause the printer to print the corresponding sequence label; and... Based on the long-term communication connection, the device status information of the printer is collected, and the printing result is returned to the user terminal based on the device status information.
2. The method according to claim 1, characterized in that, The step of collecting device status information of the printer based on the long communication connection, wherein the device status information indicates whether the serial label corresponding to the printer has been successfully printed.
3. The method according to claim 2, characterized in that, The step of receiving a print request is preceded by: Establish a short connection with the printer; The step of establishing a long-term communication connection with the printer after receiving a print request from the user terminal also includes: Upon receiving a print request from the user terminal, a communication upgrade command is sent to the printer to enable the printer to respond and establish a long-term communication connection with the printer.
4. The method according to claim 3, characterized in that, The step of establishing a long-lived communication connection with the printer is followed by: Send the printer's device authentication message to the printer so that the printer returns the device capability set.
5. The method according to claim 2, characterized in that, The step of sending a print command to the printer based on the long communication connection further includes the following before: Establish a virtual queue consisting of multiple sequence tags; where each sequence tag corresponds to an identifier; Following the step of collecting the printer's device status information based on the long communication connection, the method further includes: Establish a mapping relationship between the identifier corresponding to the sequence tag and the device status information to locate the sequence tags in the virtual queue that were printed successfully or failed to print.
6. The method according to claim 5, characterized in that, The step of returning the print result to the user terminal based on the device status information further includes: When the device status information indicating a printing failure is collected from the printer, an alarm is sent to the user terminal.
7. The method according to claim 6, characterized in that, The method further includes the following steps: Receive the reprint request from the user terminal, and locate the failed printing sequence label in the virtual queue according to the mapping relationship; and, Based on the long communication connection, a reprint command is sent to the printer so that the printer can print the failed sequence label.
8. The method according to any one of claims 1-7, characterized in that, The device status information includes: real-time printing status and error codes; the step of collecting the printer's device status information based on the long communication connection further includes: Based on frame splitting technology, the real-time printing status of the printer is collected in the first channel, and the error code of the printer is collected in the second channel; wherein the first channel has a higher priority than the second channel.
9. A printing method, characterized in that, Applied to a user terminal, the method includes the following steps: A print request is sent to a print server, causing the print server to: establish a long-lived communication connection with the printer, and send a print instruction to the printer based on the long-lived communication connection, so that the printer prints a corresponding sequence label; wherein the print request includes at least one sequence label; and, The system receives the printing result returned by the print server; wherein the printing result is determined by the print server based on the device status information of the printer collected by the print server based on the long communication connection, and based on the device status information.
10. The method according to claim 9, characterized in that, In the step of receiving the printing result returned by the print server, the device status information indicates whether the printing of the sequence label corresponding to the printer was successful.
11. The method according to claim 10, characterized in that, The method further includes the following steps: Obtain sequence tags and configuration files; wherein, the sequence tags include: part number information, machine model information and expiration date information, and the configuration files include the correspondence between part numbers and machine models and historical sequence tags; Based on the configuration file, at least one of the following verifications is performed on the serial label: verifying whether the model information of the serial label exists in the configuration file; verifying whether the correspondence between the part number information and the model information of the serial label exists in the configuration file; verifying whether the format of the expiration date information is correct; verifying whether the expiration date information overlaps with the expiration date information of historical serial labels; and, If each of the at least one verification passes, a print request is sent to the print server based on the sequence tag.
12. The method according to claim 11, characterized in that, The method further includes the following steps: If any of the at least one verification fails, then the corrected sequence label corresponding to the sequence label is obtained; and, A change event is broadcast to the print server, the change event indicating that the sequence label be changed to the corrected sequence label.
13. A printing method, characterized in that, Applied to a printer, the method includes the following steps: The system receives a print instruction and prints the corresponding sequence label; the print instruction is initiated by the print server after receiving a print request from the user terminal, establishing a long-term communication connection with the printer, and printing based on this long-term communication connection; wherein the print request includes at least one sequence label; and, Based on the long-lived communication connection, device status information is sent to the print server, so that the print server returns the printing result to the user terminal based on the device status information; wherein, the device status information indicates whether the corresponding sequence label printing was successful.
14. A print server, characterized in that, Used to execute the following processes: Upon receiving a print request from a user terminal, a long-lived communication connection is established with the printer; wherein, the print request includes at least one sequence tag; Based on the long-lived communication connection, a print command is sent to the printer to cause the printer to print the corresponding sequence label; and... Based on the long-term communication connection, the device status information of the printer is collected, and the printing result is returned to the user terminal based on the device status information; wherein, the device status information indicates whether the serial label corresponding to the printer was printed successfully.
15. A user terminal, characterized in that, Used to execute the following processes: A print request is sent to the print server, causing the print server to perform the following actions: establish a long-lived communication connection with the printer, and based on the long-lived communication connection, send a print instruction to the printer, causing the printer to print a corresponding sequence label; wherein, the print request includes at least one sequence label; The system receives the printing result returned by the print server; wherein the printing result is determined by the print server based on the long communication connection, by collecting the device status information of the printer, and based on the device status information; wherein the device status information indicates whether the printing of the corresponding sequence label of the printer was successful.
16. A printer, characterized in that, Used to execute the following processes: The system receives a print instruction and prints the corresponding sequence label. The print instruction is initiated by the print server after receiving a print request from the user terminal, establishing a long-term communication connection with the printer, and printing based on the long-term communication connection. The print request includes at least one sequence label. Based on the long-lived communication connection, device status information is sent to the print server, so that the print server returns the printing result to the user terminal based on the device status information; wherein, the device status information indicates whether the corresponding sequence label printing was successful.
17. A printing system, characterized in that, The printing system includes the print server as described in claim 14, the user terminal as described in claim 15, and the printer as described in claim 16.