Laser marking method and system based on ticket SN number jump number management
The laser marking method using work order SN number skipping management solves the problem of discontinuous serial numbers in the mass production of multi-panel PCBs in traditional laser marking systems, achieving continuity and regular increment of serial numbers, and improving the automation of production management and data traceability capabilities.
Patent Information
- Application Number
- CN202511588766.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-03
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2045-11-03
AI Technical Summary
Traditional laser marking systems cannot automatically calculate the serial number interval based on the number of panels when mass-producing multi-panel PCBs. This results in the serial numbers of smaller panels within the same panel not maintaining continuity, and the serial numbers between different panels not increasing according to predetermined rules, affecting the efficiency of batch traceability and quality management.
A laser marking method based on work order serial number skipping is adopted. By obtaining the work order data structure, calculating the serial number string, and filling it into the variable object in the marking template file, combined with consistency verification and persistent storage, the precise mapping between the serial number and the physical structure of the panel is ensured, so as to achieve the continuity and integrity of the serial number.
It achieves the continuity of serial numbers within the same whole panel and the regular increment between different whole panels, solves the problem of fixed serial number generation rules, improves the level of automation in production management and data traceability, and avoids the efficiency loss of frequent programming and template modification.
Smart Images

Figure CN121042722B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of laser marking, in particular to a laser marking method and system based on work order SN number jump management. BACKGROUND
[0002] The laser marking technology is widely used in the serial number identification and product traceability management of PCB. The traditional laser marking system usually generates serial numbers in a simple global counter increment manner, lacks a management mechanism combined with production batches and panel structure, and leads to the solidification of serial number generation rules and the inability to flexibly adapt to different product structures. When facing the batch production of multi-panel PCBs, the prior art cannot automatically calculate the serial number interval according to the number of panels, so that the serial numbers of small panels on the same whole panel cannot maintain continuity, and the serial numbers between different whole panels also cannot be incremented according to the predetermined rules, which seriously affects the batch traceability and quality management efficiency of products. SUMMARY
[0003] The present application provides a laser marking method and system based on work order SN number jump management, which avoids the efficiency loss of frequent programming and modification of templates, and improves the production management automation level and data traceability capability in the intelligent manufacturing environment.
[0004] In a first aspect, the present application provides a laser marking method based on work order SN number jump management, which comprises:
[0005] obtaining a work order data structure, wherein the work order data structure comprises a total number of PCBs, a number of panels, a prefix string, a suffix string, a base type and a starting number;
[0006] performing jump value calculation according to the starting number, a current PCB serial number, the number of panels and a current panel position serial number to obtain a current serial number string, and filling the current serial number string into a variable object in a marking template file to obtain marking content data;
[0007] correcting first marking coordinates corresponding to the marking content data to obtain second marking coordinates;
[0008] controlling a laser head to move to the second marking coordinates and perform a laser marking operation, and uploading the current serial number string and marking result data to a MES system after marking.
[0009] In combination with the first aspect, in a first implementation manner of the first aspect of the present application, the work order data structure comprises a total number of PCBs, a number of panels, a prefix string, a suffix string, a base type and a starting number, and comprises:
[0010] The work order generation interface receives user input for PCB name, total number of PCBs, number of panels, prefix string, suffix string, number system type, and starting number. The total number of PCBs is multiplied by the number of panels to obtain the total number of serial numbers.
[0011] When the number system type is decimal, a character set containing numbers 0 to 9 is generated as the number system content character set; when the number system type is hexadecimal, a character set containing numbers 0 to 9 and numbers A to F is generated as the number system content character set.
[0012] The PCB name, the total number of PCBs, the number of panels, the prefix string, the suffix string, the number system type, the number system content character set, the starting number, and the total number of serial numbers are encapsulated into a work order data structure.
[0013] In conjunction with the first aspect, in the second implementation of the first aspect of the present invention, the step of calculating the skip number value based on the starting number, the current PCB sequence number, the number of panels, and the current position sequence number within the board to obtain the current sequence number string, and filling the current sequence number string into a variable object in the marking template file to obtain the marking content data, includes:
[0014] Multiply the current PCB serial number by the number of panels to obtain the first calculation result, add the first calculation result to the current position serial number within the board to obtain the second calculation result, and then add the second calculation result to the starting number to obtain the decimal jump number value;
[0015] Divide the decimal skip sign value by the length of the character set of the base and take the remainder. Then, take the character at the corresponding position from the character set of the base according to the remainder and concatenate them to obtain the skip sign value string.
[0016] Concatenate the prefix string, the jump number string, and the suffix string to obtain the current sequence number string;
[0017] The current serial number string is filled into a variable object in the tagging template file, and an association mapping relationship is established between the variable object and the serial number variable to obtain the tagging content data.
[0018] In conjunction with the first aspect, in a third implementation of the first aspect of the present invention, the step of filling the current sequence number string into a variable object in the tagging template file and establishing an association mapping relationship between the variable object and the sequence number variable to obtain the tagging content data includes:
[0019] Extract the text objects, barcode objects, and graphic objects contained in the marking template file, and store the text objects, barcode objects, and graphic objects into an object list;
[0020] Select barcode-type variable objects from the object list and add them to the laser engraving object list. Configure the content source type of each variable object in the laser engraving object list as a serial number variable and establish an association mapping relationship between the variable objects and the serial number variables.
[0021] Iterate through each variable object in the laser engraving object list, replace the placeholder content of the variable object with the current serial number string, and generate the marking content data.
[0022] In conjunction with the first aspect, in the fourth implementation of the first aspect of the present invention, the laser marking method based on work order SN number skipping management further includes:
[0023] After each small panel is marked, the current position number within the panel is incremented by 1 and it is determined whether the number of panels has been reached. When the number has been reached, the current PCB number is incremented by 1 and the current position number within the panel is reset to 0. The updated PCB number, the current position number within the panel, the current serial number string, the work order status identifier, and the current timestamp are encapsulated into work order execution data.
[0024] After converting the work order execution data into XML format, it is first written to a backup work order execution status file. After successful writing, the contents of the backup work order execution status file are overwritten into the current work order execution status file to complete persistent storage.
[0025] In conjunction with the first aspect, in the fifth implementation of the first aspect of the present invention, after persistent storage is completed, the laser marking method based on work order SN number skipping management further includes:
[0026] When the software restarts, it reads the current SN continuation flag in the system parameter configuration. When the current SN continuation flag is enabled, it reads the current work order execution status file. If the reading fails, it reads the backup work order execution status file to obtain the current PCB number, current board position number and current serial number string at the time of the last interruption.
[0027] Consistency verification is performed based on the current PCB serial number, current on-board position serial number, and current serial number string at the time of the last interruption to obtain the data verification result;
[0028] When the data verification result is successful, the initial value of the PCB counter is set to the parsed current PCB serial number, the initial value of the board position counter is set to the parsed current board position serial number, and the current value of the serial number generator is set to the parsed current serial number string, thus completing the restoration of the system execution context.
[0029] The position of the next panel to be marked is calculated based on the restored PCB counter and the in-board position counter. The control track is used to move the PCB board into the marking station and the marking task continues from the position of the next panel to be marked.
[0030] In conjunction with the first aspect, in the sixth implementation of the first aspect of the present invention, the step of correcting the first marking coordinates corresponding to the marking content data to obtain the second marking coordinates includes:
[0031] Extract the pixel coordinate sequence of Mark points on the PCB board, and calculate the moment feature and shape context of the pixel coordinate sequence as a template contour feature descriptor;
[0032] The camera is controlled to move to the theoretical coordinates to capture real-time images, and actual contour feature descriptors are extracted from the real-time images;
[0033] Calculate the Hausdorff distance between the template contour feature descriptor and the actual contour feature descriptor, and determine the first and second actual coordinates of the Mark point based on the Hausdorff distance;
[0034] The first offset vector is calculated based on the first actual coordinates and the first theoretical coordinates, and the second offset vector is calculated based on the second actual coordinates and the second theoretical coordinates;
[0035] The rotation angle is calculated based on the first offset vector and the second offset vector, and an affine transformation matrix is constructed based on the first offset vector, the second offset vector, and the rotation angle.
[0036] The first marking coordinates are used as input to perform matrix operations on the affine transformation matrix to obtain the second marking coordinates.
[0037] In conjunction with the first aspect, in the seventh implementation of the first aspect of the present invention, the step of calculating the Hausdorff distance between the template contour feature descriptor and the actual contour feature descriptor, and determining the first and second actual coordinates of the Mark point based on the Hausdorff distance, includes:
[0038] Set a search area, divide the search area into multiple candidate position grids, set a rotation angle search range and generate multiple candidate angle values according to the angle step size, and perform a Cartesian product operation on the multiple candidate position grids and the multiple candidate angle values to obtain a candidate set of position angles;
[0039] Traverse each element in the candidate set of position and angle, transform the template contour feature descriptor according to the current candidate position and candidate angle value, and calculate the point-to-point distance with the actual contour feature descriptor to obtain the Hausdorf distance.
[0040] The first and second actual coordinates of the Mark point are determined based on the Hausdorff distance.
[0041] In conjunction with the first aspect, in the eighth implementation of the first aspect of the present invention, the step of controlling the laser head to move to the second marking coordinates and performing laser marking operation, and then uploading the current serial number string and marking result data to the MES system after marking is completed, includes:
[0042] The laser head is moved to the second marking coordinate. After reaching the target position, the laser is controlled to perform the marking operation according to the laser power parameters, pulse frequency parameters and filling spacing parameters set in the marking content data. After the marking is completed, the marking completion timestamp and the second marking coordinate are obtained as the marking position record.
[0043] Determine whether the automatic scanning flag after marking is enabled in the system parameter configuration. When the automatic scanning flag is enabled, scan the marking area to obtain the identification serial number string. Compare the identification serial number string with the current serial number string. When the two are completely consistent, set the marking quality judgment result to qualified. When the two are inconsistent or the recognition fails, set the marking quality judgment result to unqualified.
[0044] The current serial number string, the marking completion timestamp, the marking position record, the marking quality judgment result, and the operator's employee number are encapsulated into marking result data, and the marking result data is uploaded to the MES system.
[0045] Secondly, the present invention provides a laser marking system based on work order SN number skipping management, the laser marking system based on work order SN number skipping management includes:
[0046] The acquisition module is used to acquire the work order data structure, which includes the total number of PCBs, the number of panels, the prefix string, the suffix string, the number system type, and the starting number.
[0047] The calculation module is used to calculate the skip number value based on the starting number, the current PCB sequence number, the number of panels and the current position sequence number in the board, to obtain the current sequence number string, and to fill the current sequence number string into the variable object in the marking template file to obtain the marking content data;
[0048] The correction module is used to correct the first marking coordinates corresponding to the marking content data to obtain the second marking coordinates;
[0049] The laser marking operation module is used to control the laser head to move to the second marking coordinate and perform the laser marking operation. After the marking is completed, the current serial number string and the marking result data are uploaded to the MES system.
[0050] The technical solution provided by this invention establishes a work order-based SN number skipping management system, deeply integrating work order elements such as the total number of PCBs, the number of panels, and the number system type with the serial number generation algorithm. It employs a skipping calculation formula of "starting number + PCB serial number × number of panels + position number within the panel," achieving precise mapping between serial numbers and the physical structure of the panels. This ensures continuous serial numbers within the same panel and incremental increases between different panels according to the number of panels, solving the technical defects of traditional technologies where serial number generation rules are fixed and cannot adapt to panel structures. Through persistent storage of work order execution status files and a dual-file backup mechanism, the current PCB serial number, position number within the panel, and current serial number string can be accurately recovered from the XML status file after an abnormal interruption. After range verification and consistency verification, the PCB counter, position counter within the panel, and serial number generator are initialized to their pre-interruption states, and the task continues execution from the next panel to be marked. This completely eliminates the problem of serial number duplication or skipping caused by equipment power failure or software crashes, ensuring the continuity and integrity of serial numbers in mass production. By establishing a mapping relationship between variable objects and serial number variables in the marking template file, the current serial number string is dynamically filled into the placeholder position of the barcode object during marking execution. This allows the same template file to adapt to the variable content requirements of different work orders, avoiding the efficiency loss caused by frequent programming modifications to the template. The system employs the Euclidean algorithm to support serial number encoding in multiple bases, including decimal and hexadecimal. Combined with prefix and suffix string configuration, it can achieve composite encoding methods, meeting the diverse needs of different industries for serial number encoding rules. By calling the MES system's SubmitResult interface, data such as the current serial number string, marking completion timestamp, and marking quality judgment result are uploaded in real time in JSON format, improving the automation level of production management and data traceability capabilities in the intelligent manufacturing environment.
[0051] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0052] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0053] Figure 1 This is a schematic diagram of an embodiment of the laser marking method based on work order SN number skipping management in this invention.
[0054] Figure 2 This is a schematic diagram of an embodiment of a laser marking system based on work order number skipping management in this invention. Detailed Implementation
[0055] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0056] The terms "comprising" and "having," and any variations thereof, used in the embodiments of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.
[0057] To facilitate understanding of this embodiment, a laser marking method based on work order SN number skipping management, as disclosed in this embodiment of the invention, will first be described in detail. For example... Figure 1 As shown, this method includes the following steps:
[0058] 101. Obtain the work order data structure, which includes the total number of PCBs, the number of panels, the prefix string, the suffix string, the number base, and the starting number;
[0059] Specifically, the system receives multiple parameters input by the user through the work order generation interface. These parameters include the PCB name used to uniquely identify the product type, the total number of PCBs representing the total production volume of the entire panel, the number of panels indicating the number of sub-units within each panel, a prefix string used as a fixed text prefix for the serial number, a suffix string used as a fixed text suffix for the serial number, the radix type controlling the serial number increment logic, and the starting value used to initialize the skip number algorithm. After the user completes the above information input, the system performs logical calculations to determine the total number of required serial numbers. It then multiplies the total number of PCBs by the number of panels to obtain the number of unique serial numbers required for marking all small panels in this batch. Based on this, it automatically constructs a radix character set according to the selected radix type. When the radix type is decimal, the generated character set contains ten numeric characters from 0 to 9. If the radix type is hexadecimal, it generates a radix character set containing the digits 0 to 9 and the uppercase letters A to F, a total of sixteen symbols. All input parameters and calculation results are encapsulated in a structured manner to construct a data model containing fields such as PCB name, total number of PCBs, number of panels, prefix string, suffix string, number system type, number system content character set, starting number, and total number of serial numbers, thus forming the work order data structure.
[0060] 102. Calculate the jump number value based on the starting number, current PCB sequence number, number of panels, and current position sequence number within the board to obtain the current sequence number string. Then, fill the current sequence number string into the variable object in the marking template file to obtain the marking content data.
[0061] Specifically, based on the hierarchical mapping relationship between the current PCB serial number and the number of panels, a basic jump number operation is performed. The current PCB serial number is multiplied by the number of panels to obtain a first operation result reflecting the current position of the entire panel within the sequence interval of the overall work order. The first operation result is added to the position serial number of the small panel within the current board to obtain a second operation result. The second operation result represents the global position of the current small panel in the entire marking batch. The second operation result is added to the starting number to obtain a decimal jump number value used for encoding conversion. Logically, the decimal jump number value ensures that the serial numbers within the same entire panel are continuous while the serial numbers between panels are progressive. The decimal skip number value is modulo-operated according to the length of the preset base character set. The skip number value is divided by the base character set length and the remainder is taken. The remainder corresponds to the specific character index in the base character set. By repeatedly performing quotient and remainder operations and concatenating the resulting characters from the least significant digit to the most significant digit, a skip number value string conforming to the target base is generated. The skip number value string has a unique one-to-one mapping with the decimal skip number value. The prefix string, the converted skip number value string, and the suffix string are combined sequentially according to the string concatenation order to form the current sequence number string, which is the marking content required for this laser marking operation. The variable object is located in the template file loaded by the marking software, and the current sequence number string is filled into the corresponding position of the object. At the same time, a binding mapping relationship is established between the variable object and the sequence number variable. The mapping relationship is bidirectionally associated through the template object ID and the SN variable name, so that the template can automatically replace the variable placeholder with the actual sequence number when performing the marking operation, and obtain the marking content data carrying dynamic encoding information.
[0062] 103. Correct the first marking coordinates corresponding to the marking content data to obtain the second marking coordinates;
[0063] Specifically, Mark point image information is extracted at preset locations on the PCB board. Two Mark point regions with high stability and high recognizability are selected on the PCB, and local images containing the Mark points are acquired using an image acquisition device. Binarization and contour extraction are performed on the edge regions in the images. The pixel coordinate sequence of the Mark points is used as the basic input. The geometric distribution characteristics of the contour are described by calculating invariants such as geometric moments, central moments, and shape context, forming a template contour feature descriptor. An industrial camera is guided by a motion control system to move to the vicinity of the coordinates of the first and second theoretical Mark points set in the program, and real-time images of the actual production board are acquired at the theoretical positions. The contour extraction process is performed on the acquired images, and actual contour feature descriptors are generated. Matching analysis is performed between the template contour feature descriptors and the actual contour feature descriptors extracted from the real-time images. The Hausdorff distance between the two sets of feature points is used as the matching similarity index. The smaller the Hausdorff distance, the higher the contour matching accuracy. The coordinates of the first and second Mark points in the actual image are identified based on the image coordinates corresponding to the position with the minimum Hausdorff distance, and are recorded as the first actual coordinates and the second actual coordinates, respectively. The first offset vector is calculated by subtracting the first actual coordinates from the preset first theoretical coordinates, and the second offset vector is calculated by subtracting the second actual coordinates from the second theoretical coordinates. These two offset vectors describe the systematic offset of the production board relative to the programming reference board in terms of position and translation. Based on the coordinate difference between the first and second offset vectors, the angle between them is calculated using inverse trigonometric functions, which serves as the rotation angle. Combining the component information of the two offset vectors and the rotation angle, a two-dimensional affine transformation matrix containing translation and rotation components is constructed. The first marking coordinates are input into the affine transformation matrix to perform coordinate transformation, and the second marking coordinates, corrected for position and angle, are obtained through matrix multiplication.
[0064] 104. Control the laser head to move to the second marking coordinate and perform laser marking operation. After marking is completed, upload the current serial number string and marking result data to the MES system.
[0065] Specifically, the XY motion platform of the laser marking device, driven by the second marking coordinate, smoothly controls the motion process through a preset S-curve acceleration and deceleration algorithm, enabling the laser head to reach the target marking position without vibration or error accumulation. After the laser head completes positioning, it retrieves the marking content data already filled in the marking template and adjusts the laser output in real time according to the set marking parameters, including laser power parameters, pulse frequency parameters, and fill spacing parameters. The laser power parameter determines the energy output of a single laser pulse, the pulse frequency parameter affects the superposition density of laser pulses, and the fill spacing controls the density of the scanning lines within the pattern area. These three parameters work together to affect the clarity and physical depth of the marked pattern. The laser executes the marking action under the command of the control system. After marking is completed, the current system time is recorded as the marking completion timestamp, and the second marking coordinate is recorded as the spatial position of this marking, constructing basic traceability information that links position and time. The system checks if the "Automatic Scan After Marking" flag in the configuration parameters is enabled. If enabled, it automatically calls the image acquisition module or scanning device to scan the area that has just been marked, obtains the identified serial number string, and performs a string-level comparison with the original serial number string generated in the current logic. If the two match perfectly, the marking quality judgment result is automatically set to qualified. If the recognition fails or the comparison is inconsistent, the quality judgment result is set to unqualified and marked as NG. After the marking task is completed, all core data elements of this marking are uniformly encapsulated, including the current serial number string, the marking completion timestamp, the second marking coordinate as the marking position record, the marking quality judgment result, and the operator's employee number. This data set constitutes the marking result data and is uploaded through the configured MES system interface, supporting configuration file writing mode and WebService API call mode. The uploaded data is received by the MES system and stored in the central database.
[0066] In one specific embodiment, the process of performing step 101 may specifically include the following steps:
[0067] The work order generation interface receives user input for PCB name, total number of PCBs, number of panels, prefix string, suffix string, number system type, and starting number. It then multiplies the total number of PCBs with the number of panels to obtain the total number of serial numbers.
[0068] When the number system type is decimal, a character set containing 0 to 9 is generated as the number system content character set; when the number system type is hexadecimal, a character set containing 0 to 9 and A to F is generated as the number system content character set.
[0069] The PCB name, total number of PCBs, number of panels, prefix string, suffix string, number system type, number system content character set, starting number, and total number of serial numbers are encapsulated into a work order data structure.
[0070] Specifically, a graphical user interface with parameter acquisition and data structure encapsulation capabilities is constructed. The interface allows users to input key parameter fields related to the current marking work order one by one, including the PCB name used to identify the specific product model or batch mark, the total number of PCBs used to define the total number of marking objects, the number of panels used to describe the sub-panel structure in each panel, the prefix string used to indicate the beginning of the serial number, and the suffix string used to indicate the end of the serial number. Furthermore, users can select or drop down to set the number base used for the serial number in the interface. The number base is used to control the encoding rules of the serial number value during the jump number increment process. Supported number bases include two common modes: decimal and hexadecimal, or can be extended to custom number bases. A start number input box is also provided to set the starting point of the SN number for this batch of marking operations. After the user completes the above field input, the input data undergoes format validation and logical verification to ensure that the total number of PCBs and the number of panels are positive integers, the starting number conforms to the selected number system, and the prefix and suffix are not empty and contain no illegal characters. After successful verification, the calculation processing logic is executed, multiplying the total number of PCBs and the number of panels input by the user to obtain the total number of serial numbers required in the current work order. When the user selects a decimal number system, a character set "0123456789" is automatically constructed as the character reference basis for number system conversion operations in the skip numbering process. When the number system is hexadecimal, an extended character set "0123456789ABCDEF" is constructed to support high-digit encoding and a larger numbering space. The number system character set is consistent with the division and concatenation logic in the skip numbering algorithm. After all field values have been calculated and content generated, the PCB name, total number of PCBs, number of panels, prefix string, suffix string, number system type, number system character set, starting number, and total number of serial numbers obtained by multiplication are packaged and encapsulated into structured data units in a unified format, thus forming a standardized work order data structure.
[0071] In one specific embodiment, the process of performing step 102 may specifically include the following steps:
[0072] Multiply the current PCB number by the number of panels to get the first result. Add the first result to the current position number within the board to get the second result. Add the second result to the starting number to get the decimal jump number value.
[0073] Divide the decimal skip sign value by the length of the character set of the base content and take the remainder. Then, take the character at the corresponding position from the character set of the base content based on the remainder and concatenate them to obtain the skip sign value string.
[0074] Concatenate the prefix string, the jump sign numeric string, and the suffix string to obtain the current sequence number string;
[0075] The current serial number string is filled into a variable object in the tagging template file, and an association mapping relationship is established between the variable object and the serial number variable to obtain the tagging content data.
[0076] Specifically, based on the physical board number and logical position, a jump number calculation is performed. The current PCB sequence number is multiplied by the number of panels in the small panel within the single PCB to obtain the global offset of the entire panel's starting position within the sequence number distribution range. This is the first calculation result. The first calculation result is added to the current position sequence number within the board to obtain the second calculation result, which identifies the relative absolute position of the small panel in the entire batch of marking tasks. The second calculation result is then added to the preset starting number in the work order parameters to generate a decimal jump number value. The information carried by this value is the original number that is logically continuous and has a hierarchical correspondence. The decimal skip number value is converted to the target base character representation using the Euclidean algorithm. This involves dividing the decimal skip number value by the length of the character set in the target base, taking the remainder as the modulo, and retrieving the character corresponding to the least significant digit in the target base. The character at that position is then retrieved by reading the index of the remainder in the character set. The decimal skip number value is updated to the integer part obtained by dividing this value by the base length. This modulo and character lookup operation is repeated until the skip number value is divisible. During this process, each retrieved character is concatenated from the least significant digit to the most significant digit to form the skip number string, which is the valid representation of the current number in the target base. The prefix string, skip number string, and suffix string set in the work order data are then concatenated sequentially to form a unified current sequence number string. The current serial number string is dynamically filled into the variable object position defined in the marking template file. The template structure is parsed by the laser marking software and the target object containing the SN variable placeholder is located. The content source of the object is configured as the SN variable in the object attribute setting interface. The binding mapping relationship between the variable object and the currently logically generated serial number is established in the variable parsing module. The filled template content is sent as the marking content data and drives the laser marking operation.
[0077] In one specific embodiment, the process of filling the current serial number string into a variable object in the tagging template file and establishing an association mapping relationship between the variable object and the serial number variable to obtain the tagging content data can specifically include the following steps:
[0078] Extract the text objects, barcode objects, and graphic objects contained in the marking template file, and store the text objects, barcode objects, and graphic objects into an object list;
[0079] Select barcode-type variable objects from the object list and add them to the laser engraving object list. Configure the content source type of each variable object in the laser engraving object list as a serial number variable and establish an association mapping relationship between the variable objects and the serial number variables.
[0080] Iterate through each variable object in the laser engraving object list, replace the placeholder content of the variable object with the current serial number string, and generate the marking content data.
[0081] Specifically, the marking template file is loaded and a structure parsing operation is performed. The marking template file is created by laser marking software (such as MarkStudio) and contains multiple different types of template objects. These template objects include text objects for outputting variable or fixed text content, barcode objects for generating one-dimensional or two-dimensional barcodes, and graphic objects for constructing visual auxiliary graphics. After the template file is loaded, all object elements contained within it are extracted by traversing the data structure of the template. The aforementioned text objects, barcode objects, and graphic objects are then identified, categorized, and uniformly stored in an object list. For each object in the object list, type determination and attribute filtering operations are performed to filter out all objects that belong to the barcode type and have variable field attributes. Typical barcode objects include Code128, DataMatrix, and QRCode. Text fields containing variable placeholders are specifically marked for replacement operations. The filtered variable barcode objects are then uniformly added to the laser marking object list. The laser marking object list is used to identify all marking content instances in the template that require external variables to drive. For each variable object in the laser engraving object list, a content source is configured. In the object attribute configuration module, the content source field for each object is set to the "serial number variable" type, and the bound variable name is explicitly identified. The variable name must be completely consistent with the output field in the serial number generation module. Simultaneously, a bidirectional mapping relationship is established between the template object attribute table and the variable mapping dictionary, i.e., the object ID points to the serial number variable name, and the corresponding object ID can be retrieved from the variable name. For the current panel position to be marked and the work order parameters, a skipping number algorithm is used to generate the current serial number string. Then, each variable object in the laser engraving object list is traversed. During the traversal, the placeholder fields inside each object are replaced with the current serial number string, forming the completed and filled actual output content. The replacement operation applies to the character fields of barcode content and supports the replacement of encoded text in QR codes, adaptive adjustment of format validation, and dynamic impact analysis of content length on the marking range. After completing the serial number binding and content replacement of all variable objects, the updated template object set is merged into a marking content data structure.
[0082] In one specific embodiment, the laser marking method based on work order number skipping management further includes the following steps:
[0083] After each small panel is marked, the current position number within the panel is incremented by 1 and it is determined whether the number of panels has been reached. When the number has been reached, the current PCB number is incremented by 1 and the current position number within the panel is reset to 0. The updated PCB number, the current position number within the panel, the current serial number string, the work order status identifier, and the current timestamp are encapsulated into work order execution data.
[0084] After converting the work order execution data into XML format, it is first written to the backup work order execution status file. After successful writing, the contents of the backup work order execution status file are overwritten into the current work order execution status file to complete persistent storage.
[0085] Specifically, after each laser marking operation of a small panel is completed, the work order status is progressively calculated and data is encapsulated to ensure that the execution progress of the production task is traceable and has breakpoint recovery capability at any time. When a small panel marking task is completed, the position number within the board is updated according to the counter variable in the work order execution context. The current position number within the board is incremented by 1 to indicate that the marking index of the panel has been advanced, and it is immediately determined whether the position number within the board has reached the maximum number of panels. If the result is that the number of panels has not been reached, it means that there are still unfinished marking positions in the same panel of the current PCB. In this case, only the position counter within the board is updated and the current PCB number remains unchanged so as to enter the next marking cycle. If the result is that the number of panels has been reached, it means that all small panel marking tasks in the current panel have been completed. At this time, the current PCB number is incremented by 1 to enter the marking sequence of the next panel, and the position number within the board is reset to 0, which is the initialization state for a new round of panel marking tasks. After completing the above logical progression, the key operational data for this status update is uniformly encapsulated into a work order execution data structure. This structure includes the updated PCB serial number, current on-board position number, current sequence number string, work order status identifier, and current timestamp. The PCB serial number and on-board position number jointly identify the current production progress. The current sequence number string reflects the latest completed identifier number. The work order status identifier marks the current execution stage of the work order (e.g., in progress, paused, or completed), and the timestamp records the moment the status change occurred. After encapsulating the work order execution data, the structure is serialized into XML format data. The serialization process involves converting each field into a standard XML tag structure and embedding it into a unified root node. A dual-file write strategy is adopted. The serialized XML data is written to a backup work order execution status file. After the write operation is completed, data security is confirmed by verifying file integrity and a write success identifier. Then, the system overwrites the complete content of the backup file into the current work order execution status file, completing the persistent storage of the work order status data. This dual-write mechanism effectively avoids the loss of status information caused by equipment power failure, system restart, or file I / O interruption.
[0086] In one specific embodiment, after persistent storage is completed, the laser marking method based on work order SN number skipping management further includes the following steps:
[0087] When the software restarts, it reads the current SN continuation flag from the system parameter configuration. When the current SN continuation flag is enabled, it reads the current work order execution status file. If the reading fails, it reads the backup work order execution status file to obtain the current PCB number, current board position number, and current serial number string at the time of the last interruption.
[0088] Consistency verification is performed based on the current PCB serial number, current on-board position serial number, and current serial number string at the time of the last interruption to obtain the data verification result;
[0089] When the data verification result is successful, the initial value of the PCB counter is set to the parsed current PCB serial number, the initial value of the board position counter is set to the parsed current board position serial number, and the current value of the serial number generator is set to the parsed current serial number string, thus completing the restoration of the system execution context;
[0090] The position of the next panel to be marked is calculated based on the restored PCB counter and the in-board position counter. The control track is then used to move the PCB to the marking station, and the marking task continues from the position of the next panel to be marked.
[0091] Specifically, after the software restarts, it reads the "Continue Current SN" flag from the system parameter configuration file. This flag is a Boolean parameter used to indicate whether the breakpoint recovery function is enabled after the system restarts. When the flag is detected as enabled, the system enters the work order recovery logic branch. At this point, it first attempts to read the current work order execution status file. The work order execution status file stores the work order status data from the last task execution, including key fields such as the current PCB serial number, the current on-board position number, the current serial number string, the work order status identifier, and the last update timestamp. If file corruption, missing fields, or CRC check failures are detected while reading the current work order execution status file, a redundancy protection mechanism is activated, automatically switching to the backup work order execution status file for data reading. After successfully parsing any file, the current PCB serial number, the current on-board position number, and the current serial number string from the last interruption are extracted, and these parameters are temporarily stored in the recovery cache structure in memory. Upon entering the data consistency verification phase, based on the work order data structure parameters during work order initialization, the read PCB serial number and on-board position serial number are checked for range validity to ensure that the PCB serial number does not exceed the total number of panels and the on-board position serial number does not exceed the panel count threshold. Simultaneously, the skip numbering algorithm module is invoked to recalculate the theoretical serial number using the current PCB serial number, on-board position serial number, and starting number, and compares it with the read current serial number string. If both match perfectly and the encoding structure conforms to the base rule, the verification result is considered passed. If any field does not conform to the specification or fails to match, it is marked as verification failed and manual intervention is prompted. After successful verification, the execution context recovery phase begins. In this phase, the initial value of the PCB counter is set to the parsed current PCB serial number to ensure that the next loop continues execution from the correct panel number. Simultaneously, the initial value of the on-board position counter is set to the parsed current on-board position serial number to restore the marking progress of the current panel. The current value of the serial number generator is set to the parsed current serial number string, enabling the skip numbering algorithm to continue generating new numbers from the previously marked serial number position. After restoring the context variables, the position coordinates of the next panel to be marked are recalculated. Based on the restored PCB counter and the in-board position counter, the corresponding physical transfer sequence is calculated, and the track motion system is controlled to automatically feed the board, accurately transferring the corresponding PCB board to the laser marking station. Once the board is in place, the previously bound marking template and SN variable mapping relationship is loaded, and the marking task continues from the position of the next panel to be marked.
[0092] In one specific embodiment, the process of performing step 103 may specifically include the following steps:
[0093] Extract the pixel coordinate sequence of Mark points on the PCB board, and calculate the moment feature and shape context of the pixel coordinate sequence as template contour feature descriptor;
[0094] Control the camera to move to the theoretical coordinates to capture real-time images, and extract actual contour feature descriptors from the real-time images;
[0095] Calculate the Hausdorff distance between the template contour feature descriptor and the actual contour feature descriptor, and determine the first and second actual coordinates of the Mark point based on the Hausdorff distance;
[0096] The first offset vector is calculated based on the first actual coordinates and the first theoretical coordinates, and the second offset vector is calculated based on the second actual coordinates and the second theoretical coordinates;
[0097] The rotation angle is calculated based on the first offset vector and the second offset vector, and the affine transformation matrix is constructed based on the first offset vector, the second offset vector, and the rotation angle.
[0098] The first marking coordinates are used as input to perform matrix operations on the affine transformation matrix to obtain the second marking coordinates.
[0099] Specifically, the pixel coordinate sequence of Mark points on the PCB board is extracted from the Mark point region generated during the template setting stage. This pixel coordinate sequence is obtained by edge detection and contour tracking algorithms and includes the coordinates of the boundary point set within the Mark point region. Geometric moment features, including statistical parameters such as zero-order moment, central moment, and normalized moment, are calculated based on the pixel coordinate sequence to characterize the geometric distribution features of the Mark point region. Simultaneously, a shape context descriptor for each contour point is calculated. By analyzing the relative polar coordinate distance and angle relationships between points, a set of feature vectors is formed, resulting in a template contour feature descriptor that maintains stable recognition capabilities under conditions of rotation, scaling, and lighting changes. The driving vision positioning module controls the industrial camera to move to a predefined theoretical coordinate point position, capturing a real-time image of the current PCB at that position. The image is then processed by grayscale conversion, filtering, and binarization to remove background noise and surface reflection interference. Contour extraction is performed on the preprocessed image to extract the pixel coordinate contour data of the actual Mark points, and the actual contour feature descriptor is obtained using the same calculation method as the template. The template contour feature descriptor is matched with the real-time extracted actual contour feature descriptor, and the Hausdorff distance is used as a metric for matching accuracy. The shape similarity of the contours is measured by calculating the maximum and minimum distances between the two sets of points. When the Hausdorff distance reaches its minimum value, the corresponding position is identified as the best matching point. Based on this, the first and second actual coordinates of the Mark point on the current PCB board are determined to reflect the offset of the actual Mark point relative to its theoretical position. The corresponding offset vectors are calculated based on the first and second actual coordinates and the first and second theoretical coordinates, respectively. The first offset vector represents the translational difference of Mark point 1 in the horizontal and vertical directions, while the second offset vector describes the offset trend of Mark point 2. The rotation angle is calculated using the component information of the two sets of offset vectors. The angle between the two connecting vectors is solved using inverse trigonometric functions to obtain the actual rotational deviation of the PCB board. Based on the calculated translational offset and rotation angle, an affine transformation matrix is constructed, which includes translation, rotation, and scaling parameters, and can describe the geometric mapping relationship from the theoretical coordinate system to the actual production coordinate system. Input the first marking coordinates into the affine transformation matrix, perform matrix multiplication, and obtain the second marking coordinates corresponding to the actual physical location by performing a linear transformation on the coordinate points.
[0100] In one specific embodiment, the process of calculating the Hausdorff distance between the template contour feature descriptor and the actual contour feature descriptor, and determining the first and second actual coordinates of the Mark point based on the Hausdorff distance, can specifically include the following steps:
[0101] Set a search area, divide the search area into multiple candidate position grids, set the rotation angle search range and generate multiple candidate angle values according to the angle step size, perform Cartesian product operation on multiple candidate position grids and multiple candidate angle values to obtain a candidate set of position angles;
[0102] Traverse each element in the candidate set of position and angle, transform the template contour feature descriptor according to the current candidate position and candidate angle value, and calculate the point-to-point distance with the actual contour feature descriptor to obtain the Hausdorf distance.
[0103] The first and second actual coordinates of the Mark point are determined based on the Hausdorff distance.
[0104] Specifically, a finite two-dimensional search region is defined near the theoretical coordinates, and the search boundary is determined based on equipment clamping errors and mechanical tolerances. The search region is discretized into a regular grid to obtain several candidate position grids. Simultaneously, a rotation angle search interval is defined within the possible attitude deviation range, and a set of candidate angle values is generated according to a set angle step size. The candidate position grid set and the candidate angle value set are subjected to a Cartesian product operation to form a "position-angle candidate set" covering translational and rotational degrees of freedom. During set generation, a multi-level configuration of coarse-to-fine grid resolution and angle step size is adopted, allowing the first layer to quickly converge to the feasible region with a larger step size, while subsequent layers refine the set progressively to reduce overall computational load and avoid local optima. Each element in the position-angle candidate set is traversed, and the template contour feature descriptor is transformed in coordinates at the current candidate position and angle. The coordinate transformation maintains the topological and scale consistency of the template contour. Simultaneously, the matching set of candidate point pairs is narrowed down using pre-computed moment features and shape context indexes to accelerate distance evaluation. After coordinate transformation, the transformed template contour point set and the actual contour point set extracted from the real-time image are used to calculate point-to-point distances. Hausdorff distance is used as the shape similarity metric, and a truncation metric and quantile aggregation strategy that are insensitive to noise and local occlusion are introduced to obtain stable matching scores even in the presence of local contamination, reflection, or small gaps. Simultaneously, an online update and early stopping mechanism for the optimal distance is maintained for each candidate element. That is, when the distance of a partial block of the current candidate falls below the current optimal threshold, the calculation of other point pairs is immediately stopped, thereby ensuring real-time performance even with a large candidate set. After obtaining the candidate element with the current global minimum Hausdorff distance, a local quadratic search with a finer mesh and smaller angle step is performed around its position and angle, supplemented by subpixel centroid interpolation and RANSAC-style outlier removal to suppress the influence of isolated outliers. When the local refinement converges, the translation and rotation parameters of the corresponding candidate are substituted back to recover the actual landing positions of the two Mark points in the template reference frame, and the first and second actual coordinates of the Mark points are output accordingly.
[0105] In one specific embodiment, the process of performing step 104 may specifically include the following steps:
[0106] The laser head is moved to the second marking coordinate. After reaching the target position, the laser is controlled to perform the marking operation according to the laser power parameters, pulse frequency parameters and filling spacing parameters set in the marking content data. After the marking is completed, the marking completion timestamp and the second marking coordinate are obtained as the marking position record.
[0107] Determine whether the automatic scanning flag after marking is enabled in the system parameter configuration. When the automatic scanning flag is enabled, scan the marking area to obtain the identification serial number string. Compare the identification serial number string with the current serial number string. When the two are completely consistent, set the marking quality judgment result to qualified. When the two are inconsistent or the identification fails, set the marking quality judgment result to unqualified.
[0108] The current serial number string, the timestamp of the marking completion, the marking position record, the marking quality judgment result, and the operator's employee number are encapsulated into marking result data, and the marking result data is uploaded to the MES system.
[0109] Specifically, the laser motion control module receives the second marking coordinate data and drives the XY motion platform to perform S-curve acceleration and deceleration interpolation calculations, causing the laser head to move along a smooth trajectory to the target position. Upon reaching the coordinate point, it triggers a laser emission enable signal. The module reads the laser power parameters, pulse frequency parameters, and fill spacing parameters configured in the marking content data. These three parameters collectively define the laser output characteristics: the power parameter determines the single-pulse energy, the frequency parameter determines the energy superposition density, and the fill spacing parameter controls the spot coverage and engraving depth. The controller synchronously sends these parameters to the laser, achieving real-time control of energy output through a digital-analog hybrid modulation method, thereby completing the marking action according to the barcode or QR code path in the template data. After marking is completed, the system timestamp at the time of marking completion is captured as the "marking completion time," and the current second marking coordinate is recorded as the "marking position record." Together, these constitute the spatial and temporal index of the marking task. The system checks if the "Automatic Scan After Marking" flag in the system parameter configuration is enabled. If enabled, the scanning and recognition module is automatically triggered, using a high-resolution industrial camera or a 1D / 2D barcode scanner to identify the area that has just been marked, and the recognition result is parsed into a serial number string. The obtained serial number string is compared with the current serial number string generated for this marking task. If they match perfectly, the marking quality judgment result is automatically set to "Pass". If the recognition fails or the recognized content does not match the expected serial number, the marking quality judgment result is set to "Fail", and the reason for the failure is recorded in the local database for traceability. After the quality inspection is completed, all the data from this task is encapsulated, including the current serial number string, the marking completion timestamp, the second marking coordinates, the marking quality judgment result, and the operator's employee number, forming a unified marking result data structure. The data transmission module selects the data upload mode based on system parameters. When the system is configured in file interaction mode, the marking result data is formatted into an XML or CSV file and written to the specified path of the MES system, which then periodically checks and imports it. When configured in WebService interface mode, the marking result data packet in JSON structure is directly uploaded by calling the SubmitResult method of the MES interface service. After receiving the data, the MES server writes it to the production database and triggers the quality statistics and anomaly warning mechanism.
[0110] The laser marking method based on work order SN number skipping management further includes: verifying the format validity of the current serial number string by using regular expression matching to verify whether the current serial number string conforms to the preset combination format of prefix string, skipping number numerical string, and suffix string, and calculating the total character length of the current serial number string and comparing it with the maximum allowed encoding length of the barcode type. If the format does not match or the length exceeds the limit, a serial number format anomaly flag is generated; querying the local historical database of marked serial numbers, comparing the current serial number string with all serial number records stored in the historical database one by one, and generating a serial number duplicate conflict flag when the current serial number string is detected to already exist in the historical database; simultaneously reading the work order execution status file and calculating the MD5 checksum of the file content, comparing the calculated MD5 checksum with the baseline MD5 checksum recorded when the work order was initially generated, and generating a work order data tampering flag when the two are inconsistent; and when the serial number format is different... When any of the following flags is triggered: constant flag, serial number duplicate conflict flag, or work order data tampering flag, the current marking task is paused and an adaptive adjustment strategy is initiated. The adaptive adjustment strategy includes: when the serial number duplicate conflict flag is triggered, the current PCB serial number is incremented by 1 and the skipping number algorithm is re-executed to generate a new serial number string; when the work order data tampering flag is triggered, the work order data is restored from the backup work order execution status file and the work order data structure is reloaded; when the serial number format abnormality flag is triggered, an alarm is issued to the operator and manual intervention is requested; the deviation between the laser output power value and the laser power parameter setting value is monitored in real time. When the deviation exceeds the preset power fluctuation threshold, the laser power is determined to be abnormal. A fuzzy control algorithm is used to calculate the power compensation amount based on the deviation value and the deviation change rate. The power compensation amount is superimposed on the laser power parameter setting value to form an adaptively adjusted laser power output value. The laser is controlled to perform the marking operation according to the adaptively adjusted laser power output value to ensure that the marking quality is not affected by laser power fluctuations.
[0111] The laser marking method based on work order number skipping management further includes: dividing the PCB board into multiple panel areas according to the physical distribution of the panels based on the panel number parameter and the second marking coordinate in the work order data structure; assigning a unique area identifier number to each panel area; traversing the total number of serial numbers in the work order data structure; determining the panel area to which the serial number belongs based on the board position number corresponding to the serial number; establishing a mapping relationship table between serial numbers and panel area identifier numbers; extracting the second marking coordinates of all marking positions in each panel area; sorting the marking positions in the same panel area according to the ascending order of the current PCB serial number and the current board position number; calculating the Euclidean distance between adjacent marking positions as the laser head movement cost; encapsulating the marking position coordinates and movement costs of all panel areas into path planning input data; and then processing the path planning... The input data is fed into an improved nearest neighbor search algorithm for path optimization. This algorithm starts at the current laser head position and selects the nearest marking position that satisfies the continuity constraint of the panel area from the set of unvisited marking positions as the next access node. Once all marking positions within the same panel area have been visited, the algorithm selects the nearest neighbor node across areas, repeating this process until all marking positions have been traversed, resulting in an optimized FOV access path sequence. Based on this optimized FOV access path sequence, the marking task execution order is rearranged, and the laser head is controlled to move sequentially to each marking position and perform the marking operation. Compared to marking one by one according to the sequence number, the optimized FOV access path sequence reduces the total movement distance of the laser head, shortening the single-panel marking cycle time.
[0112] The laser marking method based on work order number skipping management also includes: querying the quality data of completed marking tasks within a specified time period by calling the QueryQualityData interface provided by the MES system. The quality data includes the marking quality judgment result, defect type identifier, laser power parameter value, pulse frequency parameter value, and fill spacing parameter value corresponding to each serial number. The quality data returned by the query is grouped and statistically analyzed according to PCB name and marking date to obtain a historical marking quality dataset. The marking quality judgment results in the historical marking quality dataset are statistically analyzed, and the ratio of the number of qualified samples to the total number of samples is calculated as the pass rate indicator. The frequency of defect type identifiers is statistically analyzed to obtain the probability distribution of each defect type. The main defect types with a probability higher than a preset threshold are screened out. For each main defect type, the laser power parameter value, pulse frequency parameter value, and fill spacing parameter value of the corresponding sample are extracted, and the mean and standard deviation of each parameter are calculated as the defect value. The system generates parameter feature vectors and establishes a fuzzy inference rule base containing multiple inference rules in the form of "if the defect type is X and the parameter deviation is Y, then the adjustment amount is Z". The defect parameter feature vectors are input into the fuzzy inference rule base for fuzzification. The corresponding inference rules are matched based on the defect type identifier. The centroid method is used to defuzzify the fuzzy inference results to obtain the laser power adjustment, pulse frequency adjustment, and fill spacing adjustment. The laser power adjustment is superimposed on the laser power parameter in the marking content data to obtain the adaptively optimized laser power parameter. The pulse frequency adjustment is superimposed on the pulse frequency parameter to obtain the adaptively optimized pulse frequency parameter. The fill spacing adjustment is superimposed on the fill spacing parameter to obtain the adaptively optimized fill spacing parameter. The adaptively optimized laser power parameter, adaptively optimized pulse frequency parameter, and adaptively optimized fill spacing parameter are then updated in the marking content data of subsequent marking tasks, and the marking operation is performed.
[0113] The laser marking method based on work order SN number skipping management further includes: establishing a serial number continuity monitoring window data structure, which includes a window capacity parameter and a serial number record queue. The window capacity parameter is set to twice the number of panels. After each marking operation, the current serial number string is converted to a decimal value and inserted into the tail of the serial number record queue. When the length of the serial number record queue exceeds the window capacity parameter, the earliest record at the head of the queue is deleted, keeping the queue length constant at the window capacity parameter. The difference between adjacent serial number values in the serial number record queue is calculated to obtain a serial number interval value sequence. The frequency of occurrence of each interval value in the sequence is counted, and the interval value with the highest frequency is selected as the standard skipping interval reference value. Each interval value in the sequence is compared with the standard skipping interval reference value. When the absolute value of the difference between the interval value and the standard skipping interval reference value is greater than a preset deviation tolerance threshold, the interval is determined to be an abnormal skipping interval, and its position index in the queue is recorded. When an abnormal skipping interval is detected... When the number interval is specified, the anomaly type is determined based on the numerical characteristics of the abnormal skip interval. When the abnormal skip interval is 0, it is determined to be a serial number duplication anomaly, and a duplication anomaly warning message is generated. When the abnormal skip interval is greater than twice the reference value of the standard skip interval, it is determined to be a serial number jump anomaly, and a jump anomaly warning message is generated. When the abnormal skip interval is negative, it is determined to be a serial number backtracking anomaly, and a backtracking anomaly warning message is generated. The anomaly type, the time of anomaly occurrence, the abnormal serial number value, and the current PCB serial number are encapsulated into a serial number anomaly event record and stored in the local anomaly log file. The corresponding anomaly handling strategy is executed according to the anomaly type. When a duplication anomaly warning message is detected, the marking task is paused and the adaptive adjustment strategy in step 3 is called to regenerate the serial number string. When a jump anomaly warning message is detected, an alarm prompt is sent to the operator and confirmation is requested that there is any manual modification of the work order data. When a backtracking anomaly warning message is detected, it is determined to be that the work order execution status file is corrupted, and the data is restored from the backup work order execution status file. After the anomaly handling is completed, the serial number record queue is cleared and monitoring is restarted.
[0114] The laser marking method based on work order SN number skipping management in the embodiments of the present invention has been described above. The laser marking system based on work order SN number skipping management in the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 2 One embodiment of the laser marking system based on work order number skipping management in this invention includes:
[0115] The acquisition module 201 is used to acquire the work order data structure, which includes the total number of PCBs, the number of panels, the prefix string, the suffix string, the number base, and the starting number.
[0116] The calculation module 202 is used to calculate the jump number value based on the starting number, the current PCB sequence number, the number of panels and the current position sequence number in the board, to obtain the current sequence number string, and to fill the current sequence number string into the variable object in the marking template file to obtain the marking content data;
[0117] The correction module 203 is used to correct the first marking coordinates corresponding to the marking content data to obtain the second marking coordinates;
[0118] The laser marking operation module 204 is used to control the laser head to move to the second marking coordinate and perform the laser marking operation. After the marking is completed, the current serial number string and the marking result data are uploaded to the MES system.
[0119] Through the collaborative efforts of the aforementioned components, and by establishing a work order-based SN number skipping management system, work order elements such as the total number of PCBs, the number of panels, and the number system type are deeply integrated with the serial number generation algorithm. The skipping calculation formula of "starting number + PCB serial number × number of panels + position number within the panel" achieves a precise mapping between serial numbers and the physical structure of the panels. This ensures that serial numbers within the same panel are continuous and that serial numbers between different panels increase according to the number of panels, solving the technical defects of traditional technologies where serial number generation rules are fixed and cannot adapt to panel structures. Through persistent storage of work order execution status files and a dual-file backup mechanism, the current PCB serial number, position number within the panel, and current serial number string can be accurately recovered from the XML status file after an abnormal interruption. After range verification and consistency verification, the PCB counter, position counter within the panel, and serial number generator are initialized to their pre-interruption states, and the task continues from the next panel to be marked. This completely eliminates the problem of serial number duplication or skipping caused by equipment power failure or software crashes, ensuring the continuity and integrity of serial numbers in mass production. By establishing a mapping relationship between variable objects and serial number variables in the marking template file, the current serial number string is dynamically filled into the placeholder position of the barcode object during marking execution. This allows the same template file to adapt to the variable content requirements of different work orders, avoiding the efficiency loss caused by frequent programming modifications to the template. The system employs the Euclidean algorithm to support serial number encoding in multiple bases, including decimal and hexadecimal. Combined with prefix and suffix string configuration, it can achieve composite encoding methods, meeting the diverse needs of different industries for serial number encoding rules. By calling the MES system's SubmitResult interface, data such as the current serial number string, marking completion timestamp, and marking quality judgment result are uploaded in real time in JSON format, improving the automation level of production management and data traceability capabilities in the intelligent manufacturing environment.
[0120] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0121] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0122] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A laser marking method based on work order serial number skipping management, characterized in that, include: Obtain the work order data structure, which includes the total number of PCBs, the number of panels, the prefix string, the suffix string, the number system type, and the starting number; The current serial number string is obtained by calculating the skip number value based on the starting number, the current PCB serial number, the number of panels, and the current position number within the board. The current serial number string is then filled into a variable object in the marking template file to obtain the marking content data. The first marking coordinates corresponding to the marking content data are corrected to obtain the second marking coordinates; The laser head is controlled to move to the second marking coordinate and perform laser marking operation. After marking is completed, the current serial number string and marking result data are uploaded to the MES system. After each small panel is marked, the current position number within the panel is incremented by 1, and it is determined whether the required number of panels has been reached. If the required number has been reached, the current PCB number is incremented by 1, and the current position number within the panel is reset to 0. The updated PCB number, current position number within the panel, current sequence number string, work order status identifier, and current timestamp are encapsulated into work order execution data. After the work order execution data is converted into XML format data, it is first written to a backup work order execution status file. After successful writing, the contents of the backup work order execution status file are overwritten into the current work order execution status file to complete persistent storage. After persistent storage is completed, the laser marking method based on work order SN number skipping management further includes: when the software restarts, reading the current SN continuation flag bit in the system parameter configuration; when the current SN continuation flag bit is enabled, reading the current work order execution status file; if reading fails, reading the backup work order execution status file to obtain the current PCB sequence number, current board position number, and current serial number string at the time of the last interruption; performing consistency verification based on the current PCB sequence number, current board position number, and current serial number string at the time of the last interruption to obtain the data verification result; when the data verification result is successful, setting the initial value of the PCB counter to the parsed current PCB sequence number, setting the initial value of the board position counter to the parsed current board position number, setting the current value of the serial number generator to the parsed current serial number string, and completing the restoration of the system execution context; calculating the position of the next small panel to be marked based on the restored PCB counter and board position counter, controlling the track to enter the board and transporting the PCB board to the marking station, and continuing the marking task from the position of the next small panel to be marked.
2. The laser marking method based on work order SN number skipping management according to claim 1, characterized in that, The work order data structure includes the total number of PCBs, the number of panels, a prefix string, a suffix string, a number system type, and a starting number, including: The work order generation interface receives user input for PCB name, total number of PCBs, number of panels, prefix string, suffix string, number system type, and starting number. The total number of PCBs is multiplied by the number of panels to obtain the total number of serial numbers. When the number system type is decimal, a character set containing numbers 0 to 9 is generated as the number system content character set; when the number system type is hexadecimal, a character set containing numbers 0 to 9 and numbers A to F is generated as the number system content character set. The PCB name, the total number of PCBs, the number of panels, the prefix string, the suffix string, the number system type, the number system content character set, the starting number, and the total number of serial numbers are encapsulated into a work order data structure.
3. The laser marking method based on work order SN number skipping management according to claim 2, characterized in that, The step involves calculating a jump number based on the starting number, the current PCB sequence number, the number of panels, and the current position sequence number within the board to obtain the current sequence number string. This current sequence number string is then filled into a variable object in the marking template file to obtain the marking content data, including: Multiply the current PCB serial number by the number of panels to obtain the first calculation result, add the first calculation result to the current position serial number within the board to obtain the second calculation result, and then add the second calculation result to the starting number to obtain the decimal jump number value; Divide the decimal skip sign value by the length of the character set of the base and take the remainder. Then, take the character at the corresponding position from the character set of the base according to the remainder and concatenate them to obtain the skip sign value string. Concatenate the prefix string, the jump number string, and the suffix string to obtain the current sequence number string; The current serial number string is filled into a variable object in the tagging template file, and an association mapping relationship is established between the variable object and the serial number variable to obtain the tagging content data.
4. The laser marking method based on work order SN number skipping management according to claim 3, characterized in that, The step of filling the current sequence number string into a variable object in the tagging template file and establishing an association mapping relationship between the variable object and the sequence number variable to obtain the tagging content data includes: Extract the text objects, barcode objects, and graphic objects contained in the marking template file, and store the text objects, barcode objects, and graphic objects into an object list; Select barcode-type variable objects from the object list and add them to the laser engraving object list. Configure the content source type of each variable object in the laser engraving object list as a serial number variable and establish an association mapping relationship between the variable objects and the serial number variables. Iterate through each variable object in the laser engraving object list, replace the placeholder content of the variable object with the current serial number string, and generate the marking content data.
5. The laser marking method based on work order SN number skipping management according to claim 1, characterized in that, The step of correcting the first marking coordinates corresponding to the marking content data to obtain the second marking coordinates includes: Extract the pixel coordinate sequence of Mark points on the PCB board, and calculate the moment feature and shape context of the pixel coordinate sequence as a template contour feature descriptor; The camera is controlled to move to the theoretical coordinates to capture real-time images, and actual contour feature descriptors are extracted from the real-time images; Calculate the Hausdorff distance between the template contour feature descriptor and the actual contour feature descriptor, and determine the first and second actual coordinates of the Mark point based on the Hausdorff distance; The first offset vector is calculated based on the first actual coordinates and the first theoretical coordinates, and the second offset vector is calculated based on the second actual coordinates and the second theoretical coordinates; The rotation angle is calculated based on the first offset vector and the second offset vector, and an affine transformation matrix is constructed based on the first offset vector, the second offset vector, and the rotation angle. The first marking coordinates are used as input to perform matrix operations on the affine transformation matrix to obtain the second marking coordinates.
6. The laser marking method based on work order SN number skipping management according to claim 5, characterized in that, The step of calculating the Hausdorff distance between the template contour feature descriptor and the actual contour feature descriptor, and determining the first and second actual coordinates of the Mark point based on the Hausdorff distance, includes: Set a search area, divide the search area into multiple candidate position grids, set a rotation angle search range and generate multiple candidate angle values according to the angle step size, and perform a Cartesian product operation on the multiple candidate position grids and the multiple candidate angle values to obtain a candidate set of position angles; Traverse each element in the candidate set of position and angle, transform the template contour feature descriptor according to the current candidate position and candidate angle value, and calculate the point-to-point distance with the actual contour feature descriptor to obtain the Hausdorf distance. The first and second actual coordinates of the Mark point are determined based on the Hausdorff distance.
7. The laser marking method based on work order SN number skipping management according to claim 1, characterized in that, The laser head is moved to the second marking coordinate and laser marking is performed. After marking is completed, the current serial number string and marking result data are uploaded to the MES system, including: The laser head is moved to the second marking coordinate. After reaching the target position, the laser is controlled to perform the marking operation according to the laser power parameters, pulse frequency parameters and filling spacing parameters set in the marking content data. After the marking is completed, the marking completion timestamp and the second marking coordinate are obtained as the marking position record. Determine whether the automatic scanning flag after marking is enabled in the system parameter configuration. When the automatic scanning flag is enabled, scan the marking area to obtain the identification serial number string. Compare the identification serial number string with the current serial number string. When the two are completely consistent, set the marking quality judgment result to qualified. When the two are inconsistent or the recognition fails, set the marking quality judgment result to unqualified. The current serial number string, the marking completion timestamp, the marking position record, the marking quality judgment result, and the operator's employee number are encapsulated into marking result data, and the marking result data is uploaded to the MES system.
8. A laser marking system based on work order number (SN) skipping management, characterized in that, The laser marking method for performing the work order SN number skipping management as described in any one of claims 1-7 includes: The acquisition module is used to acquire the work order data structure, which includes the total number of PCBs, the number of panels, the prefix string, the suffix string, the number system type, and the starting number. The calculation module is used to calculate the skip number value based on the starting number, the current PCB sequence number, the number of panels and the current position sequence number in the board, to obtain the current sequence number string, and to fill the current sequence number string into the variable object in the marking template file to obtain the marking content data; The correction module is used to correct the first marking coordinates corresponding to the marking content data to obtain the second marking coordinates; The laser marking operation module is used to control the laser head to move to the second marking coordinate and perform the laser marking operation. After the marking is completed, the current serial number string and the marking result data are uploaded to the MES system.
Citation Information
Patent Citations
PCB production process and PCB
CN113573506A
Machining area adjusting method and device, equipment and storage medium
CN120038441A