The content of the invention
In consideration of it, it is an object of the invention to provide a kind of method and system of word in bar code printer automatic printing,
Realize the colour code of Dynamic Recognition product, and according to corresponding to colour code automatic printing middle word bar code.
According to foregoing invention purpose, the present invention provides a kind of method of word in bar code printer automatic printing, the side
Method includes:
S1, the color characteristic for obtaining product, and according to the color characteristic, obtain middle word corresponding to the color characteristic;
S2, coding corresponding to the middle word is inquired about in a default character library, the character library is the language that target printer can recognize that
Speech compilation forms;
S3, by the coding output to the target printer.
Preferably, step S1 is specifically included:
Establish a mark sheet, the corresponding relation of the color characteristic and middle word of the mark sheet storage product;
Obtain the rgb value of product image, and the color characteristic according to corresponding to the rgb value obtains the product;
According to the color characteristic and storage table, middle word corresponding to the color characteristic is obtained.
Preferably, the setting of the default character library specifically includes:
The middle word pre-set is converted to by ZPLII language figure array codes by bar code edit tool, and described in storage
The corresponding relation of ZPLII language figure array codes after middle word and conversion.
Preferably, step S2 is specifically included:
Obtain ZPLII language figure array code corresponding to the middle word in the character library;
Generation one meets the coded data of ZPLII language formats, and the coded data includes ZPLII languages corresponding to the middle word
Say graphic array coding.
Preferably, step S3 is specifically included:
The target printer obtains the coded data, and identifies that ZPLII language graphic array corresponding to the middle word is compiled
Code, printing is performed to the middle word.
Preferably, step S2 specifically also includes:
Basic script template is made using ZPLII language, characteristic variable is set in the basic script template;
ZPLII language figure array code corresponding to the middle word in the character library is obtained, and the characteristic variable is replaced with
ZPLII language figure array code corresponding to the middle word.
According to foregoing invention purpose, the invention provides writing system in a kind of bar code printer automatic printing, the system
System includes:
Image module, for obtaining the color characteristic of product, and according to the color characteristic, obtain corresponding to the color characteristic
Middle word;
Enquiry module, for inquiring about coding corresponding to the middle word in a default character library, the character library is target printer
Recognizable language compilation forms;
Output module, for the coding to be exported to the target printer.
Preferably, described image module specifically includes:
Characteristic storing unit, for establishing a mark sheet, the color characteristic of the mark sheet storage product is corresponding with middle word
Relation;
Acquiring unit, for obtaining the rgb value of product image, and color is special according to corresponding to the rgb value judges the product
Sign;
Query unit, for according to the color characteristic, inquiring about corresponding middle word in the mark sheet.
Preferably, the enquiry module specifically includes:
Character library unit, compiled for the middle word pre-set to be converted into ZPLII language graphic array by bar code edit tool
Code, and store the corresponding relation of the ZPLII language figure array codes after the middle word and conversion;
Searching unit, for inquiring about ZPLII language figure array code corresponding to the middle word in the character library unit;
Coding unit, for the ZPLII language figure array code according to corresponding to the middle word, generation one meets ZPLII languages
The coded data of form is sayed, the coded data includes ZPLII language figure array code corresponding to the middle word.
Preferably, the enquiry module also includes a modular unit, for making basic script mould according to ZPLII language
Plate, characteristic variable is set in the basic script template.
Compared with prior art, in bar code printer automatic printing provided by the invention word method and system, have
Following beneficial effect:Solve the problems, such as that fixed Chinese brief note code can only be printed in the prior art, realize Dynamic Recognition production
The color characteristic of product, corresponding Chinese text, and Chinese brief note code corresponding to automatic printing are independently selected according to product colour;Give
User brings convenience, and improves the efficiency of product.
Embodiment
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, control is illustrated below
The embodiment of the present invention.It should be evident that drawings in the following description are only some embodiments of the present invention, for
For those of ordinary skill in the art, on the premise of not paying creative work, other can also be obtained according to these accompanying drawings
Accompanying drawing, and obtain other embodiments.
To make simplified form, part related to the present invention is only schematically show in each figure, they are not represented
Its practical structures as product.In addition, so that simplified form readily appreciates, there is identical structure or function in some figures
Part, one of those is only symbolically depicted, or only marked one of those.Herein, "one" is not only represented
" only this ", the situation of " more than one " can also be represented.
As shown in figure 1, according to one embodiment of present invention, a kind of method of word in bar code printer automatic printing,
Methods described includes:
S1, the color characteristic for obtaining product, and according to the color characteristic, obtain middle word corresponding to the color characteristic;
S2, coding corresponding to the middle word is inquired about in a default character library, the character library is the language that target printer can recognize that
Speech compilation forms;
S3, by the coding output to the target printer.
Preferably, step S1 is specifically included:
Establish a mark sheet, the corresponding relation of the color characteristic and middle word of the mark sheet storage product;
Obtain the rgb value of product image, and the color characteristic according to corresponding to the rgb value obtains the product;
According to the color characteristic and storage table, middle word corresponding to the color characteristic is obtained.
In industrial products production, to printing bar code with a batch of product.With color change phase in a batch of product
For using most, than if any " black ", " white ", " yellow ", it is necessary to for each product print corresponding to color
Bar-code label is, it is necessary to the color of automatic identification product.
A mark sheet is established, corresponding relation of the color characteristic with middle word of product is stored in the mark sheet.Such as
The color characteristic of product is shown as " yellow ", and middle word " yellow " is corresponded in the mark sheet.
Obtain the rgb value of product image, and the color characteristic according to corresponding to the rgb value obtains the product.The present invention
A specific embodiment, the mounting industrial camera on the production line of industrial products, industrial camera is used when industrial products pass through
It is taken pictures, and the imagery exploitation image processing techniques of the product of acquisition is analyzed.Obtain the RGB of product image
Value, and judge according to the rgb value color of the image of the product, get color characteristic corresponding to the product.According to
Color characteristic corresponding to the product, according to the color characteristic of the product stored in the mark sheet and the middle word
Corresponding relation, inquire about middle word corresponding to the color characteristic.
Preferably, the setting of the default character library specifically includes:
The middle word pre-set is converted to by ZPLII language figure array codes by bar code edit tool, and described in storage
The corresponding relation of ZPLII language figure array codes after middle word and conversion.
Bar code edit tool is the bar-code label design software of specialty, such as CODESOFT, BAR-ONE, LABEL
MATRIX etc..The conversion that the graphic array of word to ZPLII language encodes during bar code edit tool can be completed, middle word is turned
ZPLII language figure array codes are changed to, the ZPLII language figures array code is 16 system ASCII characters.User is according to need
Will, the middle word pre-set is converted to by ZPLII language figure array codes by bar code edit tool, and set it is described in
The corresponding relation of ZPLII language figure array codes after word and conversion.In the actual production of product, it is necessary in printing
The middle word of literary bar code is not especially more, and this is determined by the feature of product, such as, color have " black ", " white ",
" yellow " etc., so needing to do character library corresponding to word in " black ", " white ", " Huang ", " color " etc., by bar code edit tool by
Text conversion is corresponding ZPLII language figure array codes, and stores each middle word and the ZPLII language figures of its conversion
The corresponding relation of array code.Therefore for user, it is also very simple and convenient to pre-set character library by bar code edit tool
's.
The specific embodiment of the present invention, the setting of the Chinese word library are carried out by taking bar code edit tool CODESOFT as an example
Illustrate.On instrument CODESOFT editing interface, the middle word " black " to be made is inputted, " TRUE TYPE " are selected for selection
, the font format such as the font of word " black ", font size, pattern in setting, as shown in Figure 2.When to middle word " black " word
After the completion of font format editor, click on " completion " button and carry out completion confirmation." black " generation of the middle word for editing completion is corresponding
ZPLII language figure array codes, specific method for selection printer-addition zebra printer file port-save as, it is defeated
Script file can be saved as by entering filename, and it is complete ZPLII language figure array code that the script file after preservation, which is not,
Using ZPLII language, ZPLII language figure array code corresponding to middle word " black " is found out in the script file of generation
Come.
It is that graphic array corresponding to middle word " black " encodes 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,”
ZPLII language figure array codes corresponding to the middle word " black " are stored, it is right to obtain the middle word " black "
The ZPLII language figure array codes answered, and the ZPLII language graphic arrays established after the middle word " black " and its conversion
The corresponding relation of coding.According to the above method, the Chinese word library of the multiple middle words of setting.
Preferably, step S2 is specifically included:
Obtain ZPLII language figure array code corresponding to the middle word in the character library;
Generation one meets the coded data of ZPLII language formats, and the coded data includes ZPLII languages corresponding to the middle word
Say graphic array coding.
In ZPLII language, its object can both be encoded according to word, can also be encoded according to graphic array.Look into
Ask the ZPLII language figure array codes corresponding to middle word described in character library.By the programming of ZPLII language, in described
ZPLII language figure array code corresponding to word, generation meet the coded data of ZPLII language formats, the coded data
Including ZPLII language figure array code corresponding to the middle word.
Preferably, step S2 specifically also includes:
Basic script template is made using ZPLII language, characteristic variable is set in the basic script template;
ZPLII language figure array code corresponding to the middle word in the character library is obtained, and the characteristic variable is replaced with
ZPLII language figure array code corresponding to the middle word.
The specific embodiment of the present invention, in order to improve the facility of bar code printing, a basic pin is made using ZPLII language
This template, characteristic variable is set in the basic script template.When performing printing, the basic script module is transferred, by base
Characteristic variable in plinth script template replaces with ZPLII language figure array code corresponding to the middle word, generates ZPLII languages
The data of speech form are sent to target printer.For example script template is write using ZPLII language, formulating one only needs to beat
The basic script template of the label of color is printed, basic script template is as follows:
^XA//origin identification
^FWN^CFD, 24^PW1204^LH0,0//position coordinates etc. is identified
^CI0^PR2^MNY^MTT^MMT^MD15^PON^PMN^LRN // Printing Qptions mark
^A0N,25,26^FO25,20^FDColor:<COLOR>^FS//printing character
^XZ//end of identification
In above-mentioned basic script template, characteristic variable is exactly<COLOR>.
During production, by obtaining the image of product to taking pictures for product, the rgb value of image is obtained, according to
The rgb value judges the color of image for black, inquires about middle word " black " corresponding to black in character library, and obtain the middle word
ZPLII language figure array code corresponding to " black ".The basic script template set is obtained, is looked in the basic script template
To characteristic variable<COLOR>, ZPLII language figures array code corresponding to word " black " is replaced in original basis script template in
Data, generate the data of ZPLII language formats, and send to target printer.The technical scheme, utilize basic script mould
Plate, the characteristic variable in basic script template need to be only replaced, more preferable experience effect is brought to user.
Preferably, step S3 is specifically included:
The target printer obtains coded data, and identifies ZPLII language figure array code corresponding to the middle word, right
The middle word performs printing.
The target printer obtains coded data by serial ports or the communication mode of parallel port, identification ZPLII language
Form, and ZPLII language figure array code corresponding to the middle word is identified, and be by code conversion corresponding to coded data
The coding of printer itself control, printing is performed to the middle word.
According to the technical scheme, in the production process of product, identify the color of product and obtain the color characteristic of product,
Then middle word corresponding to color characteristic described in character library is inquired about, and then obtains ZPLII language figures corresponding to the middle word
Array code, and the coding is sent to target printer, so as to which target printer completes the bar code printing to word in this.Producing
In the production process of product, the color of Dynamic Recognition product, and according to the corresponding bar-code label of color print of product, to user with
To facilitate, production efficiency is improved.For example automatic identification product colour is black, during black is corresponding in inquiry Chinese word library
Word " black ", so as to the bar code printing of word " black " in completing.
As shown in figure 3, one embodiment of the invention, writing system in a kind of bar code printer automatic printing, the system
Including:
Image module 30, for obtaining the color characteristic of product, and according to the color characteristic, it is corresponding to obtain the color characteristic
Middle word;
Enquiry module 31, for inquiring about coding corresponding to the middle word in a default character library, the character library is target print
The recognizable language compilation of machine forms;
Output module 32, for the coding to be exported to the target printer.
Preferably, described image module 30 specifically includes:
Characteristic storing unit, for establishing a mark sheet, the color characteristic of the mark sheet storage product is corresponding with middle word
Relation;
Acquiring unit, for obtaining the rgb value of product image, and color is special according to corresponding to the rgb value judges the product
Sign;
Query unit, for according to the color characteristic, inquiring about corresponding middle word in the mark sheet.
Image module 30 obtains the color characteristic of product, and according to the color characteristic, it is corresponding to obtain the color characteristic
Middle word.Specifically, a mark sheet, the face of the mark sheet storage product are established in the characteristic storing unit of image module 30
The corresponding relation of color characteristic and middle word.For example color characteristic is black, word during black corresponds to is established in the storage table
" black ".The rgb value of product image, and the color according to corresponding to the rgb value judges the product are obtained by acquiring unit
Feature.The specific embodiment of the present invention, the mounting industrial camera on the production line of product, industrial phase is used when product passes through
Machine is taken pictures to it.In acquiring unit, the rgb value of product image is obtained, and the figure of the product is judged according to the rgb value
The color of picture, get color characteristic corresponding to the product.Query unit color characteristic according to corresponding to the product, inquiry
Mark sheet in the characteristic storing unit, search middle word corresponding to color characteristic described in the mark sheet.
Preferably, the enquiry module 31 specifically includes:
Character library unit, compiled for the middle word pre-set to be converted into ZPLII language graphic array by bar code edit tool
Code, and store the corresponding relation of the ZPLII language figure array codes after the middle word and conversion;
Searching unit, for inquiring about ZPLII language figure array code corresponding to the middle word in the character library unit;
Coding unit, for the ZPLII language figure array code according to corresponding to the middle word, generation one meets ZPLII languages
The coded data of form is sayed, the coded data includes ZPLII language figure array code corresponding to the middle word.
Enquiry module 31 inquires about coding corresponding to the middle word in a default character library, and the character library is target printer
Recognizable language compilation forms.Specifically, in character library unit, the middle word pre-set is turned by bar code edit tool
ZPLII language figure array codes are changed to, and store pair of the ZPLII language figure array codes after the middle word and conversion
It should be related to.The conversion that the graphic array of word to ZPLII language encodes during bar code edit tool can be completed, by middle text conversion
For ZPLII language figure array codes, the ZPLII language figures array code is 16 system ASCII characters.Bar code edit tool is
The bar-code label design software of specialty, such as CODESOFT, BAR-ONE, LABEL MATRIX.By searching unit in the word
ZPLII language figure array code corresponding to the middle word is inquired about in library unit.In coding unit, according to ZPLII language
Form be programmed, the coded data that generation one meets ZPLII language formats, the coded data includes the middle word pair
The ZPLII language figure array codes answered.In ZPLII language, its object can both be encoded according to word, can also be by
Encoded according to graphic array.
The coded data is exported to the target printer by output module 32.The target printer obtains simultaneously
The coded data is identified, performs the bar code printing of word in this.
Preferably, the enquiry module also includes a modular unit, for making basic script mould according to ZPLII language
Plate, characteristic variable is set in the basic script template.
Modular unit makes a basic script template using ZPLII language, and feature is set in the basic script template
Variable.When performing printing, the basic script module is transferred, the characteristic variable in basic script template is replaced with into the Chinese
ZPLII language figure array code corresponding to word, the data of generation ZPLII language formats are sent to target printer.
According to the technical scheme, in the production process of product, the color characteristic of Dynamic Recognition product, and according to the face of product
Color characteristic prints corresponding bar-code label, is brought convenience to user, improves production efficiency.
In summary, in bar code printer automatic printing of the present invention word method and system, solve in the prior art
Fixed Chinese bar code problem can only be printed, realizes and corresponding Chinese text is independently selected automatically according to product colour, and beat
Chinese brief note code, brings advantage to the user corresponding to print.
It should be noted that above-described embodiment can independent assortment as needed.Described above is only the preferred of the present invention
Embodiment, it is noted that for those skilled in the art, do not departing from the premise of the principle of the invention
Under, some improvements and modifications can also be made, these improvements and modifications also should be regarded as protection scope of the present invention.