Method and system for optimizing declaration process of spare and accessory parts of cigarette factory

By applying the exponential smoothing algorithm and the sliding window Z-score detection algorithm in the cigarette factory parts application process, combined with the decision tree algorithm, the deficiencies in process duration monitoring and in-transit parts reminders were solved, realizing dynamic monitoring and precise management of the process, and improving production efficiency and refined inventory management.

CN121810012APending Publication Date: 2026-04-07HONGYUN HONGHE TOBACCO (GRP) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-24
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

The existing cigarette factory parts application process has significant deficiencies in terms of process duration monitoring and in-transit parts reminders, resulting in low production efficiency or even production stoppages, and it is difficult to meet the needs of refined management.

Method used

The exponential smoothing algorithm is used to extract the average and longest processing time of process nodes. Combined with the sliding window Z-score detection algorithm and decision tree algorithm, the dynamic early warning threshold parameter set is generated and the early warning signal is accurately identified. Transparent management of in-transit status data is achieved through data stream processing and SQL join operations.

Benefits of technology

The system has achieved systematic optimization of the spare parts application process, improved the efficiency of supply chain collaboration and the level of refined inventory management, and ensured the stability and efficiency of production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121810012A_ABST
    Figure CN121810012A_ABST
Patent Text Reader

Abstract

The invention discloses a cigarette factory spare part declaration process optimization method and system, and relates to the technical field of tobaccos, the method is based on historical data, an exponential smoothing algorithm is used to generate a dynamic early warning threshold set, and a self-adaptive quantification reference is provided; external requests are analyzed and standardized, a unified data object is constructed, and an automation foundation is laid; a timestamp event is collected through data stream processing, an actual processing duration sequence is calculated, and the process progress is reflected in real time; comparing the real-time sequence with the dynamic threshold value by using a sliding window Z-score algorithm, generating an early warning signal through two-stage verification, and identifying abnormality; responding to early warning, and associating, querying and integrating the in-transit quantity and historical records to form in-transit state data; and evaluating multi-dimensional information by using a decision tree algorithm, and outputting an optimization decision instruction. Through data driving and algorithm decision making, early abnormal discovery and in-transit transparent management are realized, the repeated declaration risk is avoided, and the supply chain collaboration efficiency and the inventory refined management level are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the tobacco technical field, and particularly relates to a method and system for optimizing a spare part declaration process in a cigarette factory. BACKGROUND

[0002] In the production process of a tobacco industrial enterprise, spare part declaration is an important link for ensuring normal operation of production equipment. However, the existing spare part declaration process has many problems. First, in the declaration process, the process time of multiple links such as spare part approval, procurement, and transportation is not equal, and there is a lack of monitoring and early warning reminding mechanism for the time length of each processing process. This leads to differences in spare part processing time caused by various factors, so that the arrival time of different spare parts after declaration is uneven, and the declarer cannot accurately grasp the arrival time of the spare parts.

[0003] Secondly, the in-transit quantity reminding function is not set in the spare part declaration link. When a spare part is declared due to insufficient inventory, if it is not arrived for a long time, the declarer cannot know that the spare part is in the declaration process when declaring again, which easily causes repeated declaration of the same spare part. This not only leads to a sudden increase in the inventory of the spare part in a certain period of time, but also easily produces idle inventory, occupies a large amount of spare part funds, seriously affects the reasonable management of inventory, and increases the operating cost and inventory management difficulty of the enterprise.

[0004] At present, the monitoring and early warning of process time length mainly focuses on the power and software industries, and there is almost no research on the process time length monitoring of the circulation link of spare parts materials.

[0005] The time length monitoring and in-transit early warning of the spare part declaration process in the tobacco industry are mainly achieved by artificial periodic inspection, so that it is difficult to meet the needs of the enterprise for fine management of the spare part declaration process under the complex conditions of multiple processes and multiple spare part declarations, or the monitoring is achieved by using the part process monitoring function of the ERP system, but the ERP system can only make judgments according to a unified fixed time length standard, and it is difficult to achieve dynamic monitoring.

[0006] Therefore, the existing spare part declaration process has obvious defects in process time length monitoring and in-transit spare part reminding, which easily affects production efficiency and even leads to shutdown. SUMMARY

[0007] The main purpose of the present application is to provide a method and system for optimizing a spare part declaration process in a cigarette factory, so as to solve the problem that the spare part declaration process in the prior art has obvious defects in process time length monitoring and in-transit spare part reminding, which easily affects production efficiency and even leads to shutdown.

[0008] In order to achieve the above purpose, the present application provides the following technical scheme: A method for optimizing a spare part declaration process in a cigarette factory, the optimization method comprising: Step S1, based on the historical spare parts declaration data of the cigarette factory, the average processing time and the longest processing time of each process node are extracted by the exponential smoothing algorithm, and the dynamic early warning threshold parameter set is obtained by integration; Step S2, in response to the external input of the spare parts declaration request, the spare parts identification and declaration information of the spare parts declaration request are parsed and the standardized declaration data object is constructed; Step S3, the timestamp events of the standardized declaration data object are continuously collected by data stream processing, and the actual processing time sequence of all timestamp events is calculated; Step S4, the actual processing time sequence is compared with the dynamic early warning threshold parameter set by the sliding window Z-score detection algorithm, and the early warning signal message with the early warning spare parts is generated according to the timestamp event exceeding the dynamic early warning threshold parameter set; Step S5, in response to the early warning signal message, the external in-transit spare parts database is queried and the in-transit quantity and historical declaration record of the early warning spare parts are retrieved by SQL join operation to obtain the in-transit state data; Step S6, the in-transit state data and the early warning signal message are input into the decision tree algorithm for declaration risk assessment to obtain the optimization decision instruction.

[0009] The beneficial effects of steps S1 to S6 are: The system optimization of cigarette factory spare parts declaration process is realized. Among them, step S1 is based on historical declaration data, and exponential smoothing algorithm is used to automatically generate dynamic early warning threshold parameter set, which provides accurate and self-adaptive quantitative benchmark for process monitoring; Step S2, by analyzing and standardizing the external declaration request, the structure of the standardized declaration data object is constructed, which lays the data foundation for subsequent automatic processing; Step S3, the data stream processing technology is used to continuously collect timestamp events and calculate the actual processing time sequence, which realizes the real-time and objective reflection of the process progress; Step S4, through the sliding window Z-score detection algorithm, the real-time sequence is compared with the dynamic threshold set, and the early warning signal message is generated through two-level verification mechanism, so as to accurately identify the process abnormality; Step S5, in response to the early warning signal, the in-transit quantity and historical declaration record are integrated by association query to form comprehensive in-transit state data. Finally; Step S6 uses decision tree algorithm to evaluate the risk of multi-dimensional information, and outputs the optimization decision instruction. The whole technical scheme realizes early discovery of declaration process abnormality, transparent management of in-transit state and effective avoidance of repeated declaration risk through data driving and algorithm decision, finally improves the collaborative efficiency of spare parts supply chain and the fine level of inventory management.

[0010] As a further improvement of the present application, step S1, based on the historical accessory declaration data of the cigarette factory, the average processing time and the longest processing time of each process node are extracted by the exponential smoothing algorithm, and the dynamic early warning threshold parameter set is obtained by integration, including: Step S11, based on the external enterprise ERP system, extract historical business data records; Step S12, preprocessing the historical business data records to obtain a standardized historical data set; Step S13, grouping and aggregating the standardized historical data set according to the two dimensions of accessory category and process node, and obtaining a corresponding processing time sample sequence based on a process node; Step S14, based on the processing time sample sequence of the current process node, the baseline processing time of the current process node is calculated by the exponential smoothing algorithm; Step S15, based on the baseline processing time of the current process node, the reasonable longest processing time is calculated by T-Digest algorithm with preset percentile as threshold upper limit; Step S16, structurally integrate the baseline processing time and the reasonable longest processing time of each process node, and add the corresponding node identifier, calculation timestamp and confidence index, and integrate the dynamic early warning threshold parameter set.

[0011] Step S11 to step S16 have the following beneficial effects: Through systematic data processing and algorithm application, a dynamic early warning threshold parameter set accurately reflecting the historical business process rules is constructed. Among them, step S11 extracts the original historical business data records from the enterprise ERP system, laying a real and reliable data foundation for threshold calculation; step S12 cleanses and preprocesses the original records, eliminates noise and fills in missing values, generates a standardized historical data set, and improves the accuracy and consistency of subsequent analysis; step S13 groups and aggregates the standardized data according to the accessory category and process node, forming a processing time sample sequence for a single process node, providing data support for node-level fine-grained analysis; step S14 uses the exponential smoothing algorithm to process the node time sequence, calculates the baseline processing time, and effectively captures the central tendency of historical processing efficiency; step S15 calculates the reasonable longest processing time based on the baseline processing time, and uses T-Digest algorithm to calculate the reasonable longest processing time, and establishes the threshold upper limit that conforms to the actual business fluctuation range; step S16 structurally integrates the baseline and longest time indicators of each node, and injects node identification, timestamp and other metadata, generating a dynamic early warning threshold parameter set with timeliness and traceability. This set can adapt to historical business patterns and provide scientific and dynamically updated evaluation criteria for process anomaly monitoring.

[0012] As a further improvement of the present application, step S2, in response to an externally input spare part declaration request, parsing the spare part declaration request for part identification and declaration information and constructing a standardized declaration data object, comprising: Step S21, in response to an externally input spare part declaration request, receiving the spare part declaration request through a RESTful API interface; Step S22, identifying the part identification and declaration information in the spare part declaration request by Aho-Corasick automaton algorithm; Step S23, normalizing the part identification according to the pre-set part coding rules, and mapping the declaration information to a unified business terminology dictionary, to obtain a standard part identification and a standard declaration information; Step S24, combining and packaging the standard part identification, the standard declaration information, the system timestamp, and the session ID to obtain a preliminary structured data framework; Step S25, performing final serialization processing on the preliminary structured data framework, converting it into a standardized data format of the external enterprise ERP system, to obtain the standardized declaration data object.

[0013] Advantages of steps S21 to S25: Through the standardized data receiving and processing process, reliable conversion of external declaration request to internal structured data is realized. Among them, step S21 adopts RESTful API interface to receive spare part declaration request, establishes unified data access specification, and guarantees the real-time and compatibility of request data transmission; step S22 uses Aho-Corasick automaton algorithm to accurately identify the part identification and declaration information in the request text, improves the accuracy and efficiency of key information extraction; step S23 normalizes and maps the identification results based on the pre-set coding rules and business terminology dictionary, generates standard part identification and standard declaration information, eliminates data heterogeneity, and ensures the semantic consistency of subsequent processing links; step S24 combines and packages the standardized information with system metadata to form a preliminary structured data framework, giving the data object complete context identification and traceability; step S25 converts the data framework into a standardized declaration data object conforming to the enterprise ERP specification through serialization processing, completes the conversion of external heterogeneous request to internal unified data model, and provides clear structure and standardized format data input for downstream processes. This series of operations gradually builds high-quality standardized data entities that can be directly used for system automation processing, and strengthens the standardization of data entry and system integration capability.

[0014] As a further improvement of the present application, step S3, continuously collecting the timestamp events of the standardized declaration data object through data stream processing, and calculating the actual processing time sequence of all timestamp events, comprising: Step S31, based on the distributed stream processing engine, listen to the timestamp update event of each process node captured in real time through the event-driven architecture on the standardized declaration data object, generate the original timestamp event stream; Step S32, pre-process the original timestamp event stream to obtain a set of valid timestamp events; Step S33, group and aggregate the set of valid timestamp events according to the declaration instance identifier through the sliding window algorithm, to obtain a set of grouped valid timestamp events; Step S34, calculate the difference between adjacent timestamps based on the set of grouped valid timestamp events, to obtain the actual processing duration value of each process node; Step S35, linearly combine the actual processing duration values of all process nodes according to the process order, and add the corresponding node identifier and calculation metadata to obtain the actual processing duration sequence.

[0015] Steps S31 to S35 have the following beneficial effects: By constructing a complete data flow chain, discrete timestamp events are converted into actual processing duration sequences with clear business meaning. In step S31, the distributed stream processing engine is used to continuously monitor the standardized declaration data object, and real-time capture the timestamp update events of each process node, to generate an original timestamp event stream containing original time sequence information, ensuring the timeliness and completeness of data acquisition. In step S32, data cleaning and validity verification are performed on the original event stream to filter out invalid or abnormal timestamp records, forming a logically consistent set of valid timestamp events, providing a high-quality data basis for subsequent accurate calculation. In step S33, the sliding window algorithm is used to group and aggregate the valid event set according to the declaration instance, forming an event sequence arranged in chronological order, revealing the complete evolution path of a single declaration process in the time dimension. In step S34, based on the grouped event sequence, the difference between adjacent timestamps is accurately calculated to quantify the actual processing duration value of each process node, converting the time interval into a measurable business indicator. In step S35, the duration values of all nodes are linearly combined according to the process logic sequence, and node identifiers and other metadata are injected to construct a structured and traceable actual processing duration sequence. This continuous processing realizes the sublimation from the bottom event to the high-level business indicator, enabling the system to accurately depict the time consumption of each declaration instance at each link, providing direct and quantitative data basis for process efficiency analysis and abnormal monitoring.

[0016] As a further improvement of the present application, in step S4, the actual processing duration sequence is compared with the set of dynamic early warning threshold parameters through the sliding window Z-score detection algorithm, and a warning signal message with a warning accessory is generated according to the timestamp event exceeding the set of dynamic early warning threshold parameters, including: Step S41, the actual processing duration sequence is divided into equal-length data windows by a piecewise aggregation approximation algorithm to obtain a windowed duration data set; Step S42, real-time statistical quantity calculation is performed on each data window of the windowed duration data set to obtain a real-time mean and a real-time standard deviation of each data window; Step S43, a Z-score value of each data point is calculated based on the real-time mean and the real-time standard deviation, and Z-score values exceeding a preset Z-score threshold are screened to obtain a preliminary abnormal data point set; Step S44, data points in the preliminary abnormal data point set are compared with a longest processing duration threshold of a corresponding process node in the dynamic early warning threshold parameter set, and data points exceeding the longest processing duration threshold are defined as final abnormal data points; Step S45, the final abnormal data points are mapped to corresponding accessory identifiers and process node information, time stamps and abnormal level labels are added, and the early warning signal message is generated.

[0017] Advantages of steps S41 to S45: Through a multi-level abnormality detection and verification mechanism, a continuous actual processing duration sequence is converted into an accurate early warning signal message. In step S41, a piecewise aggregation approximation algorithm is used to divide the input sequence into windows to generate a windowed duration data set, realizing rational segmentation and summary of massive time series data. In step S42, real-time statistical quantity calculation is performed on each data window to obtain a real-time mean and a standard deviation of the window, providing a dynamic benchmark for subsequent relative deviation analysis. In step S43, Z-score values of data points are calculated based on window statistics, and a preliminary abnormal data point set is screened out according to a preset threshold, completing the first abnormality identification based on statistical distribution. In step S44, actual duration values of preliminary abnormal points are compared with historical longest processing duration thresholds for secondary comparison, and final abnormal data points that violate both recent trends and historical experience are screened out, and the double-checking mechanism effectively reduces the risk of false positives. In step S45, final abnormal data points are mapped to specific accessories and process nodes, time stamps and abnormal level labels are added, and a structured and operable early warning signal message is generated. The whole process realizes step-by-step progression through windowing, statistical abnormality detection and business threshold verification, ensuring that the output early warning information has statistical significance and business relevance, and providing high credibility risk event identification for subsequent decision-making.

[0018] As a further improvement of the present application, in step S5, in response to the early warning signal message, an external in-transit accessory database is queried, and the in-transit quantity and historical declaration records of the early warning accessory are retrieved through a SQL join operation to obtain in-transit state data, including: Step S51, in response to the early warning signal message, extracting the early warning accessory identifier list in the early warning signal message; Step S52, constructing a parameterized SQL query statement based on the early warning accessory identifier list; Step S53, establishing a connection session with the external in-transit accessory database, and inputting the parameterized SQL query statement into the connection session to perform an association query based on the accessory identifier, obtaining a plurality of query result sets; Step S54, performing summary calculation on all query result sets to respectively count the in-transit quantity and historical declaration records of each early warning accessory, and integrating to obtain the in-transit state data.

[0019] The beneficial effects of steps S51 to S54 are: Through systematic data query and integration operation, the early warning signal is converted into structured in-transit state information. Among them, step S51 accurately extracts the early warning accessory identifier list from the early warning signal message, and clearly defines the target data range to be queried; step S52 constructs a parameterized SQL query statement based on the identifier list, realizes dynamic and batch processing of query conditions, and improves the accuracy and security of database query; step S53 establishes a stable connection session with the external in-transit accessory database, executes parameterized query and obtains associated data through multi-table join operation to generate a plurality of query result sets containing original query results; step S54 performs data summary and statistical calculation on the scattered query result sets to accurately obtain the current in-transit quantity and historical declaration records of each early warning accessory, and finally integrates into complete and standardized in-transit state data. This process realizes the automatic processing from early warning identification to multi-source data association query, and then to result aggregation, ensuring that the output data can accurately reflect the real-time in-transit status and historical declaration background of the accessory, providing reliable data support for subsequent risk assessment.

[0020] As a further improvement of the present application, step S6, inputting the in-transit state data and the early warning signal message into a decision tree algorithm for declaration risk assessment to obtain an optimized decision instruction, including: Step S61, performing multi-dimensional feature extraction on the in-transit state data and the early warning signal message to obtain a multi-dimensional feature vector; Step S62, performing feature scaling and normalization processing on the multi-dimensional feature vector to obtain a standardized feature data set; Step S63, inputting the standardized feature data set into a pre-trained decision tree model, and performing layer-by-layer feature division through the tree structure nodes of the decision tree model, and defining the feature finally reaching the leaf node as the risk assessment result; Step S64, matching the optimized decision instruction corresponding to the risk assessment result based on an external decision rule library.

[0021] The steps S61 to S64 have the following beneficial effects: Through the cooperation of feature engineering and intelligent decision model, the in-transit state data and early warning signal are converted into executable optimization decision instructions. In step S61, multi-dimensional feature extraction is performed on the input multi-source information, key attributes such as in-transit quantity, historical declaration frequency, and abnormal level are captured, and a multi-dimensional feature vector representing the risk situation is constructed; in step S62, feature scaling and normalization processing is performed on the vector to eliminate the influence of dimension difference on the model, and a standardized feature data set with balanced distribution is generated; in step S63, the standardized data is input into the pre-trained decision tree model, relying on the layer-by-layer feature division logic of the tree structure node, and the data-driven risk assessment result is output by following the path to the leaf node; in step S64, the result is matched with the external decision rule library, and according to the preset strategy mapping relationship, the optimization decision instruction containing specific operation suggestions is generated. Through the progressive processing of feature dimension reduction, model reasoning and rule adaptation, the transformation from complex state data to clear action guidance is realized, ensuring that the decision instruction has both data basis and business adaptability, and providing direct support for the accurate regulation of the declaration process.

[0022] To achieve the above purpose, the application also provides the following technical solutions: An optimization system for cigarette factory spare part declaration process, the optimization system is applied to the optimization method as described above, and the optimization system comprises: A dynamic early warning threshold parameter set generation module, configured to extract the average processing time and the longest processing time of each process node based on the historical spare part declaration data of the cigarette factory through an exponential smoothing algorithm, and integrate to obtain a dynamic early warning threshold parameter set; A standardized declaration data object construction module, configured to respond to an externally input spare part declaration request, parse the spare part identification and declaration information of the spare part declaration request, and construct a standardized declaration data object; An actual processing time sequence calculation module, configured to continuously collect the timestamp events of the standardized declaration data object through data stream processing, and calculate the actual processing time sequence of all timestamp events; An early warning signal message generation module, configured to compare the actual processing time sequence with the dynamic early warning threshold parameter set through a sliding window Z-score detection algorithm, and generate an early warning signal message with an early warning spare part according to the timestamp events exceeding the dynamic early warning threshold parameter set; An in-transit state data query module, configured to respond to the early warning signal message, query an external in-transit spare part database, and retrieve the in-transit quantity and historical declaration record of the early warning spare part through a SQL join operation, to obtain in-transit state data; An optimization decision instruction obtaining module is configured to input the in-transit state data and the early warning signal message into a decision tree algorithm to perform a declaration risk assessment, and obtain an optimization decision instruction.

[0023] To achieve the above object, the present application provides the following technical solutions. An electronic device includes a processor, and a memory coupled to the processor, the memory storing program instructions executable by the processor; the processor implements the optimization method as described above when executing the program instructions stored in the memory.

[0024] To achieve the above object, the present application provides the following technical solutions. A computer readable storage medium, the computer readable storage medium stores program instructions, the program instructions are executed by the processor to achieve the optimization method as described above. BRIEF DESCRIPTION OF DRAWINGS

[0025] Figure 1 A step flowchart of an embodiment of the cigarette factory spare parts declaration process optimization method of the present application; Figure 2 A functional module diagram of an embodiment of the cigarette factory spare parts declaration process optimization system of the present application; Figure 3 A structure diagram of an embodiment of the electronic device of the present application; Figure 4 A structure diagram of an embodiment of the storage medium of the present application. DETAILED DESCRIPTION

[0026] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0027] The terms "first", "second", "third" in the present application are only for descriptive purpose, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features defined with "first", "second", "third" can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise explicitly and specifically limited. All directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present application are only used to explain the relative position relationship, movement condition, etc. between components in a certain posture (such as shown in the drawings), and if the certain posture changes, the directional indications also change accordingly. In addition, the terms "include" and "have" and any variations thereof 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 listed steps or units, but can optionally include steps or units not listed, or can optionally include other steps or units inherent to the process, method, product or device.

[0028] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive or alternative embodiments. It is expressly understood that the embodiments described herein are combinable with each other.

[0029] As shown in Figure 1 The present embodiment provides an embodiment of an optimization method for cigarette factory spare parts declaration process. In the present embodiment, the optimization method is mainly applied to an ERP system, which is an integrated platform of the entire system, carries out operation and data recording of each process node of spare parts declaration, approval, procurement, transportation, etc., provides data support and operation interface for process time length warning module and in-transit reminding module, and is a basic platform for realizing management of spare parts declaration process.

[0030] Specifically, the optimization method comprises the following steps: Step S1, based on historical spare parts declaration data of the cigarette factory, the average processing time and the longest processing time of each process node are extracted by an exponential smoothing algorithm, and a dynamic early warning threshold parameter set is obtained by integration.

[0031] Further, in step S1, based on historical spare parts declaration data of the cigarette factory, the average processing time and the longest processing time of each process node are extracted by an exponential smoothing algorithm, and a dynamic early warning threshold parameter set is obtained by integration, which specifically comprises the following steps: Step S11, extract historical business data records based on external enterprise ERP system.

[0032] Preferably, the data source of historical business data records is the spare parts declaration management module of the ERP system, and the raw data involves two core tables.

[0033] Among them, the declaration master table, the field is declaration number, declaration time, declarer, spare parts ID, declaration quantity, current state; Process log table, field is declaration number, process node ID, node start timestamp, node end timestamp, handler, processing opinion).

[0034] Preferably, the time span of historical business data records can be set to nearly 36 months to maximize the coverage of the complete business cycle and exclude test data in the initial stage of system online, while filtering valid declaration forms with status "completed" or "archived".

[0035] Preferably, the extraction method of historical business data records based on ERP system can be through the / api / v1 / procurement / history RESTful interface opened by the ERP system, and the data of the two tables can be associated with the declaration number as the key to batch export CSV format raw records.

[0036] Step S12, pre-process the historical business data records to obtain a standardized historical data set.

[0037] Preferably, the pre-processing of historical business data records can be realized by data cleaning and data conversion.

[0038] Among them, data cleaning is to calculate the single node processing duration (end timestamp-start timestamp), and remove records with duration ≤0 (logical error) or ≥82 hours (extreme abnormality). Boxplot method can be used to identify remaining outliers (1.5 times outside IQR) and replace them with the median within the group; When the timestamp is missing, fill it with the average duration of adjacent nodes, for example, "initial review" is missing, use the average of "declaration receipt" to "review".

[0039] Among them, data conversion can be achieved by converting the timestamp to Unix millisecond format; Spare parts ID is mapped to category code, for example, "YC-ENG-001" is defined as "engine parts", "YC-TRANS-005" is defined as "transmission parts", which can be determined according to the established objective facts such as spare parts type, spare parts own number, etc.; The "declaration number+process node ID" combination key can be used for deduplication, and finally generate a standardized historical data set, the field is declaration number, spare parts category, process node ID, processing duration (hours), processing status.

[0040] Step S13: Group and aggregate the standardized historical dataset according to two dimensions: component category and process node. Based on a process node, obtain a corresponding processing time sample sequence.

[0041] Preferably, the grouping logic is as follows: the data is cross-grouped by two dimensions: the category of the parts and the process nodes (e.g., 6 core nodes: preliminary review, secondary review, procurement approval, supplier confirmation, warehousing registration, and financial settlement). If there are 12 categories of parts, a total of 12×6=82 data groups are formed. Within each group, the data is sorted in ascending order of processing time, and a sample sequence of processing time is generated after removing outliers.

[0042] Step S14: The baseline processing time of the current process node is calculated using an exponential smoothing algorithm based on the sample sequence of processing time of the current process node.

[0043] Preferably, Single Exponential Smoothing is suitable for stationary series without obvious trends / seasonality. The model formula is: S t =α×t t +(1−α)×S t -1, where S t The smoothed value at time t (baseline processing time), t t Let t be the actual processing time, and α be the smoothing coefficient. Generally, the calibration threshold α = 0.3 is set to balance the sensitivity of recent data with the stability of historical trends.

[0044] Specifically, S0 is initialized to the mean of the sample sequence for the processing time, and the iteration calculates the updated S0 at all time points. t Finally, take S. t The final convergence value is used as the baseline processing time for the current process node.

[0045] Step S15: Based on the baseline processing time of the current process node, calculate the reasonable maximum processing time using the T-Digest algorithm with a preset percentile as the upper limit.

[0046] Preferably, the T-Digest algorithm is a clustering-based streaming quantile estimation algorithm suitable for quantile calculation of large-scale data. Generally, the model parameters are preset percentiles of 95%, i.e., the upper threshold, to cover 95% of normal business scenarios; the compression parameter δ=100 to control the clustering granularity, and the larger δ is, the higher the accuracy.

[0047] Specifically, the calculation process of the T-Digest algorithm is as follows: Initialize an empty T-Digest structure, where the cluster center set C = {(μ i ,w i )},μi is the center value, w i is the weight; the reference processing duration is inserted one by one, the clusters are merged according to the importance sampling principle, and the clusters are merged by the distance d < range / δ; after the insertion is completed, the cluster center set C is sorted according to the cumulative weight, and the position where the cumulative weight reaches 95% is found, which corresponds to μ i , that is, the reasonable maximum processing duration (denoted as P 95 ).

[0048] Step S16, structurally integrating the reference processing duration and the reasonable maximum processing duration of each process node, and adding corresponding node identifiers, calculation time stamps and confidence indicators, and integrating to obtain a dynamic early warning threshold parameter set.

[0049] Preferably, the integration content of the dynamic early warning threshold parameter set is the reference processing duration (S14 result) of each process node (c, n) and the reasonable maximum processing duration (S15 result), and the node ID_accessory category (for example, "initial review_engine accessories") is added as the node identifier, and the current system time (format YYYYMMDDHHMM) is added as the calculation time stamp.

[0050] The beneficial effects of steps S11 to S16 are: Through systematic data processing and algorithm application, a dynamic early warning threshold parameter set accurately reflecting the historical business process rules is constructed. Among them, step S11 extracts original historical business data records from the enterprise ERP system, laying a real and reliable data foundation for threshold calculation; step S12 cleanses and preprocesses the original records, eliminates noise and fills in missing values, generates a standardized historical data set, and improves the accuracy and consistency of subsequent analysis; step S13 groups and aggregates the standardized data according to the accessory category and process node, forming a processing duration sample sequence for a single process node, providing data support for node-level fine-grained analysis; step S14 uses the exponential smoothing algorithm to process each node duration sequence, and calculates the reference processing duration to effectively capture the center trend of historical processing efficiency; step S15 calculates the reasonable maximum processing duration based on the reference processing duration using the T-Digest algorithm, and establishes the upper limit of the threshold that conforms to the actual business fluctuation range; step S16 structurally integrates the reference and maximum duration indicators of each node, and injects node identification, time stamp and other metadata, to generate a dynamic early warning threshold parameter set with timeliness and traceability, which can adapt to historical business patterns and provide scientific and dynamically updated judgment criteria for process anomaly monitoring.

[0051] Step S2, in response to an externally input accessory declaration request, parsing the accessory identifier and declaration information of the accessory declaration request and constructing a standardized declaration data object.

[0052] Further, step S2, in response to the externally input accessory declaration request, parse the accessory identification and declaration information of the accessory declaration request and construct a standardized declaration data object, specifically including the following steps: Step S21, in response to the externally input accessory declaration request, receive the accessory declaration request through the RESTful API interface.

[0053] Preferably, the RESTful API interface exposes the POST interface / api / v1 / procurement / declare to receive the declaration request submitted by the external supplier portal and the internal procurement platform. The request body is in JSON format, including public header fields (request_id: UUID unique identifier, timestamp: client submission time, ISO 8601 format such as 20XX-YY-ZZTAA:BB:CCZ) and business load (accessories: accessory list, including original identification, quantity, purpose description, etc.).

[0054] Step S22, identify the accessory identification and declaration information in the accessory declaration request through the Aho-Corasick automaton algorithm.

[0055] Preferably, the Aho-Corasick (AC) automaton algorithm is a multi-pattern string matching algorithm suitable for parallel identification of multiple predefined keywords from unstructured / semi-structured text.

[0056] Specifically, the Aho-Corasick automaton algorithm realizes the identification function through the following steps: ① Pattern string construction: Accessory identification pattern string: based on enterprise accessory coding specifications, 6 types of core patterns are preset, such as engine accessory YC-ENG-\d{3}, transmission accessory YC-TRANS-\d{3}, electrical accessory YC-ELEC-\d{3}, etc. There are several regular patterns.

[0057] Declaration information pattern string: predefine key field name, such as "declaration quantity", "demand date", "supplier suggestion", etc. There are several fixed keywords.

[0058] ② Automaton construction: Trie tree construction: insert the pattern string into the Trie tree, and mark the end of the pattern string at the node.

[0059] Failure pointer calculation: for each node, recursively find the longest suffix node as the failure jump target, for example, the failure pointer of node "YC-ENG-" points to the root node.

[0060] Output function integration: merge the node's own pattern string with the pattern string of the failed pointer path to avoid duplicate matching.

[0061] ③ Matching process: Input the accessories field text (including original identifier and usage description) from the JSON request body into the AC automaton. During scanning, the state changes according to the character. When a pattern string is matched, the accessory identifier (e.g., "YC-ENG-001") and the declaration information (e.g., "Declared quantity: 50 pieces") are recorded. The pseudocode block is as follows: from ahocorasick import Automaton # Build pattern string - type mapping patterns = {"YC-ENG-\d{3}": "engine_part", "Application Quantity": "quantity"} automaton = Automaton() for pattern, tag in patterns.items(): automaton.add_word(pattern, (tag, pattern)) automaton.make_automaton() # Match text text = "Requirement: YC-ENG-001, 50 items submitted" matches = [] for end_idx, (tag, pattern) in automaton.iter(text): start_idx = end_idx - len(pattern) + 1 matches.append({"type": tag, "value": pattern, "pos": (start_idx,end_idx)}) Step S23: Normalize the part identification according to the preset part coding rules, and map the declaration information to the unified business terminology dictionary to obtain the standard part identification and standard declaration information.

[0062] Preferably, the normalization process for parts identification can be achieved by verifying the legality of the identification through regular expressions, eliminating identifications containing illegal characters (such as spaces, #); forcibly converting to uppercase (e.g., yc-eng-001 is converted to YC-ENG-001); and for abbreviated identifications (e.g., ENG-001), supplementing the prefix to YC-ENG-001 according to the context ("engine parts" in the declaration information).

[0063] Preferably, the unified business terminology dictionary constructs a key-value pair mapping table (e.g., the required quantity is mapped to standard_quantity, and the expected delivery date is mapped to expected_delivery_date) to cover several common expression variations; for numerical information such as 50 pieces, the numerical part is extracted and labeled with the unit quantity: 50, unit: "piece"; for date information such as XXXX / YY / ZZ, it is converted to the ISO format XXXX-YY-ZZ.

[0064] Step S24: Combine and encapsulate the standard parts identifier, standard declaration information, system timestamp, and session ID to obtain a preliminary structured data framework.

[0065] Preferably, the combined encapsulation elements are core data and metadata. The core data includes standard component identifiers (array) and standard declaration information (key-value pairs); the metadata includes system reception timestamps (Unix millisecond level), session IDs (UUID v4 format), and request source identifiers (e.g., supplier_portal_v1).

[0066] Preferably, the initial structured data framework adopts a nested JSON format, for example: { "metadata": { "session_id": "******", "receive_timestamp": ******, "source": "supplier_portal_v1" }, "accessories": [ { "standard_id": "YC-ENG-001", "info": { "standard_quantity": 50, "unit": "piece", "expected_delivery_date": "XXXX-YY-ZZ" } } ] } Step S25, the final serialization processing is performed on the preliminary structured data framework, and the standardized data format of the external enterprise ERP system is converted to obtain a standardized declaration data object.

[0067] Preferably, the serialization target is to adapt to the data format requirements of the external enterprise ERP system. If the ERP adopts XMLSchema definition and the field name is camel case, then the mandatory items include procurementRequestId and accessoryList.

[0068] Preferably, the conversion logic is: Field mapping: session_id of the preliminary framework is mapped to procurementRequestId, accessories are mapped to accessoryList, and standard_id is mapped to accessoryCode.

[0069] Format conversion: JSON is converted to XML, and nodes are built through the xml.etree.ElementTree library. The date field is of the xs:date type, and the numerical value field is of the xs:int type.

[0070] Schema verification: the XML compliance is verified through the XSD file provided by the ERP.

[0071] Finally, an XML format, standardized declaration data object conforming to the ERP interface specification is obtained.

[0072] The beneficial effects of steps S21 to S25 are: The standardized data receiving and processing process is adopted to realize reliable conversion of external declaration request to internal structured data. In step S21, a RESTful API interface is adopted to receive the spare part declaration request, a unified data access specification is established, and the real-time performance and compatibility of the request data transmission are ensured. In step S22, an Aho-Corasick automatic machine algorithm is used to accurately identify the spare part identifier and the declaration information in the request text, and the accuracy and efficiency of the key information extraction are improved. In step S23, the identified results are normalized and mapped based on the preset coding rules and business term dictionary, the standard spare part identifier and the standard declaration information are generated, the data heterogeneity is eliminated, and the semantic consistency of the subsequent processing link is ensured. In step S24, the standardized information and system metadata are combined and packaged to form a preliminary structured data framework, and the data object is given a complete context identifier and traceability. In step S25, the data framework is converted into a standardized declaration data object conforming to the enterprise ERP specification through serialization processing, the conversion of the external heterogeneous request to the internal unified data model is completed, and clear structure and standard format data input are provided for the downstream process. A series of operations gradually build high-quality standardized data entities that can be directly used for system automatic processing, and the specification of the data entrance and the system integration capability are strengthened.

[0073] In step S3, the timestamp events of the standardized declaration data object are continuously collected through data stream processing, and the actual processing time sequence of all timestamp events is calculated.

[0074] Further, in step S3, the timestamp events of the standardized declaration data object are continuously collected through data stream processing, and the actual processing time sequence of all timestamp events is calculated, which specifically includes the following steps: In step S31, based on the distributed stream processing engine, the timestamp update events of each process node of the standardized declaration data object captured in real time through the event-driven architecture are listened to, and the original timestamp event stream is generated.

[0075] Preferably, Apache Flink is adopted as the distributed stream processing engine, and the event-driven architecture based on the publish-subscribe mode is adopted. The event source is the state change of the standardized declaration data object in XML format at each process node, such as "initial review start" and "review end", and the Kafka message queue of the topic procurement-timestamp-events is used for asynchronous transmission of events.

[0076] Preferably, the listening logic subscribes to the Kafka message queue for the Flink job and configures the consumer group timestamp-listener with a back pressure threshold of 0.8 to prevent data backlog. For each standardized declaration data object, its state changes at 6 core process nodes (initial review, re-review, procurement approval, supplier confirmation, warehouse registration, financial settlement) are listened to. When the node state changes, a timestamp update event is generated, containing fields: instance_id (declaration instance ID, UUID format), node_id (node ID, e.g. "initial review"), event_type (event type: START / END), timestamp (Unix millisecond timestamp). All events are aggregated into a raw timestamp event stream (JSON format).

[0077] Step S32, the raw timestamp event stream is preprocessed to obtain a set of valid timestamp events.

[0078] Preferably, preprocessing of the raw timestamp event stream requires data cleaning and various standardization.

[0079] Among them, data cleaning: Filter invalid events: event_type is not START / END (e.g. system heartbeat event), timestamp is empty or format error (not 13-bit Unix milliseconds), instance_id does not exist in the active declaration pool (archived instance). De-duplication: de-duplicate by instance_id+node_id+event_type combination key, keep the first reported event (prevent network retries from causing duplication).

[0080] Among them, format standardization: unify timestamp to 13-bit Unix milliseconds, node_id to pre-defined encoding.

[0081] Step S33, the set of valid timestamp events is grouped and aggregated according to the declaration instance identifier by a sliding window algorithm to obtain a set of grouped valid timestamp events.

[0082] Preferably, the window size of the sliding window algorithm is 5 minutes, and the sliding step is 1 minute.

[0083] Preferably, the grouping logic splits the set of valid timestamp events into independent subsets according to instance_id (declaration instance identifier); for each subset, a sliding window is applied: with a step of 1 minute, events within 5 minutes are classified into the same window; events in the window are sorted in ascending order of timestamp, generating a set of grouped valid timestamp events, each instance corresponding to one or more ordered event windows.

[0084] Step S34, calculate the difference between adjacent timestamps based on the grouped valid timestamp event set, to obtain the actual processing duration value of each process node.

[0085] Preferably, the difference between adjacent timestamps is directly subtracted to obtain.

[0086] Step S35, linearly combine the actual processing duration values of all process nodes according to the process sequence, and add corresponding node identifiers and calculation metadata to obtain the actual processing duration sequence.

[0087] Preferably, the node duration values are linearly arranged in the order of NODE_01 preliminary examination→NODE_02 review→NODE_03 procurement approval→NODE_04 supplier confirmation→NODE_05 warehouse registration→NODE_06 financial settlement.

[0088] Preferably, the calculation metadata can add node_id: node code (e.g. NODE_01); calc_timestamp: calculation time (Unix millisecond level, such as 1816163800000); instance_id: declaration instance ID.

[0089] The beneficial effects of steps S31 to S35 are: By constructing a complete data flow chain, discrete timestamp events are converted into actual processing duration sequences with clear business meaning. In step S31, a distributed stream processing engine is used to continuously monitor standardized declaration data objects, capture timestamp update events of each process node in real time, and generate a raw timestamp event stream containing original time sequence information, ensuring the timeliness and completeness of data collection; in step S32, data cleaning and validity checking are performed on the raw event stream to filter out invalid or abnormal timestamp records, forming a logically consistent valid timestamp event set to provide a high-quality data basis for subsequent accurate calculation; in step S33, a sliding window algorithm is used to group and aggregate the valid event set by declaration instance, forming an event sequence arranged in chronological order, revealing the complete evolution path of a single declaration process in the time dimension; in step S34, the difference between adjacent timestamps is accurately calculated based on the grouped event sequence, quantifying the actual processing duration value of each process node and converting the time interval into a measurable business indicator; in step S35, the duration values of all nodes are linearly combined according to the process logic sequence, and node identifiers and other metadata are injected to construct a structured and traceable actual processing duration sequence. This continuous processing realizes the sublimation from bottom-level events to high-level business indicators, enabling the system to accurately depict the time consumption of each declaration instance at each link, providing direct and quantitative data basis for process efficiency analysis and abnormal monitoring.

[0090] Step S4, comparing the actual processing duration sequence with the dynamic early warning threshold parameter set by the sliding window Z-score detection algorithm, and generating an early warning signal message with early warning accessories according to the timestamp events exceeding the dynamic early warning threshold parameter set.

[0091] Further, step S4, comparing the actual processing duration sequence with the dynamic early warning threshold parameter set by the sliding window Z-score detection algorithm, and generating an early warning signal message with early warning accessories according to the timestamp events exceeding the dynamic early warning threshold parameter set, specifically including the following steps: Step S41, dividing the actual processing duration sequence into equal-length data windows by the piecewise aggregate approximation algorithm to obtain a windowed duration dataset.

[0092] Preferably, the piecewise aggregate approximation algorithm (PAA) is a time series dimensionality reduction method that retains trend characteristics through equal-length window aggregation.

[0093] Among them, the window size of the piecewise aggregate approximation algorithm is 10 data points, based on the average number of nodes of the declaration process 6, and the redundancy is reserved to cover the sudden fluctuation. The last window is zero-filled to 10 points.

[0094] Preferably, the calculation process is to calculate the arithmetic mean of each data point in the window to generate a windowed duration dataset.

[0095] Step S42, performing real-time statistical calculation on each data window of the windowed duration dataset to obtain the real-time mean and real-time standard deviation of each data window.

[0096] Preferably, the mean and standard deviation are well-known formulas and will not be described again.

[0097] Step S43, calculating the Z-score value of each data point based on the real-time mean and real-time standard deviation, and screening the Z-score values exceeding the preset Z-score threshold to obtain a preliminary abnormal data point set.

[0098] Preferably, based on the 3σ principle, the preset Z-score threshold can be set to 3, and the Z-score value calculation is also a well-known formula and will not be described again. At the same time, the data points exceeding the preset Z-score threshold are included in the preliminary abnormal data point set.

[0099] Step S44, comparing the data points in the preliminary abnormal data point set with the longest processing duration threshold of the corresponding process node in the dynamic early warning threshold parameter set, and defining the data points exceeding the longest processing duration threshold as final abnormal data points.

[0100] Preferably, each data point x in the preliminary abnormal data point set is compared with the longest processing duration threshold of the corresponding process node in the dynamic early warning threshold parameter set.i Actual processing duration value (unit: hour), compared with the longest processing duration threshold P of the corresponding process node in the dynamic early warning threshold parameter set 95 i If x 95 > P

[0101] Step S45: Map the final abnormal data point to the corresponding accessory identifier and process node information, add a timestamp and an abnormality level label, and generate an early warning signal message.

[0102] Preferably, the mapping logic is as follows: Accessory identifier: associate the standardized declaration data object S2 through the instance_id (declaration instance ID) of the final abnormal data point to extract the accessory identifier (e.g., YC-ENG-001).

[0103] Process node information: map the node ID through the node index (e.g., NODE_01→ "initial review").

[0104] Timestamp: take the calc_timestamp (Unix millisecond level) from the actual processing duration sequence.

[0105] Abnormality level label: divided according to the threshold exceeding proportion, for example, mild: P 95 < x i ≤ 1.2P 95 ; moderate: 1.2P 95 < x i ≤ 1.5P 95 ; severe: x i > 1.5P 95 .

[0106] The steps S41 to S45 have the following beneficial effects: ​The continuous actual processing time sequence is converted into a precise early warning signal message through a multi-level anomaly detection and verification mechanism. In step S41, a segmented aggregation approximation algorithm is used to divide the input sequence into windows, generate a windowed time length dataset, and realize rational segmentation and summary of massive time series data; in step S42, real-time statistical quantity calculation is performed on each data window to obtain the real-time mean and standard deviation of the window, providing a dynamic benchmark for subsequent relative deviation analysis; in step S43, the Z-score value of each data point is calculated based on the window statistical quantity, and the preliminary abnormal data point set is selected according to the preset threshold, completing the first anomaly identification based on statistical distribution; in step S44, the actual time length value corresponding to the preliminary abnormal point is compared with the historical longest processing time length threshold for the second time, and the final abnormal data point that violates both recent trends and historical experience is selected, and the double verification mechanism effectively reduces the false alarm risk; in step S45, the final abnormal data point is mapped to a specific accessory and process node, with a timestamp and an abnormality level label attached, generating a structured and operable early warning signal message. The whole process gradually progresses through windowing, statistical anomaly detection and business threshold verification, ensuring that the output warning information has statistical significance and business relevance, and providing high credibility risk event identification for subsequent decision-making.

[0107] In step S5, in response to the early warning signal message, the external in-transit accessory database is queried, and the in-transit quantity and historical declaration record of the early warning accessory are retrieved through a SQL join operation to obtain in-transit state data.

[0108] Further, in step S5, in response to the early warning signal message, the external in-transit accessory database is queried, and the in-transit quantity and historical declaration record of the early warning accessory are retrieved through a SQL join operation to obtain in-transit state data, specifically including the following steps: In step S51, in response to the early warning signal message, the early warning accessory identifier list in the early warning signal message is extracted.

[0109] Preferably, the early warning signal message is batch parsed to extract all accessory_id field values (e.g. YC-ENG-001, YC-TRANS-005, etc.); duplicate accessory_id is removed to avoid multiple queries of the same accessory, and a deduplicated early warning accessory identifier list (e.g. ["YC-ENG-001", "YC-TRANS-005"]) is generated.

[0110] In step S52, a parameterized SQL query statement is constructed based on the early warning accessory identifier list.

[0111] Preferably, the parameterized SQL query statement can use INNER JOIN to join two tables, filter the early warning accessory identifier list through the WHERE clause, and the statement is as follows: SELECT t1.accessory_id, SUM(t1.intransit_qty) AS total_intransit_qty, -- In-transit quantity (sum, avoid duplicate orders) COUNT(t2.declare_id) AS declare_count, -- Historical declare count MAX(t2.declare_date) AS last_declare_date -- Last declare date FROM t_procurement_intransit t1 INNER JOIN t_procurement_declaration t2 ON t1.accessory_id = t2.accessory_id WHERE t1.accessory_id IN (${warning_accessory_ids}) -- Parameterized placeholder, replace with S51's list GROUP BY t1.accessory_id; -- Group by accessory, generate aggregated results.

[0112] Step S53, establish a connection session with the external in-transit accessory database, and input the parameterized SQL query statement into the connection session to perform an associated query based on the accessory identifier, obtaining several query result sets.

[0113] Preferably, a stable connection with the external in-transit accessory database can be established through the HikariCP database connection pool, with a connection timeout time (e.g. 30 seconds) and a maximum number of connections (e.g. 100) set to avoid connection leaks or resource exhaustion; the parameterized SQL statement is executed through PreparedStatement, converting the warning_accessory_ids list of step S51 into an array of IN clause parameters (e.g. ["YC-ENG-001", "YC-TRANS-005"]).

[0114] Preferably, after executing the query, a plurality of query result sets are obtained, each result row corresponding to an early warning accessory, including accessory_id, total_intransit_qty, declare_count, last_declare_date. At the same time, the result set is checked for null values. If there is no in-transit record (total_intransit_qty is NULL), it is filled with 0; if there is no historical declaration record (declare_count is NULL), it is filled with 0.

[0115] Step S54, aggregate calculation is performed on all query result sets to respectively count the in-transit quantity and historical declaration records of each early warning accessory, and the in-transit status data is obtained by integration.

[0116] Preferably, the structured in-transit status data is as follows: [ { "accessory_id": "YC-ENG-001", "total_intransit_qty": 500, -- In-transit quantity (500 pieces) "declare_count": 10, -- Historical declaration times (10 times) "last_declare_date": "", -- The latest declaration date "query_timestamp": ******, -- Query timestamp (Unix millisecond level) "db_source": "procurement_db" -- Database source }, { "accessory_id": "YC-TRANS-005", "total_intransit_qty": 0, "declare_count": 5, "last_declare_date": "XXXX-YY-ZZ", "query_timestamp": ******, "db_source": "procurement_db" } ] Step S51 to Step S54 have the following beneficial effects: The early warning signal is converted into structured in-transit state information through systematic data query and integration operation. In step S51, the early warning accessory identifier list is accurately extracted from the early warning signal message to determine the target data range to be queried; in step S52, the parameterized SQL query statement is constructed based on the identifier list to realize dynamic and batch processing of the query conditions, and the accuracy and safety of the database query are improved; in step S53, the stable connection session with the external in-transit accessory database is established, the parameterized query is executed, and the associated data is obtained through the multi-table join operation to generate a plurality of query result sets containing the original query results; in step S54, the scattered query result sets are aggregated and statistically calculated to accurately obtain the current in-transit quantity and historical declaration record of each early warning accessory, and finally integrated into complete and standardized in-transit state data. This process realizes the automatic processing from early warning identification to multi-source data association query, and finally to result aggregation, ensuring that the output data can accurately reflect the real-time in-transit status and historical declaration background of the accessory, and providing reliable data support for subsequent risk assessment.

[0117] In step S6, the in-transit state data and the early warning signal message are input into the decision tree algorithm for declaration risk assessment to obtain an optimized decision instruction.

[0118] Further, in step S6, the in-transit state data and the early warning signal message are input into the decision tree algorithm for declaration risk assessment to obtain an optimized decision instruction, which specifically includes the following steps: In step S61, multi-dimensional feature extraction is performed on the in-transit state data and the early warning signal message to obtain a multi-dimensional feature vector.

[0119] Preferably, the key features are selected based on business relevance and risk relevance, which generally ensures coverage of “inventory pressure”, “declaration frequency” and “abnormality degree”.

[0120] Wherein, the in-transit state features are total_intransit_qty (in-transit quantity, reflecting inventory replenishment capability), declare_count (historical declaration times, reflecting declaration frequency), and last_declare_date (the latest declaration date, reflecting declaration timeliness); the early warning signal features are risk_level (risk level, mild / moderate / severe), z_score (Z-score value, reflecting time length deviation), and actual_duration (actual processing time length, reflecting current node efficiency).

[0121] Preferably, numerical features (e.g. total_intransit_qty) are normalized (Min-Max scaling to [0, 1]), and categorical features (e.g. risk_level) are one-hot encoded (e.g. Mild = [1, 0, 0], Moderate = [0, 1, 0]) to ensure uniform feature format.

[0122] Step S62, feature scaling and normalization are performed on the multi-dimensional feature vector to obtain a standardized feature dataset.

[0123] Preferably, Z-score formula is applied to each feature value; one-hot encoding of categorical features remains unchanged.

[0124] Step S63, the standardized feature dataset is input into the pre-trained decision tree model, and the feature is divided layer by layer through the tree structure nodes of the decision tree model, and the feature finally reaching the leaf node is defined as the risk assessment result.

[0125] Preferably, the pre-trained decision tree model can adopt a pre-trained CART decision tree (Classification and Regression Tree), which selects the optimal partition feature through information gain (Information Gain), generates a tree-shaped decision rule, for example, if total_intransit_qty>600 and risk_level=Severe, it is determined as high risk.

[0126] Step S64, based on the external decision rule base, the optimal decision instruction corresponding to the risk assessment result is matched.

[0127] Preferably, the rule base design can be based on the tobacco factory supply chain management policy and historical abnormal cases to construct multi-dimensional decision rules, which usually need to be set by the user or adopt the following table 1 established strategy: Table 1: Decision table.

[0128] The beneficial effects of steps S61 to S64 are: Through the cooperative operation of feature engineering and intelligent decision model, the in-transit state data and early warning signal are converted into executable optimization decision instructions. In step S61, multi-dimensional feature extraction is performed on the input multi-source information to capture key attributes such as in-transit quantity, historical declaration frequency, and abnormal level, and a multi-dimensional feature vector representing the risk situation is constructed; in step S62, feature scaling and normalization processing is performed on the vector to eliminate the influence of dimension difference on the model, and a standardized feature data set with balanced distribution is generated; in step S63, the standardized data is input into the pre-trained decision tree model, and the risk assessment result based on data driving is output by relying on the layer-by-layer feature division logic of the tree structure node and following the path to the leaf node; in step S64, the result is matched with the external decision rule library, and the optimization decision instruction containing specific operation suggestions is generated according to the preset strategy mapping relationship. Through the progressive processing of feature dimension reduction, model reasoning and rule adaptation, the transformation from complex state data to clear action guidance is realized, and the decision instruction is ensured to have data basis and business adaptability, thereby providing direct support for the accurate regulation of the declaration process.

[0129] Advantages of steps S1 to S6: The system optimization of the cigarette factory spare part declaration process is realized. In step S1, based on historical declaration data, a set of dynamic early warning threshold parameters is automatically generated by using an exponential smoothing algorithm, thereby providing a quantitative benchmark that is accurate and self-adaptable for process monitoring; in step S2, the external declaration request is analyzed and standardized to construct a standardized declaration data object with unified structure, thereby laying a data foundation for subsequent automatic processing; in step S3, data flow processing technology is used to continuously collect timestamp events and calculate the actual processing time sequence, thereby realizing real-time and objective reflection of the process progress; in step S4, the real-time sequence is compared with the dynamic threshold set by using a sliding window Z-score detection algorithm, and a warning signal message is generated through a two-level verification mechanism, thereby accurately identifying process abnormalities; in step S5, in response to the warning signal, the in-transit spare part quantity and historical declaration records are integrated through association query to form comprehensive in-transit state data. Finally, in step S6, a decision tree algorithm is used to perform risk assessment on multi-dimensional information to output optimization decision instructions. Through data driving and algorithm decision, the overall technical solution achieves early discovery of declaration process abnormalities, transparent management of in-transit state, and effective avoidance of repeated declaration risks, thereby ultimately improving the collaborative efficiency of the spare part supply chain and the fine level of inventory management.

[0130] As shown in Figure 2 , the embodiment provides an embodiment of an optimization system for the cigarette factory spare part declaration process, which is applied to the optimization method in the above embodiment.

[0131] Specifically, the optimization system comprises a dynamic early warning threshold parameter set generation module 1, a standardized declaration data object construction module 2, an actual processing time sequence calculation module 3, an early warning signal message generation module 4, an in-transit state data query module 5, and an optimization decision instruction acquisition module 6 connected in sequence.

[0132] The dynamic early warning threshold parameter set generation module 1 is configured to extract the average processing time and the longest processing time of each process node based on the historical accessory declaration data of the cigarette factory through an exponential smoothing algorithm, and integrate the dynamic early warning threshold parameter set. The standardized declaration data object construction module 2 is configured to parse the accessory identification and declaration information of the accessory declaration request and construct a standardized declaration data object in response to an externally input accessory declaration request. The actual processing time sequence calculation module 3 is configured to continuously collect the timestamp events of the standardized declaration data object through data stream processing, and calculate the actual processing time sequence of all timestamp events. The early warning signal message generation module 4 is configured to compare the actual processing time sequence with the dynamic early warning threshold parameter set through a sliding window Z-score detection algorithm, and generate an early warning signal message with an early warning accessory according to the timestamp event exceeding the dynamic early warning threshold parameter set. The in-transit state data query module 5 is configured to query an external in-transit accessory database and retrieve the in-transit quantity and historical declaration record of the early warning accessory through a SQL join operation to obtain in-transit state data in response to the early warning signal message. The optimization decision instruction acquisition module 6 is configured to input the in-transit state data and the early warning signal message into a decision tree algorithm for declaration risk assessment to obtain an optimization decision instruction.

[0133] Figure 3 FIG. 1 is a structural schematic diagram of an electronic device according to an embodiment of the present application. As shown in FIG. 1, the electronic device 8 comprises a processor 81 and a memory 82 coupled to the processor 81. Figure 3

[0134] The memory 82 stores program instructions for implementing the above-mentioned any embodiment of the federated learning-based government data group collaborative energy-saving method.

[0135] The processor 81 is configured to execute the program instructions stored in the memory 82 to perform federated learning-based government data group collaborative energy-saving.

[0136] ​The processor 81 can also be referred to as a CPU (Central Processing Unit). The processor 81 may be an integrated circuit chip with signal processing capabilities. The processor 81 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor.

[0137] Furthermore, Figure 4 This is a schematic diagram of the structure of a storage medium according to an embodiment of this application. See also: Figure 4 In this embodiment of the application, the storage medium 8 stores program instructions 81 capable of implementing all the above methods. These program instructions 81 can be stored in the storage medium in the form of a software product, including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods in the various embodiments of this application. 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, or terminal devices such as computers, servers, mobile phones, and tablets.

[0138] In the several embodiments provided in this application, it should be understood that the disclosed systems, methods, and approaches can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between systems or units may be electrical, mechanical, signal, or other forms.

[0139] In addition, the various functional units in the embodiments of the present application can be integrated in one processing unit, or each can exist physically as a separate unit, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware, or in the form of a software functional unit. The above is only an implementation of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent process transformation using the content of the present application specification and drawings, or direct or indirect application in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. An optimized method for the application process of cigarette factory spare parts, characterized in that, The optimization method includes: Step S1: Based on the historical parts and components declaration data of the cigarette factory, the average processing time and the longest processing time of each process node are extracted by the exponential smoothing algorithm, and integrated to obtain a set of dynamic early warning threshold parameters. Step S2: In response to an externally input spare parts declaration request, parse the spare parts identification and declaration information in the spare parts declaration request and construct a standardized declaration data object; Step S3: Continuously collect timestamp events of the standardized declaration data object through data stream processing, and calculate the actual processing time sequence of all timestamp events; Step S4: Compare the actual processing time sequence with the dynamic warning threshold parameter set using the sliding window Z-score detection algorithm, and generate a warning signal message with warning accessories based on the timestamp event exceeding the dynamic warning threshold parameter set; Step S5: In response to the warning signal message, query the external in-transit parts database and retrieve the in-transit quantity and historical declaration records of the warning parts through SQL join operation to obtain in-transit status data; Step S6: Input the on-the-go status data and early warning signal message into the decision tree algorithm to conduct a declaration risk assessment and obtain an optimized decision instruction.

2. The optimization method according to claim 1, characterized in that, Step S1: Based on the historical parts and components application data of the cigarette factory, the average processing time and the longest processing time of each process node are extracted using an exponential smoothing algorithm, and integrated to obtain a set of dynamic early warning threshold parameters, including: Step S11: Extract historical business data records based on the external enterprise ERP system; Step S12: Preprocess the historical business data records to obtain a standardized historical dataset; Step S13: Group and aggregate the standardized historical dataset according to two dimensions: component category and process node, and obtain a corresponding processing time sample sequence based on a process node; Step S14: The baseline processing time of the current process node is calculated using an exponential smoothing algorithm based on the sample sequence of processing time of the current process node. Step S15: Based on the baseline processing time of the current process node, calculate the reasonable maximum processing time using the T-Digest algorithm with a preset percentile as the upper limit of the threshold. Step S16: The baseline processing time and the reasonable maximum processing time of each process node are structurally integrated, and corresponding node identifiers, calculation timestamps and confidence indices are added to obtain the set of dynamic early warning threshold parameters.

3. The optimization method according to claim 1, characterized in that, Step S2, in response to an externally input spare parts declaration request, parse the spare parts identification and declaration information in the spare parts declaration request and construct a standardized declaration data object, including: Step S21: In response to an externally input spare parts declaration request, receive the spare parts declaration request through a RESTful API interface; Step S22: Identify the parts identifier and declaration information in the parts declaration request using the Aho-Corasick automaton algorithm; Step S23: Normalize the part identifier according to the preset part coding rules, and map the declaration information to a unified business terminology dictionary to obtain standard part identifier and standard declaration information; Step S24: Combine and encapsulate the standard accessory identifier, the standard declaration information, the system timestamp, and the session ID to obtain a preliminary structured data framework; Step S25: Perform final serialization processing on the preliminary structured data framework to convert it into a standardized data format of an external enterprise ERP system, thereby obtaining the standardized declaration data object.

4. The optimization method according to claim 1, characterized in that, Step S3 involves continuously collecting timestamp events of the standardized declaration data object through data stream processing and calculating the actual processing time sequence of all timestamp events, including: Step S31: Based on the distributed stream processing engine, the timestamp update event of each process node is captured in real time by the event-driven architecture of the standardized declaration data object, and the original timestamp event stream is generated. Step S32: Preprocess the original timestamp event stream to obtain a set of valid timestamp events; Step S33: The set of valid timestamp events is grouped and aggregated according to the declaration instance identifier using the sliding window algorithm to obtain the grouped set of valid timestamp events. Step S34: Calculate the difference between adjacent timestamps based on the set of valid timestamp events after grouping to obtain the actual processing time value of each process node; Step S35: Linearly combine the actual processing time values ​​of all process nodes according to the process order, and then add the corresponding node identifiers and computational metadata to obtain the actual processing time sequence.

5. The optimization method according to claim 1, characterized in that, Step S4: Compare the actual processing time sequence with the dynamic warning threshold parameter set using the sliding window Z-score detection algorithm, and generate a warning signal message with warning accessories based on timestamp events exceeding the dynamic warning threshold parameter set, including: Step S41: The actual processing time sequence is divided into equal-length data windows using a segmented aggregation approximation algorithm to obtain a windowed time dataset. Step S42: Perform real-time statistics calculations on each data window of the windowed duration dataset to obtain the real-time mean and real-time standard deviation of each data window; Step S43: Calculate the Z-score value of each data point based on the real-time mean and the real-time standard deviation, and filter out the Z-score values ​​that exceed the preset Z-score threshold to obtain a preliminary set of abnormal data points; Step S44: Compare the data points in the preliminary abnormal data point set with the longest processing time threshold of the corresponding process node in the dynamic early warning threshold parameter set, and define the data points that exceed the longest processing time threshold as the final abnormal data points; Step S45: Map the final abnormal data point to the corresponding component identifier and process node information, add a timestamp and anomaly level label, and generate the warning signal message.

6. The optimization method according to claim 1, characterized in that, Step S5: In response to the warning signal message, query the external in-transit parts database and retrieve the in-transit quantity and historical declaration records of the warning parts through an SQL join operation to obtain in-transit status data, including: Step S51: In response to the warning signal message, extract the list of warning accessory identifiers from the warning signal message; Step S52: Construct a parameterized SQL query statement based on the list of warning accessory identifiers; Step S53: Establish a connection session with the external in-transit parts database, and input the parameterized SQL query statement into the connection session to perform a correlation query based on the parts identifier and obtain several query result sets; Step S54: Summarize and calculate all query result sets to separately count the number of each early warning accessory in transit and historical declaration records, and integrate them to obtain the transit status data.

7. The optimization method according to claim 1, characterized in that, Step S6: Input the on-the-go status data and early warning signal message into the decision tree algorithm to perform a declaration risk assessment and obtain optimized decision instructions, including: Step S61: Perform multi-dimensional feature extraction on the in-transit status data and the warning signal message to obtain a multi-dimensional feature vector; Step S62: Perform feature scaling and normalization on the multidimensional feature vector to obtain a standardized feature dataset; Step S63: Input the standardized feature dataset into the pre-trained decision tree model, perform layer-by-layer feature partitioning through the tree structure nodes of the decision tree model, and define the feature that finally reaches the leaf node as the risk assessment result. Step S64: Match the optimized decision instruction corresponding to the risk assessment result based on the external decision rule base.

8. An optimization system for the application process of cigarette factory spare parts, wherein the optimization system is applied to the optimization method as described in any one of claims 1 to 7, characterized in that, The optimization system includes: The dynamic early warning threshold parameter set generation module is used to extract the average processing time and the longest processing time of each process node based on the historical parts declaration data of the cigarette factory, and integrate them to obtain the dynamic early warning threshold parameter set. The standardized declaration data object construction module is used to respond to externally input spare parts declaration requests, parse the spare parts identification and declaration information of the spare parts declaration request, and construct a standardized declaration data object; The actual processing time sequence calculation module is used to continuously collect timestamp events of the standardized declaration data object through data stream processing, and calculate the actual processing time sequence of all timestamp events; The warning signal message generation module is used to compare the actual processing time sequence with the dynamic warning threshold parameter set using a sliding window Z-score detection algorithm, and generate a warning signal message with warning accessories based on the timestamp event exceeding the dynamic warning threshold parameter set. The in-transit status data query module is used to respond to the warning signal message, query the external in-transit parts database, and retrieve the in-transit quantity and historical declaration records of the warning parts through SQL connection operation to obtain in-transit status data. The optimization decision instruction acquisition module is used to input the on-the-go status data and early warning signal messages into the decision tree algorithm to conduct a declaration risk assessment and obtain optimization decision instructions.

9. An electronic device, characterized in that, The method includes a processor and a memory coupled to the processor, the memory storing program instructions executable by the processor; when the processor executes the program instructions stored in the memory, it implements the optimization method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program instructions that, when executed by a processor, enable the implementation of the optimization method as described in any one of claims 1 to 7.