CN-122018829-A - Printing method supporting local multimode switching and cloud verification and printer
Abstract
The invention provides a printing method and a printer supporting local multimode switching and cloud verification, comprising the steps of establishing a service mode configuration table in printing equipment and a cloud for synchronously defining a required service mode; the method comprises the steps of setting up a simulated keyboard transmission channel for the printing equipment, continuously monitoring local interaction events of the printing equipment, performing table lookup switching through a service mode configuration table, attaching intention identifiers to original commodity bar code data, generating verification and cancel data, sending the verification and cancel data to a cloud or 'key-in' POS machine, and automatically performing verification and cancel management according to the intention identifiers. According to the invention, the service is switched by combining a multi-channel mode switching trigger mechanism with a local service mode configuration table or a role two-dimensional code library, and a cloud platform, a POS machine and intelligent printing equipment are established to enable the cloud or the POS machine to directly identify service intention and trigger corresponding service flow, so that the effects of supporting local multi-mode switching and realizing end-to-end intelligent service processing are achieved.
Inventors
- Request for anonymity
- Request for anonymity
Assignees
- 珠海芯烨电子科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260409
Claims (13)
- 1. A printing method supporting local multimode switching and cloud verification is characterized by comprising the following steps: S1, synchronously defining required service modes in printing equipment and a cloud, respectively distributing unique mode codes for each service mode, and establishing a service mode configuration table; S2, declaring the printing equipment as composite equipment by configuring equipment descriptors in firmware, defining composite equipment interface descriptors and establishing a simulated keyboard transmission channel; S3, a code scanning module is arranged in the printing equipment, and communication connection is established with the cloud end and data connection is established with a POS machine; s4, continuously monitoring a local interaction event of the printing equipment, judging whether the local interaction event triggers service mode switching, and if yes, performing table lookup switching through the service mode configuration table; s5, acquiring original commodity bar code data through the code scanning module, and attaching an intention identifier to the original commodity bar code data according to a unique mode code of a current service mode and generating verification and marketing data; S6, the verification data are sent to the cloud end or are "keyed in" to the POS machine in a mode of a key sequence of a simulated keyboard through the simulated keyboard transmission channel, and verification and inventory management are automatically carried out by the cloud end or the POS machine according to the intention identification; And S7, after verification is completed, the cloud or the POS machine issues a printing instruction to the printing equipment, and the printing equipment executes a printing task according to the printing instruction.
- 2. The printing method supporting local multimode switching and cloud verification according to claim 1, wherein step S1 further comprises: S11, defining a data structure of a required service mode, creating the service mode configuration table in a database of the cloud, defining a group of API endpoints based on a RESTful architecture, and taking the API endpoints as unique access channels of the printing equipment to the service mode configuration table; s12, selecting a corresponding local cache and setting a synchronous manager in the printing equipment according to the business complexity, calling the API endpoint through the synchronous manager, pulling the business mode configuration table and storing the business mode configuration table in the local cache; and S13, when the service mode configuration table is changed, the cloud allocates an incremental version number, the printing equipment initiates a synchronous request and carries a local version number, and version difference data is returned by the cloud.
- 3. The printing method supporting local multimode switching and cloud verification according to claim 2, wherein step S1 further comprises: S14, the cloud end distributes unique role two-dimension codes for each service mode, wherein the content of the role two-dimension codes comprises role IDs; and S15, the printing equipment acquires the character two-dimensional code and establishes a character two-dimensional code library, scans the character two-dimensional code through the code scanning module, analyzes the character ID of the character two-dimensional code, and returns to the cloud for validity verification.
- 4. The printing method supporting local multimode switching and cloud verification according to claim 1, wherein: The firmware reconstructs a USB interface of the printing equipment according to a service mode, and the method comprises the steps of presetting a USB descriptor template pool in the firmware, selecting and loading a USB descriptor set from the USB descriptor template pool when running, wherein the USB descriptor set comprises the equipment descriptor and a composite equipment interface descriptor; The composite device interface descriptor comprises a first interface descriptor and a second interface descriptor, wherein the first interface descriptor is a printing device class, and the second interface descriptor is an HID class.
- 5. The printing method supporting local multimode switching and cloud verification according to claim 4, wherein: The device descriptor is set to bDeviceClass =0xef, bdevicesub-stack=0x02, the first interface descriptor is set to bInterfaceClass =0x07, and a printer protocol is specified, and the second interface descriptor is set to bInterfaceClass =0x03, bdterfacesub-stack=0x01.
- 6. The printing method supporting local multimode switching and cloud verification according to claim 2, wherein step S4 further comprises: S411, selecting a physical key on the printing equipment as a mode switching key, and inputting and interrupting configuration to the mode switching key; S412, when the interrupt is triggered, reading the current service mode from the memory of the printing equipment, inquiring the index position of the current service mode through the service mode configuration table, and acquiring the next service mode configuration according to the table predefined sequence; s413, switching to the next service mode according to the next service mode configuration system, and writing the next service mode as the current service mode into the memory.
- 7. The printing method supporting local multimode switching and cloud verification according to claim 3, wherein step S4 further comprises; s421, scanning the character two-dimensional code of the next service mode through the code scanning module, analyzing the character ID of the character two-dimensional code, and comparing and searching the character ID in a local character two-dimensional code library; S422, if the search result is a local hit, executing the next step, and if the search result is not the local hit, returning to the step S15 for validity verification; If the role ID is verified to be valid, the cloud returns corresponding service mode configuration to the printing equipment by inquiring the service mode configuration table; S423, loading the corresponding service mode configuration by the printing equipment and switching to the next service mode.
- 8. The printing method supporting local multimode switching and cloud verification according to claim 4, wherein step S5 comprises: s51, reading a commodity bar code through the code scanning module, and obtaining the original commodity bar code data with the commodity identity character string after decoding; s52, the printing equipment reads the unique mode code of the current service mode from the service mode configuration table and defines at least one separator; S53, splicing the mode codes, the separator and the original commodity bar code data in sequence and carrying out structured packaging to generate structured data with business semantics; the separator is used for distinguishing the prefix of the structured data from the original commodity bar code data, and the prefix is the intention identifier.
- 9. The printing method supporting local multimode switching and cloud verification according to claim 8, wherein step S6 comprises: S611, the cloud end analyzes the received structured data, and queries the intention identification through the service mode configuration table to identify a current service mode; S612, according to the current service mode, releasing the current service action to a corresponding message queue theme, deploying a plurality of corresponding service cancellation services and subscribing the message queue theme; s613, the business verification service queries a commodity main database according to the original commodity bar code data to obtain commodity SKU information, and associates corresponding delivery bill according to the printing equipment ID; and S614, automatically verifying and selling according to the commodity SKU information, and updating the delivery order.
- 10. The printing method supporting local multimode switching and cloud verification according to claim 8, wherein step S6 comprises: S621, activating a POS cashing window on the printing equipment, analyzing the structured data and simulating USB HID KEYBOARD equipment channels; S622, writing the structured data into a keyboard report structure body in a key code and modifier state, and setting a keyboard_event_flag; and S623, sending a keyboard report to the POS machine IN a mode of interrupting periodic polling of the IN endpoint , and analyzing the keyboard report and automatically verifying and canceling by the POS machine.
- 11. The printing method supporting local multimode switching and cloud verification according to any one of claims 1 to 10, further comprising: S8, a lightweight business rule engine and a context manager are arranged in the printing equipment, local batch context in the context manager is updated according to the current business action, corresponding business rules are output through the business rule engine according to the local batch context, whether the current business action meets the business rules is judged, and if yes, an automatic printing task of a summary list is triggered.
- 12. The printing method supporting local multimode switching and cloud verification according to claim 11, wherein step S8 further comprises: s81, calling an evaluation function of the business rule engine after updating the local batch context each time; S82, the business rule engine loads all automatic printing rules under the current business mode, takes the automatic printing rules as input in sequence and evaluates the triggering conditions of the automatic printing rules through the evaluation function; and S83, judging whether the current business Action meets the triggering condition, and if so, immediately triggering and executing the corresponding Action of the automatic printing rule by the business rule engine .
- 13. A printer supporting local multimode switching and cloud verification, comprising: A memory for storing a printer program; A processor for carrying out the method steps of any one of claims 1-12 when executing a printer program stored on said memory.
Description
Printing method supporting local multimode switching and cloud verification and printer Technical Field The invention relates to the technical field of printers, in particular to a printing method supporting local multimode switching and cloud verification and a printer. Background Currently, a common core function of a cloud printer on the market is to print out an instruction issued by a cloud or a connected host, and in a cashier system, the host is usually a PC/POS machine or the like. The printer of partial high-end model has integrated the code scanning module and has constituted the code scanning and printing all-in-one, can acquire bar code information through built-in code scanning module. The typical scheme of the printer matched with the POS cashing system is that the POS machine is responsible for running cashing software and processing transaction logic, commodity information is input through an external independent code scanning gun or a built-in code scanning module, shopping vouchers are printed through an external receipt printer, and devices are connected through independent USB or serial cables. The existing scheme has the following problems: 1. The switching operation between different service modes is complicated and depends on the network/host. When the printer needs to serve different service scenes, such as commodity warehouse entry, warehouse exit, inventory and the like, mode switching is required to be performed through an upper computer or a cloud background. The service mode cannot be switched locally and quickly, and is inefficient and cannot operate independently without a network or host being ready. Meanwhile, a complex cashier system in practical application has a certain skill requirement on cashiers, so that the training period of the personnel is prolonged, and the personnel cost is high. 2. Low device integration results in complex management and low resource utilization. In order to realize a complete cashing process, a merchant at least needs to configure three independent devices, namely a code scanning gun, a POS machine and a printer, each device needs to be independently configured, monitored and maintained, the management complexity and the operation and maintenance burden are increased, and the devices independently operate and have single functions, so that the resource utilization rate of the devices is low. Through independent USB or serial port cable connection, cause the cash desk to be mixed and disorderly in wiring, occupy a plurality of interfaces and equipment cost is high, and equipment compatibility and stability problem are many. 3. Automatic verification and inventory management cannot be achieved. Even though the cloud printer can scan the code and upload the data to the cloud, the uploaded original bar code data does not carry any business scene information, so that if the cloud server cannot automatically distinguish whether the code is used for 'warehouse entry' or 'warehouse exit', and the like, the cloud server must rely on additional manual identification or complex subsequent processing, but the manual identification is easy to make mistakes, and is unfavorable for verification and inventory management. 4. The printing apparatus has a single function and poor synergy. The traditional printer is only used as output equipment, only has a one-way instruction relationship with the POS system, can not be used as input equipment to reversely provide data for the POS system, and can not simplify the hardware configuration of a cashing link. Therefore, it is desirable to design a printing method and printer that can support local multi-mode switching, composite device emulation and data routing, and achieve automatic verification and inventory management. Disclosure of Invention In order to solve the common problems in the prior art, the invention aims to provide a printing method and a printer supporting local multimode switching and cloud verification, according to the invention, through multi-channel mode switching triggering mechanisms such as code scanning, key pressing and the like, real-time query switching is performed by combining a locally cached service mode configuration table or a role two-dimensional code library, so that the effect of supporting local multi-mode switching is achieved. The invention realizes the above purpose through the following technical scheme: A printing method supporting local multimode switching and cloud verification comprises the following steps: S1, synchronously defining required service modes at printing equipment and a cloud, respectively distributing unique mode codes for each service mode, and establishing a service mode configuration table. S2, declaring the printing equipment as composite equipment by configuring equipment descriptors in firmware, defining composite equipment interface descriptors and establishing a simulated keyboard transmission channel. And S3, a code scanning module is arranged in