Pipe coding method and system
By registering production equipment locally and generating encrypted barcodes, the problem of large network dependence and high storage demand in the prior art is solved, and the efficiency and security of pipe production are improved.
Patent Information
- Application Number
- CN202310236639.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-10
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2043-03-10
AI Technical Summary
The existing technology has large reliance on the network, relatively large barcode data stored every day, and high storage requirements, especially in the production process of pipe materials.
By registering production equipment locally, downloading production work order information, and setting the coding time interval, calling the coding system to obtain the unique key after receiving the coding instruction, cache and obtaining the real-time time stamp regularly, forming a digital code for encryption, and generating the encrypted barcode for inkjet.
Reduces dependence on the network, reduces storage requirements, improves production efficiency, and improves the security of barcodes through composite encryption.
Smart Images

Figure CN116484893B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pipes, and more specifically, to a pipe coding method and system. Background Art
[0002] Pipeline coding refers to the coding operation of the produced pipes. The coding is marked on the outside of the packaging in the form of a barcode, which can be read by scanning or by the naked eye. The barcode information can be used by consumers to identify the authenticity and check the quality. At present, manufacturers mainly use the following methods to perform coding operations:
[0003] When the pipe needs to be coded, the network request is made to call the coding system to generate the corresponding barcode, which is stored in the database and then returned to the coding device. This method is highly dependent on the network. When the network is abnormal, it will affect production. In addition, the output of pipes is large, and the barcode data stored every day is relatively large, which has high storage requirements. Summary of the invention
[0004] The purpose of the invention is to solve the technical defects of the methods provided by the prior art, such as high dependence on the network, large amount of barcode data stored every day and high storage requirements, and to provide a pipe coding method.
[0005] In order to achieve the above invention purpose, the technical solution adopted is:
[0006] The pipe coding method comprises the following steps:
[0007] S1. Register the production equipment and download the production work order information according to the production equipment number;
[0008] S2. Set the coding time interval;
[0009] S3. After receiving the coding instruction, call the coding system to obtain the unique key and cache it locally; obtain the real-time timestamp regularly according to the set coding time interval;
[0010] S4. The obtained production work order information, real-time timestamp, and unique key form a digital code, encrypt the digital code to obtain an encrypted barcode, and send the obtained barcode to the inkjet printer for production inkjet printing.
[0011] Preferably, in step S4, encrypting the digital code specifically includes:
[0012] Data reverse shift operation;
[0013] Reverse operation of digit addition;
[0014] Data forward shift operation;
[0015] Data segmentation reverse operation.
[0016] Preferably, the data reverse shift operation specifically includes:
[0017] Reverse the digital code from the highest digit to get its ASCII code, subtract 48 and compare it with the previous digit. If it is less than 0, get the first new code through (ASCII code of current digit of barcode - ASCII code of previous digit of barcode + 10 + 48) + current barcode; if it is greater than 0, get the first new code through (ASCII code of current digit of barcode - ASCII code of previous digit of barcode + 48) + current barcode; then add the first ASCII code of the original digital code to the first new code to get the digital code after the reverse shift operation of the data.
[0018] Preferably, the inverse operation of digital addition specifically includes:
[0019] Loop the digital code in reverse order starting from the highest digit, subtract the ASCII code of the current value of each digit from the ASCII code of the previous digit, if it is less than 0, add 10 to get the second new code; then add the first ASCII code of the original digital code to the second new code to get the digital code after the reverse operation of digit addition.
[0020] Preferably, the data forward shift operation specifically includes:
[0021] Loop the digital code forward from the lowest bit to each bit, and then perform the following operations:
[0022] Key offset bit = ASCII code of the current cycle number of the digital code - 48;
[0023] Key bit value = key gets the corresponding value according to the key offset bit and then converts it into ascii code;
[0024] Digital code A = key bit value + ASCII code of the current cycle number of the digital code – 48;
[0025] When digital code A is greater than 9: digital code B = digital code A-10, otherwise: digital code B = digital code A;
[0026] The latest digital code = ascii (digital code B + (digital code B + 48).
[0027] Preferably, the data segmentation inverse operation specifically includes:
[0028] Reverse the digital code for each bit and then perform the following operations:
[0029] Left segment data = left segment data + ascii (2*(number of cycles + 1) - 2), when the number of cycles is the first time; the left segment data is empty;
[0030] Right segment data = right segment data + ascii (2*(number of loops + 1) - 1), when the number of loops is the first time, the right segment data is empty;
[0031] The left segment data is executed cyclically: if the ascii code of the key array (number of cycles) is less than the left segment data (number of cycles), digital code A1 = digital code A1 + ascii (key array (number of cycles)) + 10; new left segment data = left segment data + digital code A1 - ascii (right segment data (number of cycles)) + 48;
[0032] The right segment data is executed cyclically: if the ascii code of the key array (number of cycles) is less than the left segment data (11-number of cycles), digital code A2 = digital code A2 + ascii (key array (number of cycles)) + 10; new right segment data = right segment data + digital code A2-ascii (left segment data*ascii(11-i)) + 48;
[0033] The latest digital code = new left segment data + new right segment data.
[0034] Preferably, the production work order information includes work orders, materials, and production quantities.
[0035] Preferably, the real-time timestamp is a millisecond level timestamp.
[0036] Preferably, the encrypted barcode is a 16-digit digital code.
[0037] At the same time, the present invention also provides a pipe coding system, the specific scheme is as follows:
[0038] A pipe coding system, comprising a work order information acquisition module, a coding time interval setting module, a secret key acquisition module and a coding module;
[0039] The work order information acquisition module is used to register production equipment and download production work order information according to the production equipment number;
[0040] The coding time interval setting module is used to set the coding time interval;
[0041] The key acquisition module is used to call the coding system to obtain the unique key after receiving the coding instruction and cache it locally; it obtains the real-time timestamp regularly according to the set coding time interval;
[0042] The coding module is used to obtain the production work order information, real-time timestamp, and unique key to form a digital code, encrypt the digital code, obtain the encrypted barcode, and send the obtained barcode to the inkjet printer for production coding.
[0043] Compared with the prior art, the present invention has the following beneficial effects:
[0044] 1) The algorithm flow of the pipe coding method provided by the present invention is mainly performed locally, and there is no need to establish continuous communication with the coding system, thereby reducing dependence on the network.
[0045] 2) The pipe coding method provided by the present invention performs composite encryption through data reverse shift operation, digit addition reverse operation, data forward shift operation, and data segmentation reverse operation, which has high security and is not easy to be cracked.
[0046] 3) The timestamp used in the pipe coding method provided by the present invention is a millisecond-level timestamp, which can effectively reduce duplicate data. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0048] Figure 1 Schematic diagram of the process for coding pipes.
[0049] Figure 2 This is an example diagram of a data forward shift operation.
[0050] Figure 3 An example diagram of the piecewise inverse operation of data.
[0051] Figure 4 Schematic diagram of the structure of the pipe coding system. DETAILED DESCRIPTION
[0052] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] Example 1
[0054] like Figure 1 As shown, the pipe coding method provided by the present invention comprises the following steps:
[0055] S1. Register the production equipment and download the production work order information according to the production equipment number;
[0056] S2. Set the coding time interval;
[0057] S3. After receiving the coding instruction, call the coding system to obtain the unique key and cache it locally; obtain the real-time timestamp regularly according to the set coding time interval;
[0058] S4. The obtained production work order information, real-time timestamp, and unique key form a digital code, encrypt the digital code to obtain an encrypted barcode, and send the obtained barcode to the inkjet printer for production inkjet printing.
[0059] In a specific implementation process, in step S4, encrypting the digital code specifically includes:
[0060] Data reverse shift operation;
[0061] Reverse operation of digit addition;
[0062] Data forward shift operation;
[0063] Data segmentation reverse operation.
[0064] In the specific implementation process, the data reverse shift operation specifically includes:
[0065] Reverse the digital code from the highest digit to get its ASCII code, subtract 48 and compare it with the previous digit. If it is less than 0, get the first new code through (ASCII code of current digit of barcode - ASCII code of previous digit of barcode + 10 + 48) + current barcode; if it is greater than 0, get the first new code through (ASCII code of current digit of barcode - ASCII code of previous digit of barcode + 48) + current barcode; then add the first ASCII code of the original digital code to the first new code to get the digital code after the reverse shift operation of the data.
[0066] In a specific implementation process, the reverse operation of digital addition specifically includes:
[0067] Loop the digital code in reverse order starting from the highest digit, subtract the ASCII code of the current value of each digit from the ASCII code of the previous digit, if it is less than 0, add 10 to get the second new code; then add the first ASCII code of the original digital code to the second new code to get the digital code after the reverse operation of digit addition.
[0068] In the specific implementation process, the data is shifted forward, such as Figure 2 As shown, specifically including:
[0069] Loop the digital code forward from the lowest bit to each bit, and then perform the following operations:
[0070] Key offset bit = ASCII code of the current cycle number of the digital code - 48;
[0071] Key bit value = key gets the corresponding value according to the key offset bit and then converts it into ascii code;
[0072] Digital code A = key bit value + ASCII code of the current cycle number of the digital code – 48;
[0073] When digital code A is greater than 9: digital code B = digital code A-10, otherwise: digital code B = digital code A;
[0074] The latest digital code = ascii (digital code B + (digital code B + 48).
[0075] In the specific implementation process, Figure 3 As shown, the data is segmented and reversely operated, specifically including:
[0076] Reverse the digital code for each bit and then perform the following operations:
[0077] Left segment data = left segment data + ascii (2*(number of cycles + 1) - 2), when the number of cycles is the first time; the left segment data is empty;
[0078] Right segment data = right segment data + ascii (2*(number of loops + 1) - 1), when the number of loops is the first time, the right segment data is empty;
[0079] The left segment data is executed cyclically: if the ascii code of the key array (number of cycles) is less than the left segment data (number of cycles), digital code A1 = digital code A1 + ascii (key array (number of cycles)) + 10; new left segment data = left segment data + digital code A1 - ascii (right segment data (number of cycles)) + 48;
[0080] The right segment data is executed cyclically: if the ascii code of the key array (number of cycles) is less than the left segment data (11-number of cycles), digital code A2 = digital code A2 + ascii (key array (number of cycles)) + 10; new right segment data = right segment data + digital code A2-ascii (left segment data*ascii(11-i)) + 48;
[0081] The latest digital code = new left segment data + new right segment data.
[0082] In a specific implementation process, the production work order information includes work orders, materials, and production numbers.
[0083] In a specific implementation process, the real-time timestamp is a millisecond-level timestamp.
[0084] In a specific implementation process, the encrypted barcode is a 16-bit digital code.
[0085] Example 2
[0086] This embodiment provides a pipe coding system, such as Figure 4 As shown, the specific plan is as follows:
[0087] A pipe coding system, comprising a work order information acquisition module, a coding time interval setting module, a secret key acquisition module and a coding module;
[0088] The work order information acquisition module is used to register production equipment and download production work order information according to the production equipment number;
[0089] The coding time interval setting module is used to set the coding time interval;
[0090] The key acquisition module is used to call the coding system to obtain the unique key after receiving the coding instruction and cache it locally; it obtains the real-time timestamp regularly according to the set coding time interval;
[0091] The coding module is used to obtain the production work order information, real-time timestamp, and unique key to form a digital code, encrypt the digital code, obtain the encrypted barcode, and send the obtained barcode to the inkjet printer for production coding.
[0092] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0093] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0094] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0095] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or partly contributed to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0096] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for coding a pipe, characterized in that: The following steps are involved: S1. Register the production equipment and download the production work order information according to the production equipment number; S2. Set the coding time interval; S3. After receiving the coding instruction, call the coding system to obtain the unique key and cache it locally; obtain the real-time timestamp regularly according to the set coding time interval; S4. The obtained production work order information, real-time timestamp, and unique key form a digital code, encrypt the digital code to obtain an encrypted barcode, and send the obtained barcode to the inkjet printer for production coding; In the step S4, the digital code is encrypted, specifically including: data reverse shift operation; Reverse operation of digit addition; Data forward shift operation; Data segmentation reverse operation; The data reverse shift operation specifically includes: reversely looping the digital code from the highest digit to obtain its ASCII code, subtracting 48 and then comparing it with its previous digit. If it is less than 0, the first new code is obtained by (the ASCII code of the current digit of the barcode - the ASCII code of the previous digit of the barcode + 10 + 48) + the current barcode; if it is greater than 0, the first new code is obtained by (the ASCII code of the current digit of the barcode - the ASCII code of the previous digit of the barcode + 48) + the current barcode; then the first ASCII code of the original digital code is added to the first new code to obtain the digital code after the data reverse shift operation.
2. The pipe coding method according to claim 1, characterized in that: The reverse operation of digit addition specifically includes: looping the digital code in reverse order starting from the highest digit, subtracting the ASCII code of the current value of each digit from the ASCII code of the previous digit, and if the value is less than 0, adding 10 to obtain the second new code; then adding the first ASCII code of the original digital code to the second new code to obtain the digital code after the reverse operation of digit addition.
3. The pipe coding method according to claim 2, characterized in that: The data forward shift operation specifically includes: starting from the lowest bit of the digital code, the digital code is forwardly cycled by each bit, and then the following operations are performed respectively: the key offset bit = the ascii code of the current cycle number of the digital code - 48; Key bit value = key gets the corresponding value according to the key offset bit and then converts it into ascii code; Digital code A = key bit value + ASCII code of current cycle number of digital code - 48; When digital code A is greater than 9: digital code B = digital code A-10, otherwise: digital code B = digital code A; The latest digital code = ascii (digital code B + (digital code B + 48)).
4. The pipe coding method according to claim 3, characterized in that: The data segmented reverse operation specifically includes: reversely looping each bit of the digital code, and then performing the following operations respectively: left segment data = left segment data + ascii (2*(number of loops + 1) - 2), when the number of loops is the first time, the left segment data is empty; Right segment data = right segment data + ascii (2*(number of loops + 1) - 1), when the number of loops is the first time, the right segment data is empty; The left segment data is executed cyclically: if the ascii code of the key array (number of cycles) is less than the left segment data (number of cycles), digital code A1 = digital code A1 + ascii (key array (number of cycles)) + 10; new left segment data = left segment data + digital code A1 - ascii (right segment data (number of cycles)) + 48; The right segment data is executed cyclically: if the ascii code of the key array (number of cycles) is less than the left segment data (11-number of cycles), digital code A2 = digital code A2 + ascii (key array (number of cycles)) + 10; new right segment data = right segment data + digital code A2-ascii (left segment data*ascii(11-i)) + 48; The latest digital code = new left segment data + new right segment data.
5. The pipe coding method according to any one of claims 1 to 4, characterized in that: The production work order information includes work orders, materials, and production quantities.
6. The method for coding pipes according to claim 5, characterized in that: The real-time timestamp is a millisecond-level timestamp.
7. The method for coding pipes according to claim 5, characterized in that: The encrypted barcode is a 16-bit digital code.
8. A pipe coding system, characterized by: It includes a work order information acquisition module, a coding time interval setting module, a secret key acquisition module and a coding module; The work order information acquisition module is used to register production equipment and download production work order information according to the production equipment number; The coding time interval setting module is used to set the coding time interval; The key acquisition module is used to call the coding system to obtain the unique key after receiving the coding instruction and cache it locally; it obtains the real-time timestamp regularly according to the set coding time interval; The coding module is used to obtain the production work order information, real-time timestamp, and unique key to form a digital code, encrypt the digital code, obtain the encrypted barcode, and send the obtained barcode to the inkjet printer for production coding; The coding module encrypts the digital code, specifically including: Data reverse shift operation; Reverse operation of digit addition; Data forward shift operation; Data segmentation reverse operation; The data reverse shift operation specifically includes: reversely looping the digital code from the highest digit to obtain its ASCII code, subtracting 48 and then comparing it with its previous digit. If it is less than 0, the first new code is obtained by (the ASCII code of the current digit of the barcode - the ASCII code of the previous digit of the barcode + 10 + 48) + the current barcode; if it is greater than 0, the first new code is obtained by (the ASCII code of the current digit of the barcode - the ASCII code of the previous digit of the barcode + 48) + the current barcode; then the first ASCII code of the original digital code is added to the first new code to obtain the digital code after the data reverse shift operation.
Citation Information
Patent Citations
CAES traditional Chinese medicine traceability code encryption and decryption algorithm scheme
CN115150066A
Access control management apparatus and method for open service components
US20150286815A1