Disclosure of Invention
In view of this, the present invention provides a method and a system for automatically printing Chinese characters by a barcode printer, which achieve dynamic identification of color identifiers of products and automatically print corresponding barcodes of Chinese characters according to the color identifiers.
According to the above object, the present invention provides a method for automatically printing Chinese characters by a barcode printer, the method comprising:
s1, obtaining color characteristics of a product, and obtaining Chinese characters corresponding to the color characteristics according to the color characteristics;
s2, searching the codes corresponding to the Chinese characters in a preset word stock, wherein the word stock is assembled by languages recognizable by a target printer;
s3, outputting the code to the target printer.
Preferably, step S1 specifically includes:
establishing a characteristic table, wherein the characteristic table stores the corresponding relation between the color characteristics of the product and the Chinese characters;
acquiring RGB values of a product image, and acquiring color characteristics corresponding to the product according to the RGB values;
and acquiring the Chinese characters corresponding to the color features according to the color features and a storage table.
Preferably, the setting of the preset word stock specifically includes:
and converting preset Chinese characters into ZPLII language graphic array codes through a bar code editing tool, and storing the corresponding relation between the Chinese characters and the converted ZPLII language graphic array codes.
Preferably, step S2 specifically includes:
acquiring ZPLII language graphic array codes corresponding to Chinese characters in the word stock;
and generating coded data conforming to the ZPLII language format, wherein the coded data comprises ZPLII language graphic array codes corresponding to the Chinese characters.
Preferably, step S3 specifically includes:
and the target printer acquires the coded data, identifies the ZPLII language graphic array code corresponding to the Chinese characters and prints the Chinese characters.
Preferably, step S2 further includes:
manufacturing a basic script template by using a ZPLII language, and setting a characteristic variable in the basic script template;
and acquiring ZPLII language graphic array codes corresponding to Chinese characters in the character library, and replacing the characteristic variables with the ZPLII language graphic array codes corresponding to the Chinese characters.
According to the above object, the present invention provides an automatic Chinese character printing system of a barcode printer, the system comprising:
the image module is used for acquiring the color characteristics of a product and acquiring Chinese characters corresponding to the color characteristics according to the color characteristics;
the query module is used for querying the code corresponding to the Chinese character in a preset word stock, and the word stock is assembled by a language which can be recognized by a target printer;
an output module to output the code to the target printer.
Preferably, the image module specifically includes:
the characteristic storage unit is used for establishing a characteristic table which stores the corresponding relation between the color characteristics of the product and the Chinese characters;
the device comprises an acquisition unit, a processing unit and a display unit, wherein the acquisition unit is used for acquiring an RGB value of a product image and judging a color characteristic corresponding to the product according to the RGB value;
and the query unit is used for querying the corresponding Chinese characters in the characteristic table according to the color characteristics.
Preferably, the query module specifically includes:
the word stock unit is used for converting preset Chinese characters into ZPLII language graphic array codes through a bar code editing tool and storing the corresponding relation between the Chinese characters and the converted ZPLII language graphic array codes;
the searching unit is used for searching the ZPLII language graphic array code corresponding to the Chinese character in the character library unit;
and the coding unit is used for generating coded data conforming to the ZPLII language format according to the ZPLII language graphic array code corresponding to the Chinese character, and the coded data comprises the ZPLII language graphic array code corresponding to the Chinese character.
Preferably, the query module further includes a template unit, configured to make a basic script template according to the zpli language, and set the feature variable in the basic script template.
Compared with the prior art, the method and the system for automatically printing Chinese characters by the barcode printer have the following beneficial effects: the problem that only fixed Chinese character bar codes can be printed in the prior art is solved, the color characteristics of a product are dynamically identified, corresponding Chinese characters are independently selected according to the color of the product, and the corresponding Chinese character bar codes are automatically printed; brings convenience to users and improves the efficiency of products.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description will be made with reference to the accompanying drawings. It is obvious that the drawings in the following description are only some examples of the invention, and that for a person skilled in the art, other drawings and embodiments can be derived from them without inventive effort.
For the sake of simplicity, the drawings only schematically show the parts relevant to the present invention, and they do not represent the actual structure as a product. In addition, in order to make the drawings concise and understandable, components having the same structure or function in some of the drawings are only schematically illustrated or only labeled. In this document, "one" means not only "only one" but also a case of "more than one".
As shown in fig. 1, according to an embodiment of the present invention, a method for automatically printing Chinese characters by a barcode printer includes:
s1, obtaining color characteristics of a product, and obtaining Chinese characters corresponding to the color characteristics according to the color characteristics;
s2, searching the codes corresponding to the Chinese characters in a preset word stock, wherein the word stock is assembled by languages recognizable by a target printer;
s3, outputting the code to the target printer.
Preferably, step S1 specifically includes:
establishing a characteristic table, wherein the characteristic table stores the corresponding relation between the color characteristics of the product and the Chinese characters;
acquiring RGB values of a product image, and acquiring color characteristics corresponding to the product according to the RGB values;
and acquiring the Chinese characters corresponding to the color features according to the color features and a storage table.
In industrial product production, bar codes are printed on products of the same batch. The color change of products in the same batch is relatively most applied, for example, "black", "white" and "yellow", a bar code label of a corresponding color needs to be printed for each product, and the color of the product needs to be automatically identified.
And establishing a characteristic table, and storing the corresponding relation between the color characteristics of the product and the Chinese characters in the characteristic table. For example, the color feature of the product is displayed as "yellow", and the feature table corresponds to the Chinese character "yellow".
And acquiring RGB values of the product image, and acquiring the color characteristics corresponding to the product according to the RGB values. In one embodiment of the present invention, an industrial camera is installed on a production line of an industrial product, the industrial camera is used to photograph the industrial product as it passes by, and the acquired image of the product is analyzed using an image processing technique. And acquiring an RGB value of a product image, judging the color of the product image according to the RGB value, and acquiring the color characteristic corresponding to the product. And inquiring Chinese characters corresponding to the color features according to the color features corresponding to the products and the corresponding relation between the color features of the products and the Chinese characters stored in the feature table.
Preferably, the setting of the preset word stock specifically includes:
and converting preset Chinese characters into ZPLII language graphic array codes through a bar code editing tool, and storing the corresponding relation between the Chinese characters and the converted ZPLII language graphic array codes.
The barcode editing tool is a specialized barcode LABEL design software such as CODESOFT, BAR-ONE, LABEL MATRIX, etc. The bar code editing tool can complete the conversion from Chinese characters to graphic array codes of ZPLII language, and convert the Chinese characters into the graphic array codes of ZPLII language, and the graphic array codes of ZPLII language are ASCII codes with 16 system. A user converts preset Chinese characters into ZPLII language graphic array codes through a bar code editing tool according to needs, and sets the corresponding relation between the Chinese characters and the converted ZPLII language graphic array codes. In the actual production of the product, the Chinese characters of the Chinese bar code to be printed are not particularly numerous, which is determined by the characteristics of the product, for example, the colors include "black", "white", "yellow", and the like, so that a word stock corresponding to the Chinese characters such as "black", "white", "yellow", "color" and the like needs to be made, the Chinese characters are converted into corresponding ZPLII language graphic array codes through a bar code editing tool, and the corresponding relation between each Chinese character and the converted ZPLII language graphic array codes is stored. Therefore, it is simple and convenient for the user to set the word stock in advance through the bar code editing tool.
In a specific embodiment of the present invention, the setting of the chinese character library is specifically described by taking a barcode editing tool CODESOFT as an example. On the editing interface of the tool CODESOFT, the Chinese character "black" to be made is input, the "TRUE TYPE" option is selected, and the font formats of the Chinese character "black" such as font, font size, style and the like are set, as shown in fig. 2. And clicking a 'completion' button to confirm completion after the font format of the black Chinese character is edited. The method specifically comprises the steps of selecting a printer, adding a file port of a zebra printer, storing the file port as an additional file, inputting a file name, storing the file name as a script file, wherein the stored script file is not a complete ZPLII language graphic array code, and finding out the ZPLII language graphic array code corresponding to the black Chinese character in the generated script file by using the ZPLII language.
The graphic array code corresponding to the Chinese character "black" is as follows:
“00,00,00,00,00,00,00,00,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFF0000000FFF80000007FF8,0000FFF0000000FFF80000007FF8,0000FFF0000000FFF80000007FF8,0000FFF000F800FFF800F0007FF8,0000FFF003F800FFF801FE007FF8,0000FFF00FFC00FFF801FF807FF8,0000FFF03FFC00FFF803FFF07FF8,0000FFF07FFE00FFF803FFF07FF8,0000FFF07FFE00FFF807FFF07FF8,0000FFF07FFF00FFF807FFF07FF8,0000FFF07FFF00FFF80FFFF07FF8,0000FFF03FFF80FFF80FFFE07FF8,0000FFF03FFF80FFF81FFFC07FF8,0000FFF01FFFC0FFF83FFFC07FF8,0000FFF01FFFC0FFF83FFF807FF8,0000FFF00FFFE0FFF87FFF007FF8,0000FFF00FFFE0FFF87FFF007FF8,0000FFF007FFF0FFF8FFFE007FF8,0000FFF007FFF0FFF9FFFE007FF8,0000FFF003FFF0FFF9FFFC007FF8,0000FFF003FFF0FFF9FFF8007FF8,0000FFF001FFC0FFF83FF8007FF8,0000FFF001FF00FFF807F0007FF8,0000FFF000FC00FFF800F0007FF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,00000000000000FFF8,00000000000000FFF8,00000000000000FFF8,00000000000000FFF8,00000000000000FFF8,00000000000000FFF8,00000000000000FFF8,00000000000000FFF8,0000FFFC000000FFF8,0000FFFC000000FFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000FFFFFFFFFFFFFFFFFFFFFFF8,0000F800000000FFF800000000F8,00000000000000FFF8,00000000000000FFF8,00000000000000FFF8,00000000000000FFF8,00000000000000FFF8,00000000000000FFF8,00000000000000FFF8,0FFFFE00000000FFF800000003FFFF,0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF,0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF,0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF,0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF,0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF,0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF,0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF,0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF,0FFFFFFFFFFFFFFFFFFFFFFFFFFFFF,00,0001F0,0001FE0000000000001F000007F0,0001FFE00000000003FF00003FF0,0003FFF0001FF0001FFF0001FFF8,0003FFF000FFF8001FFF0001FFF8,0003FFF000FFF8001FFF8001FFF8,0007FFE000FFF8000FFF8001FFFC,0007FFE000FFF8000FFF8000FFFC,000FFFC000FFF8000FFFC000FFFE,000FFF80007FFC0007FFC0007FFE,001FFF80007FFC0007FFC0003FFF,001FFF00007FFC0007FFE0003FFF,003FFF00007FFC0007FFE0001FFF80,003FFF00007FFC0003FFE0001FFF80,007FFE00003FFE0003FFF0001FFFC0,007FFE00003FFE0003FFF0000FFFC0,00FFFC00003FFE0003FFF0000FFFE0,00FFFC00003FFE0001FFF80007FFE0,01FFFC00003FFE0001FFF80007FFE0,03FFF800003FFE0001FFF80007FFE0,03FFF800003FFE0001FFC00003FF80,03FFF000003FFE0000FE000003FE,01FFF000001FFE000000000003F8,003FE000001E00000000000001E0,000FE0,00,00,00,00,”
and storing the ZPLII language graphic array code corresponding to the Chinese character black to obtain the ZPLII language graphic array code corresponding to the Chinese character black, and establishing the corresponding relation between the Chinese character black and the converted ZPLII language graphic array code. According to the method, a Chinese character library of a plurality of Chinese characters is set.
Preferably, step S2 specifically includes:
acquiring ZPLII language graphic array codes corresponding to Chinese characters in the word stock;
and generating coded data conforming to the ZPLII language format, wherein the coded data comprises ZPLII language graphic array codes corresponding to the Chinese characters.
In the zpli language, objects may be coded either in text or in graphic arrays. And inquiring ZPLII language graphic array codes corresponding to the Chinese characters in the word stock. And generating coded data conforming to a ZPLII language format according to the ZPLII language graphic array code corresponding to the Chinese character through the programming of the ZPLII language, wherein the coded data comprises the ZPLII language graphic array code corresponding to the Chinese character.
Preferably, step S2 further includes:
manufacturing a basic script template by using a ZPLII language, and setting a characteristic variable in the basic script template;
and acquiring ZPLII language graphic array codes corresponding to Chinese characters in the character library, and replacing the characteristic variables with the ZPLII language graphic array codes corresponding to the Chinese characters.
In an embodiment of the present invention, in order to improve the convenience of barcode printing, a basic script template is made using the zpli language, and a feature variable is set in the basic script template. And when the printing is executed, calling the basic script module, replacing the characteristic variables in the basic script template with ZPLII language graphic array codes corresponding to the Chinese characters, generating data in a ZPLII language format, and sending the data to a target printer. For example, a script template is written by using the zpli language, and a basic script template of a label only needing to be printed with a color is formulated, wherein the basic script template is as follows:
lambda// start marker
Landings of ^ FWN ^ CFD,24^ PW1204^ LH0,0// position coordinate and the like
^ CI0^ PR2^ MNY ^ MTT ^ MMT ^ MD15^ PON ^ PMN ^ LRN// print option identification
A0N,25,26 FO25,20 FDcolor: < COLOR > < FS// printed text
xZ// end flag
In the basic script template described above, the feature variable is < COLOR >.
In the production process of the product, an image of the product is obtained by photographing the product, RGB values of the image are obtained, the color of the image is judged to be black according to the RGB values, Chinese character black corresponding to the black in a word stock is inquired, and ZPLII language graphic array codes corresponding to the Chinese character black are obtained. And acquiring a set basic script template, finding a characteristic variable < COLOR > in the basic script template, replacing data in the original basic script template with ZPLII language graphic array codes corresponding to Chinese characters 'black', generating data in a ZPLII language format, and sending the data to a target printer. According to the technical scheme, the basic script template is utilized, and only characteristic variables in the basic script template need to be replaced, so that a better experience effect is brought to a user.
Preferably, step S3 specifically includes:
and the target printer acquires the coded data, identifies the ZPLII language graphic array code corresponding to the Chinese characters and prints the Chinese characters.
The target printer obtains coded data through a serial port or parallel port communication mode, identifies the format of the ZPLII language, identifies the ZPLII language graphic array code corresponding to the Chinese character, converts the code corresponding to the coded data into a code controlled by the printer, and prints the Chinese character.
According to the technical scheme, in the production process of a product, the color of the product is identified, the color characteristic of the product is obtained, then the Chinese characters corresponding to the color characteristic in a word stock are inquired, the ZPLII language graphic array code corresponding to the Chinese characters is further obtained, and the code is sent to a target printer, so that the target printer finishes the bar code printing of the Chinese characters. In the production process of the product, the color of the product is dynamically identified, and the corresponding bar code label is printed according to the color of the product, so that convenience is brought to a user, and the production efficiency is improved. For example, the color of the product is automatically identified to be black, and the black corresponding Chinese character ' black ' in the Chinese character library is inquired, so that the bar code printing of the black Chinese character ' can be completed.
As shown in fig. 3, according to an embodiment of the present invention, a system for automatically printing Chinese characters by a barcode printer includes:
the image module 30 is configured to obtain color characteristics of a product, and obtain Chinese characters corresponding to the color characteristics according to the color characteristics;
the query module 31 is configured to query a preset word stock for codes corresponding to the Chinese characters, where the word stock is assembled by a language recognizable by a target printer;
an output module 32 for outputting the code to the target printer.
Preferably, the image module 30 specifically includes:
the characteristic storage unit is used for establishing a characteristic table which stores the corresponding relation between the color characteristics of the product and the Chinese characters;
the device comprises an acquisition unit, a processing unit and a display unit, wherein the acquisition unit is used for acquiring an RGB value of a product image and judging a color characteristic corresponding to the product according to the RGB value;
and the query unit is used for querying the corresponding Chinese characters in the characteristic table according to the color characteristics.
The image module 30 obtains the color feature of the product, and obtains the Chinese characters corresponding to the color feature according to the color feature. Specifically, a feature table is established in the feature storage unit of the image module 30, and the feature table stores the corresponding relationship between the color features of the product and the Chinese characters. For example, the color feature is black, and black is established in the storage table to correspond to the Chinese character "black". The RGB value of the product image is obtained through an obtaining unit, and the color characteristic corresponding to the product is judged according to the RGB value. In one embodiment of the present invention, an industrial camera is installed on a product production line, and the industrial camera is used to photograph the product as it passes by. In the acquisition unit, an RGB value of a product image is acquired, the color of the product image is judged according to the RGB value, and the color characteristic corresponding to the product is acquired. And the query unit queries the feature table in the feature storage unit according to the color features corresponding to the product, and searches the Chinese characters corresponding to the color features in the feature table.
Preferably, the query module 31 specifically includes:
the word stock unit is used for converting preset Chinese characters into ZPLII language graphic array codes through a bar code editing tool and storing the corresponding relation between the Chinese characters and the converted ZPLII language graphic array codes;
the searching unit is used for searching the ZPLII language graphic array code corresponding to the Chinese character in the character library unit;
and the coding unit is used for generating coded data conforming to the ZPLII language format according to the ZPLII language graphic array code corresponding to the Chinese character, and the coded data comprises the ZPLII language graphic array code corresponding to the Chinese character.
The query module 31 queries the code corresponding to the Chinese character in a preset word stock, wherein the word stock is assembled by a language recognizable by the target printer. Specifically, in the word stock unit, a preset Chinese character is converted into a ZPLII language graphic array code through a bar code editing tool, and the corresponding relation between the Chinese character and the converted ZPLII language graphic array code is stored. The bar code editing tool can complete the conversion from Chinese characters to graphic array codes of ZPLII language, and convert the Chinese characters into the graphic array codes of ZPLII language, and the graphic array codes of ZPLII language are ASCII codes with 16 system. The barcode editing tool is a specialized barcode LABEL design software such as CODESOV, BAR-ONE, LABEL MATRIX. And inquiring ZPLII language graphic array codes corresponding to the Chinese characters in the word stock unit through a searching unit. And in the coding unit, programming is carried out according to the format of the ZPLII language to generate coded data which accords with the ZPLII language format, wherein the coded data comprises a ZPLII language graphic array code corresponding to the Chinese character. In the zpli language, objects may be coded either in text or in graphic arrays.
The encoded data is output to the target printer via an output module 32. And the target printer acquires and identifies the coded data and executes the bar code printing of the Chinese characters.
Preferably, the query module further includes a template unit, configured to make a basic script template according to the zpli language, and set the feature variable in the basic script template.
The template unit uses ZPLII language to make a basic script template, and sets characteristic variables in the basic script template. And when the printing is executed, calling the basic script module, replacing the characteristic variables in the basic script template with ZPLII language graphic array codes corresponding to the Chinese characters, generating data in a ZPLII language format, and sending the data to a target printer.
According to the technical scheme, the color characteristics of the product are dynamically identified in the production process of the product, and the corresponding bar code label is printed according to the color characteristics of the product, so that convenience is brought to a user, and the production efficiency is improved.
In conclusion, the method and the system for automatically printing Chinese characters by the bar code printer solve the problem that only fixed Chinese bar codes can be printed in the prior art, realize automatic selection of corresponding Chinese characters according to product colors, print corresponding Chinese character bar codes and bring convenience to users.
It should be noted that the above embodiments can be freely combined as necessary. The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.