A production batch information diagnosis method and system for a pharmaceutical manufacturing enterprise

By using an information-based diagnostic method for production batches in pharmaceutical manufacturing enterprises, the problems of data silos and statistical difficulties have been solved, enabling refined and automated statistics of equipment uptime, thereby improving production efficiency and quality traceability.

CN122367408APending Publication Date: 2026-07-10SHANGHAI LEICHANG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI LEICHANG TECH CO LTD
Filing Date
2026-06-09
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

The pharmaceutical manufacturing industry suffers from severe data silos and difficulties in data statistics, making it difficult to accurately and quickly calculate the net uptime of each production device, thus failing to meet GMP requirements and achieve lean manufacturing.

Method used

By synchronizing the time of multiple sources of equipment in the production workshop, collecting operating status signals and process parameters, establishing a multidimensional array, classifying operating status categories, training a random forest model, predicting the batch to which the equipment belongs, and statistically analyzing the operating time period.

Benefits of technology

It enables rapid derivation of production equipment operating status and time under multi-source heterogeneous data, improves the accuracy of correlation judgment between batches and equipment operating time periods, and realizes refined and automated statistics of equipment operating time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122367408A_ABST
    Figure CN122367408A_ABST
Patent Text Reader

Abstract

This application discloses a method and system for information-based diagnosis of production batches in pharmaceutical manufacturing enterprises, belonging to the interdisciplinary field of artificial intelligence and pharmaceutical information technology. The method includes: unifying the time base of multi-source equipment; collecting equipment operating status, process parameters, and event data to construct a multi-dimensional array; establishing process constraints in the dimensions of product, process, and operational equipment flow; using a binning method to logically combine equipment status parameters into different operating status categories; training a random forest model using labeled historical batch data to obtain a batch diagnosis model; inputting the start time of the batch to be diagnosed into the model to derive the equipment operating time period, matching it with the operating status category, and statistically analyzing the classified operating time of each piece of equipment. This application solves the problem of statistical efficiency and validity in calculating the net operating time of each piece of equipment within a batch in pharmaceutical enterprises.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the interdisciplinary fields of artificial intelligence and pharmaceutical information technology, specifically to a method and system for information-based diagnosis of production batches in pharmaceutical manufacturing enterprises. Background Technology

[0002] Pharmaceutical manufacturing is a complex process with the "batch" as the basic management unit. For example, in a formulation workshop, a master batch of product needs to pass through multiple equipment (unit operations) such as mixing, granulation, tableting, coating, and packaging. Each master batch also generates new sub-batches according to the process and equipment. Performing full-process efficiency analysis and quality traceability for each batch is key to meeting GMP (Good Manufacturing Practice) requirements and achieving lean manufacturing. This relies on a core data point: "the net uptime of each production piece of equipment precisely serving each specific batch."

[0003] Then, in the actual production workshop, obtaining this data faces two technical bottlenecks: 1. Severe data silos: Information sources are various heterogeneous and multi-source data, including: (a) production periods controlled by PLC automatic control; (b) abnormal handling periods of equipment failure; (c) manual intervention periods waiting for manual sampling and cleaning; (d) rest periods required when machines stop when people leave; (e) objective attributes of products and batches served by the equipment; (f) paper or electronic records, etc.

[0004] 2. Data statistics difficulties and bottlenecks: Due to the diverse sources of data and the fact that the data dimensions exceed 4, manual and traditional data statistics are basically unable to accurately and quickly calculate the net operating time of the required equipment. Summary of the Invention

[0005] To help solve the above-mentioned technical problems, this application provides a method and system for information-based diagnosis of production batches in pharmaceutical manufacturing enterprises.

[0006] Firstly, this application provides a method for information-based diagnosis of production batches in pharmaceutical manufacturing enterprises, comprising the following steps: S1: Synchronize the time of multi-source equipment in the production workshop and unify the time base; S2: Collect operating status signals, process parameters, alarm events, and operator events from multiple sources to construct a multi-dimensional array; S3: Establish process constraints, which should include at least product-level constraints, process flow-level constraints, and process equipment flow-level constraints. S4: Based on the time-series data of each device in the multidimensional array, the binning method is used to divide the device process steps into multiple operating state categories according to the preset logical combination of device state parameters; S5: Obtain historical production batch data and annotate it to form an annotated dataset. The annotation content should include at least the batch start time, batch end time, and the equipment involved in the batch. S6: Merge the multidimensional array with the process constraints, extract features as independent variables, and use the batch identifier of the equipment in the labeled dataset as the dependent variable to train a random forest model to obtain a batch diagnosis model; obtain the time-series feature data of each equipment within the time period to be diagnosed and input it into the batch diagnosis model, and the model predicts the batch identifier of each equipment at each timestamp; based on the predicted batch identifier, extract the timestamps that continuously belong to the target batch identifier to deduce the running time period of each equipment in the target batch; match the running time period with the running state categories divided in S4, and statistically obtain the duration of each equipment in the target batch corresponding to different running state categories.

[0007] In S1, the time synchronization is performed by using an NTP time synchronization device to unify the time of the PLC, touch screen, PC, operating terminal, server and clock device.

[0008] In S2, the operating status signals, process parameters, alarm events and operator events are collected through the IIOT platform, SCADA system or real-time database system, wherein the operating status signals include PLC status signals, and the multi-dimensional array is constructed in the product dimension. The multidimensional array is a time-series array structure constructed with timestamps as rows and devices and their characteristic parameters as columns; The equipment includes at least one of a granulator, a checkweigher, and a packaging machine; the characteristic parameters associated with each piece of equipment include at least the motor operating status, frequency, fault status, pause status, and maintenance status; the elements in the multidimensional array are the collected values ​​of the characteristic parameters of each piece of equipment at the corresponding timestamp.

[0009] In S3, the process constraints also include defining equipment attribute constraints and operating interval constraints for the process equipment; the equipment attribute constraints include exclusive or non-exclusive, clean or unclean status, planned maintenance or unplanned maintenance; the operating interval constraints include minimum interval time and maximum interval time.

[0010] In S4, the method of dividing the operating status into categories using a binning approach specifically includes: The duration during which the following conditions are simultaneously met—motor operation = 1, frequency = 50Hz, pause = 0, maintenance = 0, and fault = 0—is defined as the net running time. The duration during which the following conditions are met simultaneously is defined as: motor running = 1, frequency < 50Hz, pause = 0, maintenance = 0, and fault = 0. This duration is defined as the warm-up time. The duration during which fault = 1 is satisfied is defined as the fault time; The duration during which maintenance = 1 is satisfied is defined as the cleaning time; The duration during which the following conditions are simultaneously met—motor running = 1, frequency < 50Hz, pause = 1, maintenance = 0, and fault = 0—is defined as lunch time. The duration during which the following conditions are simultaneously met—motor running = 1, frequency < 50Hz, pause = 1, maintenance = 0, fault = 0, and feeding motor frequency = 50Hz—is defined as the feeding time. The values ​​of each parameter are digital representations of the device PLC status signals. A value of 1 indicates that the corresponding status is active or triggered, and a value of 0 indicates that the corresponding status is not active or triggered.

[0011] In S5, the labeled dataset is obtained by labeling historical production batch data within a preset historical time period of the enterprise.

[0012] In S6, when training the random forest model, the time series features of each device and the constraint features transformed by the process constraint conditions are used together as input features.

[0013] In S6, the statistics obtain the duration of each device in the target batch corresponding to different operating state categories, including calculating the net operating time, preheating time, failure time, cleaning time, lunch time and feeding time of each device in the target batch.

[0014] Secondly, this application provides a production batch information diagnostic system for pharmaceutical manufacturing enterprises, wherein the system is used to execute the production batch information diagnostic method for pharmaceutical manufacturing enterprises as described in any one of the first aspects, the system comprising: The time synchronization module is used to execute S1 to synchronize the time of multi-source equipment in the production workshop and unify the time base. The data acquisition module is used to execute S2, collect operating status signals, process parameters, alarm events and operator events from multiple sources, and construct a multi-dimensional array; The process constraint module is used to execute S3 and establish process constraints that include at least the product dimension, process flow dimension, and process equipment flow dimension. The binning definition module is used to execute S4, which divides the equipment process steps into multiple operating state categories based on the timing data of each device in the multidimensional array and according to the preset logical combination of device state parameters. The data annotation module is used to execute S5, acquire historical production batch data, and annotate it to form an annotated dataset; The model training and diagnosis module is used to execute S6, which combines the multidimensional array with the process constraints to train a random forest model to obtain a batch diagnosis model; it acquires the time-series feature data of each device within the time period to be diagnosed and inputs it into the batch diagnosis model, which predicts the batch identifier of each device at each timestamp; based on the predicted batch identifier, it extracts the timestamps that continuously belong to the target batch identifier to deduce the running time period of each device under the target batch; and combined with the running state categories divided by the binning definition module, it calculates the duration of each device corresponding to different running state categories.

[0015] The data acquisition module collects data through an IIoT platform, SCADA system, or real-time database system, and constructs a multi-dimensional array based on the product dimension; the process constraint module also defines equipment attribute constraints and operating interval constraints for process equipment; the specific operating status categories divided by the box definition module include net operating time, preheating time, failure time, cleaning time, lunch time, and loading time.

[0016] In summary, compared with the prior art, this application has the following beneficial effects: 1. By combining artificial intelligence with a data acquisition system, the operating status and time of various production equipment under multi-source heterogeneous data can be quickly derived.

[0017] 2. A four-dimensional constraint calculation method integrating product process, equipment operation, time series data and master batch data is proposed, which improves the accuracy of batch and equipment operation time period correlation judgment.

[0018] 3. By determining the logical relationships between time-series data and classifying equipment operating status categories in a binning manner, refined and automated statistics of equipment operating time are achieved. Attached Figure Description

[0019] Figure 1 This is a flowchart illustrating a production batch information diagnostic method for a pharmaceutical manufacturing enterprise according to this application. Detailed Implementation

[0020] The present application will be further described below with reference to the accompanying drawings. The principles of the present application are very clear to those skilled in the art. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.

[0021] To make the technical solution of this application clearer, the relevant English terms and technical terms are explained as follows: GMP (Good Manufacturing Practice): Good Manufacturing Practice for pharmaceuticals is the basic principle for pharmaceutical production and quality management, requiring pharmaceutical manufacturers to conduct comprehensive quality control and batch traceability throughout the production process.

[0022] PLC (Programmable Logic Controller): A programmable logic controller is a core device for industrial automation control. It is used to collect and control the operating status of equipment in real time and output digital signals (such as 0 / 1) to indicate the start, stop, fault and other states of the equipment.

[0023] NTP (Network Time Protocol) is used for time synchronization among distributed devices. This application uses an NTP time synchronization device to unify the time of the PLC, touchscreen, PC, operator terminal, server, and clock device, ensuring consistency of multi-source data in the time dimension.

[0024] IIoT (Industrial Internet of Things): The Industrial Internet of Things enables real-time data acquisition, transmission, and analysis through the interconnection of industrial equipment and sensors. This application uses it as one of the data acquisition methods.

[0025] SCADA (Supervisory Control and Data Acquisition): A monitoring and data acquisition system used for centralized monitoring, data acquisition, and remote control of distributed industrial equipment and processes. In this application, it is used as one of the data acquisition methods.

[0026] Real-time database system: A database system specifically designed for processing high-timeliness, high-throughput time-series data, capable of continuously storing and querying large amounts of time-series data generated during production at millisecond or second intervals. In this application, it is used as one of the data acquisition methods.

[0027] Binning: A data preprocessing technique that refers to dividing continuous or discrete data into different "bins" (i.e., categories) according to preset rules or conditions. In this application, the binning method specifically refers to dividing the time-series data of equipment process steps into operating status categories with different production management implications, such as net running time, preheating time, and downtime, based on the logical combination of equipment status parameters.

[0028] Random Forest is an ensemble learning algorithm based on decision trees. It constructs multiple decision trees and combines their voting results to perform classification or regression prediction. In this application, the random forest model is used to learn the relationship between equipment operating characteristics and batch affiliation, enabling automatic batch diagnosis within equipment operating time periods.

[0029] Batch (or Lot): In pharmaceutical manufacturing, production and management are organized and managed using batches as the basic unit. Products within the same batch are processed under the same production conditions and have uniform quality and characteristics. In this application, a master batch may flow through multiple machines, generating sub-batches on each machine.

[0030] Master Batch: Refers to a complete batch identifier that spans the entire production process from start to finish, covering multiple processes such as mixing, granulation, tableting, coating, and packaging.

[0031] Sub-batch: refers to a lower-level batch with an independent identifier that is generated in a certain equipment or process to serve the main batch.

[0032] Process step: refers to a specific technological step performed on a certain piece of equipment during the production process, with a clearly defined start and end time. In this application, the process step data for each piece of equipment is an important component of the multidimensional array and is also the object of the binning method.

[0033] Multidimensional array: In this application, it specifically refers to a time-series array structure constructed with timestamps as rows and devices and their characteristic parameters as columns. The elements of the multidimensional array are the collected values ​​of the characteristic parameters of each device at the corresponding timestamp, which is the basic data structure for subsequent analysis and modeling.

[0034] Combination Figure 1 This application provides a method for information-based diagnosis of production batches in pharmaceutical manufacturing enterprises, including steps S1 to S6.

[0035] The process executes the following steps sequentially: First, a unified time constraint standard is established; then, data on equipment operation, process parameters, personnel operation, and alarms are collected and a multidimensional array is created; subsequently, multiple constraints are established from three dimensions: product, process, and operation procedure; next, a binning method is used to establish the operating status conditions of key equipment; then, historical data of the enterprise is labeled to obtain training data; finally, a random forest algorithm is used for training, and combined with the binning method, the operating status and time of the equipment within that batch are quickly determined. The process will be described in detail below.

[0036] S1: Unified time base.

[0037] Synchronize the time of multi-source equipment in the production workshop and unify the time base.

[0038] Specifically, the NTP time synchronization device unifies the time of PLCs, touch screens, PCs, operator terminals, servers, and clock devices. Since subsequent steps require aligning operating status signals, alarm events, and operator events from different devices along the time dimension, a unified time base is a prerequisite for multi-source data fusion. The NTP time synchronization device can periodically send time synchronization commands to each device based on the server time, ensuring that the timestamp deviation of all devices is controlled within milliseconds or seconds.

[0039] S2: Collect data from multiple sources and construct a multidimensional array.

[0040] Collect operating status signals, process parameters, alarm events, and operator events from multiple sources to construct a multidimensional array.

[0041] Specifically, the above data can be collected through an IIoT platform, SCADA system, or real-time database system. Among them, operating status signals include PLC status signals, process parameters include equipment frequency, temperature, pressure, etc., alarm events include equipment fault alarms, parameter over-limit alarms, etc., and operator events include human-machine interaction events such as operator login, operation records, and manual pause.

[0042] A multidimensional array is a time-series array structure built with timestamps as rows and equipment and its characteristic parameters as columns. Taking a pharmaceutical preparation workshop as an example, the equipment includes at least one of granulators, checkweighers, and packaging machines; the characteristic parameters associated with each piece of equipment include at least motor operating status, frequency, fault status, pause status, and maintenance status. The elements in the multidimensional array are the collected values ​​of the characteristic parameters of each piece of equipment at the corresponding timestamp. In the multidimensional array, each row corresponds to a timestamp, and each column corresponds to a characteristic parameter of a certain piece of equipment. Table 1 below shows the raw data fragments of equipment such as granulators and checkweighers in a pharmaceutical preparation workshop at continuous time points, used to illustrate the data organization form of the multidimensional array.

[0043] .

[0044] In Table 1, a value of 1 indicates that the state is active or triggered, and 0 indicates that it is not active; the frequency unit is Hz; "to N" indicates that there may be more similar devices or extended parameters. In actual applications, columns can be added or removed according to the equipment configuration in the workshop. 00:00:00 and 00:00:01 are unified timestamps accurate to the second.

[0045] S3: Establish process constraints.

[0046] Establish process constraints, which should include at least product-level constraints, process flow-level constraints, and process equipment flow-level constraints.

[0047] Furthermore, process constraints also include defining equipment attribute constraints and operating interval constraints for the equipment used in each process step. Equipment attribute constraints include: exclusivity or non-exclusivity, used to constrain whether a piece of equipment can only serve one batch at a time; clean or unclean status, used to constrain whether cleaning operations are required when switching between different batches; planned maintenance or unplanned maintenance, used to distinguish the type of equipment maintenance. Operating interval constraints include minimum interval time and maximum interval time, used to constrain the minimum waiting time and maximum allowable interval time for the same equipment between two consecutive batches. Constraints in the process equipment flow dimension define the sequential relationship of product flow between different pieces of equipment.

[0048] The aforementioned process constraints constitute a multi-dimensional constraint system for products, process flows, equipment procedures, and time-series data, providing domain knowledge support for subsequent model training.

[0049] S4: Use a binning method to classify operating status categories.

[0050] Based on the time-series data of each device in the multidimensional array, the binning method is adopted to divide the device process steps into multiple operating state categories according to the preset logical combination of device status parameters.

[0051] Specifically, the division rules are as follows: (1) Net running time: The duration during which the following conditions are met simultaneously: motor running = 1, frequency = 50Hz, pause = 0, maintenance = 0, and fault = 0 is defined as net running time. In this state, the equipment motor runs at full speed without pause, maintenance, or fault, indicating that the equipment is performing an effective production task.

[0052] (2) Warm-up time: The duration during which the following conditions are met simultaneously is defined as the warm-up time: motor running = 1, frequency < 50Hz, pause = 0, maintenance = 0, and fault = 0. In this state, the equipment motor has started but has not reached full frequency, indicating that the equipment is in the start-up warm-up or low-speed adjustment stage.

[0053] (3) Failure time: The duration during which the failure = 1 is satisfied is defined as the failure time. In this state, the equipment stops due to failure and does not produce effective output.

[0054] (4) Cleaning time: The duration during which maintenance = 1 is satisfied is defined as the cleaning time. In this state, the equipment is in maintenance / cleaning mode, which usually occurs during batch changeover or periodic maintenance.

[0055] (5) Lunchtime: The duration during which the following conditions are met simultaneously: motor running = 1, frequency < 50Hz, pause = 1, maintenance = 0, and fault = 0 is defined as lunchtime. In this state, the equipment is not completely stopped but is in a paused and low-speed operation state, which usually corresponds to the rest period of the operators.

[0056] (6) Feeding time: The feeding time is defined as the duration during which the following conditions are met simultaneously: motor running = 1, frequency < 50Hz, pause = 1, maintenance = 0, fault = 0, and feeding motor frequency = 50Hz. In this state, the main unit runs at low speed and is paused, but the feeding motor works at full frequency, indicating that the equipment is performing a material replenishment operation.

[0057] The values ​​of the above parameters are digital representations of the equipment PLC status signals. A value of 1 indicates that the corresponding status is active or triggered, and a value of 0 indicates that the corresponding status is inactive or not triggered. Through the above binning rules, continuous time-series data during equipment operation can be automatically divided into multiple operating status categories with clear production management implications.

[0058] S5: Obtain and label historical batch data.

[0059] Acquire and annotate historical production batch data to form an annotated dataset. The annotations should include at least the batch start time, batch end time, and the equipment involved in the batch.

[0060] Specifically, the labeled dataset is obtained by labeling historical production batch data within a pre-defined historical time period of the enterprise. The pre-defined historical time period can be determined based on the enterprise's actual data accumulation, such as obtaining production batch execution records within two years. The labeling method can be manual labeling or semi-automatic labeling based on the enterprise's existing Manufacturing Execution System (MES) records. For each historical batch, its exact start time, end time, and all equipment involved in the production process of that batch are labeled, thus forming a labeled dataset containing batch identifiers and equipment affiliation relationships, which serves as the supervised training labels for the random forest model.

[0061] S6: Train the random forest model and perform batch diagnostics.

[0062] By merging the multidimensional array with the process constraints, extracting features as independent variables, and using the batch identifier of the equipment in the labeled dataset as the dependent variable, a random forest model is trained to obtain a batch diagnostic model for identifying the batch to which the equipment belongs during its operating period.

[0063] Specifically, when training the random forest model, the time-series features of each device and the constraint features resulting from the transformation of process constraints are used as input features. Time-series features include, but are not limited to: the device's operating status parameters at each timestamp, the statistical characteristics of these parameters, and the frequency of state transitions. Constraint features include, but are not limited to: product type codes, process flow step numbers, device exclusivity identifiers, cleaning status identifiers, and relationships between preceding and following processes. These two types of features are combined to form a feature vector, which, along with the batch identifiers from the labeled dataset, constitutes the training samples for training the random forest model.

[0064] After training, the temporal feature data of each device within the time period to be diagnosed is acquired and input into the batch diagnosis model. The model then predicts the batch identifier of each device at each timestamp. Based on the predicted batch identifiers, timestamps continuously belonging to the target batch identifier are extracted to deduce the operating time period of each device within the target batch. Specifically, the model can automatically predict the batch to which each timestamp belongs based on the learned device operating mode and batch affiliation relationship, thereby extracting the time period belonging to the target batch.

[0065] The model output running time period is matched with the running state categories divided by S4, and the duration of each device in the target batch corresponding to different running state categories is statistically obtained, including calculating the net running time, preheating time, failure time, cleaning time, lunch time and feeding time of each device in the target batch.

[0066] This application also provides a production batch information diagnostic system for pharmaceutical manufacturing enterprises, used to execute the above-described method embodiments, the system comprising: The time synchronization module is used to execute S1 to synchronize the time of multi-source equipment in the production workshop and unify the time base. The data acquisition module is used to execute S2, collect operating status signals, process parameters, alarm events and operator events from multiple sources of equipment, and construct a multidimensional array; specifically, this module can collect data through an IIIOT platform, SCADA system or real-time database system, and construct a multidimensional array by product dimension; The process constraint module is used to execute S3 and establish process constraints that include at least the product dimension, process flow dimension, and process equipment flow dimension. Specifically, this module also defines equipment attribute constraints and running interval constraints for process equipment. The bin definition module is used to execute S4. Based on the timing data of each device in the multidimensional array, and according to the preset logical combination of device status parameters, the device process steps are divided into multiple operating status categories. Specifically, the divided operating status categories include net running time, preheating time, fault time, cleaning time, lunch time and loading time. The data annotation module is used to execute S5, acquire historical production batch data, and annotate it to form an annotated dataset; The model training and diagnosis module is used to execute S6, which combines the multidimensional array with the process constraints to train a random forest model to obtain a batch diagnosis model; it acquires the time-series feature data of each device within the time period to be diagnosed and inputs it into the batch diagnosis model, which predicts the batch identifier of each device at each timestamp; based on the predicted batch identifier, it extracts the timestamps that continuously belong to the target batch identifier to deduce the running time period of each device under the target batch; and combined with the running state categories divided by the binning definition module, it calculates the duration of each device corresponding to different running state categories.

[0067] The specific implementation methods of each module are consistent with the descriptions of the corresponding steps in the above method embodiments, and will not be repeated here.

[0068] The technical scope of this application is not limited to the contents of the above specification. Those skilled in the art can make various modifications and variations to the above embodiments without departing from the technical concept of this application, and all such modifications and variations should fall within the scope of this application.

Claims

1. A method for information-based diagnosis of production batches in pharmaceutical manufacturing enterprises, characterized in that, Includes the following steps: S1: Synchronize the time of multi-source equipment in the production workshop and unify the time base; S2: Collect operating status signals, process parameters, alarm events, and operator events from multiple sources to construct a multi-dimensional array; S3: Establish process constraints, which should include at least product-level constraints, process flow-level constraints, and process equipment flow-level constraints. S4: Based on the time-series data of each device in the multidimensional array, the binning method is used to divide the device process steps into multiple operating state categories according to the preset logical combination of device state parameters; S5: Obtain historical production batch data and annotate it to form an annotated dataset. The annotation content should include at least the batch start time, batch end time, and the equipment involved in the batch. S6: Merge the multidimensional array with the process constraints, extract features as independent variables, and use the batch identifier of the equipment in the labeled dataset as the dependent variable to train a random forest model to obtain a batch diagnosis model; obtain the time-series feature data of each equipment within the time period to be diagnosed and input it into the batch diagnosis model, and the model predicts the batch identifier of each equipment at each timestamp; based on the predicted batch identifier, extract the timestamps that continuously belong to the target batch identifier to deduce the running time period of each equipment in the target batch; match the running time period with the running state categories divided in S4, and statistically obtain the duration of each equipment in the target batch corresponding to different running state categories.

2. The method according to claim 1, characterized in that, In S1, the time synchronization is performed by using an NTP time synchronization device to unify the time of the PLC, touch screen, PC, operating terminal, server and clock device.

3. The method according to claim 1, characterized in that, In S2, the operating status signals, process parameters, alarm events and operator events are collected through the IIOT platform, SCADA system or real-time database system, wherein the operating status signals include PLC status signals, and the multi-dimensional array is constructed in the product dimension. The multidimensional array is a time-series array structure constructed with timestamps as rows and devices and their characteristic parameters as columns; The equipment includes at least one of a granulator, a checkweigher, and a packaging machine; the characteristic parameters associated with each piece of equipment include at least the motor operating status, frequency, fault status, pause status, and maintenance status; the elements in the multidimensional array are the collected values ​​of the characteristic parameters of each piece of equipment at the corresponding timestamp.

4. The method according to claim 1, characterized in that, In S3, the process constraints also include defining equipment attribute constraints and operating interval constraints for the process equipment; the equipment attribute constraints include exclusive or non-exclusive, clean or unclean status, planned maintenance or unplanned maintenance; the operating interval constraints include minimum interval time and maximum interval time.

5. The method according to claim 1, characterized in that, In S4, the method of dividing the operating status into categories using a binning approach specifically includes: The duration during which the motor simultaneously meets the following conditions is defined as the net running time: the motor is in an active state, the frequency is a preset frequency, the pause state is inactive, the maintenance state is inactive, and the fault state is inactive. The duration during which the motor simultaneously meets the following conditions is defined as the preheating time: the motor is in an active operating state, the frequency is less than the preset frequency, the pause state is inactive, the maintenance state is inactive, and the fault state is inactive. The duration during which the fault state is active is defined as the fault time. The duration during which the maintenance status is active is defined as the cleaning time; The duration during which the motor simultaneously meets the following conditions is defined as: the motor is in an active operating state, the frequency is less than the preset frequency, the pause state is active, the maintenance state is inactive, and the fault state is inactive. The duration during which the following conditions are met simultaneously is defined as the feeding time: the motor is in an active state, the frequency is less than the preset frequency, the pause state is active, the maintenance state is inactive, the fault state is inactive, and the feeding motor frequency is the preset frequency. The values ​​for each state are digital representations of the device PLC status signals. Activation indicates that the corresponding state is triggered, while inactivation indicates that the corresponding state is not triggered.

6. The method according to claim 1, characterized in that, In S5, the labeled dataset is obtained by labeling historical production batch data within a preset historical time period of the enterprise.

7. The method according to claim 1, characterized in that, In S6, when training the random forest model, the time series features of each device and the constraint features transformed by the process constraint conditions are used together as input features.

8. The method according to claim 1, characterized in that, In S6, the statistics obtain the duration of each device in the target batch corresponding to different operating state categories, including calculating the net operating time, preheating time, failure time, cleaning time, lunch time and feeding time of each device in the target batch.

9. A production batch information diagnostic system for a pharmaceutical manufacturing enterprise, characterized in that, The system is used to perform the batch information diagnostic method for pharmaceutical manufacturing enterprises as described in any one of claims 1-8, the system comprising: The time synchronization module is used to execute S1 to synchronize the time of multi-source equipment in the production workshop and unify the time base. The data acquisition module is used to execute S2, collect operating status signals, process parameters, alarm events and operator events from multiple sources, and construct a multi-dimensional array; The process constraint module is used to execute S3 and establish process constraints that include at least the product dimension, process flow dimension, and process equipment flow dimension. The binning definition module is used to execute S4, which divides the equipment process steps into multiple operating state categories based on the timing data of each device in the multidimensional array and according to the preset logical combination of device state parameters. The data annotation module is used to execute S5, acquire historical production batch data, and annotate it to form an annotated dataset; The model training and diagnosis module is used to execute S6, which merges the multidimensional array with the process constraints to train a random forest model to obtain a batch diagnosis model; acquires the time-series feature data of each device within the time period to be diagnosed and inputs it into the batch diagnosis model, and the model predicts the batch identifier of each device at each timestamp; based on the predicted batch identifier, extracts the timestamps that continuously belong to the target batch identifier to deduce the running time period of each device under the target batch; and combines the running state categories divided by the binning definition module to count the duration of each device corresponding to different running state categories.

10. The system according to claim 9, characterized in that, The data acquisition module collects data through an IIoT platform, SCADA system, or real-time database system, and constructs a multi-dimensional array based on the product dimension; the process constraint module also defines equipment attribute constraints and operating interval constraints for process equipment; the specific operating status categories divided by the box definition module include net operating time, preheating time, failure time, cleaning time, lunch time, and loading time.