SQLite database-based laser marking system data storage and query method
By introducing SQLite database into the laser marking system, creating data tables and indexes, and using SQL statements for data management, the problem of low data management efficiency and security is solved, and efficient data classification management and multi-marking machine re-code is realized Testing improves production efficiency.
Patent Information
- Application Number
- CN202411274956.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-12-31
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing laser marking system data management methods have problems such as low data access efficiency, inconvenient management classification and maintenance, and low data security.
Data storage and query methods based on SQLite database are adopted, and data is written and queryed by creating data tables, creating indexes, using SQL statements, and adding TCP server to the SQLite database to perform data synchronization and recode detection of multi-marker machines.
It improves the classification management and access efficiency of the laser marking system data, facilitates data management and maintenance, enhances data security, solves the problem of barcode re-code by multiple marking machines, and improves production efficiency.
Smart Images

Figure CN119226407A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of laser marking system data processing, in particular to a laser marking system data storage and query method based on an SQLite database. Background Art
[0002] In the existing new energy lithium battery cell segment - top cover laser engraving, module laser engraving, and tape engraving, the above processes need to give the product an identity ID to realize the binding of production process information of each production and manufacturing link of the product, and to realize the control of quality issues throughout the product life cycle. In the past, the data management of the coding processing usually adopted a text-defined data structure, and the barcode and other information in the laser marking process were saved in the text, and searched line by line when querying. This existing information management method has many defects: low data access efficiency, inconvenient data management classification and maintenance, and low data security. Summary of the invention
[0003] The purpose of the present invention is to provide a laser marking system data storage and query method based on SQLite database, which can improve the data classification management and access efficiency of the laser marking system, facilitate data management and maintenance, and improve data security.
[0004] The present invention adopts the following technical solutions to achieve the above purpose:
[0005] The data storage and query method of the laser marking system based on the SQLite database is as follows:
[0006] Step 1: Introduce the SQLite database into the laser marking system and create a data table;
[0007] Use the CREATE TABLE statement to create a data table, and then use the CREATE INDEX statement to create an index for the production data information;
[0008] Step 2: Write the production data information into the SQLite database;
[0009] Use the INSERT INTO statement to add data rows to write production data information into the data table. The production data information includes production date and time, production barcode information, operation user name, production speed, power, position, gas flow, and production time.
[0010] Step 3: Obtain production data information through SQLite query;
[0011] Use the SELECT statement to obtain data and the WHERE clause to query the production data information of the specified production barcode information based on the production barcode information.
[0012] Preferably, between step 1 and step 2, a duplicate code detection of the production data information is also included, and the detection method is as follows: before any marking machine writes the production data information into the SQLite database, a query is performed based on the production barcode information. If the production barcode information already exists in the current data table, it indicates that there is a duplicate code, otherwise it indicates that there is no duplicate code.
[0013] Preferably, a TCP server listening to port 3002 is added to the SQLite database to form a SQLite service platform; each marking machine software configuration specifies the IP address and port number of the SQLite service platform, and actively initiates a TCP connection to the SQLite service platform.
[0014] Preferably, each marking machine sends a storage instruction via TCP to send the production data information to the SQLite service platform, and the SQLite service platform writes the production data information into the SQLite database; sends a query instruction via TCP to send the production barcode information to the SQLite service platform for query and thus perform duplicate code detection; the SQLite service platform distinguishes between storage and query instructions according to the instruction content, processes and returns the corresponding response result to the marking machine; the marking machine receives the returned response, and makes a judgment on the response content and performs corresponding processing.
[0015] Preferably, the sent instruction content is encapsulated using a private protocol, and the instruction content uses JSON structured text for data exchange.
[0016] Beneficial effects of the present invention:
[0017] The present invention can improve the data classification management and access efficiency of the laser marking system, facilitate data management and maintenance, and improve data security. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flow chart of the method of the present invention.
[0019] Figure 2 It is a schematic diagram of the process in a specific embodiment (I).
[0020] Figure 3 It is a schematic diagram of the process in a specific embodiment (II).
[0021] Figure 4 It is a schematic diagram of the process in a specific embodiment (III).
[0022] Figure 5 4 is a flow chart of a specific embodiment.
[0023] Figure 6 It is a schematic diagram of the process in a specific embodiment (V). DETAILED DESCRIPTION
[0024] The present invention will be further described below in conjunction with the accompanying drawings.
[0025] like Figure 1 As shown, a data storage and query method of a laser marking system based on an SQLite database is as follows: Step 1, introducing an SQLite database into the laser marking system and creating a data table;
[0026] Use the CREATE TABLE statement to create a data table, and then use the CREATE INDEX statement to create an index for the production data information;
[0027] Step 2: Write the production data information into the SQLite database;
[0028] Use the INSERT INTO statement to add data rows to write production data information into the data table. The production data information includes production date and time, production barcode information, operation user name, production speed, power, position, gas flow, and production time.
[0029] Step 3: Obtain production data information through SQLite query;
[0030] Use the SELECT statement to obtain data and the WHERE clause to query the production data information of the specified production barcode information based on the production barcode information.
[0031] Between step 1 and step 2, there is also a duplicate code detection for the production data information, and the detection method is as follows: before any marking machine writes the production data information into the SQLite database, a query is performed based on the production barcode information. If the production barcode information already exists in the current data table, it indicates that there is a duplicate code, otherwise it indicates that there is no duplicate code.
[0032] A TCP server listening to port 3002 is added to the SQLite database to form a SQLite service platform; each marking machine software is configured to specify the IP address and port number of the SQLite service platform, and actively initiates a TCP connection to the SQLite service platform.
[0033] Each marking machine sends storage instructions through TCP to send production data information to the SQLite service platform, and the SQLite service platform writes the production data information into the SQLite database; it sends query instructions through TCP to send production barcode information to the SQLite service platform for query and duplicate code detection; the SQLite service platform distinguishes storage and query instructions according to the instruction content, processes and returns the corresponding response results to the marking machine; the marking machine receives the returned response, determines the response content and performs corresponding processing.
[0034] The command content sent is encapsulated using a private protocol, and the command content uses JSON structured text for data exchange.
[0035] The present invention will be further described below in conjunction with a specific embodiment:
[0036] Laser marking system data storage and query method based on SQLite database,
[0037] like Figure 2 As shown, it is described that S111 introduces the SQLite database to replace the traditional text method of storing data, and it is described that S112 writes the processed data into the SQLite database.
[0038] like Figure 3 As shown, S211 describes the present invention introducing the SQLite query method in the laser marking process, and S212 describes the SQLite query tool to obtain laser marking information.
[0039] like Figure 4 As shown, the application of the present invention is described in the detection of duplicate codes in laser marking processing.
[0040] S1201, receiving barcode information sent by other platforms, or barcode information manually generated locally.
[0041] S1202, through the SQL query method, determine whether the current barcode information is a duplicate code. If "no", go to step S1207, if "yes", go to step S1203.
[0042] In step S1202, a benchmark test is used to compare the traditional text with the introduced SQLite database. The query efficiency of the SQLite database is better than that of the traditional text.
[0043] Table 1 is a table comparison of the time consumption for querying data with 100,000 and 1 million records.
[0044] Test environment:
[0045] BenchmarkDotNet v0.13.12Windows 10(10.0.19045.4529 / 22H2 / 2022Update)
[0046] 11th Gen Intel Core i5-11300H 3.10GHz,1CPU, 8logical and 4physicalcores.NET SDK 8.0.300
[0047] Table 1
[0048]
[0049] S1203 and S1204 prompt duplicate code information, and the user decides whether to continue printing. If "No", the process ends; if "Yes", the process proceeds to step S1205.
[0050] S1205, an input window is displayed, and after the user enters the administrator password, the process proceeds to step S1206.
[0051] S1206, check the administrator password, if "No" then end, if "Yes" then go to step S1207.
[0052] S1207, control the marking machine to print the barcode.
[0053] S1208, store the current production information into the SQLite data through the storage interface, and end the process.
[0054] like Figure 5 As shown, the application of the present invention in detecting duplicate codes by a multi-marking machine is described.
[0055] S1301, build a storage and query service platform based on SQLite,
[0056] S1302, each marking machine is configured with a specified SQLite service platform IP address and port, and actively initiates a TCP connection to the SQLite service platform.
[0057] S1303, each marking machine sends a storage instruction via TCP to send the production data to the SQLite service platform for storage.
[0058] S1303, each marking machine sends a query command through TCP to send the "production barcode information" to the SQLite service platform for duplicate code detection.
[0059] S1301, the SQLite service platform distinguishes storage and query instructions according to the instruction content, processes and returns the corresponding response results to the marking machine.
[0060] S1303, wherein the sent instruction content is encapsulated using a private protocol, and the instruction content is organized using JSON structured text.
[0061] Storage instructions:
[0062] {"id":xxx,"cmd":"save",
[0063] "params":{"user":"xxx","barcode":"xxxxx","datetime":"xxxx",...}}
[0064] Storage command response:
[0065] Success: {"id":xxx,"cmd":"save_ack","status":"success"}
[0066] Failure: {"id":xxx,"cmd":"save_ack","status":"fail","reason":"xxxxx","errcode":xx}
[0067] Query command: {"id":xxxx,"cmd":"query","params":{"barcode":"xxxxxx"}}
[0068] Query command response:
[0069] Success: {"id":xxxx,"cmd":"query_ack","status":"success"}
[0070] Failure: {"id":xxxx,"cmd":"query_ack","status":"fail","reason":"xxxxx","errcode":xx}
[0071] S1302, the marking machine receives the returned response, determines the content of the failed response and performs corresponding processing.
[0072] The problem of duplicate barcodes in multiple marking machines is solved, which causes the products to be unable to enter and exit the station normally in the subsequent process, and the products are reworked in batches, affecting production. The invention uses efficient duplicate code detection (26us), and has very low impact on production efficiency.
[0073] like Figure 6 As shown, the application of the present invention to obtain laser marking information through the SQLite query tool is described.
[0074] S2201, using the "production barcode information" input by the user as the query condition of the WHERE statement.
[0075] S2202, concatenate SQL query statements, example: "SELECT user, barcode, datetime FROM marktable WHERE barcode = 'production barcode information'".
[0076] S2203, executing a query by using the concatenated SQL statement through a query interface.
[0077] S2204, displaying the data results returned by the SQLite query to the user in a table.
[0078] SQL statements can be used to quickly query information with specified conditions and display it to users for viewing, allowing historical traceability of production information.
[0079] In one embodiment of the present invention, a SQLite database is introduced into the laser marking system, a marktable database table is created for the marking processing information, and an index is created for the barcode field.
[0080] Write the laser marking processing information into the marktable database table of the SQLite database;
[0081] Introducing SQLite's SQL query method into the laser marking system;
[0082] By using SQLite's SQL query method, the marktable database table can be quickly queried to trace the laser marking processing information. The SQL statements used include SELECT statements and WHERE clauses.
[0083] Through SQLite's SQL query method and the creation of indexes on the barcode field, the marktable database is quickly checked for duplicate codes to avoid duplication of barcodes. The SQL statements used include CREATE INDEX statement, SELECT statement and WHERE clause;
[0084] By building a SQLite data storage and query service platform and introducing TCP communication interaction services, the SQLite service platform listens to port 3002. Through TCP communication interaction between multiple marking machines and the SQLite service platform, the problem of duplicate codes on multiple marking machines can be efficiently solved.
[0085] In one embodiment of the present invention, a SQLite database is introduced into the laser marking system to record production data;
[0086] SQLite database is introduced into the laser marking system to store and query data, including creating barcode tables, creating indexes, storing SQL statements, and querying SQL statements;
[0087] The laser marking system uses SQLite query tool SQL statements to perform duplicate code detection, which includes SQL statements to query barcode duplicate codes, build SQLite services to manage barcodes and check duplicate codes.
[0088] In one embodiment of the present invention, an SQLite database is introduced to record production data, including but not limited to the recording of production data information during laser marking, laser cutting, laser welding and laser cleaning. The production data information includes but is not limited to production date and time, production barcode information, operating user name, production speed, power, position, gas flow, and production time.
[0089] Use SQL statements to query production data, including but not limited to the query of production data in laser marking, laser cutting, laser welding and laser cleaning, and trace historical production data.
[0090] The above description is only a preferred embodiment of the present invention and should not be construed as limiting the present application. All equivalent changes and modifications made within the scope of the patent application of the present invention should fall within the scope of the present invention.
Claims
1. A laser marking system data storage and query method based on SQLite database, characterized in that: Here’s how: Step 1: Introduce the SQLite database into the laser marking system and create a data table; Use the CREATE TABLE statement to create a data table, and then use the CREATE INDEX statement to create an index for the production data information; Step 2: Write the production data information into the SQLite database; Use the INSERT INTO statement to add data rows to write production data information into the data table. The production data information includes production date and time, production barcode information, operation user name, production speed, power, position, gas flow, and production time. Step 3: Obtain production data information through SQLite query; Use the SELECT statement to obtain data and the WHERE clause to query the production data information of the specified production barcode information based on the production barcode information.
2. The data storage and query method of the laser marking system based on SQLite database according to claim 1 is characterized in that: Between step 1 and step 2, there is also a duplicate code detection for the production data information, and the detection method is as follows: before any marking machine writes the production data information into the SQLite database, a query is performed based on the production barcode information. If the production barcode information already exists in the current data table, it indicates that there is a duplicate code, otherwise it indicates that there is no duplicate code.
3. The data storage and query method of the laser marking system based on SQLite database according to claim 2 is characterized in that: A TCP server listening to port 3002 is added to the SQLite database to form a SQLite service platform; each marking machine software is configured to specify the IP address and port number of the SQLite service platform, and actively initiates a TCP connection to the SQLite service platform.
4. The data storage and query method of the laser marking system based on SQLite database according to claim 3 is characterized in that: Each marking machine sends a storage instruction through TCP to send the production data information to the SQLite service platform, and the SQLite service platform writes the production data information into the SQLite database; it sends a query instruction through TCP to send the production barcode information to the SQLite service platform for query and duplicate code detection; The SQLite service platform distinguishes storage and query instructions according to the instruction content, processes and returns the corresponding response results to the marking machine; The marking machine receives the returned response, determines the content of the response and performs corresponding processing.
5. The data storage and query method of the laser marking system based on SQLite database according to claim 4 is characterized in that: The command content sent is encapsulated using a private protocol, and the command content uses JSON structured text for data exchange.
Citation Information
Patent Citations
A method for quickly acquire welding product information based on database and two-dimensional code
CN109242072A
Method for simplifying database operation in iOS application development
CN118260292A
Traceability management method and management device
JP2005063095A
