PCB bar code adaptive analysis and standardized trace code generation method

CN122616583BActive Publication Date: 2026-11-03LASPIO INTELLIGENT EQUIP (TIANJIN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611104221.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-07-24
Publication Date
2026-11-03
Estimated Expiration
2046-07-24

AI Technical Summary

Technical Problem

In existing technologies, PCB barcode parsing rules rely on fixed starting positions and lengths, leading to frequent manual configuration and high error rates. This makes it impossible to adapt to changes in customer barcode formats and affects production quality.

Method used

By adapting to changes in barcode format, semantic parsing rules are generated. The mapping scheme is verified using production work order information, and the correspondence between semantic fields is automatically generated, reducing the need for manual configuration.

Benefits of technology

It achieves adaptive parsing of barcode formats, reduces the risk of human error, and ensures the stability and reliability of the entire traceability system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122616583B_ABST
    Figure CN122616583B_ABST
Patent Text Reader

Abstract

The application provides a PCB barcode adaptive analysis and standardized traceability code generation method, relates to the barcode data processing technical field in PCB production and manufacturing, collects original barcode samples and completes character segmentation, the semantic field set covers customer material number, cycle code, serial number, panel row number and column number, matches the corresponding semantic field of each character segment, generates exclusive semantic analysis rules containing field positioning mode and stores them in rule library for reuse. When scanning the code on the production line, call the analysis rules to extract the field value, and splice the unified standardized traceability code in the specified order. The scheme can rely on work order, panel barcode, work calendar and multi-layer verification of pin process parameters to complete field semantic judgment, match pre-hole name characteristics to optimize candidate labels, and correct errors in closed loop after equipment actual measurement data, adaptively analyze various customer non-standard barcode formats, solve the problem of chaotic PCB barcode format and difficult unified analysis, and realize fast barcode analysis and accurate whole-process traceability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of barcode data processing technology in PCB manufacturing, specifically relating to a method for adaptive parsing of PCB barcodes and generation of standardized traceability codes. Background Technology

[0002] During the PCB pin manufacturing process, the original barcode formats printed or affixed on the surface of PCBs supplied by different customers vary. For example, some customers use the format "customer part number-cycle code-serial number," others use "customer part number-batch number-serial number-panel number," and still others use a long string of pure numbers without separators. To achieve end-to-end traceability, the production line needs to convert these heterogeneous original barcodes into standardized internal traceability codes.

[0003] Currently, the industry generally uses a method of manually pre-configuring fixed parsing rules to achieve the above conversion. Specifically, after receiving a barcode sample from a new customer, engineers manually analyze its format, determine the starting character position and character length of each semantic field in the barcode, and then manually fill these position parameters into the equipment's rule configuration table. During production line operation, the equipment, based on this configuration table, extracts the corresponding fields from the original barcode according to the fixed starting position and fixed length, and then concatenates them into a standardized traceability code according to a preset template.

[0004] The above method has the following technical problems: the parsing rules rely entirely on the fixed starting position and fixed length of the fields. When a customer adjusts the character length of a field in the barcode due to version upgrades or design changes, the starting position of all fields in the barcode will shift, and all the original fixed position parameters will become invalid. Engineers must re-analyze the new format, recalculate the starting position and length of each field, and manually update the configuration table. This frequent manual reconfiguration is not only inefficient, but also highly susceptible to errors in human calculation, leading to incorrect traceability information association for the entire batch of PCBs and causing serious production quality accidents.

[0005] Therefore, there is an urgent need for a PCB barcode parsing and traceability method that can adapt to changes in barcode format, reduce repetitive manual configuration, and provide verifiable parsing results. Summary of the Invention

[0006] In view of the above-mentioned defects or deficiencies in the existing technology, a method for adaptive parsing and standardized traceability code generation of PCB barcodes is provided, which is used to convert original PCB barcodes of different formats into standardized traceability codes of a unified format, including the following steps: Obtain the original barcode sample to be configured; The original barcode sample is segmented to obtain multiple character segments; Determine the semantic field corresponding to each character segment. The semantic field is selected from a preset set of semantic fields. The set of semantic fields includes at least the customer part number, cycle code, serial number, panel row number, and panel column number. Based on the determined correspondence between each character segment and semantic field, a semantic parsing rule for the current barcode format is generated, and the semantic parsing rule records the positioning method of each semantic field; Obtain the original PCB barcode to be parsed on the production line, and extract the field values ​​corresponding to each semantic field from the original barcode using the semantic parsing rules; The extracted field values ​​are combined according to a preset field combination order to generate a standardized traceability code.

[0007] According to the technical solution provided in this application, determining the semantic field corresponding to each character segment includes the following steps: For each character segment, generate at least two candidate semantic tags, combine them to form multiple candidate mapping schemes, and each candidate mapping scheme records a correspondence between each character segment and each semantic field; Obtain the production work order information for the current production line, wherein the production work order information includes at least the in-plant part number currently being produced online; The production work order information is used to verify each candidate mapping scheme, the confidence score of each candidate mapping scheme is calculated, and the candidate mapping scheme with the highest confidence score is selected as the correspondence between the character segment and the semantic field. The initial confidence score of each candidate mapping scheme is the same preset base score; the verification includes: if the character content of the character segment marked as the customer part number in a candidate mapping scheme is consistent with the factory part number, then the confidence score of the candidate mapping scheme is increased.

[0008] According to the technical solution provided in this application, when the PCB to which the original barcode sample belongs is a sub-board on a panel, and the original barcode of at least another sub-board on the same panel is obtained, the step of verifying each candidate mapping scheme using the production work order information further includes the following steps: The original barcodes of each sub-board on the same panel are segmented in the same way, and the contents of the corresponding character segment of each sub-board are compared segment by segment. If each sub-board contains a character segment with sequentially increasing content, and the content of the remaining character segments is exactly the same, then the confidence score of the candidate mapping scheme that labels the character segment with sequentially increasing content as the row number or column number of the panel is increased. If the original barcodes of other sub-boards on the same panel are not obtained, skip this step.

[0009] According to the technical solution provided in this application, the verification of each candidate mapping scheme using the production work order information further includes the following steps: When a candidate mapping scheme contains a character segment marked as a periodic code, the character content of the character segment marked as a periodic code is extracted as a candidate periodic code, and the candidate production week is parsed out. The candidate production weeks are compared with preset work calendar data, which records the range of valid weeks and the number of workdays each week. If the candidate production week exceeds the range of valid weeks, or if the date corresponding to the candidate production week is a non-working day, then the confidence score of the candidate mapping scheme will be reduced.

[0010] According to the technical solution provided in this application, after selecting the candidate mapping scheme with the highest confidence score as the correspondence between the character segment and the semantic field, the following steps are also included: For each character segment with a known correspondence in the candidate mapping scheme with the highest confidence score, identify the character type of the characters in each character segment and count the character length of each character segment; The positioning method of each semantic field in the semantic parsing rule is recorded as: matching strings whose character type is consistent with the character type identified by the corresponding character segment and whose character length is consistent with the character length counted by the corresponding character segment; Store the semantic parsing rules that record the positioning method into the rule base; When the original barcode sample to be configured is obtained again, it is first matched with the semantic parsing rules already in the rule base. If the match is successful, the matched semantic parsing rule is directly called, skipping the steps of generating multiple candidate mapping schemes and confidence scores.

[0011] According to the technical solution provided in this application, after verifying each candidate mapping scheme using the production work order information, if at least two candidate mapping schemes have confidence scores exceeding a preset threshold and score differences less than a preset difference, the following steps are further included: From each candidate mapping scheme with the current score, extract the character content of the character segment marked as customer part number, and use it as the candidate customer part number corresponding to each candidate mapping scheme; Obtain the preset pin insertion process parameters of the current production work order from the production work order information. The pin insertion process parameters include the pin force range and the pin height range. For each of the candidate customer part numbers, the standard pin insertion process parameters corresponding to the candidate customer part number are queried from the process database; The pin insertion process parameters preset in the production work order are compared with the standard pin insertion process parameters corresponding to each candidate customer part number. The candidate mapping scheme corresponding to the candidate customer part number whose standard pin insertion process parameters match the pin insertion process parameters preset in the production work order is selected as the final mapping scheme.

[0012] According to the technical solution provided in this application, after selecting the candidate mapping scheme as the final mapping scheme and loading the pin insertion process parameters according to the customer part number corresponding to the final mapping scheme for production, the following steps are also included: During the pin insertion process, the actual pin insertion force and actual pin insertion height are continuously acquired from the pin insertion equipment. The actual pin force value is compared with the standard force value range in the currently applied pin process parameters, and the actual pin height is compared with the standard height range in the currently applied pin process parameters. If, during a series of preset number of pin insertion actions, the actual pin force value deviates from the median of the standard force value range by more than a first preset ratio, and the actual pin height deviates from the median of the standard height range by more than a second preset ratio, then it is determined that the currently applied pin process parameters do not match the current PCB. Exclude the currently used mapping scheme from the candidate mapping schemes, reselect the candidate mapping scheme with the highest confidence score from the remaining candidate mapping schemes, and reload the pin insertion process parameters according to the customer part number corresponding to the reselected candidate mapping scheme.

[0013] According to the technical solution provided in this application, segmenting the original barcode sample to obtain multiple character segments includes the following steps: Traverse each character in the original barcode sample, identify the character type of each character, and generate a character type sequence of the original barcode sample. The character types include at least letter type, number type, and symbol type. In the character type sequence, the positions of adjacent characters where the character type changes are identified as candidate segmentation points; Retrieve the segmented records of the stored historical barcode samples, count the frequency of occurrence of the character segment length in each segmented record, and select the multiple character segment lengths with the highest frequency of occurrence to form the preferred segment length combination for the current barcode format; Using the preferred segment length combination as a constraint, candidate segment points that satisfy the preferred segment length combination are selected from the candidate segment points and used as the final segment points; The original barcode sample is divided into multiple character segments based on the final segmentation points.

[0014] According to the technical solution provided in this application, when there are no adjacent character positions in the character type sequence where the character type changes, the step of segmenting the original barcode sample to obtain multiple character segments further includes the following steps: Obtain the preset allowed character length range for each semantic field in the semantic field set. The allowed character length range records the minimum and maximum character lengths of the character segment corresponding to the semantic field when it appears in the barcode. For the original barcode sample, enumerate all the partitioning schemes that divide the original barcode sample into multiple character segments. The number of character segments is consistent with the number of semantic fields in the semantic field set. The character segments divided in each partitioning scheme are arranged in the order of their appearance in the original barcode. For each partitioning scheme, verify one by one whether the character length of each character segment in the partitioning scheme falls within the allowed character length range of at least one semantic field in the semantic field set; A partitioning scheme in which the character length of each segment falls within the allowed character length range of at least one semantic field is taken as a candidate partitioning scheme, and multiple character segments are obtained based on the candidate partitioning scheme.

[0015] According to the technical solution provided in this application, before generating at least two candidate semantic tags for each character segment, the method further includes: Obtain the list of holes to be inserted on the current PCB board, extract the hole names from the hole list, identify the naming format characteristics of the hole names, and use them as the hole name pattern for the current PCB. Retrieve historical production records with the same or similar hole name patterns from the traceability database, and extract the character composition features of the customer part number corresponding to the historical production record and the original barcode corresponding to the customer part number; Based on the character composition features, the matching priority between each character segment and each semantic field is adjusted so that character segments that conform to the character composition features are preferentially labeled as the corresponding semantic fields; the priority of character segments that do not conform to the character composition features being labeled as the corresponding semantic fields is reduced, or candidate semantic tags corresponding to character segments that do not conform to the character composition features are excluded.

[0016] Compared with the prior art, the beneficial effects of this application are as follows: First, the parsing rules no longer rely on fixed start positions and fixed lengths, exhibiting format adaptability: By segmenting the original barcode and establishing mapping relationships with semantic fields, semantic parsing rules for record positioning are generated. When the length of a field in a customer's barcode changes, as long as the positioning method of that field (such as separator order, character type characteristics, etc.) remains unchanged, the generated semantic parsing rules remain valid, eliminating the need for manual reconfiguration. This fundamentally solves the problem of all rules failing due to changes in field length in existing technologies.

[0017] Second, the configuration process shifts from manual numerical calculations to system-assisted semantic specification, reducing the risk of human error. Existing technologies require engineers to precisely calculate the start position and length of each field, which is highly prone to errors. This application only needs to determine the correspondence between each character segment and the semantic field, without involving specific bit calculations, making the operation more intuitive and significantly reducing the probability of errors.

[0018] Third, the generation of standardized traceability codes is decoupled from the original barcode format, facilitating end-to-end traceability. Original barcodes of different formats are uniformly converted into internal standardized traceability codes. Subsequent processes such as process matching, pin batch association, and fault tracing all use this standard code, shielding against external barcode format differences and making the traceability system more stable and reliable. Attached Figure Description

[0019] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 A flowchart illustrating the steps of the PCB barcode adaptive parsing and standardized traceability code generation method provided in this application; Figure 2 A schematic diagram showing the loading station of the PCB board and the installation position of the barcode scanner provided in this application; The text labels in the image represent: 1. Material loading station; 2. Barcode scanner. Detailed Implementation

[0020] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0021] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0022] As mentioned in the background section, this application proposes a method for adaptive parsing of PCB barcodes and generation of standardized traceability codes. This method converts raw PCB barcodes of different formats into standardized traceability codes of a unified format. Figure 1 As shown, it includes the following steps: S1. Obtain the original barcode sample to be configured; S2. The original barcode sample is segmented to obtain multiple character segments; S3. Determine the semantic field corresponding to each character segment. The semantic field is selected from a preset set of semantic fields. The set of semantic fields includes at least the customer part number, cycle code, serial number, panel row number, and panel column number. S4. Based on the determined correspondence between each character segment and semantic field, generate semantic parsing rules for the current barcode format. The semantic parsing rules record the positioning method of each semantic field. S5. Obtain the original PCB barcode to be parsed on the production line, and extract the field values ​​corresponding to each semantic field from the original barcode using the semantic parsing rules. S6. Combine the extracted field values ​​according to the preset field combination order to generate a standardized traceability code.

[0023] Specifically, this method is used to convert raw PCB barcodes of different formats into standardized traceability codes of a unified format. This method can be deployed in an industrial control computer on a pin insertion production line. The industrial control computer is connected to the barcode scanner 2, HMI touchscreen, PLC controller, and MES server at loading station 1 via an industrial Ethernet network. The following uses a specific barcode sample as an example to illustrate the complete execution process of this implementation method step by step.

[0024] Step S1 is explained in detail as follows: When a new customer's PCB product is introduced to the production line, the engineer takes a sample board and places it at loading station 1 (e.g., ...). Figure 2 The scanning area is shown in the diagram. The HMI interface of the industrial control computer has a "Sample Acquisition" button. After the engineer clicks this button, the industrial control computer sends a trigger command to barcode scanner 2 via RS232 serial port. This command is a hexadecimal byte sequence "02 00 54 52 49 47 03". Upon receiving the command, barcode scanner 2 starts laser scanning, reads the barcode image on the PCB surface, and its internal decoding chip parses the image into a string, returning it to the industrial control computer via serial port. The industrial control computer reads data from the serial port data receive buffer, using the carriage return and line feed character "0D 0A" as the end marker for a data frame, and extracts the barcode string from the buffer. Then, the industrial control computer reads the system real-time clock to obtain the current date and time as the acquisition timestamp, and simultaneously obtains the operator's employee ID through the current HMI login session. The industrial control computer writes these three pieces of data—the barcode string, the acquisition timestamp, and the operator's employee ID—into the sample storage table of the local SQLite database using a database insert command. The table, named SampleStorage, contains four fields: a sample number (auto-incrementing integer), barcode content (text), collection time (text), and operator ID (text). For example, the barcode content field value written this time is "82550202217243466047000158". After successful writing, the original barcode sample to be configured is retrieved.

[0025] Step S2 is detailed as follows: The industrial control computer queries the barcode content field of the latest record from the SampleStorage table and reads it into a string variable in memory. Then, it calls the segmentation module. The segmentation module first reads a list of preset delimiters from the industrial control computer's local configuration file delimiter.conf. This list contains five characters: hyphen "-", underscore "_", period ".", forward slash " / ", and space " ". The module iterates through each character of the original barcode string, from the first character to the last character, comparing each character with one of the five characters in the delimiter list. If the current character is the same as one of the delimiters, the position index of that character in the string is recorded, starting from index 0. After the iteration is complete, a list of delimiter positions is obtained. If this list is not empty, it means that there are delimiters in the barcode, and delimiter segmentation is used. First, an empty string list is created to store the segmentation results. A starting position variable is set with an initial value of 0. The process involves sequentially retrieving each position value from the delimiter position list, calling the string truncation function, and extracting the character from the current starting position up to the character before that position. This extracted substring is then added to the result list as a segment. The starting position is then updated to the current position plus 1, effectively skipping that delimiter. After processing all delimiter positions, the process continues from the last starting position to the end of the string, adding this last segment to the result list. If the delimiter position list is empty, it means the barcode does not contain any of the five delimiters mentioned above, and equal-width segmentation is used. The industrial control computer reads preset segment length combinations from another configuration file, segment.conf. This combination is a set of integers, such as "8,6,12", indicating that the first segment has a length of 8, the second has a length of 6, and the third has a length of 12. An empty string list is created, with the starting position set to 0. Each preset length value is sequentially retrieved, and the ending position is obtained by adding the current length value to the starting position. If the ending position exceeds the total string length, the total length is used. The substring is then extracted from the starting position to the ending position, and added to the result list as a segment. Then, the start position is updated to the end position. After processing all preset length values, if the start position is still less than the total string length, the remaining characters are added to the result list as a single character segment. For the barcode content "82550202217243466047000158", since there is no delimiter, equal-width segments are used with preset lengths of 8, 6, and 12, resulting in three character segments: "82550202", "217243", and "466047000158". These are stored sequentially in a string array, denoted as the character segment list.

[0026] Step S3 is detailed as follows: The industrial control computer sends the character segment list to the browser interface of the HMI touchscreen via WebSocket communication. The left side of the HMI interface uses JavaScript to dynamically generate rectangular display boxes equal to the number of character segments. Each box displays the content of one character segment, and the "data-index" attribute of the box records the sequential number of that character segment in the list, starting from 0. The right side of the HMI interface has five hard-coded rectangular display boxes, corresponding to five semantic fields in the preset semantic field set: customer part number, cycle code, serial number, panel row number, and panel column number. The "data-field" attribute of each box records the corresponding semantic field enumeration value. Specifically, the customer part number is an internally unique identification code assigned by the customer to this PCB product model; the cycle code is a code containing the production year and week, commonly a four-digit number such as "2435" representing the 35th week of year 24; the serial number is the serial number of each PCB within the same batch and part number; and the panel row number and panel column number identify the row and column positions of the PCB sub-board on the panel, respectively. The operator operates via the touchscreen: pressing and holding a character segment box on the left, dragging it to a semantic field box on the right, and then releasing the finger. The JavaScript program on the HMI interface listens for touch events, recording the sequence number of the dragged character segment box at the start of the touch and retrieving the "data-field" attribute value of the semantic field box below the finger at the end of the touch. If the finger happens to be above a semantic field box, the character segment sequence number and semantic field name are stored as a pair of associated data in a JavaScript object. The operator repeats this operation for all character segments and then clicks the "Confirm" button on the interface. The HMI converts this JavaScript object into a JSON string and sends it back to the industrial control computer (ICC) via WebSocket. Upon receiving the JSON string, the ICC uses a JSON parsing library to parse it into a collection of key-value pairs. The key is the character segment sequence number, and the value is the semantic field name. The ICC creates a mapping table data structure of type key-value pair list, storing the number and name for each pair for later use.

[0027] Step S4 is elaborated as follows: Generate semantic parsing rules for the current barcode format. The industrial control computer connects to the local SQLite database and opens the rule base table RuleBase. This table contains five fields: an auto-incrementing integer primary key RuleID, a text type SemanticField, an integer type PositionIndex, an integer type SegmentLength, and a text type CharTypePattern. The industrial control computer iterates through each record in the mapping table established in step S3. For each record, it obtains the character segment sequence number and the semantic field name. Based on the number, it retrieves the corresponding character segment string from the character segment list. It calculates the number of characters contained in the string to obtain the length value. Then, it creates an empty character type pattern string. It extracts each character in the character segment one by one, converts it to an ASCII code integer value, and judges it: if the ASCII code is between 48 and 57, it appends the letter "D" to the pattern string to represent a number; if it is between 65 and 90 or between 97 and 122, it appends the letter "L" to represent a letter; if it is any other value, it appends the letter "S" to represent a symbol. After iterating through all characters, a pattern string consisting of "D", "L", and "S" is obtained. For example, the pattern string for the character segment "82550202" is "DDDDDDDD". Finally, the industrial control computer executes an SQL insert statement to write the generated rule data into the RuleBase table: the SemanticField field is filled with the name of the current semantic field, PositionIndex is filled with the character segment sequence number, SegmentLength is filled with the character length value, and CharTypePattern is filled with the pattern string. RuleID is automatically generated by the database. After iterating through all records in the mapping table, all complete semantic parsing rules for this barcode format are stored in the rule base.

[0028] Step S5 is detailed as follows: After entering mass production, each PCB arrives at the barcode scanning station. Barcode scanner 2 automatically reads the barcode and sends the string to the industrial control computer in real time. Upon receiving the barcode string, the industrial control computer queries the rule base in ascending order by the PositionIndex field to retrieve all rule records corresponding to the current customer. Then, an empty dictionary structure is created to store the extraction results. An integer variable is set as the current scan position, initially set to 0. Each rule record is retrieved sequentially, and the SegmentLength field value of that record is read as the current extraction length (len). Starting from the current scan position, len characters are extracted as a substring, and this substring is used as the field value corresponding to the SemanticField field of that record, stored in the dictionary with the semantic field name as the key and the substring as the value. Then, the current scan position is incremented by len. This process is repeated until all rule records have been processed. For example, for the barcode "82550202217243466047000158", the lengths of the three rules are 8, 6, and 12 respectively. The first time, 8 bits are extracted from position 0 to get "82550202" which corresponds to the customer part number. The second time, 6 bits are extracted from position 8 to get "217243" which corresponds to the period code. The third time, 12 bits are extracted from position 14 to get "466047000158" which corresponds to the serial number.

[0029] Step S6 is elaborated as follows: The extracted field values ​​are combined according to a preset field combination order to generate a standardized traceability code. The industrial control computer reads the preset field combination template from the system configuration file format.conf. The template data contains two parts: an ordered list of semantic field names, such as [customer part number, cycle code, serial number], and a field separator character, such as a hyphen "-". The industrial control computer retrieves the field value corresponding to each name from the dictionary in step S5 according to the order of the field name list. An empty string is created as the result. The field name list is traversed; for each field name, the field value is retrieved and appended to the end of the result string. If the field is not the last field in the list, the separator character is appended after the field value. After the traversal is complete, the result string is the standardized traceability code. For example, if the field values ​​are "82550202", "217243", and "466047000158" in sequence, and the concatenation operator is "-", the result is "82550202-217243-466047000158". The industrial control computer associates this standardized traceability code with the current PCB's internal unique identifier ID and stores it in the TraceRecord table of the traceability database for subsequent process procedures and quality traceability.

[0030] The technical principle of this implementation is as follows: The barcode parsing rules are changed from the existing method of specifying a fixed starting character position and a fixed truncation length to recording the sequential position, length, and character type pattern of the character segments corresponding to each semantic field. When a customer adjusts the length of a field in the barcode, as long as the relative arrangement and separation method of each field remain unchanged, the system only needs to re-collect samples and reconfirm the correspondence to automatically generate new length and pattern parameters. No manual calculation of any bit offsets is required, thus avoiding the problem of the entire configuration failing due to changes in field length.

[0031] In a preferred embodiment, determining the semantic field corresponding to each character segment includes the following steps: For each character segment, generate at least two candidate semantic tags, combine them to form multiple candidate mapping schemes, and each candidate mapping scheme records a correspondence between each character segment and each semantic field; Obtain the production work order information for the current production line, wherein the production work order information includes at least the in-plant part number currently being produced online; The production work order information is used to verify each candidate mapping scheme, the confidence score of each candidate mapping scheme is calculated, and the candidate mapping scheme with the highest confidence score is selected as the correspondence between the character segment and the semantic field. The initial confidence score of each candidate mapping scheme is the same preset base score; the verification includes: if the character content of the character segment marked as the customer part number in a candidate mapping scheme is consistent with the factory part number, then the confidence score of the candidate mapping scheme is increased.

[0032] Specifically, in this embodiment, step S21 is executed first: at least two candidate semantic tags are generated for each character segment, and combined to form multiple candidate mapping schemes. The industrial control computer obtains the number N of character segments obtained in step S2. All five semantic fields—CustomerPartNo, WeekCode, SerialNo, PanelRow, and PanelCol—are read from the system semantic field definition file and stored in a list. The system uses a recursive algorithm to generate all permutations of N selected from the five semantic fields (if the length of the selected field list is equal to N, a copy of the current selected list is added to the result list). The recursive function maintains three parameters: the selected field list, a boolean array marking whether each field has been selected, and a result list storing all complete permutations. The execution logic of the recursive function is as follows: if the length of the selected field list is equal to N, a copy of the current selected list is added to the result list and returned; otherwise, the five semantic fields are traversed, and for each field not marked as selected, it is added to the end of the selected list, marked as selected, and the function calls itself to enter the next level of recursion. After the recursion returns, the field is removed from the selected list and the mark is restored to unselected. The recursion begins with an empty list of selected options. Upon completion, the result list contains all possible permutations. Each permutation corresponds to a candidate mapping scheme, with the mapping relationship as follows: the first semantic field in the permutation corresponds to the first character segment of the character segment list, the second semantic field corresponds to the second character segment, and so on. The system generates a unique identifier for each scheme and records the permutation array as the mapping relationship. All schemes form a candidate mapping scheme list.

[0033] Next, step S22 is executed: Obtain the production work order information for the current production line. The industrial control computer sends a GET request to the MES server via HTTP protocol, with the URL "http: / / [MES server address] / api / workorder / current". The query parameter "lineId" is set to the current production line number, which is stored in the industrial control computer's local configuration file. After receiving the request, the MES server searches for the first record in its WorkOrder table where the Status field value is "PRODUCING" or "PENDING" and the LineId field value matches the input parameter. If a record is found, the InternalPartNo field value of that record is extracted and constructed into a JSON string "{"internalPartNo":"specific part number value"}" and returned; if not found, "{"internalPartNo":""}" is returned. The industrial control computer receives the response, uses a JSON parsing library to extract the value of the "internalPartNo" field, and stores it in a variable as the current work order's internal part number. If this value is empty, subsequent verification skips the internal part number comparison.

[0034] Execute step S23 again: Verify each candidate mapping scheme using production work order information, calculate confidence scores, and select the optimal scheme. The industrial control computer assigns an initial confidence score to each scheme in the candidate scheme list, reading a default value (e.g., 100.0) from a configuration parameter `baseScore`. It then reads another parameter `incrementScore` as the increment step, (e.g., 50.0). Create a floating-point array of the same length as the scheme list and initialize all elements to `baseScore`. Iterate through the candidate mapping scheme list. For each scheme, check which position in its mapping array is marked with the semantic field "CustomerPartNo". Obtain the index of that position and retrieve the corresponding character segment content from the character segment list based on that index. Perform a character-by-character equality comparison (case-sensitive) with the factory part number string obtained in step S22. If they are completely identical, increment `incrementScore` is added to the corresponding score array element. If the factory part number is empty, skip this step, and the score remains unchanged at `baseScore`. After all schemes have been scored, find the maximum value in the score array. The scoring array is traversed, collecting the indices of all schemes with scores equal to the maximum value, forming a list of highest-scoring indices. If the list contains only one index, the candidate mapping scheme corresponding to that index is directly selected as the final mapping relationship. If multiple indices are included, and the number does not exceed the system-configured parallel threshold (e.g., 3), one of these indices is randomly selected as the final scheme. If the threshold is exceeded, the detailed mapping relationship information of these candidate schemes is sent to the HMI interface via WebSocket, displaying the correspondence between character segments and semantic fields in each scheme in list form. The operator then selects one as the final scheme. The industrial control computer writes the character segment and semantic field correspondence recorded for the finally selected scheme into a mapping table for subsequent rule generation and real-time parsing.

[0035] In a preferred embodiment, when the PCB to which the original barcode sample belongs is a sub-board on a panel, and the original barcode of at least another sub-board on the same panel is obtained, the verification of each candidate mapping scheme using the production work order information further includes the following steps: The original barcodes of each sub-board on the same panel are segmented in the same way, and the contents of the corresponding character segment of each sub-board are compared segment by segment. If each sub-board contains a character segment with sequentially increasing content, and the content of the remaining character segments is exactly the same, then the confidence score of the candidate mapping scheme that labels the character segment with sequentially increasing content as the row number or column number of the panel is increased. If the original barcodes of other sub-boards on the same panel are not obtained, skip this step.

[0036] Specifically, in this embodiment, step S31 is executed first: determining the conditions and acquiring the multi-board barcode. An industrial camera is installed above the loading station 1 and connected to the industrial control computer via gigabit Ethernet. The camera resolution is set to 2048×1536 pixels. When the panel reaches the detection position via the conveyor belt, the through-beam photoelectric sensor is blocked, and the output 24V high-level signal is connected to the digital input channel DI0 of the industrial control computer. After the industrial control computer detects the rising edge of DI0 level changing from low to high, it calls the camera SDK's image capture function to acquire a frame of BMP format image and store it in memory. The industrial control computer processes the image as follows: First, it calls the color space conversion function of the image processing library to convert the original color image into a grayscale image. Then, it calls the binarization function, sets the threshold to 128, sets the pixel grayscale greater than 128 to 255 (white), and sets it to 0 (black) for pixels less than or equal to 128. Afterward, it calls the contour detection function to detect only the outermost contour and uses compressed storage to reduce the amount of data. Iterate through all detected contours, calculating the bounding rectangle for each contour. If the rectangle's width or height is less than 50 pixels (excluding noise), the contour is ignored. For contours that meet the size requirements, extract the bounding rectangle region from the original grayscale image and call the barcode decoding library function for recognition. If recognition is successful, return the barcode string; otherwise, return empty. Collect all successfully recognized barcode strings and sort them according to the coordinates of their top-left corner bounding rectangles: first, determine the rows in ascending order of y-coordinate (with a tolerance of 30 pixels to absorb tilt), and within the same row, determine the columns in ascending order of x-coordinate. Fill the sorted data into a two-dimensional string array. If the total number of elements in the array is greater than or equal to 2, set the system flag MultiPanelFlag to 1; otherwise, set it to 0. Before executing the scoring verification loop, the industrial control computer checks the value of MultiPanelFlag. If it is 0, skip all subsequent steps in this implementation method; if it is 1, continue execution.

[0037] Next, step S32 is executed: segmenting and comparing each segment in the same way. The industrial control computer retrieves all sub-board barcodes in the first row of the two-dimensional string array (the row numbers of the same board are the same, only the column numbers change, making them easy to identify as they increment). For each barcode, the same segmentation processing logic used in step S2 is called to obtain a list of character segments for each sub-board. Assume there are M sub-boards in the first row, and each sub-board is segmented to obtain K character segments. The industrial control computer creates an M-row, K-column two-dimensional matrix and fills in the character segments of each sub-board according to rows and columns. Then, the matrix is ​​analyzed column by column, with column numbers cycling from 0 to K-1. For the current column, the contents of M character segments are extracted, and a hash set is created for deduplication. These M contents are added to the set sequentially, and the set's size method is called. If the size is 1, it means that all sub-board contents in this column are exactly the same, so this character segment cannot be a board row number or column number, and the process continues to the next column. If the size is equal to M, it means that all values ​​in this column are different, so the column number is recorded and stored in a list `suspectCols`.

[0038] Next, proceed to step S33: verify the increasing pattern and adjust the confidence score. Iterate through each column number in the `suspectCols` list. For each column, extract M character segments. First, check if each string consists entirely of numeric characters by iterating through each character and determining if its ASCII value is between 48 and 57. If a non-numeric character is found, stop judging this column and jump to the next column number. If all M strings are purely numeric, convert them to long integers and store them in a numerical array. Calculate the difference between adjacent values: starting from the second value, subtract the previous value from the current value. If the difference is less than or equal to 0, stop judging this column; if all differences are greater than 0 and equal, the column is determined to have a strict increasing pattern, and the corresponding character segment should correspond to a panel row number or panel column number. For example, if the values ​​in this column for three sub-panels are 1, 2, and 3, and the difference is 1, then it meets the increasing condition. After determining the increasing column, the industrial control computer iterates through all candidate mapping schemes. For each solution, examine the semantic field name at the corresponding column position in its mapping array. If the name is "PanelRow" or "PanelCol", increase the current confidence score of that solution by a preset bonus (e.g., 50.0); otherwise, the score remains unchanged. After processing all candidate solutions, the solution with the highest confidence score is more likely to correctly label the incrementing column as the panel row and column field. It should be noted that in the panel verification implementation (steps S31 to S33), the letter M always represents "the number of sub-panels in the first row of the two-dimensional string array", i.e., the number of sub-panels. When describing a "two-dimensional matrix of M rows and K columns", the number of rows in the matrix is ​​determined by the number of sub-panels M. Here, M is used as a specific numerical value for the number of rows, rather than M itself representing the dimension concept of "row". Within this context, all instances of M (such as "extracting M character segments" or "if the size is equal to M") refer to the same number of sub-panels.

[0039] In a preferred embodiment, the verification of each candidate mapping scheme using the production work order information further includes the following steps: When a candidate mapping scheme contains a character segment marked as a periodic code, the character content of the character segment marked as a periodic code is extracted as a candidate periodic code, and the candidate production week is parsed out. The candidate production weeks are compared with preset work calendar data, which records the range of valid weeks and the number of workdays each week. If the candidate production week exceeds the range of valid weeks, or if the date corresponding to the candidate production week is a non-working day, then the confidence score of the candidate mapping scheme will be reduced.

[0040] Specifically, step S41 is executed first: identifying candidate cycle codes and parsing production weeks. During the verification process, the industrial control computer (ICC) iterates through each candidate mapping scheme, performing cycle code verification in addition to the internal part number consistency check. For the current candidate scheme, the ICC checks the semantic fields marked at each position in its mapping array. If a position is marked as a cycle code, the corresponding character segment content is retrieved from the character segment list as the candidate cycle code. The ICC parses the candidate cycle code string to extract the production week information. The common format of the cycle code is a four-digit number, where the first two digits represent the last two digits of the production year, and the last two digits represent the production week within that year. For example, if the candidate cycle code is "217243", the first four digits "2172" are taken, which is parsed as the 72nd week of 2021; or if the candidate cycle code is "2435", it is parsed as the 35th week of 2024. If the candidate cycle code string is less than four digits long or contains non-numeric characters, the verification is directly deemed to have failed.

[0041] Next, execute step S42: Obtain and compare work calendar data. The industrial control computer reads the preset work calendar data from the work calendar table in the local database. This table contains two fields: WeekNumber represents the week number, in the format of a four-digit number such as "2435"; WorkDays represents the workday information within that week, recorded as a seven-character string, from left to right representing Monday to Sunday, with the character "1" representing a workday and the character "0" representing a non-workday. For example, the record "2435,1111100" means that Monday to Friday of the 35th week of year 24 are workdays, and Saturday and Sunday are non-workdays. This table is pre-entered by engineers based on the actual production calendar of the factory during the initial deployment of the system. The industrial control computer performs the following two checks, and failure of each check will result in a decrease in the confidence score of the candidate solution. The first check is the week validity check. The industrial control computer compares the candidate production week parsed in step S41 with the week range recorded in the work calendar table. The week number range is 1 to 52. If a candidate production week exceeds this range, for example, if the parsed week number is 53 or 00, the week number is considered significantly abnormal. If the verification fails, a preset deduction value is deducted from the confidence score of the candidate solution. The second item is the workday verification. If the candidate production week is within the valid range, the industrial control computer queries the record corresponding to that week in the work calendar table and reads the value of the WorkDays field in that record. Then, based on the weekday date information that may be included in the candidate week number, or the default rule that production on any day within that week is reasonable, it determines whether there are any workdays within that week. If all WorkDays fields for that week are "0", it means that all seven days of that week are non-working days, and therefore there cannot be any PCB production activity within that week. If the verification fails, the confidence score of the candidate solution is also deducted. If both verifications pass, the week number verification of the candidate solution passes, and the confidence score remains unchanged.

[0042] Next, execute step S43: Apply the verification results. The industrial control computer overlays the deduction results from the periodic code verification with the addition results from the in-plant part number verification, updating the confidence scores of each candidate solution. After verification, continue with subsequent score comparison and optimal solution selection steps.

[0043] The technical principle of this implementation is to cross-validate the periodic code, a semantic field with time meaning, against the factory's actual production calendar. Conventional barcode parsing methods rely solely on string format characteristics, failing to distinguish whether a string like "2435" represents the compliant 35th week of the 24th year or a typo for the compliant 53rd week of the 24th year. By introducing the work calendar as an objective data source for logical verification, the system can eliminate candidate solutions that conform to the format but lack logical coherence, reducing parsing errors caused by abnormal barcodes.

[0044] In a preferred embodiment, after selecting the candidate mapping scheme with the highest confidence score as the correspondence between the character segment and the semantic field, the following steps are further included: For each character segment with a known correspondence in the candidate mapping scheme with the highest confidence score, identify the character type of the characters in each character segment and count the character length of each character segment; The positioning method of each semantic field in the semantic parsing rule is recorded as: matching strings whose character type is consistent with the character type identified by the corresponding character segment and whose character length is consistent with the character length counted by the corresponding character segment; Store the semantic parsing rules that record the positioning method into the rule base; When the original barcode sample to be configured is obtained again, it is first matched with the semantic parsing rules already in the rule base. If the match is successful, the matched semantic parsing rule is directly called, skipping the steps of generating multiple candidate mapping schemes and confidence scores.

[0045] Specifically, step S51 is executed first: extracting character features from each character segment whose correspondence has been determined. After selecting the optimal candidate mapping scheme and determining the correspondence of the scheme, the industrial control computer uses the correspondence as input to this step.

[0046] The industrial control computer iterates through each record in the mapping relationship. Each record contains the sequential number of a character segment in the list and the name of the semantic field corresponding to that character segment. For each record, the industrial control computer retrieves the corresponding character segment content from the character segment list according to its sequential number, and then performs two feature extraction operations on that character segment.

[0047] The first step is character type recognition. The industrial control computer determines the ASCII code range of each character: values ​​48 to 57 are identified as numeric, 65 to 90 or 97 to 122 as letter types, and the rest as symbol types. The type determination results of each character are then concatenated in their original order to obtain a pattern string composed of "D", "L", and "S". For example, if the character segment content is "82550202", which consists entirely of numeric characters, the pattern string is "DDDDDDDD"; if the character segment content is "ABC123", with the first three characters being letters and the last three characters being numeric characters, the pattern string is "LLLDDD".

[0048] The second item is character length statistics. The industrial control computer directly calculates the total number of characters contained in the character segment and obtains an integer value as the length feature of the character segment.

[0049] Next, execute step S52: Generate generalization parsing rules and store them in the rule base. The industrial control computer associates the extracted feature information with the semantic field names to generate a generalization parsing rule. The positioning method of this rule is recorded as: matching strings whose character type pattern is consistent with the extracted pattern string, and whose character length is consistent with the counted length value. This recording method is logically consistent with the rules recorded for specific barcode formats, but the rules recorded for specific barcode formats are derived from a single manual configuration, while the rules in this step are derived from the generalization results of the optimal solution automatically selected by the system.

[0050] The industrial control computer stores the generalized rules into a rule base. Each rule record in the rule base includes a semantic field name, a character segment position number, a character type pattern string, and a character segment length value. During storage, the PositionIndex field is filled with the character segment's sequential number in the list, the SemanticField with the corresponding semantic field name, the CharTypePattern with the pattern string obtained in step S51, and the SegmentLength with the length value obtained in step S51. After traversing all character segments, all generalized parsing rules for this barcode format are stored in the rule base.

[0051] Then execute step S53: When acquiring a barcode sample again, prioritize matching the rule base. When a raw barcode sample to be configured is acquired again on the production line, the industrial control computer does not immediately execute the candidate solution generation and confidence scoring steps. Instead, it first attempts to match the sample with the existing generalization parsing rules in the rule base. The matching process is as follows: The industrial control computer segments the new sample to obtain a list of character segments. Then, it compares the character type pattern and character length of each character segment with the CharTypePattern and SegmentLength fields of each rule record in the rule base. The comparison is performed one by one according to the PositionIndex order. If each character segment of the new sample can match the corresponding character type pattern and length in the rule base in sequence, the match is considered successful. The set of rule records is directly called to complete the semantic field positioning and field value extraction, skipping all steps of generating candidate solutions and confidence scoring. If a certain character segment of the new sample cannot match the corresponding rule record in the rule base, for example, if the character length changes or the character type pattern is different, the match fails. At this point, the system reverts to the aforementioned execution flow and re-executes the complete process of candidate scheme generation and context verification for the new sample.

[0052] The technical principle of this implementation is to abstract reusable character pattern rules from specific samples. A single configuration generates case-specific rules for a specific barcode value (e.g., "82550202"), while generalization generates type rules for character patterns (e.g., "8-digit pure numbers"). When the same customer's barcode changes only the field content without altering the field format due to a version upgrade, the generalized rules can be directly applied without reconfiguration, significantly reducing the computational overhead of repeated parsing and the frequency of manual intervention.

[0053] In a preferred embodiment, after verifying each candidate mapping scheme using the production work order information, if at least two candidate mapping schemes have confidence scores exceeding a preset threshold and score differences less than a preset difference, the following step is further included: From each candidate mapping scheme with the current score, extract the character content of the character segment marked as customer part number, and use it as the candidate customer part number corresponding to each candidate mapping scheme; Obtain the preset pin insertion process parameters of the current production work order from the production work order information. The pin insertion process parameters include the pin force range and the pin height range. For each of the candidate customer part numbers, the standard pin insertion process parameters corresponding to the candidate customer part number are queried from the process database; The pin insertion process parameters preset in the production work order are compared with the standard pin insertion process parameters corresponding to each candidate customer part number. The candidate mapping scheme corresponding to the candidate customer part number whose standard pin insertion process parameters match the pin insertion process parameters preset in the production work order is selected as the final mapping scheme.

[0054] Specifically, step S61 is executed first: extracting the candidate customer part numbers for each candidate scheme. After the industrial control computer completes the verification scoring, it checks the distribution of the scoring array. First, it counts the number of schemes whose scores exceed a preset threshold, which is stored in the system configuration file, for example, 80 points. If the number of schemes exceeding the threshold is less than two, it indicates that there is only one high-scoring scheme, and arbitration is not required; this scheme is directly selected. If the number of schemes exceeding the threshold is greater than or equal to two, the difference between the highest and second-highest scores among these high-scoring schemes is calculated. If this difference is greater than or equal to a preset difference threshold, for example, 10 points, it indicates that the highest-scoring scheme has a significant advantage, and arbitration is also not required. The arbitration process of this implementation is triggered only when both conditions are met simultaneously: at least two schemes exceed the threshold and the difference between the highest and second-highest scores is less than the preset difference threshold. The industrial control computer extracts the character segment content marked as the customer part number from each candidate mapping scheme that meets the conditions. The extraction method is as follows: for each candidate scheme, it finds the position in its mapping relationship array where the semantic field is the customer part number, and retrieves the character segment string at that position from the character segment list as the candidate customer part number corresponding to that scheme. All candidate customer part numbers are compiled into a list.

[0055] Next, execute step S62: Obtain the preset pin insertion process parameters for the production work order. The industrial control computer further reads the preset pin insertion process parameters for the current work order from the production work order information obtained in step S22. In the work order data structure of the MES system, in addition to the in-plant part number, it also includes the pin insertion process parameters corresponding to the product in the work order, specifically including the pin force range and the pin height range. The pin force range is defined by two values: minimum force and maximum force, in Newtons; the pin height range is defined by two values: minimum height and maximum height, in millimeters. For example, a work order may have a preset pin force range of 200 to 900 Newtons and a pin height range of 34.7 to 35.3 millimeters. If the current production work order information does not contain pin insertion process parameters, or if the field is empty due to the work order not being fully issued during the equipment commissioning phase, this arbitration process cannot be executed, and the industrial control computer will revert to random selection or manual confirmation.

[0056] Next, execute step S63: Query the standard pin process parameters corresponding to each candidate customer part number. The industrial control computer connects to the local process database, which contains a process parameter table. The table structure includes a customer part number field and the corresponding standard pin force range and standard pin height range fields. The data in this table comes from the accumulation of historical production records. After the completion of mass production of each PCB product, the system associates the pin process parameters of that product with the customer part number and stores them in this table. The industrial control computer sequentially retrieves each candidate customer part number from the candidate customer part number list obtained in step S61 and performs a query in the process parameter table, with the condition that the customer part number field equals the current candidate customer part number. If a corresponding record is found, the standard pin force range and standard pin height range of that record are read; if no record is found, it means that the candidate customer part number has never appeared in historical production, and the candidate part number is marked as having no process data.

[0057] Next, execute step S64: Compare process parameters and select a matching scheme. The industrial control computer compares the preset pin insertion process parameters obtained in step S62 with the standard pin insertion process parameters of each candidate customer part number queried in step S63. The comparison method is to calculate the degree of overlap of the force range and the height range respectively. The degree of overlap of the force range is determined by whether the minimum force value preset in the work order falls between the minimum and maximum values ​​of the standard force range, and whether the maximum force value preset in the work order also falls within this range; or whether the overlap ratio of the two ranges exceeds a preset ratio threshold. The comparison method for the height range is the same. If the standard pin insertion process parameters of a candidate customer part number match both the force range and the height range of the preset process parameters in the work order, then it is determined that the candidate customer part number is consistent with the product corresponding to the current production work order, and the candidate mapping scheme corresponding to the candidate customer part number is selected as the final mapping scheme. If the process parameters of multiple candidate customer part numbers match, the one with the highest overlap ratio is selected. If none of the candidate customer part numbers can be matched or there is no process data, the arbitration cannot reach a definite conclusion, and the industrial control computer will return to random selection or manual confirmation for processing. After selecting the final mapping scheme, the subsequent process is the same as the aforementioned execution method.

[0058] In a preferred embodiment, after selecting the candidate mapping scheme as the final mapping scheme and loading the pin insertion process parameters according to the customer part number corresponding to the final mapping scheme for production, the following steps are further included: During the pin insertion process, the actual pin insertion force and actual pin insertion height are continuously acquired from the pin insertion equipment. The actual pin force value is compared with the standard force value range in the currently applied pin process parameters, and the actual pin height is compared with the standard height range in the currently applied pin process parameters. If, during a series of preset number of pin insertion actions, the actual pin force value deviates from the median of the standard force value range by more than a first preset ratio, and the actual pin height deviates from the median of the standard height range by more than a second preset ratio, then it is determined that the currently applied pin process parameters do not match the current PCB. Exclude the currently used mapping scheme from the candidate mapping schemes, reselect the candidate mapping scheme with the highest confidence score from the remaining candidate mapping schemes, and reload the pin insertion process parameters according to the customer part number corresponding to the reselected candidate mapping scheme.

[0059] Specifically, step S71 is executed first: continuously acquiring actual pin feedback data. During the pin production process of each PCB, the industrial control computer collects feedback data of each pin's action in real time via a PLC. After each pin insertion action is completed, the PLC sends the actual force value and actual height value of the pin to the industrial control computer via industrial Ethernet. The actual force value is the peak force value measured by the pressure sensor during the pin insertion process, in Newtons; the actual height is the height of the pin tip measured by the displacement sensor after the pin insertion is completed, in millimeters. The industrial control computer stores these data in a real-time data buffer according to the pin insertion order. The buffer adopts a first-in-first-out circular queue structure, and the queue length is preset to a fixed value.

[0060] Next, execute step S72: Compare the actual value with the standard range. The industrial control computer reads the standard force range and standard height range from the currently loaded pin insertion process parameters. The standard force range includes the minimum and maximum force values, and the standard height range includes the minimum and maximum heights. For each pin insertion's actual force value and actual height obtained in step S71, the industrial control computer performs the following judgment: First, calculate the median of the standard force range, which is equal to the sum of the minimum and maximum force values ​​divided by two. Then, calculate the percentage by which the actual force value deviates from the median, which is equal to the absolute value of the actual force value minus the median divided by the median. If this percentage exceeds a first preset percentage, for example, exceeding 20%, the force value of this pin insertion is determined to be abnormally deviated. The judgment method for the height direction is the same: calculate the median of the standard height range, calculate the percentage by which the actual height deviates from the median, and if this percentage exceeds a second preset percentage, for example, exceeding 5%, the height of this pin insertion is determined to be abnormally deviated.

[0061] Next, execute step S73: Trigger correction upon consecutive anomalies. The industrial control computer maintains an anomaly counter, initially set to zero. In each comparison in step S72, if the force value and height of a pin are both determined to be abnormally deviated (i.e., both force and height are abnormal simultaneously), the anomaly counter is incremented. If only one is abnormal or both are normal, the anomaly counter is reset to zero. When the value of the anomaly counter reaches a preset number of consecutive occurrences, for example, five consecutive instances where both force and height of the pins are abnormally deviated simultaneously, the industrial control computer determines that the currently loaded pin process parameters do not match the PCB being produced. This mismatch is highly likely because the process parameter matching arbitration process selected an incorrect candidate mapping scheme, causing the system to use a customer part number that does not match the actual part and load incorrect process parameters.

[0062] At this point, the industrial control computer triggers the correction process. First, it marks the currently used mapping scheme as invalid and excludes it from the generated candidate mapping scheme list. Then, from the remaining candidate mapping schemes, it sorts them by score and reselects the scheme with the highest confidence score. Based on the customer part number corresponding to the reselected scheme, it queries the process database for the standard pin insertion process parameters corresponding to that part number, reloads them into the pin insertion device, and replaces the currently executing process parameters. Simultaneously, the industrial control computer logs this correction event, including the time the correction was triggered, the number of the excluded incorrect scheme, the number of the reselected scheme, and the corresponding customer part number. After reloading the process parameters, subsequent PCB production uses the new parameters, the error counter is reset to zero, and the monitoring process restarts.

[0063] Then execute step S74: Re-verification after correction. After reloading the process parameters and continuing production, the industrial control computer continues to execute the monitoring process from steps S71 to S73. If the feedback data of a preset number of pins under the new process parameters are all normal, it indicates that the correction was successful and the correct customer part number has been selected. If continuous anomalies are triggered again, the correction process is repeated, continuing to exclude the current solution and reselect from the remaining solutions until the candidate solutions are exhausted or the feedback data returns to normal.

[0064] In a preferred embodiment, segmenting the original barcode sample to obtain multiple character segments includes the following steps: Traverse each character in the original barcode sample, identify the character type of each character, and generate a character type sequence of the original barcode sample. The character types include at least letter type, number type, and symbol type. In the character type sequence, the positions of adjacent characters where the character type changes are identified as candidate segmentation points; Retrieve the segmented records of the stored historical barcode samples, count the frequency of occurrence of the character segment length in each segmented record, and select the multiple character segment lengths with the highest frequency of occurrence to form the preferred segment length combination for the current barcode format; Using the preferred segment length combination as a constraint, candidate segment points that satisfy the preferred segment length combination are selected from the candidate segment points and used as the final segment points; The original barcode sample is divided into multiple character segments based on the final segmentation points.

[0065] Specifically, step S81 is executed first: generating a character type sequence. The industrial control computer reads the original barcode sample string and creates an empty character type sequence list. Starting from the first character of the string, each character is processed sequentially. For each character, its ASCII code integer value is obtained and judged: if the code value is between 48 and 57, the character type is recorded as numeric; if the code value is between 65 and 90 or between 97 and 122, the character type is recorded as letter; if it is any other code value, it is recorded as symbol. The type determination result of each character is appended to the character type sequence list in its original order. For example, for barcode ABC-202435-001, the character type sequence is: letter, letter, letter, symbol, number, number, number, number, number, number, symbol, number, number, number. For the all-numeric barcode 82550202217243466047000158, the character type sequence consists of twenty-four numeric type markers.

[0066] Next, execute step S82: Identify character type change points as candidate segmentation points. The industrial control computer traverses the character type sequence generated in step S81, starting from the second element, comparing the type of the current element with the type of the previous element. If the types are different, the position index of the current element in the string is recorded; this position is a character type change point. For example, in barcode ABC-202435-001, the third character is the letter C, and the fourth character is the symbol "-". Since the types are different, the position index 3 of the fourth character is recorded as a candidate segmentation point; similarly, the tenth character is the number 5, and the eleventh character is the symbol "-", so the position index 10 of the eleventh character is also recorded as a candidate segmentation point. After traversal, a list of candidate segmentation point positions is obtained. For all-numeric barcodes, since all character types are the same, this list is empty.

[0067] Next, execute step S83: Count the frequency of historical segment lengths and generate optimal segment length combinations. The industrial control computer reads data from the historical segment record table in the local database. This table stores the segmentation results of successfully parsed barcode samples in the past. Each record contains the sample number, character segment sequence number, and the length value of that character segment. The industrial control computer executes a database aggregation query, grouping by character segment sequence number, and counting the frequency of each length value within each group. The query statements are sorted in descending order of frequency. For the group with character segment sequence number 1, the industrial control computer takes the length value with the highest frequency as the optimal length for the first character segment. For the group with sequence number 2, the highest frequency length value is taken as the optimal length for the second character segment. And so on, to obtain an optimal segment length combination corresponding to the number of character segments. For example, if the first character segment length 8 appears 150 times in the historical record, and length 6 appears 20 times, then the optimal length is 8; the second character segment length 6 appears 140 times, then the optimal length is 6; the third character segment length 12 appears 130 times, then the optimal length is 12. The optimal combination of segment lengths is 8, 6, and 12.

[0068] Next, execute step S84: filter segment points using the preferred segment length combination as a constraint. The industrial control computer matches and filters the candidate segment point list obtained in step S82 with the preferred segment length combination obtained in step S83. Starting from the beginning position of the barcode string, check sequentially whether the end position corresponding to each preferred length value falls exactly on a candidate segment point. Specifically, set the initial value of the current scan position to 0, take out the first preferred length value L1, and calculate the ideal end position of the first segment as the current scan position plus L1. Check whether there is a segment point in the candidate segment point list whose position is exactly equal to the ideal end position. If it exists, the segment point is retained as the first final segment point, the current scan position is updated to the segment point position plus 1, and the next round of matching is continued using the second preferred length value L2. If there is no matching segment point, search the candidate segment point list for the segment point that is closest to the ideal end position and within the preset tolerance range. The tolerance is usually set to 1 character. If found, it is retained; if not found, the position is marked as a match failure. After all preferred length values ​​have been matched, a set of final segmentation points is obtained after filtering. The industrial control computer divides the original barcode sample according to these final segmentation points, cutting the string into multiple character segments at the final segmentation point positions. If the candidate segmentation point list in step S82 is empty, i.e., in the case of an all-digital barcode, the preferred segmentation length combination cannot pass the segmentation point filtering, this step fails to match, and the process switches to segmentation mode.

[0069] In a preferred embodiment, when there are no adjacent character positions in the character type sequence where the character type changes, the step of segmenting the original barcode sample to obtain multiple character segments further includes the following steps: Obtain the preset allowed character length range for each semantic field in the semantic field set. The allowed character length range records the minimum and maximum character lengths of the character segment corresponding to the semantic field when it appears in the barcode. For the original barcode sample, enumerate all the partitioning schemes that divide the original barcode sample into multiple character segments. The number of character segments is consistent with the number of semantic fields in the semantic field set. The character segments divided in each partitioning scheme are arranged in the order of their appearance in the original barcode. For each partitioning scheme, verify one by one whether the character length of each character segment in the partitioning scheme falls within the allowed character length range of at least one semantic field in the semantic field set; A partitioning scheme in which the character length of each segment falls within the allowed character length range of at least one semantic field is taken as a candidate partitioning scheme, and multiple character segments are obtained based on the candidate partitioning scheme.

[0070] Specifically, step S91 is executed first: obtaining the allowed character length range for each field in the semantic field set. The industrial control computer reads the allowed character length range corresponding to each semantic field in the preset semantic field set from the system configuration file. This configuration file is set by engineers according to common barcode formats in the PCB industry during system deployment. The allowed character length range records the minimum and maximum character lengths that may appear in the character segment corresponding to each semantic field. For example, the allowed character length range for customer part numbers is 6 to 10, for period codes it is 4 to 6, for serial numbers it is 8 to 12, and for panel row and column numbers it is 1 to 3.

[0071] Next, execute step S92: Enumerate all possible segmentation schemes. The industrial control computer determines the number N of semantic fields participating in segmentation in the current semantic field set, which is consistent with the number of character segments to be generated. Obtain the total character length TotalLen of the original barcode sample. The industrial control computer uses an enumeration algorithm to generate all segmentation schemes that satisfy the following conditions: the string of length TotalLen is divided into N consecutive character segments, each character segment contains at least one character, and the sum of the lengths of all character segments is equal to TotalLen. The enumeration method is: select N-1 positions from TotalLen minus 1 possible segmentation positions as segmentation points. A recursive combination algorithm is used during enumeration to maintain a current segmentation point list, recursively selecting segmentation points from the range of possible positions and adding them to the list. When the list length reaches N-1, the current list is recorded as a complete segmentation scheme. Each segmentation scheme is represented as an integer array of length N, where the value of each element in the array is the character length of the character segment. It should be noted that the N in "an integer array of length N" mentioned in this step is the same parameter as the N in "the number of semantic fields N" and "divided into N consecutive character segments" mentioned earlier in this step, both referring to the number of character segments to be generated. Since a partitioning scheme needs to record the length values ​​of each of the N character segments, an array of length N is used for storage, and the meaning of N remains unchanged.

[0072] Next, execute step S93: Verify whether the length of each character segment falls within the allowed range. For each partitioning scheme generated in step S92, the industrial control computer checks the length value of each character segment one by one according to the order of the partitioned character segments. The length value of the first character segment is compared with the allowed character length range of the first semantic field in the semantic field set to determine whether the length value is greater than or equal to the minimum length and less than or equal to the maximum length. Then, it checks whether the length value of the second character segment falls within the allowed range of the second semantic field, and so on until all character segments have been checked. It should be noted that it is not required that each character segment be bound to a specific semantic field one by one. Instead, it checks whether the length value of each character segment falls within the allowed range of at least one semantic field in the semantic field set. The verification logic is as follows: for each character segment length value, it iterates through the allowed ranges of all semantic fields in the semantic field set. If the allowed range of at least one semantic field covers the length value, the character segment passes the verification; if the length value of a character segment cannot be covered by the allowed range of any semantic field, the entire partitioning scheme fails the verification.

[0073] Next, execute step S94: Select candidate segmentation schemes and obtain character segments. The industrial control computer collects all segmentation schemes that have passed the verification in step S93 into a candidate segmentation scheme list. If there is only one candidate segmentation scheme, the original barcode sample is directly truncated according to the length values ​​of each character segment of the scheme to obtain multiple character segments. If there are multiple candidate segmentation schemes, the industrial control computer sends these schemes to the HMI interface for display. Each scheme is displayed in the form of each character segment length, and the operator selects the most reasonable scheme according to the actual barcode format and truncates the character segments according to the selected scheme. If the candidate segmentation scheme list is empty, it means that the currently set allowed character length range cannot cover the barcode. The system sends a prompt to the HMI, requesting the operator to manually segment or adjust the allowed length range configuration.

[0074] In a preferred embodiment, before generating at least two candidate semantic tags for each character segment, the method further includes: Obtain the list of holes to be inserted on the current PCB board, extract the hole names from the hole list, identify the naming format characteristics of the hole names, and use them as the hole name pattern for the current PCB. Retrieve historical production records with the same or similar hole name patterns from the traceability database, and extract the character composition features of the customer part number corresponding to the historical production record and the original barcode corresponding to the customer part number; Based on the character composition features, the matching priority between each character segment and each semantic field is adjusted so that character segments that conform to the character composition features are preferentially labeled as the corresponding semantic fields; the priority of character segments that do not conform to the character composition features being labeled as the corresponding semantic fields is reduced, or candidate semantic tags corresponding to character segments that do not conform to the character composition features are excluded.

[0075] Specifically, step S101 is executed first: obtaining the hole position list and extracting the hole name pattern. When the pin insertion device loads the process program, the industrial control computer reads the pin insertion hole position list corresponding to the current PCB board from the process database. This hole position list contains the hole names of all holes on the PCB board that require pin insertion, usually a list of strings, with each string representing a hole name. For example, the hole position list of a certain PCB board contains hole names X2.1, X3.1, X3.2, X9.2, X9.1, X4.1, X4.2, etc. The industrial control computer performs format analysis on all hole names in the hole position list and extracts the hole name pattern. The extraction method is as follows: traverse each hole name string and identify the common structural features. Analyze each hole name character by character, replacing letters with wildcard L, replacing numbers with wildcard D, and keeping symbols as they are. For example, the wildcard pattern for hole name X2.1 is LDDD; the pattern for X3.1 is also LDDD; and the pattern for X10.7 is LDDDD. Analyze all wildcard patterns for hole names and select the pattern with the highest frequency as the hole name pattern for the current PCB. If the highest frequency pattern accounts for more than a preset percentage, such as more than 80%, then that pattern is used as the hole name pattern; otherwise, the two most frequent patterns are combined as the hole name pattern.

[0076] Next, proceed to step S102: Retrieve historical production records with the same or similar hole name patterns. The industrial control computer retrieves historical production records from the traceability database. The traceability database contains a production record table, which includes a customer part number field and a hole position list field. The hole position list field stores the complete list of hole names corresponding to the PCB product. The industrial control computer executes a database query, iterates through each record in the production record table, and performs the same hole name pattern extraction operation as in step S101 on the hole position list field of each record. The extracted pattern is compared with the hole name pattern of the current PCB. If they are completely identical, the customer part number corresponding to that record is added to the candidate matching list. If no completely identical record exists, the similarity is calculated, and the customer part numbers corresponding to records with similarity exceeding a preset threshold are added to the candidate matching list.

[0077] Next, step S103 is executed: extract the character composition features of the original barcode corresponding to the customer part number. For each customer part number in the candidate matching list obtained in step S102, the industrial control computer further queries the historical barcode parsing records corresponding to that customer part number from the traceability database. The historical barcode parsing records are stored in the rule base and contain the character type pattern and character length value of each character segment of the original barcode of that customer part number. The industrial control computer reads these records and extracts the character composition features corresponding to that customer part number. The features include: the position order of the character segments corresponding to that customer part number in the barcode, the character type pattern, and the character length range. For example, if the query results show that the character segments corresponding to a certain customer part number in the historical records are all 8-digit pure numeric types, then its feature is the 8-digit pure numeric at a certain position.

[0078] Next, execute step S104: Adjust the matching priority of semantic tags based on character composition features. When generating candidate semantic tags for each character segment, the industrial control computer calculates the degree of matching between the character segment and the character composition features of each customer part number extracted in step S103 for each character segment in the character segment list. Specifically, the character type pattern of the character segment is compared with the character type pattern of the candidate customer part number in the same position, and the character length of the character segment is compared with the character length range of the candidate customer part number in the same position. If the character type pattern and character length of a certain character segment completely match the features of a candidate customer part number in the same position, then the semantic tag corresponding to the customer part number is taken as the preferred candidate tag for that character segment and ranked first in the candidate tag list. If there is a partial match, it is ranked in the middle. If there is no complete match, it is ranked last or the candidate tag is directly excluded. For example, if the current character segment is 8 digits, and a customer part number in the historical record is also 8 digits in the same position, then the semantic tag of the customer part number is preferentially assigned to that position. Based on this, the system comprehensively adjusts the matching priority between each character segment and each semantic field, so that the tag combination that matches the character composition characteristics of the historical customer part number is given priority in the subsequent arrangement and generation, while the non-matching is given lower priority or excluded.

[0079] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

Claims

1. A method for adaptive parsing and standardized traceability code generation of PCB barcodes, used to convert original PCB barcodes of different formats into standardized traceability codes of a unified format, characterized in that, Includes the following steps: Obtain the original barcode sample to be configured; The original barcode sample is segmented to obtain multiple character segments; Determine the semantic field corresponding to each character segment. The semantic field is selected from a preset set of semantic fields. The set of semantic fields includes at least the customer part number, cycle code, serial number, panel row number, and panel column number. Based on the determined correspondence between each character segment and semantic field, a semantic parsing rule for the current barcode format is generated, and the semantic parsing rule records the positioning method of each semantic field; Obtain the original PCB barcode to be parsed on the production line, and extract the field values ​​corresponding to each semantic field from the original barcode using the semantic parsing rules; The extracted field values ​​are combined according to a preset field combination order to generate a standardized traceability code; Determining the semantic fields corresponding to each character segment includes the following steps: For each character segment, generate at least two candidate semantic tags, combine them to form multiple candidate mapping schemes, and each candidate mapping scheme records a correspondence between each character segment and each semantic field; Obtain the production work order information for the current production line, wherein the production work order information includes at least the in-plant part number currently being produced online; The production work order information is used to verify each candidate mapping scheme, the confidence score of each candidate mapping scheme is calculated, and the candidate mapping scheme with the highest confidence score is selected as the correspondence between the character segment and the semantic field. The initial confidence score of each candidate mapping scheme is the same preset base score; the verification includes: if the character content of the character segment marked as the customer part number in a candidate mapping scheme is consistent with the factory part number, then the confidence score of the candidate mapping scheme is increased.

2. The PCB barcode adaptive parsing and standardized traceability code generation method according to claim 1, characterized in that, When the original barcode sample belongs to a sub-board on a panel, and the original barcode of at least another sub-board on the same panel is obtained, the verification of each candidate mapping scheme using the production work order information further includes the following steps: The original barcodes of each sub-board on the same panel are segmented in the same way, and the contents of the corresponding character segment of each sub-board are compared segment by segment. If each sub-board contains a character segment with sequentially increasing content, and the content of the remaining character segments is exactly the same, then the confidence score of the candidate mapping scheme that labels the character segment with sequentially increasing content as the row number or column number of the panel is increased. If the original barcodes of other sub-boards on the same panel are not obtained, skip this step.

3. The PCB barcode adaptive parsing and standardized traceability code generation method according to claim 1, characterized in that, The verification of each candidate mapping scheme using the production work order information also includes the following steps: When a candidate mapping scheme contains a character segment marked as a periodic code, the character content of the character segment marked as a periodic code is extracted as a candidate periodic code, and the candidate production week is parsed out. The candidate production weeks are compared with preset work calendar data, which records the range of valid weeks and the number of workdays each week. If the candidate production week exceeds the range of valid weeks, or if the date corresponding to the candidate production week is a non-working day, then the confidence score of the candidate mapping scheme will be reduced.

4. The PCB barcode adaptive parsing and standardized traceability code generation method according to claim 1, characterized in that, After selecting the candidate mapping scheme with the highest confidence score as the correspondence between the character segment and the semantic field, the following steps are also included: For each character segment with a known correspondence in the candidate mapping scheme with the highest confidence score, identify the character type of the characters in each character segment and count the character length of each character segment; The positioning method of each semantic field in the semantic parsing rule is recorded as: matching strings whose character type is consistent with the character type identified by the corresponding character segment and whose character length is consistent with the character length counted by the corresponding character segment; Store the semantic parsing rules that record the positioning method into the rule base; When the original barcode sample to be configured is obtained again, it is first matched with the semantic parsing rules already in the rule base. If the match is successful, the matched semantic parsing rule is directly called, skipping the steps of generating multiple candidate mapping schemes and confidence scores.

5. The PCB barcode adaptive parsing and standardized traceability code generation method according to claim 1, characterized in that, After verifying each candidate mapping scheme using the production work order information, if at least two candidate mapping schemes have confidence scores exceeding a preset threshold and score differences less than a preset difference, the following steps are further included: From each candidate mapping scheme with the current score, extract the character content of the character segment marked as customer part number, and use it as the candidate customer part number corresponding to each candidate mapping scheme; Obtain the preset pin insertion process parameters of the current production work order from the production work order information. The pin insertion process parameters include the pin force range and the pin height range. For each of the candidate customer part numbers, the standard pin insertion process parameters corresponding to the candidate customer part number are queried from the process database; The pin insertion process parameters preset in the production work order are compared with the standard pin insertion process parameters corresponding to each candidate customer part number. The candidate mapping scheme corresponding to the candidate customer part number whose standard pin insertion process parameters match the pin insertion process parameters preset in the production work order is selected as the final mapping scheme.

6. The PCB barcode adaptive parsing and standardized traceability code generation method according to claim 5, characterized in that, After selecting the candidate mapping scheme as the final mapping scheme and loading the pin insertion process parameters according to the customer part number corresponding to the final mapping scheme for production, the following steps are also included: During the pin insertion process, the actual pin insertion force and actual pin insertion height are continuously acquired from the pin insertion equipment. The actual pin force value is compared with the standard force value range in the currently applied pin process parameters, and the actual pin height is compared with the standard height range in the currently applied pin process parameters. If, during a series of preset number of pin insertion actions, the actual pin force value deviates from the median of the standard force value range by more than a first preset ratio, and the actual pin height deviates from the median of the standard height range by more than a second preset ratio, then it is determined that the currently applied pin process parameters do not match the current PCB. Exclude the currently used mapping scheme from the candidate mapping schemes, reselect the candidate mapping scheme with the highest confidence score from the remaining candidate mapping schemes, and reload the pin insertion process parameters according to the customer part number corresponding to the reselected candidate mapping scheme.

7. The PCB barcode adaptive parsing and standardized traceability code generation method according to claim 1, characterized in that, The process of segmenting the original barcode sample to obtain multiple character segments includes the following steps: Traverse each character in the original barcode sample, identify the character type of each character, and generate a character type sequence of the original barcode sample. The character types include at least letter type, number type, and symbol type. In the character type sequence, the positions of adjacent characters where the character type changes are identified as candidate segmentation points; Retrieve the segmented records of the stored historical barcode samples, count the frequency of occurrence of the character segment length in each segmented record, and select the multiple character segment lengths with the highest frequency of occurrence to form the preferred segment length combination for the current barcode format; Using the preferred segment length combination as a constraint, candidate segment points that satisfy the preferred segment length combination are selected from the candidate segment points and used as the final segment points; The original barcode sample is divided into multiple character segments based on the final segmentation points.

8. The PCB barcode adaptive parsing and standardized traceability code generation method according to claim 7, characterized in that, When there are no adjacent character positions in the character type sequence where the character type changes, the step of segmenting the original barcode sample to obtain multiple character segments further includes the following steps: Obtain the preset allowed character length range for each semantic field in the semantic field set. The allowed character length range records the minimum and maximum character lengths of the character segment corresponding to the semantic field when it appears in the barcode. For the original barcode sample, enumerate all the partitioning schemes that divide the original barcode sample into multiple character segments. The number of character segments is consistent with the number of semantic fields in the semantic field set. The character segments divided in each partitioning scheme are arranged in the order of their appearance in the original barcode. For each partitioning scheme, verify one by one whether the character length of each character segment in the partitioning scheme falls within the allowed character length range of at least one semantic field in the semantic field set; A partitioning scheme in which the character length of each segment falls within the allowed character length range of at least one semantic field is taken as a candidate partitioning scheme, and multiple character segments are obtained based on the candidate partitioning scheme.

9. The PCB barcode adaptive parsing and standardized traceability code generation method according to claim 1, characterized in that, Before generating at least two candidate semantic tags for each character segment, the method further includes: Obtain the list of holes to be inserted on the current PCB board, extract the hole names from the hole list, identify the naming format characteristics of the hole names, and use them as the hole name pattern for the current PCB. Retrieve historical production records with the same or similar hole name patterns from the traceability database, and extract the character composition features of the customer part number corresponding to the historical production record and the original barcode corresponding to the customer part number; Based on the character composition features, the matching priority between each character segment and each semantic field is adjusted so that character segments that conform to the character composition features are preferentially labeled as the corresponding semantic fields; the priority of character segments that do not conform to the character composition features being labeled as the corresponding semantic fields is reduced, or candidate semantic tags corresponding to character segments that do not conform to the character composition features are excluded.

Citation Information

Patent Citations

  • Nuclear power station code analysis method and device and electronic equipment

    CN121835599A