CN112016270A - Chinese-sensible code logistics information coding method, device and equipment - Google Patents
Chinese-sensible code logistics information coding method, device and equipment Download PDFInfo
- Publication number
- CN112016270A CN112016270A CN202010936615.0A CN202010936615A CN112016270A CN 112016270 A CN112016270 A CN 112016270A CN 202010936615 A CN202010936615 A CN 202010936615A CN 112016270 A CN112016270 A CN 112016270A
- Authority
- CN
- China
- Prior art keywords
- character
- encoding
- character string
- characters
- mode
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 66
- 238000004590 computer program Methods 0.000 claims description 12
- 238000004891 communication Methods 0.000 claims description 5
- 238000010586 diagram Methods 0.000 description 20
- 238000004519 manufacturing process Methods 0.000 description 9
- PCTMTFRHKVHKIS-BMFZQQSSSA-N (1s,3r,4e,6e,8e,10e,12e,14e,16e,18s,19r,20r,21s,25r,27r,30r,31r,33s,35r,37s,38r)-3-[(2r,3s,4s,5s,6r)-4-amino-3,5-dihydroxy-6-methyloxan-2-yl]oxy-19,25,27,30,31,33,35,37-octahydroxy-18,20,21-trimethyl-23-oxo-22,39-dioxabicyclo[33.3.1]nonatriaconta-4,6,8,10 Chemical compound C1C=C2C[C@@H](OS(O)(=O)=O)CC[C@]2(C)[C@@H]2[C@@H]1[C@@H]1CC[C@H]([C@H](C)CCCC(C)C)[C@@]1(C)CC2.O[C@H]1[C@@H](N)[C@H](O)[C@@H](C)O[C@H]1O[C@H]1/C=C/C=C/C=C/C=C/C=C/C=C/C=C/[C@H](C)[C@@H](O)[C@@H](C)[C@H](C)OC(=O)C[C@H](O)C[C@H](O)CC[C@@H](O)[C@H](O)C[C@H](O)C[C@](O)(C[C@H](O)[C@H]2C(O)=O)O[C@H]2C1 PCTMTFRHKVHKIS-BMFZQQSSSA-N 0.000 description 7
- 230000006870 function Effects 0.000 description 5
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000006243 chemical reaction Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/12—Use of codes for handling textual entities
- G06F40/126—Character encoding
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
The embodiment of the application provides a logistics information coding method, a device and equipment of Chinese-sensible codes, which are applied to a GS1 system, and the method comprises the following steps: obtaining symbol information corresponding to information to be coded, wherein the symbol information comprises at least two character strings and at least one separator, and the separator is used for dividing the two character strings; coding the symbol information according to a preset sequence to obtain a coding result; the character string is encoded in a numeric mode or a text mode, and the separator is encoded in a numeric mode. The efficiency of coding is improved.
Description
Technical Field
The present application relates to the field of code recognition, and in particular, to a method, an apparatus, and a device for encoding logistics information using hanxin codes.
Background
At present, the two-dimensional code is a data carrier widely used in the logistics industry, for example, commodity data is written into the two-dimensional code, and a user can obtain the commodity data by scanning the two-dimensional code through a mobile device (a mobile phone, a tablet personal computer).
In the prior art, the commodity data is generally encoded by using a GS1 (global standard for coding) encoding system. For example, commodity data is converted into GS1 data comprising numbers, letters and characters, and the GS1 data is encoded according to a GS1 encoding system to obtain a two-dimensional code corresponding to the GS1 data. However, when encoding GS1 data, some data in GS1 data need to be encoded by ASCII encoding method, in which each character is encoded by 8-bit byte mode, resulting in low encoding efficiency.
Disclosure of Invention
The application provides a Chinese-sensible code logistics information coding method, a Chinese-sensible code logistics information coding device and Chinese-sensible code logistics information coding equipment. The efficiency of coding is improved.
In a first aspect, an embodiment of the present application provides a method for encoding logistics information using hanxin codes, where the method is applied to a GS1 system, and the method includes:
obtaining symbol information corresponding to information to be coded, wherein the symbol information comprises at least two character strings and at least one separator, and the separator is used for dividing the two character strings;
coding the symbol information according to a preset sequence to obtain a coding result; the character string is encoded in a numeric mode or a text mode, and the separator is encoded in a numeric mode.
In a possible implementation manner, encoding the symbol information according to a preset order to obtain an encoding result includes:
determining an encoding mode corresponding to the character string according to the content included in the character string, and encoding the character string according to the encoding mode;
upon recognition of the separator, the separator is encoded in a digital pattern.
In a possible implementation manner, determining, according to content included in the character string, an encoding mode corresponding to the character string includes:
encoding characters before text characters in the character string according to the number mode;
and coding the text characters in the character string and the characters behind the text characters according to the text mode.
In one possible embodiment, encoding characters preceding a text character in the character string according to the number pattern includes:
dividing the numbers in the character string into at least one group of characters, wherein the characters in each group of characters are decimal data;
acquiring binary data in each group of characters, wherein the length of the binary data is ten;
determining a first encoding result corresponding to the digital pattern encoding comprises: binary data corresponding to the decimal data in each group of characters, a first start character and a first termination character, wherein the first start character is located at the start position of the first coding result, and the first termination character is located at the end position of the first coding result.
In one possible implementation, encoding a text character in the character string and characters following the text character according to the text mode includes:
obtaining binary data corresponding to each character in the character string;
determining a second encoding result corresponding to the character string comprises: binary data corresponding to each character, a second start character and a second end character, wherein the second start character is located at the start position of the second coding result, and the second end character is located at the end position of the second coding result.
In a possible embodiment, the coding mode of the separator is a digital mode, comprising:
the separator corresponds to a digital pattern encoded as 1111101000.
In a second aspect, an embodiment of the present application provides a logistics information encoding device of a hanxin code, including: the Chinese sensible code encoding method comprises a memory, a processor and a communication interface, wherein the memory is used for storing program instructions, and the processor is used for calling the program instructions in the memory to execute the Chinese sensible code encoding method according to any one of the first aspect.
In a third aspect, an embodiment of the present application provides a readable storage medium, on which a computer program is stored; the computer program is used for implementing the logistics information encoding method of hanxin code according to any one of the first aspect.
In the logistics information encoding method, device and equipment of the Chinese-sensible code, during encoding, symbol information corresponding to information to be encoded, for example, a character string and a separator of the character string, is obtained first, and the symbol information is encoded according to a preset sequence to obtain an encoding result, wherein an encoding mode of the character string is a digital mode or a text mode, and an encoding mode of the separator is a digital mode. Therefore, when encoding is carried out, the separator is encoded according to the digital mode, and when encountering the separator, the encoding mode does not need to be switched, thereby improving the encoding efficiency.
Drawings
Fig. 1 is a schematic view of an application scenario provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of a method for encoding logistics information of a hanxin code according to an embodiment of the present application;
fig. 3 is a schematic diagram illustrating conversion of a character string into binary code according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a process for encoding a character string according to an embodiment of the present application;
fig. 5 is a schematic diagram of another process for encoding a character string according to an embodiment of the present application;
fig. 6 is a schematic process diagram of a logistics information encoding method of hanxin codes according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a logistics information encoding apparatus of a hanxin code according to an embodiment of the present application;
fig. 8 is a schematic hardware structure diagram of a logistics information encoding device of a han-xin code 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.
For ease of understanding, an application scenario of a system architecture to which the embodiment of the present application is applicable is described below with reference to fig. 1.
Fig. 1 is a schematic view of an application scenario provided in an embodiment of the present application. Referring to fig. 1, according to the chinese-sensible code encoding method of the GS1 system provided by the present application, the commodity information is encoded into a two-dimensional code. The two-dimensional code package can be printed and attached to the surface of the logistics box. The commodity information can be obtained by scanning the Chinese letter code on the logistics box by using the terminal equipment. For example, through a scanning function in the mobile phone, the two-dimensional code corresponding to the commodity information can be scanned, and the mobile phone page can display the commodity information included in the two-dimensional code.
It should be noted that fig. 1 illustrates an application scenario used in the present application by way of example only, and is not limited to the application scenario.
In the logistics information encoding method of the hanxin code provided by the embodiment of the application, in the encoding process, symbol information corresponding to information to be encoded, for example, a character string and a separator of the character string, is obtained first, and the symbol information is encoded according to a preset sequence to obtain an encoding result, wherein an encoding mode of the character string is a digital mode or a text mode, and an encoding mode of the separator is a digital mode. Therefore, when encoding is carried out, the separator is encoded according to the digital mode, and when encountering the separator, the encoding mode does not need to be switched, thereby improving the encoding efficiency.
The technical means shown in the present application will be described in detail below with reference to specific examples. It should be noted that the following embodiments may be combined with each other, and the description of the same or similar contents in different embodiments is not repeated.
Fig. 2 is a schematic flowchart of a logistics information encoding method of hanxin codes according to an embodiment of the present application. Referring to fig. 2, the method may include:
s201, obtaining symbol information corresponding to information to be coded.
The execution main body of the embodiment of the application can be an electronic device, and can also be a coding device arranged in/out of the electronic device. Optionally, the electronic device may be a mobile phone, a computer, a wearable device, or the like. The coding means may be implemented by software or by a combination of software and hardware.
Optionally, the information to be encoded may include raw data of the commodity. For example, the information to be encoded may include a production date of the commodity, a shelf life of the commodity, a batch number of the commodity, a global trade item code of the commodity, and the like.
Optionally, the symbol information is information composed of characters and used for representing information to be encoded. The symbol information includes at least two character strings for representing original data of the commodity and at least one separator for dividing the two character strings. For example, the symbol information may be (01)06901234567892(10) 20181009% (21)123456789, where (01)06901234567892 denotes the global trade item code 06901234567892, (10)20181009 denotes the lot number 20181009, (21)123456789 denotes the serial number 123456789, and the% denotes the separator.
Alternatively, the character string may be composed of an application identifier and data corresponding to the application identifier, wherein the application identifier may be composed of 2-bit, 3-bit or 4-bit numbers for defining the meaning and format of the data corresponding to the application identifier. For example, the character string may be (10) ABCD1234, where 10 is the application identifier representing the lot number, and the ABDC1234 is the data corresponding to the lot number, that is, the character string represents that the lot number is: ABCD 1234.
Optionally, the character string includes a fixed-length unit character string and an indefinite-length unit character string. The fixed-length unit character string indicates that the data length corresponding to the application identifier is fixed. For example, the global trade item code may be represented as (01)03453120000011, where 01 is an application identifier representing the global trade item code and 03453120000011 represents data corresponding to the global trade item code, the length of which is fixed. The indefinite length unit character indicates that the data length corresponding to the application identifier is indefinite. For example, the sequence number may be (21)123456789, where 21 is an application identifier and represents the sequence number, and 123456789 represents data corresponding to the sequence number, and the length thereof is variable and may be 123456789 or 123456.
Alternatively, it may be determined whether the character string is a fixed-length unit character string or an indefinite-length unit character string according to the application identifier. For example, the application identifier is 01, which indicates a global trade item code, and the format of the data after the application of the application identifier is a fixed 14-digit number.
Optionally, when the symbol information corresponding to the information to be encoded includes a plurality of character strings, the character strings may be connected according to the order that the fixed-length unit character string is in front of the fixed-length unit character string and the indefinite-length unit character string is behind the fixed-length unit character string. For example, the symbol information corresponding to the information to be encoded includes 3 character strings, where 1 character string is a fixed-length unit character string, and 2 character strings are indefinite-length unit character strings, then a first character string of the symbol information is a fixed-length unit character string, and a second character string and a third character string of the symbol information are indefinite-length unit character strings.
The separator is used to divide the two strings. For example, a separator may be added between two strings of indefinite length cells to distinguish the two strings of indefinite length cells. Therefore, two unit character strings with indefinite length can be prevented from being combined into one character string, and the accuracy of coding is improved.
Optionally, a separator does not need to be added between the fixed-length unit character strings and the indefinite-length unit character strings, and a separator does not need to be added after the last character string in the symbol information.
Optionally, the symbol information may be GS1 data, and the symbol information corresponding to the information to be encoded may be determined according to the following feasible manner: and converting original data in the information to be encoded into symbolic information according to the GS1 unit character string table. For example, the GS1 cell string table may be as shown in table 1:
TABLE 1
Application Identifier (AI) | Data definition | Coding format (AI + data) |
01 | Global trade item code | N2+ |
10 | Batch number | N2+X…20 |
11 | Date of production (YYMMDD) | N2+N6 |
15 | Shelf life (YYMMDD) | N2+ |
17 | Effective period (YYMMDD) | N2+ |
21 | Serial number | N2+X…20 |
It should be noted that table 1 illustrates the GS1 cell string table by way of example only, and does not limit the GS1 cell string table. Wherein N represents a digit; x represents a text character; n is a radical of2Representing a fixed length of 2 bits; n is a radical of6Representing a fixed length of 6 bits; n is a radical of14Representing a fixed length of 14 bits; x …20Representing a variable length text character having a maximum length of 20.
For example, when the information to be encoded needs to encode the global trade item code, the application identifier in the symbol information is 01; when the information to be coded needs to code the batch number, the application identifier in the symbol information is 10; when the information to be coded needs to code the production date, the application identifier in the symbol information is 11; when the information to be coded needs to code the shelf life, the application identifier in the symbol information is 15; when the information to be coded needs to code the validity period, the application identifier in the symbol information is 17; when the information to be encoded needs to encode the serial number, the application identifier in the symbol information is 21. For example, the encoding format of the symbolic information of the global trade item code may be represented as (01) 03453120000011; the Bibushy Marger format of the symbol information for the lot number may be represented as (10) ABCD 1234; the encoding format of the symbol information of the date of production can be expressed as (11) 20200101; the encoded format of the shelf-life symbolic information may be represented as (15) 20200101; the encoding format of the symbol information of the validity period may be represented as (17) 20200101; the encoding format of the symbol information of the serial number may be represented as (21) 123456789.
Alternatively, the type of the character string may be determined according to the encoding format. For example, the encoding format corresponding to the global trade item code is a fixed length of 2 digits, reinforced with fixed length of 14 digits, and the character string type of the global trade item code is a fixed length unit character string; the coding format corresponding to the batch number is a digit with the fixed length of 2 digits and a variable-length text character with the maximum length of 20, and the character string type of the batch number is an indefinite-length unit character string; the coding format corresponding to the production date is a digit with the fixed length of 2 digits and reinforced with a digit with the fixed length of 6 digits, and the character string type of the production date is a fixed-length unit character string; the coding format corresponding to the quality guarantee period is data with fixed length of 6 bits reinforced by digits with fixed length of 2 bits, and the character string type of the quality guarantee period is a fixed-length unit character string; the coding format corresponding to the validity period is a digit with a fixed length of 2 digits and a fixed length of 6 digits, and the character string type of the validity period is a fixed-length unit character string; the coding format corresponding to the serial number is a digit with a fixed length of 2 digits and a variable length text character with a maximum length of 20, and the character string type of the serial number is an indefinite-length unit character string.
S202, coding the symbol information according to a preset sequence to obtain a coding result, wherein the coding mode of the character string is a numeric mode or a text mode, and the coding mode of the separator is a numeric mode.
Alternatively, the preset order may be a connection order of the character strings. For example, the preset order may be connected in an order in which all the indefinite-length cell character strings within the symbol information follow the fixed-length cell character string.
Wherein the numeric mode may encode numeric characters in the string and the text mode may encode text characters in the string.
Optionally, the symbol information may be encoded according to the following feasible manner: and determining an encoding mode corresponding to the character string according to the content included in the character string, and encoding the character string according to the encoding mode. The content included in the character string may include, among others, numbers, letters, combinations of numbers and letters, and combinations of numbers and letters and symbols. For example, the character string may be (21)123456789 or (10) ABCD 1234.
Optionally, the encoding mode corresponding to the character string may be determined according to the content included in the character string according to the following feasible implementation manners: characters preceding a text character in the character string are encoded according to a numeric pattern. For example, in the character string (21)123456789, all characters are numeric characters, and the character string is encoded in a numeric pattern. The text characters in the character string and the characters following the text characters are encoded according to a text mode. For example, in the string ABCD1234, where the characters in the string include numeric characters and text characters, the text characters and the characters following the text characters are encoded by a text pattern.
If the number character in the character string is before the text character, the character before the text character is coded according to the number mode, and the text character and the character after the text character are coded according to the text mode. For example, in the string (10) ABCD1234, the characters in the string include numeric characters and text characters, the numeric characters 10 precede the text characters, the numeric characters 1234 follow the text characters, the characters 10 are encoded by a numeric pattern, and the characters ABCD1234 are encoded by text. In the feasible implementation mode, the coding mode corresponding to the character string is determined according to the content included in the character string, and the content in the character string is coded through the number mode and the text mode, so that the coding accuracy can be effectively improved.
In the process of encoding according to the content in the character string, the separator is used for dividing two unit character strings with variable length, and when the separator is identified, the separator is encoded according to a number mode. For example, (10)20181009 and (21)123456789 are two indefinite-length unit character strings, and a separator may be added to the two indefinite-length unit character strings, (10)20181009< FNC1> (21)123456789, where < FNC1> is the separator between the two indefinite-length unit character strings, and < FNC1> is encoded according to a number pattern during encoding.
And coding the symbol information according to a preset sequence according to the determined coding mode to obtain a coding result. For example, the symbol information is 123456, the symbol information is divided into three groups of characters, each group of characters is composed of three numeric characters, the first group of characters is a decimal 123 composed of numeric characters, the second group of characters is a decimal 456 composed of numeric characters, binary data of 123 and 456 are obtained, the binary data are arranged according to the connection sequence of the character groups in the symbol information, and an encoding result of the symbol information is obtained: 00011110110111001000.
in the logistics information encoding method of the hanxin code provided by the embodiment of the application, in the encoding process, symbol information corresponding to information to be encoded, for example, a character string and a separator of the character string, is obtained first, and the symbol information is encoded according to a preset sequence to obtain an encoding result, wherein an encoding mode of the character string is a digital mode or a text mode, and an encoding mode of the separator is a digital mode. Therefore, when encoding is carried out, the separator is encoded according to the number mode, the encoding mode of the character string is determined according to the content of the character string, the separator can be integrated into the encoding process of the character string, the encoding mode does not need to be switched when the separator is encountered during encoding, the encoding efficiency is improved, meanwhile, the separator symbols used for representing data in the character string are not mixed with the separator symbols used for separating the character string, and the encoding accuracy is improved.
In any of the above embodiments, the encoding process for each character string in the symbol information is the same, and the following description will take the encoding process for any character string as an example.
Fig. 3 is a schematic diagram illustrating conversion of a character string into a binary code according to an embodiment of the present disclosure. Referring to fig. 3, the method may include:
s301, encoding characters before the text characters in the character string according to the number mode.
The character preceding the text character in the string may be encoded according to a numeric pattern. For example, in the character string (21)123456789, all characters are numeric characters, and the character string (21)123456789 is encoded in a numeric pattern; in the string (10) ABCD1234, the numeric characters 10 in the string precede the text characters a, and 10 in the string (10) ABCD1234 are encoded by a numeric pattern.
Alternatively, the character preceding the text character in the character string may be encoded according to the numeric pattern according to the following feasible manner: dividing the numbers in the character string into at least one group of characters, wherein the characters in each group of characters are decimal data, and acquiring binary data in each group of characters, and the length of the binary data is ten. For example, the character string is 123456, and the character string is encoded by an array mode, and the character string can be equally divided into two groups of characters according to the sequence of the characters in the character string, wherein each group of characters comprises three numeric characters, and the three numeric characters can form decimal numbers; the string 123456 may be divided into 123 and 456, with the ten-bit binary data corresponding to 123 being obtained as 0001111011, and the ten-bit binary data corresponding to 456 being obtained as 0111001000.
Alternatively, if the bit number of the binary data is insufficient, the bit number of the binary data may be supplemented by 0. For example, if the number of numeric characters in each group of characters in the character string is 3 characters, the number of bits of binary data corresponding to decimal data in each group of characters is 10 bits, and if the number of numeric characters in a group of characters in the character string is 123, the binary data corresponding to the numeric characters is 1111011, and the binary data corresponding to the numeric characters is 0001111011 because of insufficient ten bits.
Optionally, in the process of encoding the character string according to the number mode, when the character string is divided into at least one group of characters, the number of the number characters in the last group of characters is less than or equal to the number of the number characters in other character groups. For example, the character string of the numeric mode encoding is 12345678, the character string of the numeric mode encoding is divided into three groups of characters, wherein each group of characters consists of three numeric characters, and since the character string includes 8 numeric characters, the first group of characters in the character string is 123, the second group of characters is 456, and the third group of characters is 78, if the character string of the numeric mode encoding is 1234567, the character string of the numeric mode encoding is divided into three groups of characters, the first group of characters is 123, the second group of characters is 456, and the third group of characters is 7.
Determining a first encoding result corresponding to the digital pattern encoding includes: binary data corresponding to the decimal data in each group of characters, a first start character and a first termination character, wherein the first start character is located at the start position of the first coding result, and the first termination character is located at the end position of the first coding result. For example, the start position of the first encoding result is provided with a first start character indicating that the first encoding result is an encoding result obtained by encoding according to the digital mode, and a first end character is added to the end position in the first encoding result to indicate that the encoding of the digital mode is finished.
Alternatively, the first terminator may be determined according to the number of characters of the last group of characters in the character string encoded in the numeric mode. For example, the number of characters in the last group of characters in the numeric mode encoded character string may be 1 character, 2 characters, and 3 characters, with different numbers of characters corresponding to different first terminators.
The start position of the coding of the digital pattern requires the addition of a first start character and the end position of the coding of the digital pattern requires the addition of a first end character.
S302, encoding the text characters in the character string and characters behind the text characters according to the text mode.
The text characters in the string and the characters following the text characters may be encoded according to a text mode. For example, in the character string ABCD1234, the character string includes text characters and numeric characters, and the numeric characters are positioned after the text characters, and the character string ABCD1234 is encoded by a text pattern.
Alternatively, the character string may be encoded according to the text mode according to the following feasible manner: and acquiring binary data corresponding to each character in the character string. For example, the character string is ABCD, the character string includes text characters, the character string ABCD is encoded by a text pattern, binary data corresponding to each character in the character string can be obtained according to the sequence of the text characters in the character string, for the character string ABCD encoded by the text pattern, binary data corresponding to the character a, binary data corresponding to the character B, binary data corresponding to the character C, and binary data corresponding to the character D can be respectively obtained, and the binary data are arranged according to the sequence of the characters in the character string.
Optionally, binary data corresponding to the characters in the text mode may be acquired according to a preset mode. For example, the character string coded in the Text mode is ABCD, characters in the character string are coded according to a Text1 sub-mode in the chinese-sensible code, binary data corresponding to a character a is 001010, binary data corresponding to a character B is 001011, binary data corresponding to a character C is 001100, binary data corresponding to a character D is 001101, and the binary data are arranged according to the order of the characters in the character string.
In the process of encoding the character string according to the text mode, the numeric characters in the character string are also encoded according to the text mode. For example, the character string is ABCD1234, the numeric characters in the character string are encoded through a text pattern, binary data corresponding to each numeric character in the character string is obtained, that is, 1, 2, 3, and 4 all need to obtain binary data corresponding to each character according to a preset pattern, and the numeric characters are encoded according to the text pattern, so as to obtain the binary data.
Determining a second encoding result corresponding to the character string encoded in the text mode comprises: binary data corresponding to each character, a second start character and a second end character, wherein the second start character is located at the start position of the second coding result, and the second end character is located at the end position of the second coding result. For example, a second start symbol is set at the start position of the second encoding result to indicate that the second encoding result is an encoding result obtained by encoding according to the text mode, and a second end symbol is added at the end position in the second encoding result to indicate that encoding of the text mode is ended.
The start position of the text mode encoding requires the addition of a second start character and the end position of the text mode encoding requires the addition of a second end character.
S303, when the delimiter is encoded in the digital mode, the digital mode encoding corresponding to the delimiter is 1111101000.
Optionally, when the delimiter is encoded according to the digital mode, if the encoding result before the delimiter is the first encoding result, the delimiter does not need to be added with the digital mode start character before encoding, and if the encoding result before the delimiter is the second encoding result, the delimiter needs to be added with the digital mode start character before encoding, and the delimiter is encoded according to the digital mode.
According to the logistics information encoding method of the Chinese-sensible code, the encoding mode corresponding to the character string is determined according to the content in the character string. The method comprises the steps of coding characters in a character string before text characters according to a number mode, coding the text characters in the character string and characters after the text characters according to the text mode, and coding separators according to the number mode in the coding process. Therefore, when encoding is carried out, the separator can be fused into the encoding process of the digital mode, the encoding mode does not need to be switched when the separator is encountered during encoding, meanwhile, the separator symbols used for representing data in the character string are not mixed with the separator symbols used for separating the character string, and the encoding accuracy is improved.
On the basis of any of the above embodiments, the following describes the encoding process of the character string in detail by using specific examples in conjunction with fig. 4 to 5.
Fig. 4 is a schematic process diagram of encoding a character string according to an embodiment of the present application. In the embodiment shown in fig. 4, the character string includes numeric characters, and the character string is encoded according to a numeric pattern. Please refer to fig. 4, which includes the merchandise information, the symbol information and the encoding result. The commodity information comprises the production date of the commodity, the effective period of the commodity and the global trade item code of the commodity. The commodity information is converted into symbol information according to a logistics information coding method of Chinese-sensible codes in the application, and the symbol information corresponding to the commodity information is obtained and is symbol information consisting of all digital characters: (01)03453120000011(17)191125(11)20190101, wherein (01)03453120000011 indicates that the global trade item code of the commodity is 03453120000011, (17)191125 indicates that the effective period of the commodity is 191125, and (11)20190101 indicates that the production date of the commodity is 20190101.
Grouping the character strings, wherein each group of characters comprises 3 characters to obtain a grouping result of the character strings, and obtaining binary data corresponding to the decimal data in each group of characters in the character strings according to the grouping result of the character strings to obtain the binary data of the character strings. And arranging the binary data according to the arrangement sequence of each group of characters in the character string to obtain the encoding result of the character string. Wherein 0001 is a first start symbol for indicating the encoding mode of the encoding result is a digital mode, and 1111111101 is a first end symbol for indicating the encoding end of the digital mode.
Fig. 5 is a schematic diagram of another process for encoding a character string according to an embodiment of the present application. In the embodiment shown in fig. 5, the character string includes numeric characters and text characters, and the character string is encoded according to a numeric mode and a text mode. Please refer to fig. 5, which includes the merchandise information, the symbol information and the encoding result. The commodity information comprises a batch number of the commodity, a validity period of the commodity and a global trade item code of the commodity. Since the character string indicated by the application identifier in the commodity information is a fixed-length cell character, it is not necessary to add a separator.
According to the logistics information coding method of the Chinese-sensible code, commodity information is converted into symbol information, and due to the fact that the symbol information comprises numeric characters and text characters, the characters in the symbol information are combined to obtain character strings formed by combining the numeric characters and the text characters. And analyzing the combined character strings in a coding mode, coding characters before text characters according to a numerical mode, coding the text characters and characters after the text characters according to the text mode, and dividing the character strings into character strings coded in the numerical mode and character strings coded in the text mode. Grouping the character strings coded by the digital mode, wherein each group of characters comprises 3 digital characters, and acquiring binary data corresponding to decimal data of each group of characters of the character strings coded by the digital mode to obtain the binary data of the character strings coded by the digital mode. And coding each character in the character string coded by the Text mode according to the Text1 sub-mode in the Chinese-sensible code to obtain binary data of the character string coded by the Text mode. And arranging the binary data according to the arrangement sequence of the characters in the character string, and adding a first start character, a first termination character, a second start character and a second termination character to obtain the coding result of the commodity information. Wherein 0001 is the first start character, 1111111110 is the first terminator, 0010 is the second start character, 111111 bit second terminator.
On the basis of any of the above embodiments, the following describes in detail a logistics information encoding method of hanxin codes by a specific example with reference to fig. 6.
Fig. 6 is a schematic process diagram of a logistics information encoding method of han-xin codes according to an embodiment of the present application. Please refer to fig. 6, which includes the merchandise information, the symbol information and the encoding result. The commodity information comprises a batch number of the commodity, a validity period of the commodity, a global trade item code of the commodity and a serial number of the commodity. Since the character string indicated by the application identifier of the lot number of the commodity is an indefinite length unit character and the character string indicated by the application identifier of the serial number of the commodity is an indefinite length unit character, a separator < FNC1> for distinguishing two indefinite length unit characters is required to be added between the lot number of the commodity and the serial number of the commodity in the symbol information.
According to the logistics information coding method of the Chinese-sensible code, commodity information is converted into symbol information, the symbol information comprises two unit characters with indefinite lengths, two character strings with indefinite lengths in the symbol information are grouped to obtain a character string 1 and a character string 2, a separator is added between the character string 1 and the character string 2, and coding mode analysis is carried out on the character string 1 and the character string 2. A numeric mode encoded character string in the character string 1, a text mode encoded character string, and a numeric mode encoded character string in the character string 2 are determined.
Grouping the character strings coded by the digital patterns in the character string 1, wherein each group of characters comprises 3 digital characters, and acquiring binary data corresponding to decimal data of each group of characters of the character strings coded by the digital patterns in the character string 1 to obtain the binary data of the character strings coded by the digital patterns in the character string 1. And coding each character of the character string coded by the Text mode in the character string 1 according to the Text1 sub-mode in the Chinese character-letter code to obtain binary data of the character string coded by the Text mode in the character string 1. Because the separator is the number pattern code, the character strings of the number pattern code in the character string 2 are grouped, and binary data corresponding to decimal data of each group of characters of the character string of the number pattern code in the character string 2 is obtained, so that the binary data of the character string of the number pattern code in the character string 2 is obtained. The numeric pattern of separators encodes the binary data of 1111101000.
The binary data is arranged according to the arrangement order of the character string 1, the delimiter, and the character string 2, and the first start character, the first terminator, the second start character, and the second terminator are added. Since the encoding mode of the character string before the delimiter is a text mode, the first terminator is added after the second terminator, and the delimiter is added in the encoding of the character string by using a number mode to obtain an encoding result. Wherein 0001 is the first start character of the character string 1 and the character string 2, 1111111110 is the first end character of the character string 1, 0010 is the second start character of the character string 1, 111111 is the second end character of the character string 1, 1111101000 is the separator, 1111111101 is the first end character of the character string 2.
Optionally, if the character string encoded in the numeric mode is preceded by the delimiter, the character string encoded in the numeric mode, the delimiter and the character following the delimiter are encoded according to the numeric mode without adding a first terminator, and without adding a first start character before the delimiter, and the first stop character is added before the text character in the character following the delimiter. For example, when the symbol information is 1234< FNC1>123, there is no need to add a first terminator after 1234 encoding, there is no need to add a first start symbol before < FNC1>, it is possible to add < FNC1> directly to the encoding of the number pattern of the character string, and since there is a number character 123 after < FNC1>, there is no need to add a first terminator after < FNC1>, the first terminator is added after the encoding of the character string 123 according to the number pattern is completed.
According to the logistics information coding method of the Chinese-sensible code, the separator is coded according to the number mode in the coding process and is added into the character string of the number mode, therefore, when coding is carried out, the separator does not need to be switched in the coding mode when coding is carried out, meanwhile, the separator symbols used for representing data in the character string are in the text mode, the separator symbols used for separating the character string are mixed, and the coding accuracy is further improved.
Fig. 7 is a schematic structural diagram of a logistics information encoding apparatus of han-xin code according to an embodiment of the present application. The apparatus may be provided in a terminal device. Referring to fig. 7, the logistics information encoding apparatus 10 of hanxin code includes a reading module 11 and an encoding module 12, wherein:
the reading module 11 is configured to obtain symbol information corresponding to information to be encoded, where the symbol information includes at least two character strings and at least one separator, and the separator is used to divide the two character strings;
the encoding module 12 is configured to encode the symbol information according to a preset sequence to obtain an encoding result; the character string is encoded in a numeric mode or a text mode, and the separator is encoded in a numeric mode.
In a possible implementation, the encoding module 12 is specifically configured to:
determining an encoding mode corresponding to the character string according to the content included in the character string, and encoding the character string according to the encoding mode;
upon recognition of the separator, the separator is encoded in a digital pattern.
In a possible implementation, the encoding module 12 is specifically configured to:
encoding characters before text characters in the character string according to the number mode;
and coding the text characters in the character string and the characters behind the text characters according to the text mode.
In a possible implementation, the encoding module 12 is specifically configured to:
dividing the numbers in the character string into at least one group of characters, wherein the characters in each group of characters are decimal data;
acquiring binary data in each group of characters, wherein the length of the binary data is ten;
determining a first encoding result corresponding to the digital pattern encoding comprises: binary data corresponding to the decimal data in each group of characters, a first start character and a first termination character, wherein the first start character is located at the start position of the first coding result, and the first termination character is located at the end position of the first coding result.
In a possible implementation, the encoding module 12 is specifically configured to:
obtaining binary data corresponding to each character in the character string;
determining a second encoding result corresponding to the character string comprises: binary data corresponding to each character, a second start character and a second end character, wherein the second start character is located at the start position of the second coding result, and the second end character is located at the end position of the second coding result.
In a possible implementation, the encoding module 12 is specifically configured to:
the separator corresponds to a digital pattern encoded as 1111101000.
The logistics information encoding device of the hanxin code provided by the embodiment of the invention can execute the technical scheme shown in the method embodiment, the implementation principle and the beneficial effect are similar, and the description is omitted here.
Fig. 8 is a schematic hardware structure diagram of a logistics information encoding device of a han-xin code according to an embodiment of the present application. Referring to fig. 8, the logistics information encoding apparatus 20 of hanxin code may include: a processor 21 and a memory 22, wherein the processor 21 and the memory 22 may communicate; illustratively, the processor 21 and the memory 22 communicate via a communication bus 23, the memory 22 is configured to store program instructions, and the processor 21 is configured to call the program instructions in the memory to execute the logistics information encoding method of hanxin code shown in any of the above-mentioned method embodiments.
Optionally, the logistics information encoding apparatus 20 of hanxin code may further include a communication interface, and the communication interface may include a transmitter and/or a receiver.
Alternatively, the processor may be a central processing unit, or may be other general-purpose processors, digital signal processors, application specific integrated circuits, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor, or in a combination of the hardware and software modules in the processor.
A readable storage medium having a computer program stored thereon; the computer program is used for implementing the logistics information encoding method of the hanxin code according to any of the embodiments.
The embodiment of the application provides a computer program product, which comprises instructions, and when the instructions are executed, the instructions enable a computer to execute the logistics information encoding method of the Chinese-sensible code.
All or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The aforementioned program may be stored in a readable memory. Which when executed performs steps comprising the method embodiments described above.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processing unit of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the embodiments of the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to encompass such modifications and variations.
In the present application, the terms "include" and variations thereof may refer to non-limiting inclusions; the term "or" and variations thereof may mean "and/or". The terms "first," "second," and the like in this application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. In the present application, "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
Claims (10)
1. A logistics information coding method of Chinese sensible code is applied to a GS1 system, and is characterized by comprising the following steps:
obtaining symbol information corresponding to information to be coded, wherein the symbol information comprises at least two character strings and at least one separator, and the separator is used for dividing the two character strings;
coding the symbol information according to a preset sequence to obtain a coding result; the character string is encoded in a numeric mode or a text mode, and the separator is encoded in a numeric mode.
2. The method of claim 1, wherein encoding the symbol information according to a predetermined sequence to obtain an encoding result comprises:
determining an encoding mode corresponding to the character string according to the content included in the character string, and encoding the character string according to the encoding mode;
upon recognition of the separator, the separator is encoded in a digital pattern.
3. The method according to claim 2, wherein determining the encoding mode corresponding to the character string according to the content included in the character string comprises:
encoding characters before text characters in the character string according to the number mode;
and coding the text characters in the character string and the characters behind the text characters according to the text mode.
4. The method of claim 3, wherein encoding characters preceding a text character in the string of characters according to the numerical pattern comprises:
dividing the numbers in the character string into at least one group of characters, wherein the characters in each group of characters are decimal data;
acquiring binary data in each group of characters, wherein the length of the binary data is ten;
determining a first encoding result corresponding to the digital pattern encoding comprises: binary data corresponding to the decimal data in each group of characters, a first start character and a first termination character, wherein the first start character is located at the start position of the first coding result, and the first termination character is located at the end position of the first coding result.
5. The method of claim 3, wherein encoding a text character in the string of characters and characters subsequent to the text character according to the text mode comprises:
obtaining binary data corresponding to each character in the character string;
determining a second encoding result corresponding to the character string comprises: binary data corresponding to each character, a second start character and a second end character, wherein the second start character is located at the start position of the second coding result, and the second end character is located at the end position of the second coding result.
6. The method according to any of claims 1-5, wherein the encoding mode of the separator is a digital mode comprising:
the separator corresponds to a digital pattern encoded as 1111101000.
7. A logistics information coding device of Chinese sensible code is applied to a GS1 system, and is characterized by comprising a reading module and a coding module, wherein:
the reading module is used for acquiring symbol information corresponding to information to be coded, wherein the symbol information comprises at least two character strings and at least one separator, and the separator is used for dividing the two character strings;
the coding module is used for coding the symbol information according to a preset sequence to obtain a coding result; the character string is encoded in a numeric mode or a text mode, and the separator is encoded in a numeric mode.
8. The apparatus of claim 7, wherein the encoding module is specifically configured to:
determining an encoding mode corresponding to the character string according to the content included in the character string, and encoding the character string according to the encoding mode;
upon recognition of the separator, the separator is encoded in a digital pattern.
9. A logistics information coding device of Chinese-sensible code is characterized by comprising: a memory for storing program instructions, a processor for calling the program instructions in the memory to execute the method for encoding logistics information of hanxin codes according to any one of claims 1-6, and a communication interface.
10. A readable storage medium, characterized in that the readable storage medium has stored thereon a computer program; the computer program is used for implementing a method for encoding logistics information of hanxin codes according to any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010936615.0A CN112016270B (en) | 2020-09-08 | 2020-09-08 | Logistics information coding method, device and equipment of Chinese-character codes |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010936615.0A CN112016270B (en) | 2020-09-08 | 2020-09-08 | Logistics information coding method, device and equipment of Chinese-character codes |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112016270A true CN112016270A (en) | 2020-12-01 |
CN112016270B CN112016270B (en) | 2024-04-02 |
Family
ID=73521241
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010936615.0A Active CN112016270B (en) | 2020-09-08 | 2020-09-08 | Logistics information coding method, device and equipment of Chinese-character codes |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112016270B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113627578A (en) * | 2021-08-09 | 2021-11-09 | 中国物品编码中心 | Two-dimensional code generation method, two-dimensional code recognition device, two-dimensional code, equipment and medium |
CN114638218A (en) * | 2022-03-23 | 2022-06-17 | 北京字跳网络技术有限公司 | Symbol processing method, device, electronic equipment and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101364142A (en) * | 2007-08-08 | 2009-02-11 | 孙强国 | Method for inputting Chinese characters by numeric keyboard of mobile phone |
CN102156825A (en) * | 2011-03-28 | 2011-08-17 | 重庆大学 | Cancer vaccine trial data encoding and processing method based on data mining |
CN102592160A (en) * | 2012-01-17 | 2012-07-18 | 浙江工商大学 | Character two-dimension code encoding and decoding method for short message |
CN102650989A (en) * | 2011-02-23 | 2012-08-29 | 上海博路信息技术有限公司 | Content parsing system based on digital object identification |
CN105450232A (en) * | 2014-08-28 | 2016-03-30 | 华为技术有限公司 | Encoding method, decoding method, encoding device and decoding device |
CN110932822A (en) * | 2019-12-02 | 2020-03-27 | 泰康保险集团股份有限公司 | Data encoding method, data decoding method, device, equipment and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111311229A (en) * | 2018-12-11 | 2020-06-19 | 北京意锐新创科技有限公司 | Chinese-sensible code based passive code scanning method and device |
-
2020
- 2020-09-08 CN CN202010936615.0A patent/CN112016270B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101364142A (en) * | 2007-08-08 | 2009-02-11 | 孙强国 | Method for inputting Chinese characters by numeric keyboard of mobile phone |
CN102650989A (en) * | 2011-02-23 | 2012-08-29 | 上海博路信息技术有限公司 | Content parsing system based on digital object identification |
CN102156825A (en) * | 2011-03-28 | 2011-08-17 | 重庆大学 | Cancer vaccine trial data encoding and processing method based on data mining |
CN102592160A (en) * | 2012-01-17 | 2012-07-18 | 浙江工商大学 | Character two-dimension code encoding and decoding method for short message |
CN105450232A (en) * | 2014-08-28 | 2016-03-30 | 华为技术有限公司 | Encoding method, decoding method, encoding device and decoding device |
CN110932822A (en) * | 2019-12-02 | 2020-03-27 | 泰康保险集团股份有限公司 | Data encoding method, data decoding method, device, equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
魏维娜: "汉信码在商品条码质量检测中的应用研究", 《中国优秀硕士学位论文全文数据库》, pages 138 - 1837 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113627578A (en) * | 2021-08-09 | 2021-11-09 | 中国物品编码中心 | Two-dimensional code generation method, two-dimensional code recognition device, two-dimensional code, equipment and medium |
CN113627578B (en) * | 2021-08-09 | 2024-02-09 | 中国物品编码中心 | Two-dimensional code generation method, identification device, two-dimensional code, device and medium |
CN114638218A (en) * | 2022-03-23 | 2022-06-17 | 北京字跳网络技术有限公司 | Symbol processing method, device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112016270B (en) | 2024-04-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112711935A (en) | Encoding method, decoding method, apparatus and computer readable storage medium | |
CN103400174B (en) | The coded method of a kind of Quick Response Code, coding/decoding method and system | |
CN100495318C (en) | Compression and uncompression method of integer data and device thereof | |
US6196466B1 (en) | Data compression method using multiple base number systems | |
CN104579360B (en) | A kind of method and apparatus of data processing | |
CN112016270B (en) | Logistics information coding method, device and equipment of Chinese-character codes | |
CN115529357B (en) | Updating abnormity matching method based on MES intercommunication interconnection production data | |
CN116506073A (en) | Industrial computer platform data rapid transmission method and system | |
CN112152634B (en) | Block compression encoding method, device, computer equipment and readable storage medium | |
CN103368582A (en) | Data coding and decoding method and device | |
CN101655944A (en) | Method and system for coding service receipt | |
CN112200286B (en) | Character string coding method and device | |
CN110545106A (en) | Method and device for coding time series data | |
CN112733568A (en) | One-dimensional bar code identification method, device, equipment and storage medium | |
EP0026267B1 (en) | Method and apparatus for compressing and decompressing strings of electrical binary data bits | |
EP2442256B1 (en) | Method of encoding and decoding text on a matrix code symbol | |
CN111708574A (en) | Instruction stream compression and decompression method and device | |
CN114064308A (en) | Multi-data sending and receiving method, device and equipment based on column type data scanning | |
CN114500670B (en) | Encoding compression method, decoding method and device | |
CN111950233B (en) | Code scanning identification method and device, electronic equipment and readable storage medium | |
CN109213973A (en) | VIN code transcoding storage method and device and corresponding read method and device | |
CN110348554B (en) | Digital information encoding and decoding method and device, electronic equipment and storage medium | |
CN114070901A (en) | Data sending and receiving method, device and equipment based on multi-data alignment | |
CN113779932A (en) | Digital formatting method, device, terminal equipment and storage medium | |
CN115510811A (en) | Character string encoding and decoding methods, encoding device and decoding 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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |