CPU-based short hash-based automatic detection and monitoring system for industrial production lines using CSV (Version Detection and Monitoring).

By employing a CPU short hash dual-branch authorization verification mechanism and automated CSV file parsing, the problem of data distortion caused by manual parsing in industrial production line testing equipment is solved, achieving automated monitoring and data integrity assurance.

CN123113802APending Publication Date: 2026-11-17瑞翔光电(惠州)有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611246541.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-17
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

The CSV test files generated by existing industrial production line testing equipment require manual parsing and comparison, which leads to inaccurate batch quality statistics and fails to accurately reflect the yield rate and process status of the production line. Furthermore, there is a lack of automated parsing and monitoring systems.

Method used

By using a dual-branch authorization verification mechanism based on CPU short hashes, an identity identifier is generated using the device's inherent CPU hardware information. An authorization signature is generated by combining one-way hash operation and Base64 encoding, thereby achieving device binding and time-based anti-tampering. This is combined with automated CSV file parsing to replace manual processing.

Benefits of technology

It achieves automated parsing and monitoring of CSV files, eliminates deviations introduced by manual operation, ensures the security of authorization credentials and the integrity of data, and provides a stable foundation for production line testing data storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123113802A_ABST
    Figure CN123113802A_ABST
Patent Text Reader

Abstract

This invention discloses an automatic CSV detection and monitoring system for industrial production lines based on CPU short hashing. It includes an administrator authorization generation program and a production line monitoring client program. The administrator program obtains the CPU serial number of the target device and concatenates it into an original authorization string. A second one-way hash operation is performed on the original authorization string, and bits of a predetermined length are extracted as an authorization signature. This signature is appended to the end of the original authorization string to generate a short authorization code. A two-branch authorization verification is performed on the received short authorization code, including an initial activation process and an automatic startup verification process. After successful verification, the system enters the main interface. The background system polls a preset monitoring folder, automatically identifies and parses newly added CSV test files, and accumulates the total number of tests, the number of good products, and the number of defective products in real time, generating a test log CSV file. This invention can automatically scan and parse CSV files without manual reading and comparison, thereby improving the detection efficiency of industrial production lines.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of production line inspection technology, specifically, to an automatic inspection and monitoring system for industrial production lines based on CPU short hashing (CSV). Background Technology

[0002] During mass production, automated testing equipment on industrial production lines continuously collects various data, including product performance parameters, testing indicators, and process parameters, and stores and outputs them in batches in CSV file format. This is one of the most mainstream data storage formats for testing data in the current industrial manufacturing field. Currently, most industrial testing production lines in China use a traditional processing mode for the CSV test files generated by the equipment: manual offline parsing, manual comparison and judgment, and manual statistical archiving. There is no supporting automated parsing, testing, and monitoring system. Existing technical solutions rely entirely on manual operation to complete the entire process. Workers must open the massive amounts of CSV documents continuously added to the production line, manually locate the fixed rows and columns, read the corresponding hexadecimal feature values, and then manually compare and judge the values ​​against the standard CFG benchmark file. Finally, they manually count the number of good and defective products in the batch, create a log table to enter the test data line by line, and retain the testing records. This results in distorted batch quality statistics, failing to accurately reflect the production line's yield rate and process status. Summary of the Invention

[0003] To address the shortcomings of existing technologies, this invention provides an automatic detection and monitoring system for CSV (Version Criteria) in industrial production lines based on CPU short hashing, comprising: The administrator authorization generation program is used to obtain the CPU serial number of the target device, perform a first one-way hash operation on the CPU serial number and extract a predetermined length of bits as a short CPU identifier; perform Base64 compression encoding on the authorization issuance timestamp and authorization expiration timestamp respectively to generate compressed issuance time and compressed expiration time; concatenate the CPU short identifier, compressed issuance time, compressed expiration time and preset one-time authorization flag into the original authorization string; perform a second one-way hash operation on the original authorization string and extract a predetermined length of bits as an authorization signature, append the authorization signature to the end of the original authorization string to generate a short authorization code; The production line monitoring client program performs dual-branch authorization verification on received short authorization codes. This includes an initial activation process and an automatic startup verification process. The initial activation process involves reading the blacklist database corresponding to the activated authorization code from the system's private user directory, verifying the device binding relationship based on the short authorization code and the blacklist database, performing multi-layer anti-time tampering verification after successful device binding verification, writing the successfully activated short authorization code to the blacklist database after successful anti-time tampering verification, and saving the valid authorization information to the production line monitoring configuration folder in the system's private user directory. The automatic startup verification process skips the blacklist database verification and directly performs CPU short identifier consistency comparison and time validity verification. After the dual-branch authorization verification passes, the program directly enters the main interface. The background polls the preset monitoring folder, automatically identifies and parses newly added CSV test files, automatically compares the detection values ​​with standard values, and accumulates the total number of tests, the number of good products, and the number of defective products in real time, generating a test log CSV file. The production line monitoring configuration folder is located in the system user's private directory, independent of the application installation directory. Uninstalling the application will not delete this production line monitoring configuration folder, which contains at least the authorization record file, the blacklist database file, and the time baseline file.

[0004] The beneficial effects of this application are as follows: By reading the target device's CPU serial number, a short CPU identifier is obtained through a first one-way hash operation and bit truncation. Two types of timestamps are then Base64 compressed and encoded, and combined with a one-time authorization tag to obtain the original authorization string. A second one-way hash operation generates an authorization signature, which is then concatenated to obtain a short authorization code, constructing a hardware-bound authorization credential. This solves the problem of traditional production lines lacking program access control. It utilizes the device's inherent CPU hardware information to generate an identity identifier, uses two one-way hash operations to prevent tampering of the authorization content, and Base64 encoding to compress the timestamp, reducing the data length of the authorization code. Combined with a one-time authorization tag to restrict authorization reuse, this deeply binds the authorization credential to the hardware device, preventing unauthorized copying and deployment. This provides a reliable operating environment for subsequent automated client parsing of CSV files and statistical analysis of production line testing data. The system employs a dual-branch authorization verification logic consisting of initial activation and automatic startup verification. During initial activation, it performs blacklist database verification, device binding verification, and multi-layered anti-time tampering checks. Upon successful verification, authorization information is persistently stored. The automatic startup verification stage simplifies the verification process. After verification, the background polls the monitoring folder, automatically performing CSV file recognition and parsing, numerical comparison, count accumulation, and log generation, replacing traditional manual processing. This dual-branch verification balances the security requirements of initial activation with the operational efficiency of daily startup. While mitigating the risk of tampering, it automates file parsing, numerical comparison, and count archiving, eliminating various deviations introduced by manual operation. It continuously outputs test logs, comprehensively preserving all data from the production line testing process, thus solving problems such as errors in manual readings, ineffective authorization control, time tampering, and directory permission issues. The production line monitoring configuration folder is located in the system user's private directory, independent of the application installation directory. The application uninstallation operation will not delete the authorization record file, blacklist database file, and time baseline file stored in this folder. This solves the data breakage problem caused by the traditional software configuration being destroyed along with the installation directory. The uninstallation process will not clear core files such as authorization, blacklist, and time baseline. The device does not need to complete the activation operation repeatedly. Historical control information related to authorization verification can be continuously retained, ensuring that the client can stably carry out authorization verification and automated statistical work of CSV files, thereby providing underlying storage support for the long-term retention of quality data on the production line. Attached Figure Description

[0005] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a schematic diagram of the program control flow of the industrial production line CSV automatic detection and monitoring system based on CPU short hash in the embodiment. Figure 2 for Figure 1 A detailed flowchart illustrating the implementation steps of the initial activation process; Figure 3 for Figure 1 A detailed flowchart illustrating the implementation steps of the automatic startup verification process. Detailed Implementation

[0006] The following drawings disclose several embodiments of the present invention. For clarity, many practical details will be described in the following description. However, it should be understood that these practical details are not intended to limit the invention. That is, in some embodiments of the invention, these practical details are not essential. Furthermore, for the sake of simplicity, some conventional structures and components will be shown in the drawings in a simple schematic manner.

[0007] To further understand the invention's content, features, and effects, the following embodiments are provided, and detailed descriptions are given below in conjunction with the accompanying drawings: Reference Figure 1 , Figure 1 This is a schematic diagram of the program control flow of the industrial production line CSV automatic detection and monitoring system based on CPU short hashing in this embodiment. The industrial production line CSV automatic detection and monitoring system based on CPU short hashing in this embodiment includes: The administrator authorization generation program is used to obtain the CPU serial number of the target device, perform a first one-way hash operation on the CPU serial number and extract a predetermined length of bits as a short CPU identifier; perform Base64 compression encoding on the authorization issuance timestamp and authorization expiration timestamp respectively to generate compressed issuance time and compressed expiration time; concatenate the CPU short identifier, compressed issuance time, compressed expiration time and preset one-time authorization flag into the original authorization string; perform a second one-way hash operation on the original authorization string and extract a predetermined length of bits as an authorization signature, append the authorization signature to the end of the original authorization string to generate a short authorization code; In this embodiment, the administrator authorization generation program is a desktop program running on a separate administrator computer. The administrator obtains the CPU serial number string of the target device from the device ledger and inputs this string into the text input box of the authorization generation program. The authorization generation program calls the MD5 hash function to perform the first one-way hash operation on the CPU serial number string, obtaining a 32-bit hexadecimal digest string, and then extracts the first 8 characters of the digest string as the CPU short identifier. The authorization generation program obtains the authorization issuance timestamp and authorization expiration timestamp set by the administrator. Both timestamps are integers representing the total number of seconds elapsed since the Unix epoch. The authorization generation program performs URL-secure Base64 compression encoding on these two integer timestamps, converting the longer numeric string into a shorter alphanumeric string, obtaining the compressed issuance time and compressed expiration time. The authorization generation program uses the CPU short identifier string, the compressed issuance time string, the compressed expiration time string, and a fixed string "1" as a one-time authorization marker, and concatenates them into an original authorization string in the order of CPU short identifier - compressed issuance time - compressed expiration time - 1. The authorization generation program performs an MD5 hash operation on the original authorization string to obtain a second one-way hash digest. The first eight characters of this digest are extracted as the authorization signature and appended to the end of the original authorization string. All parts are separated by hyphens, ultimately generating a complete short authorization code. The administrator sends this short authorization code to on-site operators via instant messaging or email.

[0008] The production line monitoring client program performs dual-branch authorization verification on received short authorization codes. This includes an initial activation process and an automatic startup verification process. The initial activation process involves reading the blacklist database corresponding to the activated authorization code from the system's private user directory, verifying the device binding relationship based on the short authorization code and the blacklist database, performing multi-layer anti-time tampering verification after successful device binding verification, writing the successfully activated short authorization code to the blacklist database after successful anti-time tampering verification, and saving the valid authorization information to the production line monitoring configuration folder in the system's private user directory. The automatic startup verification process skips the blacklist database verification and directly performs CPU short identifier consistency comparison and time validity verification. After the dual-branch authorization verification passes, the program directly enters the main interface. The background polls the preset monitoring folder, automatically identifies and parses newly added CSV test files, automatically compares the detection values ​​with standard values, and accumulates the total number of tests, the number of good products, and the number of defective products in real time, generating a test log CSV file. In this embodiment, the production line monitoring client program is deployed on the production line industrial control computer. When the program starts, it first checks whether an authorization record file exists in the production line monitoring configuration folder under the system's private user directory. If it does not exist, the program pops up a manual activation window to perform the initial activation process. The on-site operator pastes the short authorization code obtained from the administrator into the activation window. The program reads the blacklist database file from the production line monitoring configuration folder and compares the short authorization code with each record in the blacklist database. If the short authorization code is not in the blacklist database, the program parses the short authorization code to extract the CPU short identifier, calls the operating system's underlying interface to read the local CPU serial number, and performs an MD5 hash to extract the first 8 bits to obtain the local CPU short identifier. The two are then compared to verify the device binding relationship. After the device binding verification is successful, the program parses the compressed issuance time and compressed expiration time in the short authorization code, obtains the current base time, and performs a three-layer anti-time tampering verification. After the verification is successful, the program appends the short authorization code to the blacklist database file, writes the CPU short identifier, issuance timestamp, expiration timestamp, and current base time to the authorization record file, writes the current base time to the time baseline file, and then directly enters the main interface. If the authorization record file exists, the program executes the automatic boot verification process, skips the blacklist database verification, directly reads the CPU short identifier in the authorization record file and compares it with the local CPU short identifier, and verifies the authorization validity period and time offset. After the verification is successful, it directly enters the main interface.

[0009] The production line monitoring configuration folder is located in the system user's private directory, independent of the application installation directory. Uninstalling the application will not delete this production line monitoring configuration folder, which contains at least the authorization record file, the blacklist database file, and the time baseline file.

[0010] In this embodiment, after entering the main interface, the CSV fully automatic detection engine starts in a background thread, recursively listening to the user-specified monitoring folder by calling the file change notification interface provided by the operating system. When a new CSV test file creation event is detected in the folder, the detection engine obtains the complete path of the file and generates a queue of files to be processed. The background processing thread retrieves the file path from the queue, opens the file in read-only mode, reads the first few bytes of the file to analyze the byte order mark or byte frequency distribution to automatically identify the encoding format, and reads the first line of the file to count the frequency of each character to determine the delimiter type. Based on the identified encoding format and delimiter type, the processing thread parses the file into a two-dimensional data table structure in memory, locates the target cell according to the preset row index and column index, and extracts the string in the cell as a hexadecimal detection value. The processing thread reads the standard CFG hexadecimal value pre-stored in the production line monitoring configuration folder and compares the hexadecimal detection value with the standard value character by character. If the two are completely consistent, it is judged as a good product and the good product counter is incremented by one; otherwise, it is judged as a defective product and the defective product counter is incremented by one, and the total test counter is incremented by one. The processing thread pushes the current values ​​of the good product counter, defective product counter, and total test counter to the statistics display area of ​​the main interface in real time. The processing thread opens a CSV file named with the current date in the independent log directory in append write mode, writes the file name of this test, the test time, the hexadecimal test value, the comparison result, and the cumulative statistical result into a single line, and then closes the file handle to generate a complete test log CSV file.

[0011] Furthermore, refer to Figure 2 , Figure 2 for Figure 1 A detailed flowchart illustrating the implementation steps of the initial activation process is provided below. The initial activation process described in this embodiment specifically includes: S101: When the production line monitoring client program detects that there is no valid authorization record file in the production line monitoring configuration folder, it pops up a manual activation window and obtains the received short authorization code. It reads the blacklist database corresponding to the activated authorization code from the blacklist database file and compares the short authorization code with the blacklist database. In this embodiment, the production line monitoring client program first locates the production line monitoring configuration folder C:\Users\Current Login Username\Production Line Monitoring Authorization Configuration under the system's private user directory. The production line monitoring client program calls the file access interface provided by the operating system to check if a valid authorization record file named auth_info.dat exists in this folder. If the file does not exist or its content is empty, the production line monitoring client program determines that the current device is inactive and immediately pops up a manual activation window in the center of the screen. This activation window contains a text input box and an activation button. The on-site operator obtains a short authorization code from the administrator, pastes or types the short authorization code into the text input box, and clicks the activation button. After receiving this short authorization code, the production line monitoring client program reads a blacklist database file named used_code_list.dat from the production line monitoring configuration folder. This blacklist database is a plain text file, with each line recording the complete string of a short authorization code that has already been activated. The production line monitoring client program performs a character-by-character comparison between the received short authorization code and each line of strings recorded in the blacklist database file. If the received short authorization code is found to be identical to a string in a record in the file, it is determined that the short authorization code exists in the blacklist database. The production line monitoring client program immediately displays the message "This authorization code has been used and cannot be activated again" in the activation window and refuses to continue any subsequent activation process. If no match is found after traversing the entire blacklist database file, it is determined that the short authorization code is not in the blacklist database, and the production line monitoring client program then proceeds to the next parsing operation.

[0012] S102: If the short authorization code exists in the blacklist database, activation is rejected; if it does not exist in the blacklist database, the short authorization code is parsed to extract the CPU short identifier, and the local interface is called to read the local CPU serial number and generate the local CPU short identifier according to the same first one-way hash operation rule, and then the comparison is performed to verify the device binding relationship. In this embodiment, after confirming that the short authorization code does not exist in the blacklist database, the production line monitoring client program begins to parse the short authorization code. The format of the short authorization code is CPU short hash - compressed issuance time - compressed expiration time - one-time flag 1 - signature, with each part separated by hyphens. The production line monitoring client program splits the short authorization code string into five independent parts using hyphens as delimiters, extracting the first part, the CPU short hash string. This CPU short hash is obtained by the administrator authorization generation program performing an MD5 hash operation on the complete CPU serial number of the device and then extracting the first 8 hexadecimal characters. The production line monitoring client program then calls the underlying interface provided by the operating system to read the local CPU serial number. The production line monitoring client program inputs the read local CPU complete serial number string into the MD5 hash function to calculate the complete 32-bit hexadecimal MD5 digest string, and then extracts the first 8 characters of the digest string to obtain the local CPU short identifier. The production line monitoring client program performs a character-by-character precise comparison between the CPU short hash string in the parsed short authorization code and the calculated local CPU short identifier string. If the two strings differ at any character position, the device binding verification fails, and the production line monitoring client program displays the message "Authorization code does not match the current device" in the activation window and terminates the activation process. If the two strings are completely identical, the device binding verification passes, and the production line monitoring client program then extracts the second part of the short authorization code (compressed issuance time) and the third part (compressed expiration time) and proceeds to the next step of time verification.

[0013] S103: After the device binding verification is successful, the compressed issuance time and compressed expiration time in the short authorization code are parsed and the current base time is obtained to perform multi-layer anti-time tampering verification; In this embodiment, after the device binding verification is successful, the production line monitoring client program extracts the second part of the compressed issuance time string and the third part of the compressed expiration time string from the short authorization code. These two time strings are digital timestamps that have undergone URL-secure Base64 compression encoding. The production line monitoring client program performs a URL-secure Base64 decoding operation on these two compressed time strings to restore the original issuance time digital stamp and expiration time digital stamp. Each digital stamp is an integer representing the total number of seconds that have elapsed since 00:00 on January 1, 1970. The production line monitoring client program then obtains the current base time. The production line monitoring client program first attempts to obtain the international standard Beijing time as the base time through the Network Time Protocol server. If the network connection is unavailable, the production line monitoring client program reads the time value from the time baseline file stored in the production line monitoring configuration folder as the local base time. The production line monitoring client program performs the first-level verification, comparing the current base time with the parsed issuance time. If the current base time is earlier than the issuance time, the verification is deemed to have failed. The second layer of verification involves the production line monitoring client program reading the time of the last successful verification record from local storage. If the current reference time is earlier than this record time, it is determined that there has been a manual rollback, and the verification fails. The third layer of verification involves the production line monitoring client program calculating the absolute value of the difference between the current reference time and the time of the last successful verification record. If this absolute value is greater than 2,592,000 seconds (30 days), it is determined that the time offset exceeds the allowable range, and the verification fails. If any layer of verification fails, the production line monitoring client program immediately determines that the authorization is invalid and displays a corresponding error message in the activation window, forcibly terminating the activation process.

[0014] S104: After the anti-time tampering verification passes, the currently successfully activated short authorization code is written to the blacklist database and the valid authorization information is saved to the production line monitoring configuration folder. Then, the main interface is entered directly.

[0015] In this embodiment, after all multi-layer anti-time tampering verifications pass, the production line monitoring client program appends the complete string of the currently successfully activated short authorization code to the end of the blacklist database file in the production line monitoring configuration folder, ensuring that the authorization code cannot be used again on any device. The production line monitoring client program then creates an authorization record file in the production line monitoring configuration folder, writing the CPU short identifier, issuance timestamp, expiration timestamp, and current base timestamp from the currently successfully activated short authorization code into this file. This authorization record file contains all the necessary information for this activation for subsequent automatic verification upon startup. After completing the above writing operations, the production line monitoring client program closes the manual activation window and directly loads and displays the system's main operation interface. The main interface displays the CSV file monitoring status, real-time statistics, and system operating information. Operators can start using all the system's functions without performing any further authorization-related operations. At this point, the entire one-time authorization activation process is complete, and the production line monitoring client program enters normal working state, beginning to execute the automatic detection and monitoring tasks of the CSV file.

[0016] Furthermore, the multi-layer anti-time tampering verification specifically includes: Parse the compressed issuance time and compressed expiration time in the short authorization code and decode them to obtain the issuance timestamp and expiration timestamp. At the same time, try to obtain the standard time through the network as the base timestamp. If the network connection is successful, use the base timestamp as the current base time. If the network connection fails, read the local system time as the current base time. In this embodiment, after the device binding verification is successful, the production line monitoring client program immediately begins the time verification process. The production line monitoring client program extracts the second part (compressed issuance time string) and the third part (compressed expiration time string) from the short authorization code. These two strings are obtained by the administrator authorization generation program using the URL-secure Base64 compression encoding algorithm to process the original digital timestamp. The production line monitoring client program calls the built-in Base64 decoding function to perform reverse decoding operations on these two strings respectively, restoring the compressed issuance time string to an integer issuance timestamp representing the total number of seconds elapsed since the Unix epoch, and similarly restoring the compressed expiration time string to an integer expiration timestamp. The production line monitoring client program then initiates the base time acquisition process. The production line monitoring client program calls the network communication interface provided by the operating system to send a time query request to the preset network time protocol server. If the network connection is successful, the server returns a standard Beijing time timestamp, which the production line monitoring client program sets as the current base time. If the network request times out or returns an error code, indicating that the device is currently offline, the production line monitoring client program will call the system time reading interface provided by the operating system kernel to directly read the current local system time from the system clock chip and convert it into a Unix timestamp format, which will then be used as the current reference time. The production line monitoring client program will store the obtained current reference time, along with the previously decoded issuance timestamp and expiration timestamp, in a memory variable, preparing to proceed to the next verification stage.

[0017] The current base time is compared with the issuance timestamp. If the current base time is earlier than the issuance timestamp, it is determined that the system time has been tampered with before the authorization took effect. The verification fails and activation is directly rejected. In this embodiment, the production line monitoring client program compares the current base time with the decoded issuance timestamp. The program executes an integer comparison instruction to determine if the current base time value is less than the issuance timestamp value. If the current base time value is strictly less than the issuance timestamp value, it means that the current time is logically earlier than the earliest time the authorization took effect. This directly proves that the system clock was manually moved forward to a point in time before the authorization took effect. The production line monitoring client program immediately determines that the system time has been tampered with before the authorization took effect, which is a violation. The program then displays the message "System time is abnormal; time points before authorization take effect are not allowed" in the activation window, stops executing any subsequent verification steps, exits the entire activation process, and returns to the activation window to wait for the user to operate again. If the current base time value is greater than or equal to the issuance timestamp value, it indicates that the current time has reached or exceeded the start time of authorization take effect. The production line monitoring client program determines that this layer of verification has passed and continues to execute the next layer of verification logic.

[0018] Provided that the current base time is not earlier than the issuance timestamp, read the last record timestamp saved when the last successful verification was performed in the authorization record file, compare the current base time with the last record timestamp, and if the current base time is earlier than the last record timestamp, it is determined that the system time has been manually rolled back, and the verification is notified that it has failed and activation is directly rejected. In this embodiment, assuming the verification passes (i.e., the current reference time is not earlier than the issuance timestamp), the production line monitoring client program enters the second time verification stage. The production line monitoring client program accesses the production line monitoring configuration folder C:\Users\Current Login Username\Production Line Monitoring Authorization Configuration and reads the last recorded timestamp saved during the previous successful verification, stored in the authorization record file under this folder. This authorization record file is a structured text file containing four fields: CPU short identifier, issuance timestamp, expiration timestamp, and last recorded timestamp, separated by newline characters. The production line monitoring client program locates the fourth line, the last recorded timestamp field, converts the string to an integer type, and obtains the last recorded timestamp. The production line monitoring client program compares the current reference time with the last recorded timestamp. If the current reference time value is strictly less than the last recorded timestamp value, this means that the system time has been rolled back relative to the last verification time, indicating that the system time has been artificially reduced. The production line monitoring client program immediately determines that the system time has been artificially rolled back, constituting a clear act of tampering. The production line monitoring client program displays the message "System time rollback detection failed, please correct the system time and try again" in the activation window, and directly rejects this activation request, terminating all subsequent processes. If the current base time value is greater than or equal to the previously recorded timestamp value, it indicates that the time flow direction is normal, the production line monitoring client program determines that this layer of verification has passed, and continues to execute the final layer of verification.

[0019] Provided that the current reference time is not earlier than the last recorded timestamp, calculate the absolute difference between the current reference time and the last recorded timestamp. If the absolute difference exceeds the preset maximum allowable offset duration, it is determined that the system time has an abnormal offset, and the verification fails and activation is directly rejected; otherwise, the verification passes, the current reference time is updated to the new last recorded timestamp and written to the time baseline file.

[0020] In this embodiment, assuming the verification passes (i.e., the current reference time is not earlier than the last recorded timestamp), the production line monitoring client program performs a final time protection check. The production line monitoring client program calculates the absolute difference between the current reference time and the last recorded timestamp, i.e., subtracting the smaller time value from the larger time value to obtain a non-negative integer difference. The production line monitoring client program compares this absolute difference with a preset fixed threshold of 2,592,000 seconds, corresponding to the total number of seconds in 30 calendar days. If the calculated absolute difference is greater than 2,592,000 seconds, it means that the system time has jumped significantly for more than a month since the last successful verification. This significant time change does not conform to the normal operating pattern of the equipment and is highly likely to be an abnormal offset caused by malicious manipulation of the system time. The production line monitoring client program immediately determines that the system time has an abnormal offset, displays the message "System time offset exceeds the allowed range, authorization verification failed" on the activation window, and directly rejects the activation request. If the absolute difference is less than or equal to 2,592,000 seconds, the production line monitoring client program determines that all three-level time verifications have passed. The production line monitoring client program writes the current base time value to the time baseline file in the production line monitoring configuration folder, overwriting the old value, ensuring that the file always stores the latest successful verification time record. The production line monitoring client program then passes the current base time to subsequent processes to continue executing the authorization code blacklist writing and authorization record saving operations.

[0021] Furthermore, refer to Figure 3 , Figure 3 for Figure 1 A detailed flowchart illustrating the implementation steps of the automatic boot verification process in this embodiment is provided. Specifically, the automatic boot verification process in this embodiment includes: S201: The production line monitoring client program is considered to be activated when it detects a valid authorization record file in the production line monitoring configuration folder; In this embodiment, the production line monitoring client program first performs an initialization operation, locating the production line monitoring configuration folder C:\Users\Current Login Username\Production Line Monitoring Authorization Configuration under the system's private user directory. The production line monitoring client program calls the file access interface provided by the operating system to check if an authorization record file named auth_info.dat exists in this folder. The production line monitoring client program confirms the existence and non-empty content of the file by reading its attribute information. If the file exists and can be opened and read normally, the production line monitoring client program determines that the current device is already activated, without needing to pop up a manual activation window. The production line monitoring client program then proceeds to the subsequent automatic power-on verification process, skipping all manual interaction steps required for the initial activation. If the file does not exist or its content is empty, the production line monitoring client program determines that the device is not activated, immediately pops up a manual activation window, and requires the on-site operator to enter a short authorization code to complete the activation. This determination logic ensures that activated devices can quickly enter the working state each time they are powered on or restarted, without having to repeat the complete activation process.

[0022] S202: Read the authorization record file and extract the saved CPU short identifier and authorization validity period information from it; In this embodiment, after determining that the current device is in an activated state, the production line monitoring client program opens the authorization record file auth_info.dat in the production line monitoring configuration folder and reads all the text content of the file. This authorization record file is a structured text file that stores key information written during the last successful activation. The production line monitoring client program splits the file content into four independent fields according to newline characters. The production line monitoring client program reads the first line of string to obtain the saved short CPU identifier, which is a string of 8 hexadecimal characters, obtained by the administrator authorization generation program performing an MD5 hash operation on the device's complete CPU serial number and then extracting the first 8 digits. The production line monitoring client program reads the second line of string to obtain the issuance timestamp, which is an integer representing the total number of seconds elapsed since the Unix epoch. The production line monitoring client program reads the third line of string to obtain the expiration timestamp, also an integer number of seconds. The production line monitoring client program reads the fourth line of string to obtain the last recorded timestamp, recording the moment when all time verifications were successfully completed last time. The production line monitoring client program stores the values ​​of these four fields in memory variables for use in subsequent verification steps. The entire reading and parsing process is completed automatically in the background without any manual intervention.

[0023] S203: Skip the blacklist database verification step and directly perform CPU short identifier consistency comparison and time validity verification. After the verification is successful, directly enter the main interface.

[0024] In this embodiment, after extracting information from the authorization record file, the production line monitoring client program skips the blacklist database verification step and directly enters the device binding verification and time validity verification stages. The production line monitoring client program calls the operating system's underlying interface to read the complete serial number of the local CPU, performs an MD5 hash operation on the serial number, and extracts the first 8 hexadecimal characters to obtain the local CPU short identifier. The production line monitoring client program performs a character-by-character precise comparison between the local CPU short identifier and the saved CPU short identifier extracted from the authorization record file. If the two strings are completely identical, the device binding verification passes. The production line monitoring client program then obtains the current reference time, preferentially obtaining standard Beijing time through a network time protocol server; if the network is unavailable, it reads the local system time. The production line monitoring client program compares the current reference time with the extracted issuance timestamp to ensure that the current reference time is not earlier than the issuance timestamp. The production line monitoring client program then compares the current reference time with the expiration timestamp to ensure that the current reference time is not later than the expiration timestamp. The production line monitoring client program also reads the timestamp of the last successful verification record from the time baseline file in the production line monitoring configuration folder, performs rollback detection and offset detection, compares the current base time with the last recorded timestamp, and determines rollback if the current base time is earlier than the last recorded timestamp; if the absolute difference between the two exceeds 2,592,000 seconds, it determines abnormal offset. After all verifications pass, the production line monitoring client program updates the current base time to the new timestamp of the last successful verification record and writes it to the time baseline file. The production line monitoring client program then directly loads and displays the system's main interface, which shows all functional modules such as CSV file monitoring status and real-time statistical data. On-site operators can immediately start using the system for automatic detection and monitoring of production line CSV files without any authorization.

[0025] Furthermore, after the dual-branch authorization verification passes, the user directly enters the main interface. The background polls the preset monitoring folder and automatically identifies and parses the newly added CSV test file, specifically including: The background starts a fully automatic CSV detection engine to provide a file change notification interface to recursively listen to the monitoring folder specified by the user. When a new CSV test file is created in the monitoring folder, the file path and file extension of the new CSV test file are obtained and a queue of files to be processed is generated. In this embodiment, after authorization verification is successful and the main interface is accessed, the production line monitoring client program starts the CSV fully automatic detection engine in a background thread. This detection engine calls the file change notification interface provided by the operating system to register a recursive listener handle for the user-specified monitoring folder at the operating system kernel level. The user specifies a disk directory as the monitoring folder through a folder browsing dialog box in the system settings interface, for example, D:\Production Line Test Data\Batch 20250807. The detection engine includes this directory and all its subdirectories in its monitoring scope. When a new CSV test file is created in this folder by a production line device, the operating system file system driver immediately captures this file creation event and passes the event notification to the detection engine through a callback mechanism. The detection engine extracts the complete path string of the newly created file from the event notification structure, for example, D:\Production Line Test Data\Batch 20250807\test_result_001.csv. The detection engine also extracts the file extension string and filters non-CSV files by comparing whether the extension is .csv. For files that meet the requirements, the detection engine encapsulates the file path and extension into a queue entry to be processed, and then places this entry at the end of a first-in-first-out (FIFO) memory queue, waiting for subsequent processing threads to retrieve and process it one by one. The entire process runs automatically in the background without any manual intervention.

[0026] Retrieve the file path from the pending file queue, open the newly added CSV test file in read-only mode, and read the first few bytes. Automatically identify the file encoding format by analyzing the byte order mark or byte frequency distribution. At the same time, read the first line of the file and automatically identify the file delimiter type by detecting the frequency of delimiter occurrences. Generate file parsing parameters containing the encoding format and delimiter type. In this embodiment, the background processing thread of the CSV fully automatic detection engine retrieves a file path entry from the head of the file queue and opens the newly added CSV test file in read-only mode. The processing thread first reads the first few bytes of the file, typically the first four bytes, and places them into a byte buffer. The processing thread compares the byte sequence in the buffer with predefined byte order markers, such as 0xFF 0xFE for UTF-16LE encoding, 0xFE 0xFF for UTF-16BE encoding, and 0xEF 0xBB 0xBF for UTF-8 encoding. If a marker is matched at the beginning of the buffer, the corresponding encoding format is directly determined. If no byte order marker is matched, the processing thread performs frequency statistical analysis on the byte values ​​in the entire buffer, counting the number of times each byte value appears, and infers the encoding format based on the byte distribution characteristics of common encodings. For example, the distribution pattern of high-order bytes in GBK encoding differs significantly from that in UTF-8 encoding. After determining the encoding format, the processing thread reads the first line of text in the file using that encoding format. The processing thread iterates through each character in the first line of text, counting the occurrences of common delimiters such as commas, tabs, semicolons, and vertical bars. The processing thread selects the most frequently occurring delimiter as the file's delimiter type. It then combines the identified encoding format string and delimiter type string into a file parsing parameter dictionary, which is attached to the attributes of the current file queue entry for use in subsequent parsing steps.

[0027] The newly added CSV test file is parsed with the correct encoding format and delimiter type based on the file parsing parameters, so as to load it into a two-dimensional data table structure in memory, and locate the target cell according to the preset row index and column index, and extract the string content in the target cell as a hexadecimal detection value. In this embodiment, the processing thread opens the newly added CSV test file with the correct encoding format according to the determined file parsing parameters, and reads the file content line by line with the correct delimiter type. The processing thread segments each line of text into a field array according to the delimiter, and organizes all the field arrays of all lines into a two-dimensional data table structure stored in memory. The row index of this two-dimensional data table starts counting from 0, and the column index also starts counting from 0. The processing thread locates the target cell according to the system's preset row and column index values. For example, the system's preset row index is 3, corresponding to the 4th row, and the column index is 3, corresponding to the 4th column. The processing thread retrieves the content of the cell in the 3rd row and 3rd column from the two-dimensional data table. This content is a string, such as "A5B3". After removing leading and trailing whitespace characters from this string, the processing thread stores it in memory as a hexadecimal detection value for subsequent comparison steps. The entire parsing process is fully automated, requiring no manual opening of the file or manual transcription of the values.

[0028] Read the standard CFG hexadecimal value that the user has pre-imported and stored in the configuration file, and compare the hexadecimal detection value with the standard CFG hexadecimal value. If the two are the same, it is judged as a good product and the good product counter is incremented by one. If they are not the same, it is judged as a defective product and the defective product counter is incremented by one. At the same time, the total test counter is incremented by one, generating real-time statistical results including the total number of tests, the number of good products and the number of defective products. In this embodiment, the processing thread reads a pre-stored standard CFG hexadecimal value configuration file from the production line monitoring configuration folder. This configuration file is uploaded by the user through the import function on the interface when using the system for the first time. The file records the standard hexadecimal value string corresponding to the product model. The processing thread performs a character-by-character precise comparison between the obtained hexadecimal detection value string and this standard CFG hexadecimal value string. If the two strings are completely identical at every character position, the product is determined to be a good product, and the processing thread increments the good product counter variable in memory by 1. If the two strings differ at any character position, the product is determined to be a defective product, and the processing thread increments the defective product counter variable in memory by 1. Regardless of the comparison result, the processing thread increments the total test counter variable by 1. The processing thread pushes the current values ​​of the good product counter, defective product counter, and total test counter to the statistics display area of ​​the main interface in real time, updating the indicators such as the yield rate, defective product rate, and total number of tests displayed on the screen. The entire process is completed in milliseconds, realizing real-time automated statistics of production line inspection data.

[0029] Open the CSV file named with the current date in the independent directory in append mode, write the file name of this test, detection time, hexadecimal detection value, comparison result and cumulative statistics into a single line, close the file handle, and generate a test log CSV file.

[0030] In this embodiment, after completing the detection and statistics of a single file, the processing thread immediately performs a log recording operation. The processing thread obtains the current system date and formats it as a string in the YYYYMMDD format, such as 20250807. The processing thread checks if a CSV file named with this date string exists in the independent log directory D:\Production Line Test Log, for example, 20250807.csv. If the file does not exist, the processing thread creates the file in write mode and writes the header row. If the file already exists, the processing thread opens the file in append write mode. The processing thread constructs a record string containing the filename of this test, the detection time, the hexadecimal detection value, the comparison result, and the cumulative statistical result. The filename is taken from the last part of the obtained file path, for example, test_result_001.csv. The detection time is taken from the current system time of the operating system and formatted as YYYY-MM-DD HH:MM:SS. The hexadecimal detection value is taken from the original string extracted from the CSV file. The comparison result is filled with "Good" or "Defective" according to the judgment result. The cumulative statistics include three values: total number of tests, number of good products, and number of defective products. The processing thread writes this record string to the open CSV file, ending it with a newline character, and then closes the file handle to release system resources. This generates a separate log file daily, and all test records are permanently saved for easy quality traceability and statistical analysis.

[0031] Furthermore, the production line monitoring configuration folder specifically includes: Create an authorization record file in the production line monitoring configuration folder to store the valid authorization information written during the first activation process or the last successful verification. This file includes the CPU short identifier, issuance timestamp, expiration timestamp, and last record timestamp. In this embodiment, after all verifications in the initial activation process pass, the production line monitoring client program creates an authorization record file in the production line monitoring configuration folder C:\Users\Current Login Username\Production Line Monitoring Authorization Configuration. The production line monitoring client program calls the file creation interface provided by the operating system to open a new file in write mode. The production line monitoring client program writes four key fields line by line into the file. The first line writes the CPU short identifier string, which is 8 hexadecimal characters long and is obtained by the administrator authorization generation program after performing an MD5 hash operation on the complete serial number of the device's CPU and extracting the first 8 digits. The second line writes the issuance timestamp, which is an integer representing the total number of seconds elapsed since the Unix epoch, set by the administrator authorization generation program when generating the short authorization code. The third line writes the expiration timestamp, also an integer number of seconds, representing the expiration time of the authorization validity period. The fourth line writes the last recorded timestamp, which is the base time when the current successful verification was passed, determined by the production line monitoring client program. After writing these four fields into the file in plain text format, the production line monitoring client program immediately closes the file handle to ensure that the data is completely written to disk. After each subsequent automatic verification upon system startup, the production line monitoring client program reopens the file in overwrite mode, updating only the last recorded timestamp field in the fourth line, while the other three fields remain unchanged. This authorization log file is always stored in the production line monitoring configuration folder and is unaffected by changes to the application's installation directory or uninstallation.

[0032] Create a blacklist database file in the production line monitoring configuration folder to store all short authorization codes that have been successfully activated. Each line stores one short authorization code. This blacklist database file is retained even after the local application is uninstalled. In this embodiment, the production line monitoring client program creates a blacklist database file within the production line monitoring configuration folder C:\Users\Current Login Username\Production Line Monitoring Authorization Configuration. The production line monitoring client program calls the file creation interface provided by the operating system to open a new file in append mode. This file is stored in plain text format, with each line recording a complete short authorization code string. After successfully completing an activation process, the production line monitoring client program immediately appends the short authorization code used for the current activation to the end of the file. For example, the short authorization code written for the first activation occupies the first line, the short authorization code written for the second activation occupies the second line, the short authorization code written for the third activation occupies the third line, and so on. After each write operation, the production line monitoring client program immediately closes the file handle. The production line monitoring configuration folder containing this file is located in the system's private user directory, completely isolated from the application's installation directory. When the user uninstalls the application through the Programs and Features in the operating system's control panel, the uninstaller only deletes all files and subdirectories in the installation directory and does not perform any deletion operations on the production line monitoring configuration folder. Therefore, the blacklist database file remains intact on the disk after the application is uninstalled. Even if the device's operating system is reinstalled and the folder is deleted, the blacklist database will be permanently retained as long as the folder is not manually deleted. When the production line monitoring client program reads this file to compare against the blacklist, it reads each line of string and matches it with the input short authorization code to ensure that the same short authorization code is never activated and used repeatedly.

[0033] Create a time baseline file in the production line monitoring configuration folder to store the current base time obtained after successful network connection or after local system time calibration during the last successful verification.

[0034] In this embodiment, the production line monitoring client program creates a time baseline file within the production line monitoring configuration folder C:\Users\Current Login Username\Production Line Monitoring Authorization Configuration. The production line monitoring client program calls the file creation interface provided by the operating system to open a new file in overwrite mode. This file is stored in plain text format and contains only an integer string representing the base timestamp determined during the last successful verification. The production line monitoring client program first attempts to obtain the international standard Beijing time as the base timestamp through a network time protocol server. If the network connection is successful, the production line monitoring client program writes the obtained network timestamp to the file. If the network connection fails, the production line monitoring client program reads the local system time as the base timestamp and writes it to the file. After all three layers of time verification pass, the production line monitoring client program writes the finally passed current base time to the file in overwrite mode, replacing the original old value. After each write operation is completed, the production line monitoring client program immediately closes the file handle. The content of this file is updated after each successful verification, always maintaining the base timestamp from the most recent successful verification. When the production line monitoring client program starts and performs multi-layer anti-time tampering verification again, it reads the last recorded timestamp from this file to perform time rollback detection and time offset detection, ensuring that the system time has not been tampered with. This file, together with the authorization log file and the blacklist database file, constitutes a complete authorization storage system. All three reside in the production line monitoring configuration folder and share the same persistent storage characteristics.

[0035] Furthermore, saving the valid authorization information to the production line monitoring configuration folder specifically includes: After the multi-layer anti-time tampering verification of the initial activation process is passed, the production line monitoring client program obtains the verified CPU short identifier, issuance timestamp, expiration timestamp and current base time from the current activation process, serializes them into a text string according to the predefined key value, and writes them into the authorization record file; In this embodiment, after all multi-layered anti-time tampering checks in the initial activation process pass, the production line monitoring client program immediately executes the persistent storage operation of the authorization information. The production line monitoring client program retrieves four key data items from the memory variables of the current activation process: a short CPU identifier string, an integer issuance timestamp, an integer expiration timestamp, and an integer current base timestamp. Following predefined key-value pair serialization rules, the production line monitoring client program organizes these four data items into a structured text string. The serialization rule occupies one line for each data item: the first line contains the short CPU identifier string, the second line contains the decimal number string of the issuance timestamp, the third line contains the decimal number string of the expiration timestamp, and the fourth line contains the decimal number string of the current base timestamp. The production line monitoring client program calls the file write interface provided by the operating system to open the authorization record file in the production line monitoring configuration folder in overwrite mode, completely writes the serialized text string into the file, and then immediately closes the file handle to ensure complete data persistence to disk. This authorization record file becomes the sole basis for subsequent automatic verification upon device startup. The CPU short identifier is used for device binding verification, the issuance timestamp and expiration timestamp are used for validity period verification, and the current baseline timestamp serves as the initial reference point for time rollback detection.

[0036] The currently successfully activated short authorization code is appended line by line to the blacklist database file; In this embodiment, after completing the writing of the authorization record file, the production line monitoring client program immediately performs an update operation on the blacklist database. The production line monitoring client program retrieves the complete string of the currently successfully activated short authorization code from memory. This string contains five parts: CPU short hash, compressed issuance time, compressed expiration time, one-time flag, and signature. The production line monitoring client program calls the file writing interface provided by the operating system to open the blacklist database file in the production line monitoring configuration folder in append mode. The production line monitoring client program appends a newline character to the end of the file and then closes the file handle. For example, if the file already has two lines of records, the newly written short authorization code becomes the third line. This operation ensures that if the same short authorization code is used again on any subsequent device, it will be intercepted by the blacklist comparison logic, thereby achieving the control goal of one-time activation. Even if the authorization code is leaked to other devices, activation will be rejected because a record exists in the blacklist database.

[0037] Write the current reference time to the time baseline file; In this embodiment, after updating the blacklist database, the production line monitoring client program then performs a write operation on the time baseline file. The production line monitoring client program retrieves the current baseline timestamp integer from memory and converts it into a decimal string. The program then calls the file write interface provided by the operating system to open the time baseline file in the production line monitoring configuration folder in overwrite mode, writes the current baseline timestamp string to the file, and then closes the file handle. This time baseline file then becomes the reference point for performing callback detection and offset detection in the subsequent automatic boot verification process. Because it operates in overwrite mode, the file only saves the baseline timestamp from the most recent successful verification and does not accumulate historical records.

[0038] If the time validity verification passes during the automatic power-on verification process, only the last recorded timestamp in the authorization record file is updated to the latest current base time and the time baseline file is overwritten synchronously. The CPU short identifier and authorization validity information remain unchanged, including the issuance timestamp and expiration timestamp.

[0039] In this embodiment, during each subsequent automatic power-on verification process, after the production line monitoring client program completes the time validity verification and all verifications pass, the production line monitoring client program performs a partial update operation on the authorization record file. The production line monitoring client program opens the authorization record file in the production line monitoring configuration folder in read mode and reads all four lines of content into memory. The production line monitoring client program keeps the CPU short identifier string in the first line unchanged, keeps the issuance timestamp string in the second line unchanged, and keeps the expiration timestamp string in the third line unchanged, only replacing the last recorded timestamp string in the fourth line with the latest decimal number string of the current baseline timestamp. The production line monitoring client program reopens the authorization record file in overwrite mode, completely writes the updated four lines of text strings, and then closes the file handle. Simultaneously, the production line monitoring client program also synchronously overwrites the latest current baseline timestamp into the time baseline file, ensuring that the time baselines in the two files remain consistent. The CPU short identifier and authorization validity information remain unchanged throughout the entire automatic power-on verification process, only written during the initial activation, and never modified subsequently. This design ensures the uniqueness of the authorized device and the fixed validity period of the authorization, while also enabling continuous updates to the time baseline.

[0040] Furthermore, it also includes intercepting duplicate activations on the same device based on the fingerprint of the activated device when the blacklist database is missing, specifically including: After the device binding verification and multi-layer anti-time tampering verification are passed in the initial activation process, the production line monitoring client program writes the currently successfully activated short authorization code into the blacklist database. At the same time, it writes the local CPU short identifier corresponding to this activation as the activated device fingerprint into the activated device fingerprint file in the system's private user directory. In this embodiment, after the device binding verification of the initial activation process passes and all multi-layer anti-time tampering verifications pass, the production line monitoring client program performs two persistent write operations. First, the production line monitoring client program retrieves the complete string of the currently successfully activated short authorization code from memory, calls the file write interface provided by the operating system, opens the blacklist database file under the production line monitoring configuration folder in append mode, adds a newline character to the short authorization code string and writes it to the end of the file, then closes the file handle. Second, the production line monitoring client program retrieves the local CPU short identifier string corresponding to this activation from memory. This string is 8 hexadecimal characters long, obtained by the production line monitoring client program performing an MD5 hash operation on the complete serial number of the local CPU and extracting the first 8 bits. The production line monitoring client program calls the file write interface provided by the operating system, opens the activated device fingerprint file under the system's private user directory in append mode, adds a newline character to the local CPU short identifier string and writes it to the end of the file, then closes the file handle. For example, if the activated device fingerprint file has previously recorded short CPU identifiers for two different devices, the newly written local CPU short identifier will appear as the third line. This activated device fingerprint file, along with the blacklist database file, is stored in the system's private user directory and is unaffected by application uninstallation.

[0041] When the initial activation process is executed upon receiving any short authorization code, the existence or emptiness of the blacklist database is checked. If the blacklist database does not exist or its contents are empty, it is determined that the blacklist database is in a missing state. The comparison between the short authorization code and the blacklist database is no longer performed. Instead, the activated device fingerprint file is read directly, and the CPU short identifier obtained by parsing the short authorization code is compared one by one with any activated device fingerprint in the activated device fingerprint file. In this embodiment, at any subsequent moment, when the production line monitoring client program receives a short authorization code and executes the initial activation process, the production line monitoring client program first checks the existence of the blacklist database file. The production line monitoring client program calls the file access interface provided by the operating system to check if the file exists. If the file does not exist, it is determined that the blacklist database is in a missing state. If the file exists, the production line monitoring client program further reads the file size field in the file attribute information. If the file size is 0 bytes, it is also determined that the blacklist database is in a missing state. In the case of a missing blacklist database, the production line monitoring client program skips the line-by-line comparison step between the short authorization code and the blacklist database, and instead executes the fallback interception logic. The production line monitoring client program calls the file reading interface provided by the operating system to open the activated device fingerprint file in the system's private user directory in read-only mode, and reads each line of the activated device fingerprint string in the file line by line and loads it into a memory list. The production line monitoring client program then parses the received short authorization code and extracts the first part of the CPU short identifier string using hyphens as delimiters. The production line monitoring client program compares the parsed CPU short identifier with each activated device fingerprint in the memory list character by character.

[0042] If the CPU short identifier matches any activated device fingerprint in the activated device fingerprint file, it is determined that the current device has already completed its first activation and the blacklist database has been lost. Activation is directly rejected and a message is displayed indicating that the device has been activated in the past. In this embodiment, if the parsed CPU short identifier is completely identical to a line of activated device fingerprint strings in the activated device fingerprint file, it is determined that the current device has already completed its first activation in history, and the blacklist database has been lost due to formatting or manual deletion. The production line monitoring client program immediately displays the message "This device has been historically activated and cannot be reactivated" in the activation window, and directly rejects the current activation request, terminating all subsequent processes. This fallback interception mechanism ensures that even if the blacklist database file is accidentally deleted, the same device cannot be reactivated using any authorization code, thereby mitigating the security vulnerability caused by the loss of the blacklist database. After displaying the prompt message, the production line monitoring client program closes the activation window and returns to the initial state, waiting for the user's next operation.

[0043] If the CPU short identifier does not match any of the activated device fingerprints in the activated device fingerprint file, it is determined to be a new device being activated for the first time. The valid authorization information is then saved. In this way, in abnormal scenarios where the blacklist database becomes invalid due to formatting or manual clearing, the persistent activated device fingerprints of the same device using the CPU short identifier provide a fallback to prevent duplicate activation on the same device.

[0044] In this embodiment, if the parsed short CPU identifier does not match any of the activated device fingerprint strings in the activated device fingerprint file, the production line monitoring client program determines that the current device is a new device that has never been activated. The production line monitoring client program continues to execute the complete activation process, including subsequent authorization validity period verification, time verification, and saving of valid authorization information. The production line monitoring client program writes the currently successfully activated short authorization code to the blacklist database file, appends the local CPU short identifier to the activated device fingerprint file, writes the authorization information to the authorization record file, and writes the current base time to the time baseline file. Through this mechanism, in abnormal scenarios where the blacklist database becomes invalid due to formatting or manual clearing, the system provides a fallback interception capability for duplicate activation on the same machine by utilizing the persistent activated device fingerprint of the same machine's CPU short identifier, significantly improving the robustness and security of the authorization system.

[0045] Furthermore, the automatic identification of file delimiter types specifically includes: The CSV fully automatic detection engine opens the newly added CSV test file in read-only text mode and reads the first line of the file. It then scans the first line of the file character by character and counts the number of times each character appears in the line, generating a frequency statistics table. In this embodiment, the background processing thread of the CSV fully automatic detection engine retrieves a file path entry from the head of the file queue and opens the newly added CSV test file in read-only text mode. The processing thread calls the file reading interface provided by the operating system to read the first line of text content of the file and stores the string in a memory buffer. The processing thread then performs a character-by-character scan operation on the string, traversing from the first character to the last character. For each scanned character, the processing thread looks up the corresponding count in a hash map. If the character is not yet registered in the hash map, a new count is created and the count value is initialized to 1; if the character already exists in the hash map, the corresponding count value is incremented by 1. After the scan is completed, the hash map records the total number of occurrences of each different character in the string, forming a complete frequency statistics table. For example, if the first line of the file contains "device number, test result, judgment status", then the count value of the comma character is 2, and the count value of other characters is 1. The processing thread stores this frequency statistics table in memory for use in subsequent steps.

[0046] The most frequently occurring characters are selected from the frequency statistics table as candidate delimiters. These candidate delimiters are then matched against a pre-defined list of common CSV delimiters, which includes commas, tabs, semicolons, and vertical bars. In this embodiment, the processing thread extracts all characters and their corresponding occurrence counts from the frequency statistics table, and sorts all characters in descending order of occurrence count. The processing thread then extracts the top few most frequent characters from the sorted list, forming a candidate delimiter set. The maximum number of candidate delimiters is determined by a preset fixed value within the system, for example, four characters. The processing thread then matches each character in the candidate delimiter set against a preset list of common CSV delimiters. This list of common CSV delimiters is a fixed set of characters, including commas, tabs, semicolons, and vertical bars. The processing thread performs equality comparisons on each character in the candidate delimiter set with the four characters in the common CSV delimiter list, checking for any completely identical matches.

[0047] If there is a character in the candidate delimiter that exactly matches a delimiter in the list of common CSV delimiters, then that matching character is determined as the delimiter type of the file; In this embodiment, if a character in the candidate delimiter set is exactly the same as a delimiter character in the common CSV delimiter list, the processing thread immediately determines that character as the delimiter type of the newly added CSV test file. For example, if the candidate delimiter set contains a comma, and the common CSV delimiter list also contains a comma, the processing thread directly uses the comma as the delimiter type for that file. The processing thread records this delimiter type string in the file parsing parameter dictionary for use in subsequent parsing steps. This direct matching mechanism is applicable to most standard CSV files, enabling rapid delimiter determination based on a single scan of the first line, without requiring additional file reading and analysis operations, thereby improving the overall processing efficiency of the detection engine.

[0048] If no character in the candidate delimiter matches any delimiter in the list of common CSV delimiters, then read the first few lines of the file, attempt to split each line according to each candidate delimiter, count the number of fields after splitting, and select the candidate delimiter that makes the number of fields in each line consistent and has the largest number of fields as the delimiter type of the file.

[0049] In this embodiment, if none of the characters in the candidate delimiter set match any delimiter in the common CSV delimiter list, the processing thread performs a more in-depth delimiter inference process. The processing thread reopens the newly added CSV test file in read-only text mode and reads the first few lines of text, for example, the first 5 lines. The processing thread uses each candidate delimiter in the candidate delimiter set as a hypothetical delimiter and attempts to segment each line of text. For each candidate delimiter, the processing thread uses that character as the segmentation criterion to cut each line of text into several fields and counts the number of fields after segmentation for each line. The processing thread compares whether the number of fields in all lines under that candidate delimiter is consistent, i.e., all lines have the same number of fields. If a candidate delimiter makes the number of fields in all lines consistent, the processing thread then compares the number of fields generated by that candidate delimiter with those of other candidate delimiters and selects the candidate delimiter that results in the largest number of fields as the delimiter type for that file. For example, if using commas to separate each line results in 5 fields, and using tabs to separate each line results in 3 fields, and the number of fields is the same in each line separated by commas, then the processing thread will determine the comma symbol as the delimiter type. The processing thread will record the finally determined delimiter type in the file parsing parameter dictionary for use in subsequent parsing steps.

[0050] Furthermore, the execution time validity verification specifically includes: Read the saved authorization validity period information from the authorization record file. This authorization validity period information includes the issuance timestamp and the expiration timestamp. In this embodiment, after the automatic power-on verification process determines that the current device is in an activated state, the production line monitoring client program opens the authorization record file in the production line monitoring configuration folder and reads all the text content of the file in read-only mode. This authorization record file is a structured text file that stores four lines of key information written during the initial activation. The production line monitoring client program splits the file content into four independent fields according to line breaks. The program locates the second line of string, converts it to an integer type to obtain the issuance timestamp, which represents the start time of the authorization's effectiveness. The program also locates the third line of string, converts it to an integer type to obtain the expiration timestamp, which represents the end time of the authorization's validity period. The program stores these two timestamp integers in a memory variable for subsequent validity period verification. The entire reading and parsing process is completed automatically in the background without any manual intervention.

[0051] Get the current base time, compare the current base time with the expiration timestamp, and if the current base time is later than the expiration timestamp, the authorization is determined to have expired, the verification fails, and the first activation window is forcibly popped up. In this embodiment, the production line monitoring client program obtains the current reference time. The program first calls the network communication interface provided by the operating system to send a time query request to a pre-configured network time protocol server, attempting to obtain the international standard Beijing time. If the network connection is successful, the production line monitoring client program uses the timestamp returned by the server as the current reference time. If the network connection fails, the program calls the system time reading interface provided by the operating system kernel to directly read the current local system time from the system clock chip and convert it to Unix timestamp format, using this as the current reference time. The program then compares the current reference time with the read expired timestamp. If the current reference time is significantly greater than the expired timestamp, it indicates that the current time has exceeded the expiration date of the authorization, and the authorization has expired. The production line monitoring client program immediately determines that the verification failed and forcibly pops up an initial activation window on the screen, requiring the on-site operator to enter a new short authorization code to complete the reactivation. Simultaneously, the program clears the authorization information in memory to prevent subsequent processes from misusing expired authorizations.

[0052] If the current reference time is not later than the expired timestamp, then the last recorded timestamp in the time baseline file is read, the current reference time is compared with the last recorded timestamp, and the absolute difference between the current reference time and the last recorded timestamp is calculated. In this embodiment, if the current base time is not greater than the expiration timestamp (i.e., the current base time is less than or equal to the expiration timestamp), it indicates that the authorization is still valid, and the production line monitoring client program continues to perform subsequent verifications. The production line monitoring client program reads the time baseline file in the production line monitoring configuration folder. This file is stored in plain text format and contains only an integer string. The production line monitoring client program converts this string to an integer type to obtain the previous record timestamp saved during the last successful verification. The production line monitoring client program calculates the absolute difference between the current base time and the previous record timestamp, that is, subtracting the smaller time value from the larger time value to obtain a non-negative integer difference. This absolute difference reflects the magnitude of the change in system time since the last successful verification.

[0053] If the absolute difference exceeds the preset maximum allowable offset duration, the system time is determined to have an abnormal offset, the verification fails, and the first activation window is forcibly popped up. In this embodiment, the production line monitoring client program compares the calculated absolute difference with a preset fixed threshold. This fixed threshold is 2,592,000 seconds, corresponding to the total number of seconds in 30 calendar days. If the calculated absolute difference is greater than 2,592,000 seconds, it means that the system time has jumped significantly for more than a month since the last successful verification. Such a large time change does not conform to the normal operating pattern of the equipment and is very likely caused by abnormal offset due to malicious human intervention in adjusting the system time. The production line monitoring client program immediately determines that the system time has an abnormal offset, and the verification fails. The production line monitoring client program forcibly pops up an initial activation window on the screen, requiring the on-site operator to enter a new short authorization code to complete the reactivation, while clearing the authorization information in memory.

[0054] If the absolute difference does not exceed the preset maximum allowable offset duration, the time validity check is deemed to have passed, the current base time is updated to the new last recorded timestamp and written to the time baseline file, and the authorization check continues.

[0055] In this embodiment, if the calculated absolute difference is less than or equal to 2,592,000 seconds, the production line monitoring client program determines that the time validity check has passed. The production line monitoring client program writes the current base time value to the time baseline file in the production line monitoring configuration folder in overwrite mode, replacing the original old value, so that the file always stores the latest successful verification time record. At the same time, the production line monitoring client program opens the authorization record file in overwrite mode, keeping the CPU short identifier string in the first line unchanged, keeping the issuance timestamp string in the second line unchanged, keeping the expiration timestamp string in the third line unchanged, and only replacing the last recorded timestamp string in the fourth line with the latest decimal number string of the current base timestamp. After completing the write operation, the production line monitoring client program marks the authorization verification status as passed, continues to execute the subsequent CSV automatic detection engine startup process, and directly enters the system main interface.

[0056] The above description is merely an embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the claims of the present invention.

Claims

1. An automatic detection and monitoring system for CSV in industrial production lines based on CPU short hashing, characterized in that, include: The administrator-authorized generation program is used to obtain the CPU serial number of the target device, perform a first one-way hash operation on the CPU serial number, and extract bits of a predetermined length as a short CPU identifier. Perform Base64 compression encoding on the authorization issuance timestamp and authorization expiration timestamp respectively to generate compressed issuance timestamp and compressed expiration times; The CPU short identifier, compressed issuance time, compressed expiration time, and preset one-time authorization flag are concatenated into the original authorization string; Perform a second one-way hash operation on the original authorization string and extract bits of a predetermined length as the authorization signature. Append the authorization signature to the end of the original authorization string to generate a short authorization code. The production line monitoring client program performs dual-branch authorization verification on received short authorization codes. This includes an initial activation process and an automatic startup verification process. The initial activation process involves reading the blacklist database corresponding to the activated authorization code from the system's private user directory, verifying the device binding relationship based on the short authorization code and the blacklist database, performing multi-layer anti-time tampering verification after successful device binding verification, writing the successfully activated short authorization code to the blacklist database after successful anti-time tampering verification, and saving the valid authorization information to the production line monitoring configuration folder in the system's private user directory. The automatic startup verification process skips the blacklist database verification and directly performs CPU short identifier consistency comparison and time validity verification. After the dual-branch authorization verification passes, the program directly enters the main interface. The background polls the preset monitoring folder, automatically identifies and parses newly added CSV test files, automatically compares the detection values ​​with standard values, and accumulates the total number of tests, the number of good products, and the number of defective products in real time, generating a test log CSV file. The production line monitoring configuration folder is located in the system user's private directory, independent of the application installation directory. Uninstalling the application will not delete this production line monitoring configuration folder, which contains at least the authorization record file, the blacklist database file, and the time baseline file.

2. The industrial production line CSV automatic detection and monitoring system based on CPU short hash as described in claim 1, characterized in that, The initial activation process specifically includes: When the production line monitoring client program detects that there is no valid authorization record file in the production line monitoring configuration folder, it pops up a manual activation window and obtains the received short authorization code. It then reads the blacklist database corresponding to the activated authorization code from the blacklist database file and compares the short authorization code with the blacklist database. If the short authorization code exists in the blacklist database, activation is rejected; if it does not exist in the blacklist database, the short authorization code is parsed to extract the CPU short identifier, and the local interface is called to read the local CPU serial number and generate the local CPU short identifier according to the same first one-way hash operation rule, and then the comparison is performed to verify the device binding relationship. After the device binding verification is successful, the compressed issuance time and compressed expiration time in the short authorization code are parsed and the current base time is obtained to perform multi-layer anti-time tampering verification; After the anti-time tampering verification passes, the currently successfully activated short authorization code is written to the blacklist database and the valid authorization information is saved to the production line monitoring configuration folder. Then, the main interface is accessed directly.

3. The industrial production line CSV automatic detection and monitoring system based on CPU short hash as described in claim 2, characterized in that, The implementation of multi-layer anti-time tampering verification specifically includes: Parse the compressed issuance time and compressed expiration time in the short authorization code and decode them to obtain the issuance timestamp and expiration timestamp. At the same time, try to obtain the standard time through the network as the base timestamp. If the network connection is successful, use the base timestamp as the current base time. If the network connection fails, read the local system time as the current base time. The current base time is compared with the issuance timestamp. If the current base time is earlier than the issuance timestamp, it is determined that the system time has been tampered with before the authorization took effect. The verification fails and activation is directly rejected. Provided that the current base time is not earlier than the issuance timestamp, read the last record timestamp saved when the last successful verification was performed in the authorization record file, compare the current base time with the last record timestamp, and if the current base time is earlier than the last record timestamp, it is determined that the system time has been manually rolled back, and the verification is notified that it has failed and activation is directly rejected. Provided that the current reference time is not earlier than the last recorded timestamp, calculate the absolute difference between the current reference time and the last recorded timestamp. If the absolute difference exceeds the preset maximum allowable offset duration, it is determined that the system time has an abnormal offset, and the verification fails and activation is directly rejected; otherwise, the verification passes, the current reference time is updated to the new last recorded timestamp and written to the time baseline file.

4. The automatic detection and monitoring system for industrial production line CSV based on CPU short hash as described in claim 1, characterized in that, The automatic power-on verification process specifically includes: When the production line monitoring client program detects a valid authorization record file in the production line monitoring configuration folder, it determines that the system is activated. Read the authorization record file and extract the saved CPU short identifier and authorization validity period information from it; Skip the blacklist database verification step and directly perform CPU short identifier consistency comparison and time validity verification. After the verification is successful, directly enter the main interface.

5. The industrial production line CSV automatic detection and monitoring system based on CPU short hash as described in claim 1, characterized in that, After the dual-branch authorization verification passes, the user is directly taken to the main interface. The background system polls the preset monitoring folders and automatically identifies and parses newly added CSV test files, specifically including: The background starts a fully automatic CSV detection engine to provide a file change notification interface to recursively listen to the monitoring folder specified by the user. When a new CSV test file is created in the monitoring folder, the file path and file extension of the new CSV test file are obtained and a queue of files to be processed is generated. Retrieve the file path from the pending file queue, open the newly added CSV test file in read-only mode, and read the first few bytes. Automatically identify the file encoding format by analyzing the byte order mark or byte frequency distribution. At the same time, read the first line of the file and automatically identify the file delimiter type by detecting the frequency of delimiter occurrences. Generate file parsing parameters containing the encoding format and delimiter type. The newly added CSV test file is parsed with the correct encoding format and delimiter type based on the file parsing parameters, so as to load it into a two-dimensional data table structure in memory, and locate the target cell according to the preset row index and column index, and extract the string content in the target cell as a hexadecimal detection value. Read the standard CFG hexadecimal value that the user has pre-imported and stored in the configuration file, and compare the hexadecimal detection value with the standard CFG hexadecimal value. If the two are the same, it is judged as a good product and the good product counter is incremented by one. If they are not the same, it is judged as a defective product and the defective product counter is incremented by one. At the same time, the total test counter is incremented by one, generating real-time statistical results including the total number of tests, the number of good products and the number of defective products. Open the CSV file named with the current date in the independent directory in append mode, write the file name of this test, detection time, hexadecimal detection value, comparison result and cumulative statistics into a single line, close the file handle, and generate a test log CSV file.

6. The industrial production line CSV automatic detection and monitoring system based on CPU short hash as described in claim 1, characterized in that, The production line monitoring configuration folder specifically includes: Create an authorization record file in the production line monitoring configuration folder to store the valid authorization information written during the first activation process or the last successful verification. This file includes the CPU short identifier, issuance timestamp, expiration timestamp, and last record timestamp. Create a blacklist database file in the production line monitoring configuration folder to store all short authorization codes that have been successfully activated. Each line stores one short authorization code. This blacklist database file is retained even after the local application is uninstalled. Create a time baseline file in the production line monitoring configuration folder to store the current base time obtained after successful network connection or after local system time calibration during the last successful verification.

7. The industrial production line CSV automatic detection and monitoring system based on CPU short hash as described in claim 2, characterized in that, The step of saving the valid authorization information to the production line monitoring configuration folder specifically includes: After the multi-layer anti-time tampering verification of the initial activation process is passed, the production line monitoring client program obtains the verified CPU short identifier, issuance timestamp, expiration timestamp and current base time from the current activation process, serializes them into a text string according to the predefined key value, and writes them into the authorization record file; The currently successfully activated short authorization code is appended line by line to the blacklist database file; Write the current reference time to the time baseline file; If the time validity verification passes during the automatic power-on verification process, only the last recorded timestamp in the authorization record file is updated to the latest current base time and the time baseline file is overwritten synchronously. The CPU short identifier and authorization validity information remain unchanged, including the issuance timestamp and expiration timestamp.

8. The industrial production line CSV automatic detection and monitoring system based on CPU short hash as described in claim 2, characterized in that, This also includes blocking duplicate activations on the same device based on the fingerprint of the activated device when the blacklist database is missing, specifically including: After the device binding verification and multi-layer anti-time tampering verification are passed in the initial activation process, the production line monitoring client program writes the currently successfully activated short authorization code into the blacklist database. At the same time, it writes the local CPU short identifier corresponding to this activation as the activated device fingerprint into the activated device fingerprint file in the system's private user directory. When the initial activation process is executed upon receiving any short authorization code, the existence or emptiness of the blacklist database is checked. If the blacklist database does not exist or its contents are empty, it is determined that the blacklist database is in a missing state. The comparison between the short authorization code and the blacklist database is no longer performed. Instead, the activated device fingerprint file is read directly, and the CPU short identifier obtained by parsing the short authorization code is compared one by one with any activated device fingerprint in the activated device fingerprint file. If the CPU short identifier matches any activated device fingerprint in the activated device fingerprint file, it is determined that the current device has already completed its first activation and the blacklist database has been lost. Activation is directly rejected and a message is displayed indicating that the device has been activated in the past. If the CPU short identifier does not match any of the activated device fingerprints in the activated device fingerprint file, it is determined to be a new device being activated for the first time. The valid authorization information is then saved. In this way, in abnormal scenarios where the blacklist database becomes invalid due to formatting or manual clearing, the persistent activated device fingerprints of the same device using the CPU short identifier provide a fallback to prevent duplicate activation on the same device.

9. The industrial production line CSV automatic detection and monitoring system based on CPU short hash as described in claim 5, characterized in that, The automatic identification of file delimiter types specifically includes: The CSV fully automatic detection engine opens the newly added CSV test file in read-only text mode and reads the first line of the file. It then scans the first line of the file character by character and counts the number of times each character appears in the line, generating a frequency statistics table. The most frequently occurring characters are selected from the frequency statistics table as candidate delimiters. These candidate delimiters are then matched against a pre-defined list of common CSV delimiters, which includes commas, tabs, semicolons, and vertical bars. If there is a character in the candidate delimiter that exactly matches a delimiter in the list of common CSV delimiters, then that matching character is determined as the delimiter type of the file; If no character in the candidate delimiter matches any delimiter in the list of common CSV delimiters, then read the first few lines of the file, attempt to split each line according to each candidate delimiter, count the number of fields after splitting, and select the candidate delimiter that makes the number of fields in each line consistent and has the largest number of fields as the delimiter type of the file.

10. The industrial production line CSV automatic detection and monitoring system based on CPU short hash as described in claim 6, characterized in that, The execution time validity check specifically includes: Read the saved authorization validity period information from the authorization record file. This authorization validity period information includes the issuance timestamp and the expiration timestamp. Get the current base time, compare the current base time with the expiration timestamp, and if the current base time is later than the expiration timestamp, the authorization is determined to have expired, the verification fails, and the first activation window is forcibly popped up. If the current reference time is not later than the expired timestamp, then the last recorded timestamp in the time baseline file is read, the current reference time is compared with the last recorded timestamp, and the absolute difference between the current reference time and the last recorded timestamp is calculated. If the absolute difference exceeds the preset maximum allowable offset duration, the system time is determined to have an abnormal offset, the verification fails, and the first activation window is forcibly popped up. If the absolute difference does not exceed the preset maximum allowable offset duration, the time validity check is deemed to have passed, the current base time is updated to the new last recorded timestamp and written to the time baseline file, and the authorization check continues.