CN112149445A - Bar code processing method, device, equipment and storage medium - Google Patents

Bar code processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN112149445A
CN112149445A CN202011140317.7A CN202011140317A CN112149445A CN 112149445 A CN112149445 A CN 112149445A CN 202011140317 A CN202011140317 A CN 202011140317A CN 112149445 A CN112149445 A CN 112149445A
Authority
CN
China
Prior art keywords
short code
character
code
short
hash
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011140317.7A
Other languages
Chinese (zh)
Inventor
张硕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Zhenshi Information Technology Co Ltd
Original Assignee
Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Zhenshi Information Technology Co Ltd filed Critical Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority to CN202011140317.7A priority Critical patent/CN112149445A/en
Publication of CN112149445A publication Critical patent/CN112149445A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14131D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques

Abstract

The method comprises the steps of converting a data source to be coded into a first hash character string, replacing other character letters in the first hash character string with corresponding numbers according to a preset first corresponding relation between other characters and numbers to obtain a second hash character string, taking out a plurality of character groups corresponding to the length of the short code bar code from the second hash character string according to the length of the preset short code bar code and preset intervals, and generating the short code bar code according to the plurality of character groups. The conversion relation between the character groups and the short code characters is determined by selecting the plurality of character groups in the second hash character string, so that the short code characters are obtained, and the problems that the bar code cannot be accurately identified by identification equipment and the identification precision is low are solved.

Description

Bar code processing method, device, equipment and storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing a barcode.
Background
With the progress of science and technology and the development of society, people gradually enter the digital era, and bar codes are widely applied to the lives of people as a novel information carrier. The bar code is a parallel line pattern formed by black bars and white bars with large reflectivity differences, light rays are irradiated on the bar code by using a bar code reader, and a group of data signals are obtained and converted according to the different reflectivities of the black bars and the white bars, so that a plurality of information such as the production country, the manufacturing manufacturer, the commodity name, the production date, the logistics situation and the like of an article can be identified according to the data signals, and the commodity can be managed and tracked conveniently.
However, the width of bar code printing provided by many commodities or logistics lists is limited, and within the limited printing width, black bars and white bars of the printed bar line code can be combined together, so that the bar code cannot be accurately identified by an identification device, and the identification precision is low.
Disclosure of Invention
The application provides a method, a device, equipment and a storage medium for processing a bar code, which are used for solving the problems that identification equipment cannot accurately identify the bar code and the identification precision is low.
In a first aspect, an embodiment of the present application provides a method for processing a barcode, including:
converting a data source to be encoded into a first hash string, the first hash string comprising numbers and other characters;
replacing other characters in the first hash character string with corresponding numbers according to a preset first corresponding relation between the other characters and the numbers to obtain a second hash character string;
according to the length of a preset short code bar code, taking out a plurality of character groups corresponding to the length of the short code bar code from the second hash character string according to a preset interval;
and generating the short code bar code according to the plurality of character groups.
In one possible design of the first aspect, the generating a short code barcode from the plurality of character groups includes:
acquiring a short code character corresponding to each character group in the character groups according to the character groups and a second corresponding relation between preset short code characters and the character groups;
acquiring short codes corresponding to the data sources according to the short code characters corresponding to each character group and the sequence of the character groups;
and generating the short code bar code according to the short code.
In another possible design of the first aspect, the generating a short-code barcode according to the plurality of character groups includes:
according to the character groups and a preset short code character set, taking each character group in the character groups as a sequence, and acquiring the short code character of the corresponding sequence of each character group from the short code character set;
acquiring the short codes corresponding to the data sources according to the short code characters corresponding to the sequence of each character group and the sequence of the plurality of character groups;
and generating the short code bar code according to the short code.
Optionally, the method further includes:
and storing the mapping relation between the short code and the data source in a short code database, and changing the state of the short code into a use state.
Optionally, before generating the short code barcode according to the short code, the method further includes:
determining the state of each short code according to the state of each short code in a short code database;
and if the short code is in a use state, taking out a plurality of character groups corresponding to the length of the short code bar code from the second hash character string according to another preset interval according to the length of the preset short code bar code, and re-acquiring the short code according to the plurality of character groups.
In another possible design of the first aspect, the extracting, according to a preset short code barcode length, a plurality of character groups corresponding to the short code barcode length from the second hash character string at preset intervals includes:
taking out the character groups corresponding to the length of the short code bar code from the initial position of the second hash character string at preset intervals;
alternatively, the first and second electrodes may be,
and taking out the character groups corresponding to the length of the short code bar code from the preset position of the second hash character string according to a preset interval.
Optionally, the method further includes:
receiving a bar code identification request sent by identification equipment, wherein the bar code identification request comprises a short code identified by the identification equipment;
acquiring a data source corresponding to the short code according to the short code and a mapping relation between the short code and the data source stored in a short code database;
and executing the logic corresponding to the data source, and returning an execution result to the identification equipment.
Optionally, the method further includes:
and changing the state of the short codes in the short code database into a recovery state.
Optionally, the data source includes a character string or a link address.
Optionally, the short code is composed of at least one arabic numeral, at least one english alphabet and at least one special character.
In a second aspect, an embodiment of the present application provides a device for processing a barcode, including: the device comprises a conversion module, a processing module and a generation module;
the conversion module is used for converting a data source to be coded into a first hash character string, wherein the first hash character string comprises numbers and other characters;
the processing module is further used for replacing other characters in the first hash character string with corresponding numbers according to a preset first corresponding relation between other characters and numbers to obtain a second hash character string;
the processing module is further used for taking out a plurality of character groups corresponding to the short code bar code length from the second hash character string according to the preset interval and the preset short code bar code length;
and the generating module is used for generating the short code bar code according to the plurality of character groups.
In a possible design of the second aspect, the generating module is specifically configured to:
acquiring a short code character corresponding to each character group in the character groups according to the character groups and a second corresponding relation between preset short code characters and the character groups;
and acquiring the short code corresponding to the data source according to the short code character corresponding to each character group and the sequence of the plurality of character groups.
In another possible design of the second aspect, the generating module is specifically configured to:
according to the character groups and a preset short code character set, taking each character group in the character groups as a sequence, and acquiring the short code character of the corresponding sequence of each character group from the short code character set;
acquiring the short codes corresponding to the data sources according to the short code characters corresponding to the sequence of each character group and the sequence of the plurality of character groups;
and generating the short code bar code according to the short code.
Optionally, the processing module is further configured to store the mapping relationship between the short code and the data source in a short code database, and change the state of the short code into a use state.
Optionally, the processing module is specifically configured to:
determining the state of each short code according to the state of each short code in a short code database;
and if the short code is in a use state, taking out a plurality of character groups corresponding to the length of the short code bar code from the second hash character string according to another preset interval according to the length of the preset short code bar code, and re-acquiring the short code according to the plurality of character groups.
In yet another possible design of the second aspect, the processing module is specifically configured to:
taking out the character groups corresponding to the length of the short code bar code from the initial position of the second hash character string at preset intervals;
alternatively, the first and second electrodes may be,
and taking out the character groups corresponding to the length of the short code bar code from the preset position of the second hash character string according to a preset interval.
Optionally, the apparatus further comprises:
the system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving a bar code identification request sent by identification equipment, and the bar code identification request comprises short codes identified by the identification equipment;
the processing module is further configured to obtain a data source corresponding to the short code according to the short code and a mapping relationship between the short code and the data source stored in a short code database; and executing the logic corresponding to the data source, and returning an execution result to the identification equipment.
Optionally, the processing module is further configured to change the state of the short code in the short code database to a recovery state.
Optionally, the data source includes a character string or a link address.
Optionally, the short code is composed of at least one arabic numeral, at least one english alphabet and at least one special character.
In a third aspect, embodiments of the present application further provide an electronic device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the method according to the first aspect and possible designs.
In a fourth aspect, embodiments of the present application further provide a computer-readable storage medium, in which computer instructions are stored, and when the computer instructions are executed on a computer, the computer is caused to execute the method according to the first aspect and each possible design.
According to the barcode processing method, the barcode processing device, the barcode processing equipment and the barcode processing storage medium, a data source to be coded is converted into a first hash character string, and other characters in the first hash character string are replaced with corresponding numbers according to a first preset corresponding relation between the other characters and the numbers, so that a second hash character string is obtained. And then taking out a plurality of character groups corresponding to the length of the short code bar code from the second hash character string according to the length of the preset short code bar code and preset intervals, and generating the short code bar code according to the plurality of character groups. The conversion relation between the character groups and the short code characters is determined by selecting the plurality of character groups in the second hash character string, so that the short code characters are obtained, and the problems that the bar code cannot be accurately identified by identification equipment and the identification precision is low are solved.
Drawings
FIG. 1 is a schematic diagram illustrating comparison between bar code width printing provided in the embodiments of the present application;
fig. 2 is a schematic view of an application scenario of a barcode processing method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a first embodiment of a barcode processing method according to an embodiment of the present application;
fig. 4 is a schematic view of a calculation interface for calculating the number of short codes when the number of bar code bits of the short codes is 4 bits according to an embodiment of the present application;
fig. 5 is a schematic view of a calculation interface for calculating the number of short codes when the number of bar code bits of the short codes is 5 bits according to an embodiment of the present application;
fig. 6 is a schematic view of a calculation interface for calculating the number of short codes when the number of short code bar codes is 6 bits according to an embodiment of the present application;
FIG. 7 is a diagram illustrating a barcode processing method according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a data source barcode and a short code barcode provided in an embodiment of the present application;
fig. 9 is a schematic flowchart of a second embodiment of a barcode processing method according to an embodiment of the present application;
fig. 10 is a schematic flowchart of a third embodiment of a barcode processing method according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of a first barcode processing apparatus according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of a second barcode processing apparatus according to an embodiment of the present application;
fig. 13 is a schematic structural diagram of an electronic device for executing a barcode processing method according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
With the continuous progress of science and technology, people can more and more easily acquire required information through an information carrier, wherein a bar code is an important novel information carrier. The bar code is a graphic identifier in which a plurality of black bars and white bars having different widths are arranged according to a certain encoding rule to express a set of information. Because of the different reflectivity of the black and white bars of a bar code, an identification device scans the bar code to obtain a set of data signals to read the information. Taking the sending of an article as an example, people initially convey information and the article by means of letters, however, only the telephone numbers and addresses of a sender and a receiver are described on an envelope, the real-time position of the letters cannot be tracked after the letters are sent out, and the sender and the receiver cannot know the specific transportation condition of the letters. Moreover, since no statistics are collected on the information of the letters during transportation, the letter loss is easy to occur. Therefore, in order to facilitate the user to grasp the situation of the item during transportation and reduce the loss rate of the item, a bar code is usually attached to a bill of the express delivery, and a transportation company scans the bar code to fill in detailed information of the express delivery, such as names, addresses, telephone numbers, types and weights of the sender and the receiver, and the like. In the process of commodity transportation, when a transfer point is reached, workers at the transfer point can scan the bar codes to update the position of the express delivery in real time, and a user can acquire real-time information of the commodity by scanning the bar codes on the express delivery bill. The goods are delivered by the courier after arriving at the area of the receiver, and when a user scans the bar codes to check the logistics information, the user can display the name, the telephone number and other information of the courier besides the position of the goods, so that the user can conveniently contact the courier to communicate with the problem of delivery of the express.
The conventional bar code has a large number of encoding bits, and occupies a large space when the bar code is printed. However, because some items have their own small volume, such as erasers, pencils, etc., the print width provided to the bar code is small, resulting in the black and white bars of the bar code coming together within a limited range of print widths. Fig. 1 is a schematic diagram illustrating comparison of barcode width printing provided in the embodiment of the present application. As shown in fig. 1, it is apparent that black and white bars of a bar code are clear when a normal width paper is used to print the bar code, and the black bars of the bar code overlap due to a reduction in the print width when a fixed width paper is used to print the bar code. When the bar code is identified by the identification equipment, the identification equipment cannot accurately identify the bar code due to the fact that the black bars and the white bars of the bar code are combined together, and the identification accuracy is low.
In view of the above problems, the present application provides a method for processing a barcode, which is used to solve the above problems. In the process of solving the problems, the inventor finds that the black bars and the white bars of the printed bar codes are combined together mainly because the number of coding bits is too large, so that the black bars and the white bars of the bar codes are overlapped in the printing process because of too large number. This problem can be solved by reducing the number of black and white bars of the bar code if the number of encoding bits can be reduced appropriately.
Based on the method, the data source to be coded is converted into the first hash character string, and other characters in the first hash character string are replaced by corresponding numbers according to the preset first corresponding relation between other characters and numbers, so that the second hash character string is obtained. And according to the length of the preset short code bar code, taking out a plurality of character groups corresponding to the length of the short code bar code from the second hash character string according to a preset interval, and generating the short code bar code according to the plurality of character groups. In limited printing width, black bars and white bars of the bar code can be clearly printed, and the problems that the bar code cannot be accurately identified by identification equipment and the identification precision is low are effectively solved.
For example, the barcode processing method provided in the embodiment of the present application may be applied to an application scenario diagram shown in fig. 2. Fig. 2 is a schematic view of an application scenario of the barcode processing method according to the embodiment of the present application. As shown in fig. 2, the schematic diagram may include: electronic device 10, identification device 11. The number of the identification devices 11 is at least one, and three are taken as an example here, and are respectively the identification device 111, the identification device 112, and the identification device 113.
The electronic device 10 is capable of converting the data source code to a short code and generating the short code into a short code barcode. In addition, the electronic device 10 can also store the mapping relationship between the short codes and the data source in a short code database, and count the use states of the short codes.
When the identification device 11 identifies the short code barcode, the electronic device 10 can also receive the short code sent by the identification device 11, obtain a data source corresponding to the short code according to a mapping relationship between the short code and the data source, execute a logic corresponding to the data source, and return an execution result to the identification device 11.
It is understood that the electronic device 10 may be a terminal device, such as a computer, a tablet computer, etc., or a server, such as a barcode processing platform, etc. Therefore, the present embodiment is explained by referring to the terminal device and the server collectively as the electronic device, and the electronic device may be specifically the terminal device, and may also be the server, which may be determined in actual situations.
The code reading device 11 is mainly configured to scan a short code barcode to obtain the short code, send a barcode identification request to the electronic device 10 according to the short code, and receive an execution result returned by the electronic device 10.
Optionally, the schematic diagram may further include: the printing device 12.
The printing device 12 is mainly configured to receive a print request sent by the electronic device 10, acquire a short barcode to be printed and a print position, and print the short barcode at a specified print position.
The technical solution of the present application will be described in detail below with reference to specific examples.
It should be noted that the following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
Fig. 3 is a schematic flowchart of a first embodiment of a barcode processing method according to an embodiment of the present application. As shown in fig. 3, the barcode processing method may include the following steps:
s101, converting a data source to be coded into a first hash character string.
In the embodiment of the application, because the number of the character bits of the data source is large, if the data source is directly converted into the bar code, the bar code is not clearly printed, and the white bar and the black bar are overlapped. The electronic device needs to acquire the data source and process it to convert it into short codes. The mapping relation is established between the short code and the data source, and all information of the data source can be acquired through the short code.
Specifically, the short code is mainly composed of numbers, capital and lower-case English letters and special symbols in a short code character set. Wherein, the number, capital and lower case English letters and the number of special symbols in the short code character set can be freely set. In the embodiment of the present application, a short code character set composed of 64 characters, including numbers 0 to 9, upper and lower case english letters, and 2 arbitrary special symbols, is taken as an example for explanation.
In this step, the electronic device needs to acquire a data source to be encoded, the data source has a certain logical relationship with the article or the information that the data source refers to, and all data information of the article or the information can be viewed through the data source. For example, if the data source represents logistics information of an article, real-time location information of the article and a call of a dispatcher can be checked through the data source according to a logical relationship between the data source and the logistics information.
The data source may be a character string generated according to a certain rule, or may be a character and a link, for example, JDV000165020743-1-1,% # +, http:// www.example.com, and the like.
Because the character composition of the data source is complex, the data source may contain numbers, upper and lower case letters and symbols at the same time, if the data source is directly related to the short code database to construct a corresponding logical relationship, the corresponding relationship system is huge, and the conversion efficiency is affected. There is therefore a need for converting data sources so that the data sources can be more efficiently converted to short codes.
Specifically, after acquiring a data source to be encoded, the electronic device converts the data source to form a first hash character string. For example, the data source may be converted into a cryptographic hash function, such as MD5, MD6, MD7, etc., to generate a first hash string of a fixed length, such as 16 bits, 32 bits, etc., which is not limited in this application.
Optionally, the first hash string includes numbers and other characters, where the other characters may be upper and lower case letters, or may be special symbols, which is not limited in this application.
S102, replacing other characters in the first hash character string with corresponding numbers according to a preset first corresponding relation between other characters and numbers to obtain a second hash character string.
In this step, since the first hash string includes numbers and other characters, the other characters in the first hash string are further processed to be converted into the second hash string, so as to reduce the complexity of converting the second hash string into a short code. Wherein all characters in the second hash string are numbers.
Specifically, the electronic device needs to preset a first correspondence between letters and numbers, and convert the letters in the first hash string into numbers. Optionally, upper and lower case letters may correspond to the same number, or may correspond to different numbers, and the embodiment of the present application is not particularly limited. For example, the upper and lower case letters may correspond to the same number, and the letter a or letter a may correspond to the number 1, B or B may correspond to the number 2, C or C may correspond to the number 3, …, and the letter Z or letter Z may correspond to the number 26.
Specifically, the letters in the first hash string are converted to numbers by a first correspondence between other characters and numbers. If the first hash string contains a symbol, the symbol is skipped and deleted directly during the conversion process.
S103, according to the length of the preset short code bar code, a plurality of character groups corresponding to the length of the short code bar code are taken out from the second hash character string according to the preset interval.
Considering that the short bar code has a small number of bits, if the number of the articles or the information is large, the short bar code may not be sufficient. The short code bar code is generally 4 bits, 5 bits or 6 bits, the length of the short code bar code is not specifically limited in the embodiment of the application, and the short code bar code can be determined according to actual requirements
Illustratively, the number of short codes respectively existing when the short code bar code length is 4 bits, 5 bits and 6 bits when the short code character set contains 64 characters is calculated.
Fig. 4 is a schematic view of a calculation interface for calculating the number of short codes when the number of bar code bits of the short codes is 4 bits according to an embodiment of the present application. Fig. 5 is a schematic view of a calculation interface for calculating the number of short codes when the number of short code bar codes is 5 bits according to an embodiment of the present application. Fig. 6 is a schematic view of a calculation interface for calculating the number of short codes when the number of short code bar codes is 6 bits according to an embodiment of the present application. As shown in fig. 4, N is the number of characters included in the short code character set, and 64 characters are total; and M is the number of the short code bar code and is 4 bits. Using equation (1): k ═ n + m-1! /[ (n-1)! M! And calculating the number of the short codes, wherein K is the number of the short codes, and n, m and N, M are consistent in reference, and are the number of characters contained in the short code character set and the number of short code bar codes respectively. As can be seen from the calculation, when the short code word set includes 64 words, a total of 766480 short codes are available to the user when the number of short code bits is set to 4 bits.
As shown in fig. 5 and 6, in accordance with the process of calculating the number of short codes when the number of short code bar codes is 4 bits, it can be found by calculation that when the short code character set includes 64 characters, a total of 10424128 short codes are available to the user when the number of short code bar codes is 5 bits; when the number of bits of the short code bar code is set to 6 bits, 119877472 short codes are available for the user.
In this step, a suitable character group is selected from the second hash character string according to the length of the short code barcode. The number of bits of the short code bar code can be selected according to the calculation results of the number of the short codes in fig. 4, 5 and 6 in combination with the number of the data sources. For example, if there are 846257 data sources in total, since the number of short bar codes with 4 digits is less than that of the data sources, the data sources cannot be converted into short bar codes with 4 digits and cannot be converted into short bar codes with 5 or 6 digits.
Specifically, after the length of the short code barcode is selected, a preset interval needs to be set, and the electronic device takes out a plurality of character groups from the second hash character string according to the preset interval. The preset interval may be a fixed interval or a non-fixed interval, for example, 1, 2, 3, or the like, or 1 every first time, 2 every second time, 3 every third time, or the like, and the application does not specifically limit this.
Optionally, the number of bits of the character set may be freely set, such as 2 bits, 3 bits, and the like, which is not specifically limited in this application.
Specifically, the number of the selected character sets is determined according to the number of the short code bar codes, and when the number of the selected character sets is consistent with the number of the short code bar codes, the character sets are stopped being selected.
Optionally, the electronic device may select from the first character of the second hash string, or may start selecting at a certain position in the string, which is not specifically limited in this application.
And S104, generating the short code bar code according to the plurality of character groups.
In this step, the character group is converted into short code characters and short codes are formed according to a certain sequence to generate short code bar codes.
In a specific embodiment, since conversion is required according to the relationship between the character group and the short code, a second corresponding relationship between the character group and the short code can be established. Wherein each burst corresponds to a short code. Converting each acquired character group into a short code character according to a second corresponding relation, illustratively, 64 characters are in a short code character set, and when the character group is 24, converting the character group into W according to the second corresponding relation between the character group and the short code; when the character group is 76, F is converted according to the second correspondence between the character group and the short code.
In another specific embodiment, the short code characters may also be numbered in a certain order. Illustratively, 64 characters in the short code character set are numbered from 1 to 64, respectively, and each character corresponds to a unique number. And taking the selected character group of each group as the serial number of the short code character, and converting the short code character into the short code character according to the corresponding relation between the short code character and the serial number. When the numerical value of the character group is smaller than that of the short code character, directly converting the numerical value of the character group and the numerical value of the short code character correspondingly; when the value of the character group is greater than the value of the short code character, the total number of the short code character set is subtracted from the value of the character group, and the difference value is used as the number of the short code character to perform corresponding conversion with the short code character. Illustratively, the short code character set has 64 characters, and when the character set is 24, the short code character set is converted into a letter W according to the corresponding relationship between the short code character and the serial number; when the character group is 76, since the total number of the numerical values in the short code character set is exceeded, it is necessary to first subtract 64 from 76 to obtain a difference value of 12, and convert 12 as the number of the short code character into a letter F according to the correspondence between the short code character and the number.
Specifically, the converted characters are extracted and arranged according to a certain sequence, for example, from left to right, and the like, which is not limited by the present solution.
Specifically, after the short code is generated, the mapping relationship between the short code and the corresponding data source and the generation time of the short code are stored in the short code database, and the state of the short code is changed into the use state. The short code database comprises a data source, corresponding short codes, a use state and generation time information. The using state is divided into a using state and a recycling state, after the short code is used for a period of time, the corresponding commodity or information can be considered to be used or transmitted, in order to avoid the waste of the short code, the short code can be recycled for secondary utilization, and the state of the short code database is changed from the using state to the recycling state. Illustratively, table 1 is a short code database master table field.
Data source encoding Short code Status of state Generating time
JDV009778783-221-300 Jf7E0 Use of 2020-07-23 8:00:00
http://www.example.com W9ip# Recovering 2020-07-21 9:00:00
In the process of generating the short code, due to the reason of preset intervals and selected positions, the situation that different data sources generate the same short code may exist, so that collision processing needs to be performed on the short code, the electronic equipment checks the state of the short code in the short code database after generating the short code, and if the state of the short code is a recovery state, which indicates that the short code can be used, the use state in the database is changed into a use state; if the short code is in use state, a new short code needs to be regenerated.
Specifically, the regeneration of the short code may be performed by modifying the preset interval and/or modifying the start position of the selected character set. For example, if the preset interval of the first generated short code is 2 characters, the preset interval may be modified into 2 characters; if the character group is selected from the first character of the second hash character string during the first generation of the short code barcode, the selection may be modified to be performed from the seventh character of the second hash character string, or the preset interval and the selection position may be modified at the same time.
Specifically, each short code character corresponds to a black bar or a white bar with different reflectivity, the corresponding black bar or the corresponding white bar is generated according to the short code character in the short code, and the short code bar codes are generated by combination.
Fig. 7 is a diagram illustrating a barcode processing method according to an embodiment of the present application, and as shown in fig. 7, a data source JDV000165020743-1-1 is converted into MD5, and is hashed to generate a 32-bit first hash string 2dd0576cbcf734121915c805bbfdff54, and letters in the first hash string are converted into corresponding numbers, where the numbers corresponding to upper and lower case letters are the same, to generate a second hash string 24405763236734121915380522646654. For the second hash string, a two-digit character set is taken out every three character intervals, and since the short codes are 5-bit characters in total, 5-digit character sets, 24, 76, 67, 21 and 38 respectively, need to be taken out. And taking the character group of each group as the number of the short code character, and replacing the character group with the short code character, namely W, F, 8, X and i. The short codes of the characters are arranged in sequence to generate short codes WF8Xi, and short code bar codes are generated according to black bars or white bars corresponding to different short code characters.
Fig. 8 is a schematic diagram illustrating comparison between a data source barcode and a short code barcode according to an embodiment of the present application. As can be seen from FIG. 8, the data source bar code is converted into the short code bar code and printed, the length of the bar code is shortened by at least half, and the space occupied by printing is saved.
According to the bar code processing method provided by the embodiment of the application, a data source to be coded is converted into a first hash character string, letters in the first hash character string are replaced by corresponding numbers according to a first corresponding relation between preset letters and numbers to obtain a second hash character string, a plurality of character groups corresponding to the length of the short code bar code are taken out from the second hash character string according to the length of the short code bar code and preset intervals, and the short code bar code is generated according to the character groups. The conversion relation between the character groups and the short code characters is determined by selecting the plurality of character groups in the second hash character string, so that the short code characters are obtained, and the problems that the bar code cannot be accurately identified by identification equipment and the identification precision is low are solved.
On the basis of the above embodiments, the short-code barcode can be used after being generated, such as identification and entry of information.
Fig. 9 is a schematic flowchart of a second embodiment of a barcode processing method according to an embodiment of the present application. As shown in fig. 9, the barcode processing method may include the following steps:
s201, receiving a bar code identification request.
In this embodiment, when the short-code barcode starts to be used, the barcode needs to be identified by using an identification device, and the identified short code is sent to the electronic device to send an identification request to the electronic device.
In this step, the identification device identifies according to different refractive indexes of black bars and white bars in the short bar code to obtain a short code corresponding to the short bar code, and sends an identification request to the electronic device, identifies and executes logic information corresponding to the short code, and the electronic device receives the identification request sent by the identification device to the short bar code.
Optionally, the barcode identification request includes a short code identified by the identification device.
Illustratively, when a supermarket shops for payment, a salesperson needs to acquire the price of a commodity, and then identifies a short code bar code on the commodity through an identification device, identifies a short code corresponding to the short code bar code, and sends the short code to an electronic device for identification, so as to achieve the purpose of acquiring the price of the commodity.
S202, acquiring a data source corresponding to the short code according to the short code and the mapping relation between the short code and the data source stored in the short code database.
In this step, the electronic device obtains the data source corresponding to the short code by checking the short code database. Illustratively, if the obtained short code is Jf7E0, the database is checked to find the corresponding short code data source JDV 009778783-221-300.
And acquiring a data source corresponding to the short code in the short code data source, so as to facilitate further processing of the data source.
And S203, executing the logic corresponding to the data source and returning an execution result.
In this step, the obtained logical relationship in the data source is checked and executed, and the execution result is obtained. Illustratively, the electronic device acquires the data source JDV009778783-221-300, executes the corresponding logic thereof, and acquires the price of the commodity corresponding to the data source as 10 yuan.
And after the electronic equipment acquires the execution result, returning the execution result to the identification equipment. For example, the electronic device obtains that the price of the commodity is 10 yuan, returns the price of the commodity to the identification device, and the cashier can receive the price of the commodity through the identification device, so that the checkout work for the customer can be completed more conveniently.
According to the barcode processing method provided by the embodiment of the application, the barcode identification request sent by the identification device is received, the data source corresponding to the short code is obtained according to the short code and the mapping relation between the short code and the data source stored in the short code database, the logic corresponding to the data source is executed, and the execution result is returned to the identification device. The purpose of identifying the logic content of the short code is realized according to the mapping relation between the short code and the data source in the short code database, and a foundation is laid for subsequently obtaining an execution result.
Fig. 10 is a schematic flowchart of a third embodiment of a barcode processing method according to the embodiment of the present application. As shown in fig. 10, the method for processing a barcode may include the following steps:
s301, data source coding is converted into short codes.
In this step, the data source to be encoded is converted into a first hash string, wherein the first hash string includes a number and other characters. And replacing other characters in the first hash character string with corresponding numbers according to a preset first corresponding relation between other characters and numbers to obtain a second hash character string, wherein all characters in the second hash character string are numbers. And according to the length of the short code bar code, taking out a plurality of character groups corresponding to the length of the short code bar code from the second hash character string according to a preset interval, and generating the short code bar code according to the plurality of character groups.
S302, printing the short code bar code.
In the step, the generated short code bar code is printed on the surface of the article, so that the short code bar code is convenient for the identification equipment to scan and identify the article.
And S303, scanning the short codes and converting the short codes into data source codes.
In this step, the identification device identifies the short code corresponding to the short code barcode according to the different refractive indexes of the black bar and the white bar in the short code barcode, and sends a barcode identification request to the electronic device, identifies the logic information corresponding to the short code and executes the logic information, and the electronic device receives the identification request sent by the identification device to the short code barcode.
And acquiring the data source corresponding to the short code according to the short code and the mapping relation between the short code and the data source stored in the short code database.
S304, executing logic by using data source coding.
In this step, the obtained logical relationship in the data source is checked and executed, and the execution result is obtained. And after the electronic equipment acquires the execution result, returning the execution result to the identification equipment.
S305, recycling the short codes.
In this step, after the short code is used for a period of time, the corresponding commodity or information may be considered to have been used or transmitted, so as to avoid the waste of the short code, the short code may be recycled for secondary use, and at the same time, the state of the short code in the short code database needs to be changed from the use state to the recycling state.
According to the barcode processing method provided by the embodiment of the application, the data source code is converted into the short code and printed, the short code is scanned and converted into the data source code, the data source code is used for executing logic, and the short code is recycled after the short code is used. The data source code is converted into the short code, and the short code is converted into the data source code when the short code is used, so that the length of the bar code printed on the surface of an article is shortened, and the space occupied by printing is saved.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Fig. 11 is a schematic structural diagram of a first barcode processing apparatus according to an embodiment of the present application. As described with reference to fig. 11, the apparatus may include: a conversion module 51, a processing module 52 and a generation module 53.
The conversion module 51 is configured to convert a data source to be encoded into a first hash character string, where the first hash character string includes a number and other characters;
the processing module 52 is configured to replace other characters in the first hash character string with corresponding numbers according to a preset first corresponding relationship between other characters and numbers, so as to obtain a second hash character string;
the processing module 52 is further configured to, according to a preset short code barcode length, take out a plurality of character groups corresponding to the short code barcode length from the second hash character string at preset intervals;
and a generating module 53, configured to generate a short-code barcode according to the plurality of character groups.
In a possible design of the embodiment of the present application, the generating module 53 is specifically configured to obtain a short code character corresponding to each character group in the plurality of character groups according to the plurality of character groups and a second correspondence between preset short code characters and the character groups; and acquiring the short code corresponding to the data source according to the short code character corresponding to each character group and the sequence of the plurality of character groups.
In another possible design of the embodiment of the present application, the generating module 53 is specifically configured to, according to the multiple character groups and a preset short code character set, use each character group in the multiple character groups as a sequence, and obtain a short code character of the sequence corresponding to each character group from the short code character set; acquiring the short codes corresponding to the data sources according to the short code characters corresponding to the sequence of each character group and the sequence of the plurality of character groups; and generating the short code bar code according to the short code.
Optionally, the processing module 52 is further configured to store the mapping relationship between the short code and the data source in a short code database, and change the state of the short code into a use state.
Optionally, the processing module 52 is specifically configured to:
determining the state of each short code according to the state of each short code in a short code database;
and if the short code is in a use state, taking out a plurality of character groups corresponding to the length of the short code bar code from the second hash character string according to another preset interval according to the length of the preset short code bar code, and re-acquiring the short code according to the plurality of character groups.
In another possible design of the embodiment of the present application, the processing module 52 is specifically configured to:
taking out the character groups corresponding to the length of the short code bar code from the initial position of the second hash character string at preset intervals;
alternatively, the first and second electrodes may be,
and taking out the character groups corresponding to the length of the short code bar code from the preset position of the second hash character string according to a preset interval.
On the basis of the foregoing embodiments, fig. 12 is a schematic structural diagram of a second embodiment of a barcode processing apparatus according to an embodiment of the present application. As described with reference to fig. 12, the apparatus may further include:
a receiving module 54, configured to receive a barcode identification request sent by an identification device, where the barcode identification request includes a short code identified by the identification device;
the processing module 52 is further configured to obtain a data source corresponding to the short code according to the short code and a mapping relationship between the short code and the data source stored in the short code database; and executing the logic corresponding to the data source, and returning an execution result to the identification equipment.
Optionally, the processing module 52 is further configured to change the state of the short code in the short code database to a recovery state.
Optionally, the data source includes a character string or a link address.
Optionally, the short code is composed of at least one arabic numeral, at least one english alphabet and at least one special character.
The apparatus provided in the embodiment of the present application may be used to execute the method in the above-described embodiments, and the implementation principle and technical effect are similar, which are not described herein again.
It should be noted that the division of the modules of the above apparatus is only a logical division, and the actual implementation may be wholly or partially integrated into one physical entity, or may be physically separated. And these modules can be realized in the form of software called by processing element; or may be implemented entirely in hardware; and part of the modules can be realized in the form of calling software by the processing element, and part of the modules can be realized in the form of hardware. For example, the conversion module may be a processing element separately set up, or may be implemented by being integrated in a chip of the apparatus, or may be stored in a memory of the apparatus in the form of program code, and a processing element of the apparatus calls and executes the functions of the above determination module. Other modules are implemented similarly. In addition, all or part of the modules can be integrated together or can be independently realized. The processing element described herein may be an integrated circuit having signal processing capabilities. In implementation, each step of the above method or each module above may be implemented by an integrated logic circuit of hardware in a processor element or an instruction in the form of software.
For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs), among others. For another example, when some of the above modules are implemented in the form of a processing element scheduler code, the processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor that can call program code. As another example, these modules may be integrated together, implemented in the form of a system-on-a-chip (SOC).
Fig. 13 is a schematic structural diagram of an electronic device for executing a barcode processing method according to an embodiment of the present application. As shown in fig. 13, the electronic device may include: a processor 131, a memory 132, a communication interface 133, and a system bus 134. The memory 132 and the communication interface 133 are connected to the processor 131 through the system bus 134 and perform communication with each other, the memory 132 is used for storing computer-executable instructions, the communication interface 133 is used for communicating with other devices, and the processor 131 implements the solution of the above-mentioned illustrated embodiment when executing the computer-executable instructions.
The system bus 134 mentioned in fig. 13 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The system bus 134 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus. The communication interface 133 is used to enable communication between the database access device and other devices (e.g., clients, read-write libraries, and read-only libraries). The memory 132 may comprise Random Access Memory (RAM) and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 131 may be a general-purpose processor, including a central processing unit CPU, a Network Processor (NP), and the like; but also a digital signal processor DSP, an application specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic device, discrete gate or transistor logic, discrete hardware components.
Optionally, an embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-readable storage medium is run on a computer, the computer is caused to execute the method according to the embodiment as described above.
Optionally, an embodiment of the present application further provides a chip for executing the instruction, where the chip is configured to execute the method in the foregoing illustrated embodiment.
Embodiments of the present application further provide a computer program product, where the computer program product includes a computer program, where the computer program is stored in a computer-readable storage medium, and at least one processor can read the computer program from the computer-readable storage medium, and when the computer program is executed by the at least one processor, the at least one processor can implement the method of the above-described illustrated embodiment.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (13)

1. A method of processing a bar code, comprising:
converting a data source to be encoded into a first hash string, the first hash string comprising numbers and other characters;
replacing other characters in the first hash character string with corresponding numbers according to a preset first corresponding relation between the other characters and the numbers to obtain a second hash character string;
according to the length of a preset short code bar code, taking out a plurality of character groups corresponding to the length of the short code bar code from the second hash character string according to a preset interval;
and generating the short code bar code according to the plurality of character groups.
2. The method of claim 1, wherein generating a short code barcode from the plurality of character sets comprises:
acquiring a short code character corresponding to each character group in the character groups according to the character groups and a second corresponding relation between preset short code characters and the character groups;
acquiring short codes corresponding to the data sources according to the short code characters corresponding to each character group and the sequence of the character groups;
and generating the short code bar code according to the short code.
3. The method of claim 1, wherein generating a short code barcode from the plurality of character sets comprises:
according to the character groups and a preset short code character set, taking each character group in the character groups as a sequence, and acquiring the short code character of the corresponding sequence of each character group from the short code character set;
acquiring the short codes corresponding to the data sources according to the short code characters corresponding to the sequence of each character group and the sequence of the plurality of character groups;
and generating the short code bar code according to the short code.
4. A method according to claim 2 or 3, characterized in that the method further comprises:
and storing the mapping relation between the short code and the data source in a short code database, and changing the state of the short code into a use state.
5. The method of claim 4, wherein prior to generating the short code barcode from the short code, the method further comprises:
determining the state of each short code according to the state of each short code in a short code database;
and if the short code is in a use state, taking out a plurality of character groups corresponding to the length of the short code bar code from the second hash character string according to another preset interval according to the length of the preset short code bar code, and re-acquiring the short code according to the plurality of character groups.
6. The method according to any one of claims 1 to 3, wherein the extracting a plurality of character groups corresponding to the length of the short code barcode from the second hash character string at a preset interval according to the length of the short code barcode comprises:
taking out the character groups corresponding to the length of the short code bar code from the initial position of the second hash character string at preset intervals;
alternatively, the first and second electrodes may be,
and taking out the character groups corresponding to the length of the short code bar code from the preset position of the second hash character string according to a preset interval.
7. The method of claim 4, further comprising:
receiving a bar code identification request sent by identification equipment, wherein the bar code identification request comprises a short code identified by the identification equipment;
acquiring a data source corresponding to the short code according to the short code and a mapping relation between the short code and the data source stored in a short code database;
and executing the logic corresponding to the data source, and returning an execution result to the identification equipment.
8. The method of claim 7, further comprising:
and changing the state of the short codes in the short code database into a recovery state.
9. A method according to any one of claims 1 to 3, wherein the data source comprises a string or a linked address.
10. The method according to any one of claims 1 to 3, wherein the short code is composed of at least one Arabic numeral, at least one English alphabet, and at least one special character.
11. A device for processing a bar code, comprising: the device comprises a conversion module, a processing module and a generation module;
the conversion module is used for converting a data source to be coded into a first hash character string, wherein the first hash character string comprises numbers and other characters;
the processing module is used for replacing other characters in the first hash character string with corresponding numbers according to a preset first corresponding relation between other characters and numbers to obtain a second hash character string;
the processing module is further used for taking out a plurality of character groups corresponding to the short code bar code length from the second hash character string according to the preset interval and the preset short code bar code length;
and the generating module is used for generating the short code bar code according to the plurality of character groups.
12. An electronic device, comprising: processor, memory and computer program instructions stored on the memory and executable on the processor, characterized in that the processor implements the method of processing a barcode according to any one of the preceding claims 1 to 10 when executing the computer program instructions.
13. A computer-readable storage medium having stored thereon computer-executable instructions for implementing the method of processing a barcode according to any one of claims 1 to 10 when executed by a processor.
CN202011140317.7A 2020-10-22 2020-10-22 Bar code processing method, device, equipment and storage medium Pending CN112149445A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011140317.7A CN112149445A (en) 2020-10-22 2020-10-22 Bar code processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011140317.7A CN112149445A (en) 2020-10-22 2020-10-22 Bar code processing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112149445A true CN112149445A (en) 2020-12-29

Family

ID=73954518

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011140317.7A Pending CN112149445A (en) 2020-10-22 2020-10-22 Bar code processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112149445A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020194270A1 (en) * 1996-08-30 2002-12-19 Internet Media Corporation System and method for providing easy access to the world wide web
CN101005485A (en) * 2006-12-14 2007-07-25 钟杨 Method and system for compression coding information resource address
CN102866994A (en) * 2011-07-04 2013-01-09 阿里巴巴集团控股有限公司 Method and system for processing internet resource popularization data
CN110365806A (en) * 2019-06-06 2019-10-22 无线生活(杭州)信息科技有限公司 Network address conversion method and device
CN110932822A (en) * 2019-12-02 2020-03-27 泰康保险集团股份有限公司 Data encoding method, data decoding method, device, equipment and storage medium
CN111027656A (en) * 2019-11-15 2020-04-17 浙江口碑网络技术有限公司 Two-dimensional code generation and identification method and device, electronic equipment and storage medium
CN111368575A (en) * 2020-03-09 2020-07-03 山东浪潮通软信息科技有限公司 One-dimensional bar code encoding and decoding method and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020194270A1 (en) * 1996-08-30 2002-12-19 Internet Media Corporation System and method for providing easy access to the world wide web
CN101005485A (en) * 2006-12-14 2007-07-25 钟杨 Method and system for compression coding information resource address
CN102866994A (en) * 2011-07-04 2013-01-09 阿里巴巴集团控股有限公司 Method and system for processing internet resource popularization data
CN110365806A (en) * 2019-06-06 2019-10-22 无线生活(杭州)信息科技有限公司 Network address conversion method and device
CN111027656A (en) * 2019-11-15 2020-04-17 浙江口碑网络技术有限公司 Two-dimensional code generation and identification method and device, electronic equipment and storage medium
CN110932822A (en) * 2019-12-02 2020-03-27 泰康保险集团股份有限公司 Data encoding method, data decoding method, device, equipment and storage medium
CN111368575A (en) * 2020-03-09 2020-07-03 山东浪潮通软信息科技有限公司 One-dimensional bar code encoding and decoding method and system

Similar Documents

Publication Publication Date Title
EP2309426B1 (en) Two-dimensional bar code encoding method, decoding method and device, terminal
CN103400174B (en) The coded method of a kind of Quick Response Code, coding/decoding method and system
CN111539502B (en) Anti-counterfeiting two-dimensional code generation method and device, server and storage medium
CN113672230B (en) Industrial element identification coding method
CN110807080A (en) Commodity coding method and device
CN113297435B (en) Material management method and system based on gene codes
CN107544765A (en) A kind of order print system and method
CN104915698B (en) Chemical producting safety information quick search and complete period tracking digital labelling system
CN104361379A (en) Two-dimensional code label data interaction system with positioning function
CN112733568B (en) One-dimensional bar code recognition method, device, equipment and storage medium
CN112149445A (en) Bar code processing method, device, equipment and storage medium
CN108256610A (en) A kind of word is around the generation system and generation method of Quick Response Code
CN105117878A (en) Method and device for treating remaining article amount
CN104376295A (en) Data interaction system used for printing two-dimension codes and having positioning function
CN112016270B (en) Logistics information coding method, device and equipment of Chinese-character codes
CN112465519A (en) Server component fool-proof management and control method, system, terminal and storage medium
CN113590856A (en) Label query method and device, electronic equipment and readable storage medium
CN111552689A (en) Method, device and equipment for calculating deduplication index of fund audit
CN101004787A (en) Device and method for recognizing quick response codes run on mobile terminals
CN113343639B (en) Product identification code diagram generation and information query method based on product identification code diagram
CN117094349B (en) Two-dimensional code graph generation method, device, equipment and medium
Weng et al. Design and implementation of barcode management information system
CN103257977A (en) Method and device for obtaining identification numbers
Berisso Reed-Solomon Based Bar Code Character Substitution Rates
CN113592514A (en) Information encoding method, information decoding method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination