A method and system for interlocking control of packaging of traditional Chinese medicine materials
By constructing a Chinese herbal medicine packaging interlocking control system, the problems of data timing mismatch and authorized reuse in the automatic dispensing equipment for Chinese herbal medicines were solved. The system realizes the uniqueness and traceability of packaging actions, ensuring that each packaging action corresponds to an independent verification event and undergoes double review.
Patent Information
- Application Number
- CN202611387792.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-08
- Publication Date
- 2026-11-17
AI Technical Summary
In existing automated dispensing equipment for Chinese medicinal materials, the data timing of the weighing, image acquisition, and image recognition modules does not correspond, leading to problems such as cross-event data mixing, reuse of old results, repeated encapsulation, and broken re-inspection paths.
The Chinese herbal medicine packaging interlocking control system adopts a closed-loop control architecture through the combination of task management module, weighing acquisition module, image acquisition and recognition module, event management module, event consistency verification module, weight and category joint verification module, one-time release certificate generation module, packaging controller, packaging execution mechanism, anomaly recovery module and execution receipt and traceability storage module, to ensure data consistency and authorization uniqueness.
The system implements data consistency verification and authorization non-reusability in the packaging process of Chinese medicinal materials, prevents data mismatch, ensures that each packaging action has a traceable source, and that the abnormal re-inspection process and the normal verification process share the same path.
Smart Images

Figure CN123113544A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of intelligent dispensing technology of traditional Chinese medicine, specifically relating to a method and system for interlocking control of packaging of traditional Chinese medicine. Background Technology
[0002] Automated dispensing equipment for traditional Chinese medicine (TCM) typically includes a prescription task management unit, an electronic weighing unit, an image acquisition unit, an image recognition unit, and an automated packaging execution mechanism. In actual operation, after the operator or material handling mechanism retrieves the TCM according to the current dispensing task, the weighing unit obtains the actual weight of the herbs, the image acquisition unit acquires images of the herbs within the weighing area, the recognition unit outputs the herb category result, and after all verifications are passed, the packaging execution mechanism completes the bagging, sealing, or finished product output.
[0003] The aforementioned weighing, image acquisition, image recognition, and packaging actions are often performed asynchronously by different functional modules within the equipment. Existing control procedures typically use status signals such as "weight qualified" and "category identification passed" as the direct basis for triggering the packaging actuator's actions. However, under conditions of continuous adjustment, task switching, communication delays, or anomaly verification, relying solely on these status signals for control can easily lead to the following problems: First, since the weighing data, image data, and recognition results are returned separately by different modules, their arrival time at the control unit may not completely correspond to the current material collection time. If the weight and image are combined only according to the order in which the data arrive, or if recognition results returned at different times are used for the current task, it is easy to combine the data from the previous material collection time or old recognition results with the current stable weight into a single verification conclusion, resulting in the mixing of cross-event data.
[0004] Second, if the allowed state after a successful verification is maintained in the form of a regular flag or enable signal, this allowed state may not be cleared in time after task switching, reloading in the weighing area, or system status updates. The passing result of the previous task or the previous verification event remains valid in the current task or the current verification event, thus driving the new packaging action with the old result.
[0005] Third, the encapsulation allows signals to be received multiple times by the encapsulation controller during communication due to path retransmission, message duplication, or program restart. If the actuator has already responded to the initial action signal and completed encapsulation, subsequent arrivals of the same signal may still trigger another action, resulting in repeated bagging, repeated sealing, or repeated output.
[0006] Fourth, when the controller has output an action signal but the actuator fails to return an execution receipt for some reason, the upper-level control module cannot accurately determine whether the action has actually been completed. If the permission signal is simply reissued, a secondary action may be triggered if the action has actually been completed; if the lock is maintained directly, the operation may be halted due to the unclear status. Existing control methods lack a clear transition mechanism for situations where the execution result is unclear.
[0007] Fifth, when the weight verification or category identification fails and abnormal medicinal materials need to be manually removed and re-retrieved, if the original task's pass status is directly restored or the original packaging permission signal is reused, there is no mandatory sequential association between the original abnormal record, the re-inspection process and the final packaging action, making it difficult to form a continuous traceability path from the occurrence of the abnormality to the passing of the re-inspection and then to the completion of packaging. Summary of the Invention
[0008] To address the aforementioned shortcomings of existing technologies, this invention provides a method and system for interlocking control of Chinese medicinal material packaging. This system solves the problems in the existing automatic dispensing and packaging process of Chinese medicinal materials, such as data mismatch across events, reuse of old results across tasks, duplicate packaging, lost receipts and unclear status, and broken traceability of re-inspection, caused by the lack of unique binding between verification results and original material picking events, the ability to reuse one-time access permissions, and the lack of mandatory association in abnormal re-inspection paths.
[0009] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A Chinese herbal medicine packaging interlocking control system is provided, including a task management module, a weighing acquisition module, an image acquisition and recognition module, an event management module, an event consistency verification module, a weight and category joint verification module, a one-time release certificate generation module, a packaging controller, a packaging execution mechanism, an anomaly recovery module, and an execution receipt and traceability storage module; The task management module is connected to the encapsulation controller and is used to synchronize the current task status with the encapsulation controller; The event management module is connected to the task management module, weighing acquisition module, image acquisition and recognition module, and event consistency verification module. It is used to respond to the weight stability event output by the weighing acquisition module, create a unique verification event identifier, and trigger the image acquisition and recognition module to acquire the medicinal material image in the weighing area. It also writes the task identifier of the current dispensing task, the verification event identifier, the stable weight in the weight data, the medicinal material image, and the medicinal material category identification result identified by the image acquisition and recognition module into the same verification event record. The event consistency verification module is connected to the weight and category joint verification module and the anomaly recovery module, respectively. It is used to perform event consistency verification on the verification event records before joint verification to confirm that the task identifier, stable weight, medicinal material image and medicinal material category identification result belong to the same dispensing task and are generated by the same verification event. The weight and category joint verification module is connected to the one-time release certificate generation module and the anomaly recovery module, respectively. It is used to perform joint verification based on whether the stable weight meets the prescription weight requirements and whether the medicinal material category identification result meets the prescription medicinal material category requirements after the event consistency verification is passed. The one-time release certificate generation module is connected to the encapsulation controller and is used to generate a one-time release certificate only after both the event consistency check and the joint check have passed. The one-time release certificate is then bound to the task identifier, the check event identifier, and the encapsulation execution mechanism identifier, respectively. The encapsulation controller is connected to the encapsulation execution mechanism and is used to independently verify the one-time release certificate before driving the encapsulation execution mechanism. The independent verification includes at least verifying whether the task identifier, verification event identifier, and encapsulation execution mechanism identifier bound to the one-time release certificate match the current task, the current valid verification event, and the encapsulation execution mechanism to be driven, respectively, and verifying whether the one-time release certificate is within its validity period and whether the certificate sequence number meets the order requirements and has not been used. The encapsulation controller independently stores the current task identifier, the current valid verification event identifier, and the cancelled certificate sequence number. The encapsulation controller is also used to drive the encapsulation execution mechanism to perform an encapsulation action after the independent verification is passed, and at the same time as outputting the encapsulation action signal, switch the status of the one-time release certificate to the executing state, and refuse to trigger the encapsulation action again for certificates in the same executing state. The encapsulation execution mechanism is connected to the execution receipt and traceability storage module to perform encapsulation actions and return execution receipts to the encapsulation controller. The execution receipt is associated with at least the task identifier, the verification event identifier, the voucher identifier of the one-time release voucher, and the action sequence number. The execution receipt includes the execution status and information that can uniquely identify this action. The execution receipt and traceability storage module is connected to the event management module, the one-time release voucher generation module, the encapsulated execution mechanism and the exception recovery module, respectively, to associate and save the task identifier, the verification event identifier, the voucher identifier of the one-time release voucher and the execution receipt, so as to complete the voucher cancellation; The anomaly recovery module is connected to the event consistency verification module, the weight and category joint verification module, and the event management module. It generates an anomaly flag when the event consistency verification or joint verification fails, sets the failed verification event to an invalid state, and immediately revokes any unused one-time release vouchers generated for failed verification events, preventing the failure event and its voucher from being reused. After removing the abnormal medicinal materials and re-retrieving the materials, it triggers the event management module to create a new verification event for the same dispensing task. The anomaly recovery module also associates and saves the anomaly flag with the same dispensing task, the failed verification event, and the new verification event. The execution receipt and traceability storage module is also used to save the association between the exception identifier and the same adjustment task, failure verification event and new verification event.
[0010] The beneficial effects of adopting the above technical solution are as follows: The system uses verification events as indexes and one-time release certificates as authorization carriers to form a two-level control architecture. The weighing and image modules do not directly drive the actuators. Instead, a unified event record is generated in the event management module. After being filtered by the event consistency verification module and the weight and category joint verification module, the one-time release certificate generation module outputs a one-time release certificate to the packaging controller. The packaging controller independently saves the task and certificate status and verifies it again. Only after the verification is passed will the packaging actuator be driven. After execution, the packaging actuator returns a receipt to the packaging controller and outputs the execution record to the execution receipt and traceability storage module, forming a complete closed-loop structure to prevent data mismatch, ensure that the packaging action is traceable and the authorization is not reusable. The task management module synchronizes the current task status with the encapsulation controller, enabling it to verify whether the task bound to the voucher is consistent with the current one, avoiding cross-task authorization. The event management module aggregates scattered data such as weighing and images into the same event record, ensuring that the verification basis comes from the same trigger. The event consistency verification module reviews the homogeneity of event records before joint verification, excluding records that are cross-task, cross-time, or incomplete. The weight and category joint verification module only initiates weight and category judgment after receiving a record that has passed consistency verification, ensuring that the verification result on which the voucher is based has passed the homogeneity review. The one-time release voucher generation module only generates the voucher after both dual verifications have passed, ensuring that the authorization source simultaneously meets the requirements of data homogeneity and verification correctness. The encapsulation controller verifies various conditions of the voucher based on its own saved state, ensuring that the action output depends on the data source. The status comparison, rather than the higher-level signal, automatically rejects the action when communication is abnormal or the voucher is duplicated. When the encapsulation controller outputs an action signal, it switches the voucher to the execution state and refuses to trigger the action again with the same execution voucher. After the encapsulation execution mechanism executes, it returns a receipt to the encapsulation controller for verification. At the same time, it outputs the execution receipt and traceability storage module to avoid record loss due to a single path. When the verification fails, the exception recovery module generates an exception identifier and associates it with the current task and failure event. It immediately cancels the generated but unused vouchers and they cannot be restored. After re-retrieving the materials, a new verification event is triggered, so that the re-inspection and normal verification share the same path. This ensures that the re-retrieving medicinal materials must undergo complete verification before a new voucher can be obtained. The execution receipt and traceability storage module links the event record, voucher information, execution record, and exception identifier into a complete traceability chain.
[0011] Furthermore, it also includes a carrier identification reader, which is set at the loading position of the packaging container and is used to read the packaging container carrier identification at the current loading position; the carrier identification reader is connected to the packaging controller.
[0012] A method for interlocking control of traditional Chinese medicine packaging, implemented using the aforementioned interlocking control system for traditional Chinese medicine packaging, includes the following steps: S1. Task creation and verification event creation: Create the current dispensing task, generate a task identifier, and put the encapsulated execution mechanism in a prohibited execution state; in response to the weight data output by the weighing acquisition module meeting the preset stability conditions, the event management module creates a verification event and triggers the image acquisition and recognition module to acquire images of medicinal materials within the weighing area; S2. Event Data Binding: The event management module writes the task identifier of the current dispensing task, the verification event identifier of the verification event, the stable weight in the weight data, the medicinal material image, and the medicinal material category identification result identified by the image acquisition and recognition module based on the medicinal material image into the same verification event record. S3. Event Consistency Verification: The event consistency verification module performs event consistency verification on the verification event records to confirm that the task identifier, stable weight, medicinal material image, and medicinal material category identification result belong to the same dispensing task and are generated by the same verification event. S4. Joint Verification: After the event consistency verification is passed, the weight and category joint verification module performs joint verification based on whether the stable weight meets the prescription weight requirements and whether the medicinal material category identification result meets the prescription medicinal material category requirements. S5. One-time Release Certificate Generation: After the joint verification is passed, the one-time release certificate generation module generates a one-time release certificate and binds the one-time release certificate to the task identifier, verification event identifier, and encapsulation execution agency identifier respectively; only one one-time release certificate is generated for each verification event; a new verification event must be created when reauthorization is required; when the current adjustment task is switched or canceled, the weighing area is re-released, the one-time release certificate expires, or the verification event is replaced by a new verification event, the unused one-time release certificate is set to invalid; S6. Execution End Document Verification: After obtaining the one-time release document, the encapsulation controller performs independent verification on the one-time release document before executing the encapsulation action. The independent verification includes at least verifying whether the task identifier, verification event identifier, and encapsulation execution mechanism identifier bound to the one-time release document match the current task, the current valid verification event, and the encapsulation execution mechanism to be driven, respectively; and verifying whether the one-time release document is within its validity period and whether the document sequence number meets the requirement of monotonically increasing order within the task and has not been used. The encapsulation controller rejects one-time release documents with a document sequence number less than or equal to the most recently cancelled document sequence number. The encapsulation controller saves the current task identifier, the current valid verification event identifier, and the cancelled document sequence number independently of the event consistency verification module. S7. Encapsulation Action Execution: After independent verification is passed, the encapsulation controller drives the encapsulation execution mechanism to perform one encapsulation action; each one-time release certificate corresponds to only one encapsulation action; while outputting the encapsulation action signal, the encapsulation controller switches the status of the one-time release certificate to the executing status and refuses to trigger the encapsulation action again for certificates in the same executing status. S8. Execution Receipt Association and Voucher Verification: After the encapsulation controller obtains the execution receipt returned by the encapsulation execution mechanism, it marks the one-time release voucher as used; it associates the execution receipt with at least the task identifier, verification event identifier, voucher identifier of the one-time release voucher, and action sequence number, and after the association is saved, it verifies the one-time release voucher; the execution receipt includes the execution status and information that can uniquely identify this action; S9. Anomaly Re-inspection and Re-authorization: If the event consistency check or joint check fails, the anomaly recovery module generates an anomaly identifier and sets the failed check event to an invalid state; if a one-time release certificate has been generated for the failed check event but not yet used, the certificate is immediately revoked, and the failed check event and its certificate cannot be reused; after removing the abnormal medicinal materials and re-retrieving the materials, the event management module is triggered based on the anomaly identifier to create a new check event for the same dispensing task; the anomaly recovery module associates and saves the anomaly identifier with the same dispensing task, the failed check event, and the new check event; only when the association between the anomaly identifier, the same dispensing task, and the new check event is correct, and the new check event passes the event consistency check and joint check, will a one-time release certificate bound to the new check event be regenerated.
[0013] The beneficial effects of adopting the above technical solution are as follows: This method uses verification events as indexes and one-time release certificates as authorization carriers to form a complete closed-loop path from data collection, event consistency verification, joint verification, certificate generation, independent verification at the execution end, to receipt cancellation and anomaly re-inspection, ensuring that each packaging action corresponds to an independent verification event and undergoes review through both event consistency verification and joint verification. Step S1 locks the packaging execution mechanism when establishing the dispensing task, and only creates a verification event and triggers collection when the weight is stable, so that the timing of verification event creation strictly corresponds to the moment of weight stabilization; Step S2 writes the task identifier, verification event identifier, stable weight, medicinal material image, and medicinal material category identification result into the same verification event record, so that multi-source data are forcibly associated; Step S3 reviews the data homogeneity of the verification event record before joint verification, and intercepts data across tasks or across time periods; Step S4 only starts the judgment of whether the stable weight meets the prescription weight requirements and whether the medicinal material category identification result meets the prescription medicinal material category requirements after the event consistency verification is passed. If any requirement is not met, a one-time release certificate will not be generated. The one-time release certificate generated in step S5 is bound to the task identifier, verification event identifier, and encapsulation execution mechanism identifier. Only one certificate is generated for each verification event. When reauthorization is required, a new verification event must be created to make the authorization a structured data with a clearly defined user object. When a task is switched or canceled, the weighing area is reloaded, the certificate expires, or the verification event is replaced by a new event, the unused certificate is set to invalid to prevent the verification result of the previous task or old event from being reused across tasks or the same verification result from being used multiple times. In step S6, the encapsulation controller independently saves the current task identifier. The current valid verification event identifier and the serial number of the cancelled voucher are used to verify, before execution, whether the task identifier, verification event identifier, and packaging execution mechanism identifier bound to the one-time release voucher match the current reassignment task, the current valid verification event, and the packaging execution mechanism to be driven, respectively. It is also verified whether the one-time release voucher is within its validity period, whether the voucher serial number meets the monotonically increasing order requirement within the task, and whether it has not been used. Vouchers with serial numbers less than or equal to the most recently cancelled voucher serial number are rejected, making the voucher serial number order requirement an independent review dimension to prevent replay of old vouchers. Step S7 only drives the packaging execution mechanism to execute after the independent verification is passed. Each packaging action is performed once, and each one-time release certificate corresponds to only one packaging action. When the action signal is output, the certificate is switched to the executing state and the same executing certificate is refused to trigger the action again, so that the number of times the packaging action is executed is strictly limited. After obtaining the execution receipt returned by the packaging execution mechanism, step S8 associates the execution receipt with at least the task identifier, verification event identifier, certificate identifier and action sequence number. After the association is saved, the certificate is cancelled. At the same time, the receipt contains the execution status and information that uniquely identifies this action, so that the certificate status change is based on the actual completion of the packaging execution mechanism, avoiding the ambiguity caused by assuming that the certificate has been consumed based solely on the output action signal.Step S9: When event consistency verification or joint verification fails, the anomaly recovery module generates an anomaly identifier and sets the failed verification event to an invalid state. Any generated but unused vouchers are immediately revoked and cannot be reused. After removing the abnormal medicinal materials and re-collecting the materials, the event management module is triggered based on the anomaly identifier to create a new verification event for the same dispensing task. A one-time release voucher bound to the new verification event is only regenerated after the association between the anomaly identifier, the same dispensing task, and the new verification event is correct and the new verification event passes both event consistency verification and joint verification. This ensures that anomaly re-inspection requires re-going through the complete verification path instead of reusing the original voucher.
[0014] Furthermore, the preset stability condition in S1 is that the fluctuation range between multiple weight values obtained continuously within a preset time period is less than or equal to a preset threshold, or the weight stability signal output by the weighing acquisition module is valid.
[0015] Furthermore, the event consistency verification in S3 includes the following specific verification methods: verifying that the task identifier in the verification event record is consistent with the task identifier of the current dispensing task; verifying that the medicinal material image was triggered by this verification event; verifying that the image referenced by the medicinal material category identification result is consistent with the medicinal material image in the verification event record; verifying that the time difference between the moment when the weight data meets the preset stability condition and the moment when the medicinal material image is collected is within the preset range; and verifying whether the preset fields of the verification event record are complete.
[0016] Furthermore, in S8, when the packaging controller has output a packaging action signal but has not received an execution acknowledgment within the preset waiting time, the corresponding one-time release certificate is set to a pending verification lock state. When the packaging controller outputs a packaging action signal, it immediately registers the corresponding certificate number as an execution status and saves it persistently. The packaging controller also rejects one-time release certificates whose certificate number is equal to the certificate number in the current execution status or the pending verification lock state. The cancelled certificate number, the currently executing certificate number, and the certificate number in the pending verification lock state are persistently saved in the packaging controller and must not be lost after the program restarts or the device is powered off.
[0017] Furthermore, the verification event record in S2 also includes the carrier identifier of the packaging container, and the one-time release certificate in step S5 also includes the carrier identifier; in S6, the packaging controller reads the carrier identifier of the current loading position before performing the packaging action, and only allows the packaging action to be performed when the read carrier identifier is consistent with the carrier identifier bound in the one-time release certificate.
[0018] In summary, the beneficial effects of the traditional Chinese medicine packaging interlocking control method and system provided by this invention are as follows: (1) This invention constructs a two-level control architecture with verification events as the index and one-time release certificates as the authorization carrier, so that the weighing acquisition module and the image acquisition and recognition module do not directly drive the packaging execution mechanism. Instead, a unified verification event record is formed in the event management module. After being filtered by the event consistency verification module and the weight and category joint verification module, the one-time release certificate generation module outputs the certificate to the packaging controller. The packaging controller independently saves the task and certificate status and verifies them again. Only after the verification is passed will the packaging execution mechanism be driven. This closed-loop structure can prevent data mismatch and ensure that each packaging action has a traceable source and that the authorization is not reusable.
[0019] (2) The present invention writes the task identifier, verification event identifier, stable weight, medicinal material image, weight stabilization time, image acquisition time and medicinal material category identification result into the same verification event record when the verification event is created through the event management module. This forces the multi-source data originally generated by different modules to be bound together with the verification event identifier as the index. Then, the event consistency verification module reviews the consistency of the task identifier, the consistency of the image trigger source, the correlation between the weight stabilization time and the image acquisition time, and the consistency between the image referenced by the identification result and the image in the event record before joint verification. This ensures that all data participating in the subsequent joint verification of weight and category belong to the same adjustment task and are generated by the same verification event, thereby avoiding the combination of cross-task or cross-time data for verification.
[0020] (3) The present invention generates a one-time release certificate after both the event consistency check and the joint check are passed by the one-time release certificate generation module. The certificate is bound to the task identifier, the check event identifier and the encapsulation execution mechanism identifier respectively. Only one certificate is generated for each check event. When re-authorization is required, a new check event must be created. The result of a joint check is transformed into structured data with a clear target and scope of use instead of a simple pass signal. When switching tasks, re-releasing materials in the weighing area, when the certificate expires or the check event is replaced by a new event, the unused certificate is set to an invalid state, thereby preventing the check result of the previous task from continuing to be effective in the current task or the same check result from being used multiple times.
[0021] (4) The present invention encapsulates the current task identifier, the current valid verification event identifier and the verified voucher number independently of the event consistency verification module by the encapsulation controller, and independently verifies the received voucher before executing the encapsulation action. The verification content includes whether the task identifier bound to the voucher is consistent with the current task, whether the verification event identifier is consistent with the current valid verification event, whether the encapsulation execution mechanism identifier is consistent with the execution mechanism to be driven, whether the voucher is within the validity period, whether the voucher number meets the monotonically increasing order requirement in the task, and whether the voucher has been used. When outputting the action signal, the voucher switches to the execution state and refuses to trigger the action again with the same execution voucher. This makes the action output of the encapsulation controller depend on the comparison result between its own stored state information and the received voucher information rather than simply relying on the pass signal of the upper module. Thus, it can refuse to execute when communication abnormalities cause message retransmission, program restarts cause repeated distribution, or old vouchers arrive late.
[0022] (5) The present invention marks the voucher as used only after the encapsulation controller obtains the execution receipt returned by the encapsulation execution mechanism. When the encapsulation action signal has been output but the execution receipt has not been received within the preset waiting time, the corresponding voucher is set to the pending verification locked state, and the original voucher is prohibited from repeatedly outputting the action signal. At the same time, the execution voucher number is registered and permanently stored, and duplicate vouchers with the same number as the execution or pending verification voucher number are rejected. The voucher status change is based on the actual completion of the encapsulation execution mechanism, avoiding the problem of unclear status caused by simply assuming that the voucher has been consumed based on the output action signal. At the same time, the cancelled voucher number, the execution and pending verification voucher numbers are permanently stored in the encapsulation controller to ensure that the status is not lost after the program restarts or the device is powered off.
[0023] (6) The present invention generates an anomaly identifier when the event consistency check or joint check fails, sets the failed check event to an invalid state, and immediately cancels the generated but unused vouchers and cannot be reused. After the abnormal medicinal materials are removed and the materials are re-obtained, the event management module is triggered based on the anomaly identifier to create a new check event for the same dispensing task. At the same time, the anomaly identifier is associated with the same dispensing task, the failed check event and the new check event and saved. The voucher bound to the new check event is only regenerated after the association between the anomaly identifier, the same dispensing task and the new check event is correct and the new check event passes the event consistency check and joint check. This allows the anomaly re-inspection process and the normal check process to share the same event management and voucher generation path, instead of directly modifying the conclusion based on the failed event and reusing the original voucher. This ensures that the medicinal materials after re-obtaining must go through the complete check path again to obtain a new voucher and forms a closed-loop path from the occurrence of the anomaly to the passing of the re-inspection and then to the completion of the packaging.
[0024] (7) The present invention connects the execution receipt and traceability storage module to the event management module, the one-time release certificate generation module, the encapsulation execution mechanism and the exception recovery module respectively, and links the verification event record, one-time release certificate information, the execution receipt returned by the encapsulation execution mechanism and the exception identifier and association relationship generated by the exception recovery module into a complete traceability record, so that the original data collected, authorization certificate, execution result and exception handling process corresponding to each encapsulation action can be traced back and queried. Attached Figure Description
[0025] Figure 1 This is the overall flowchart of the Chinese herbal medicine packaging interlock control method of the present invention.
[0026] Figure 2 This is a schematic diagram of the connection of the interlocking control system module for the packaging of Chinese medicinal materials in this invention.
[0027] Figure 3 This is a flowchart illustrating the verification and cancellation process for the one-time release certificate of this invention.
[0028] Figure 4 This is a flowchart of the re-verification and re-authorization process for abnormal medicinal materials in this invention. Detailed Implementation
[0029] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.
[0030] like Figure 2 As shown, the Chinese herbal medicine packaging interlocking control system provided by the present invention includes a task management module, a weighing acquisition module, an image acquisition and recognition module, an event management module, an event consistency verification module, a weight and category joint verification module, a one-time release certificate generation module, a packaging controller, a packaging execution mechanism, an anomaly recovery module, and an execution receipt and traceability storage module.
[0031] The task management module is connected to the encapsulation controller and is used to synchronize the current task status with the encapsulation controller.
[0032] The event management module is connected to the task management module, weighing acquisition module, image acquisition and recognition module, and event consistency verification module. The weighing acquisition module continuously acquires the weight data of the medicinal materials to be verified and outputs a weight stability event to the event management module when the weight data meets preset stability conditions. The image acquisition and recognition module acquires images of the medicinal materials and outputs the medicinal material category identification result when triggered by a verification event. The event management module generates a verification event identifier in response to the weight stability event and triggers the image acquisition and recognition module. Simultaneously, it writes the task identifier, verification event identifier, stable weight, medicinal material image, weight stabilization time, image acquisition time, and medicinal material category identification result into the same verification event record, and then outputs this verification event record to both the event consistency verification module and the traceability storage module. Through this connection, the multi-source data originally generated independently by the weighing acquisition module and the image acquisition and recognition module are forcibly associated with the same record using the verification event identifier as an index, providing a unified data foundation for subsequent data source verification by various modules.
[0033] The event consistency verification module is connected to both the weight and category joint verification module and the anomaly recovery module. It determines whether verification event records belong to the current task and the same verification event before joint verification. Because the event consistency verification module is located between the event management module and the weight and category joint verification module in the data flow, it can independently examine whether various data points in the event records originate from the same verification event before the weight and category joint verification module initiates substantive judgments on weight and category. This effectively excludes data from cross-task or cross-time periods from subsequent verification channels.
[0034] The weight and category joint verification module is connected to the one-time release certificate generation module and the anomaly recovery module, respectively, and is used to jointly judge the stable weight and medicinal material category after the event consistency verification is passed.
[0035] The one-time release certificate generation module is connected to the encapsulation controller and is used to generate a one-time release certificate only when both the event consistency check and the joint check pass. This certificate is bound to the task identifier, the check event identifier, and the encapsulation execution mechanism identifier.
[0036] The encapsulation controller is connected to the task management module, the one-time release certificate generation module, and the encapsulation execution mechanism. The task management module outputs the current task status to the encapsulation controller. After receiving the one-time release certificate from the one-time release certificate generation module, the encapsulation controller independently verifies the certificate before executing the encapsulation action. After successful verification, it outputs a drive signal to the encapsulation execution mechanism. Because the encapsulation controller independently stores the current task identifier, the currently valid verification event identifier, and the used certificate information, its action output depends on the comparison result between its own stored status information and the received certificate information, rather than simply relying on the pass signal output by the upper-level module. This allows the encapsulation controller to independently determine whether to execute an action based on its own stored status when communication anomalies cause message retransmission, program restarts cause duplicate issuance, or old certificates arrive late. Simultaneously with outputting the action signal, the encapsulation controller switches the one-time release certificate to the executing state and refuses to allow certificates in the same executing state to trigger actions again.
[0037] The encapsulation execution mechanism is connected to both the encapsulation controller and the execution receipt and traceability storage module. After verification by the encapsulation controller, it performs the encapsulation action and returns an execution receipt to the controller, while simultaneously outputting the execution record to the execution receipt and traceability storage module. The direct connection between the encapsulation execution mechanism and the execution receipt and traceability storage module ensures that the execution record does not rely on the encapsulation controller for independent transmission. Even if the communication path between the encapsulation controller and the execution receipt and traceability storage module fails, the execution record can still be saved to the execution receipt and traceability storage module through this direct path, avoiding record loss or inconsistencies caused by transmission via a single path.
[0038] The execution receipt and traceability storage module is connected to the event management module, the one-time release certificate generation module, the encapsulated execution mechanism, and the exception recovery module, respectively, to associate and save the relationships between tasks, verification events, one-time release certificates, execution receipts, and exception recovery. By connecting to the above four modules, the execution receipt and traceability storage module brings together the event records scattered in the event management module, the certificate information in the one-time release certificate generation module, the execution records in the encapsulated execution mechanism, and the exception identifiers and relationships in the exception recovery module, forming a complete traceability path from the original data collection to the authorization certificate, and from the execution result to the exception handling process.
[0039] The anomaly recovery module connects to the event consistency verification module, the weight and category joint verification module, and the event management module. It generates an anomaly flag when verification fails, sets the failed verification event to an invalid state, and immediately revokes any unused one-time release vouchers generated for the failed verification event. The failed verification event and its voucher cannot be reused. After removing the abnormal medicinal materials and re-collecting the materials, the event management module is triggered to create a new verification event for the same dispensing task. The anomaly recovery module also connects to the output of the failed event and the input of the event management module, forcibly associating failed events and re-inspection events through the anomaly flag. The re-inspection process cannot bypass the normal verification process to obtain authorization directly.
[0040] The execution receipt and traceability storage module is connected to the event management module, the one-time release certificate generation module, the encapsulated execution mechanism, and the exception recovery module, respectively, to associate and save the relationships between tasks, verification events, one-time release certificates, execution receipts, and exception recovery. By connecting to the above four modules, the execution receipt and traceability storage module consolidates the event records scattered in the event management module, the certificate information in the one-time release certificate generation module, the execution records of the encapsulated execution mechanism, and the exception identifiers and relationships in the exception recovery module into one place, forming a complete traceability path from the original collected data to the authorization certificate, and from the execution result to the exception handling process.
[0041] The system also includes a carrier identification reader, which is positioned at the loading location of the packaging container to read the carrier identification of the packaging container at the current loading location. The carrier identification reader is connected to the packaging controller.
[0042] Based on the above-mentioned interlocking system for packaging Chinese medicinal materials, such as Figure 1 As shown, the present invention also provides a method for interlocking control of traditional Chinese medicinal materials, comprising the following steps: S1. Task Creation and Verification Event Creation: The task management module creates a dispensing task based on the current medicinal materials in the prescription to be executed, generates a task identifier, and puts the encapsulated execution mechanism in a prohibited state. The weighing acquisition module continuously acquires the weight data output by the weighing acquisition module. When the weight data meets the preset stability condition, the weighing acquisition module outputs a weight stability event to the event management module. In response to this weight stability event, the event management module creates a unique verification event identifier and triggers the image acquisition and recognition module to acquire images of the medicinal materials within the weighing area based on this verification event identifier.
[0043] S2. Event Data Binding: The event management module writes the task identifier of the current dispensing task, the verification event identifier of the verification event, the stable weight in the weight data, the medicinal material image, and the medicinal material category identification result identified by the image acquisition and recognition module based on the medicinal material image into the same verification event record.
[0044] S3. Event Consistency Verification: The event consistency verification module performs event consistency verification on the verification event records to confirm that the task identifier, stable weight, medicinal material image, and medicinal material category identification result belong to the same dispensing task and were generated by the same verification event. Specific methods for event consistency verification include: verifying that the task identifier in the verification event record is consistent with the task identifier of the current dispensing task; verifying that the medicinal material image was triggered and collected by this verification event; verifying that the image referenced in the medicinal material category identification result is consistent with the medicinal material image in the verification event record; verifying that the time difference between the moment when the weight data meets the preset stability condition and the moment when the medicinal material image was collected is within a preset range; and verifying whether the preset fields of the verification event record are complete.
[0045] S4. Joint Verification: After the event consistency verification is passed, the weight and category joint verification module performs joint verification based on whether the stable weight meets the prescription weight requirements and whether the medicinal material category identification result meets the prescription medicinal material category requirements.
[0046] S5. One-time Release Certificate Generation: After the joint verification passes, the one-time release certificate generation module generates a one-time release certificate and binds it to the task identifier, verification event identifier, and encapsulation execution agency identifier. Only one one-time release certificate is generated for each verification event; a new verification event must be created when reauthorization is required. When the current allocation task is switched or canceled, materials are re-released in the weighing area, the one-time release certificate expires, or the verification event is replaced by a new verification event, any unused one-time release certificates are set to invalid.
[0047] S6. Verification of vouchers at the execution end: such as Figure 3 As shown, after obtaining the one-time release credential, the encapsulation controller performs independent verification on the credential before executing the encapsulation action. The encapsulation controller independently stores the current task identifier, the currently valid verification event identifier, and the previously cancelled credential sequence number, separate from the event consistency verification module. Independent verification includes at least: verifying whether the task identifier, verification event identifier, and encapsulation execution mechanism identifier bound to the one-time release credential match the current task, the currently valid verification event, and the encapsulation execution mechanism to be driven, respectively; verifying whether the one-time release credential is within its validity period; verifying whether the credential sequence number meets the requirement of monotonically increasing order within the task and is not used; the encapsulation controller rejects one-time release credentials with a credential sequence number less than or equal to the most recently cancelled credential sequence number; and verifying whether the credential has not been used.
[0048] S7. Encapsulation Action Execution: After independent verification, the encapsulation controller drives the encapsulation execution mechanism to perform one encapsulation action. Each one-time release certificate corresponds to only one encapsulation action. While outputting the encapsulation action signal, the encapsulation controller switches the one-time release certificate to the executing state and refuses to trigger the encapsulation action again for certificates in the same executing state.
[0049] S8. Execution Receipt Association and Voucher Verification: After receiving the execution receipt returned by the packaging execution mechanism, the packaging controller associates the execution receipt with at least the task identifier, verification event identifier, voucher identifier of the one-time release voucher, and action sequence number. After the association is saved, the one-time release voucher is verified. The execution receipt includes the execution status and information that can uniquely identify this action. When the packaging controller has output a packaging action signal but has not received an execution receipt within the preset waiting time, it sets the corresponding one-time release voucher to a pending verification lock state, prohibiting the repeated output of the packaging action signal using the original one-time release voucher. When the packaging controller outputs a packaging action signal, it immediately registers the corresponding voucher sequence number as being in the execution state and saves it persistently; the packaging controller also rejects one-time release vouchers with voucher sequence numbers equal to the current execution state or pending verification lock state.
[0050] S9. Abnormal Re-inspection and Re-authorization: (e.g.) Figure 4 As shown, if the event consistency check or joint check fails, the anomaly recovery module generates an anomaly identifier and sets the failed check event to an invalid state. If a one-time release certificate has been generated for the failed check event but not yet used, the certificate is immediately revoked, and the failed check event and its certificate cannot be reused. After removing the abnormal medicinal materials and re-collecting the materials, the event management module is triggered based on the anomaly identifier to create a new check event for the same dispensing task. The anomaly recovery module associates and saves the anomaly identifier with the same dispensing task, the failed check event, and the new check event. Only when the association between the anomaly identifier, the same dispensing task, and the new check event is correct, and the new check event passes the event consistency check and joint check, is a one-time release certificate bound to the new check event regenerated.
[0051] In the above method flow, the preset stability condition in step S1 is that the fluctuation range between multiple weight values obtained continuously within a preset time period is less than or equal to a preset threshold, or the weight stability signal output by the weighing acquisition module is valid. In step S2, the verification event record also includes the carrier identifier of the packaging container. In step S5, the one-time release certificate also includes this carrier identifier. In step S6, before performing the packaging action, the packaging controller reads the carrier identifier at the current loading position through the carrier identifier reader, and only allows the packaging action to be performed when the read carrier identifier matches the carrier identifier bound in the one-time release certificate.
[0052] Example 1 This embodiment uses a normal dispensing and packaging process as an example for illustration.
[0053] The task management module creates a dispensing task based on the current medicinal materials in the prescription to be executed, generates a task identifier, and outputs the current task status to the encapsulation controller. The encapsulation controller sets the encapsulation execution mechanism to a disabled state based on the received task status.
[0054] After the operator or material handling mechanism places the medicinal materials in the weighing area, the weighing acquisition module continuously acquires the weight data output by the weighing acquisition module according to a preset sampling period. When the weight data is detected to meet a preset stability condition, the weighing acquisition module outputs a weight stability event to the event management module. In response to this weight stability event, the event management module creates a first verification event identifier and uses this first verification event identifier to trigger the image acquisition and recognition module to acquire images of the medicinal materials within the weighing area. After completing acquisition and recognition, the image acquisition and recognition module returns the medicinal material image and the corresponding medicinal material category recognition result to the event management module.
[0055] The event management module writes the task identifier of the current dispensing task, the first verification event identifier, the stable weight in the weight data, the weight stabilization time, the medicinal material image, the image acquisition time, and the medicinal material category identification result into the same verification event record. The event consistency verification module performs an event consistency verification on this verification event record, confirming that the task identifier in the record is consistent with the task identifier of the current dispensing task, the medicinal material image was triggered by this verification event, the difference between the weight stabilization time and the image acquisition time is within the preset associated time window, the image identifier referenced by the identification result is consistent with the image identifier in the record, and the preset fields in the record are complete.
[0056] After the event consistency check passes, the weight and category joint verification module initiates joint verification to determine whether the stable weight is within the allowable range of the prescription target weight, and whether the medicinal material category identification result is consistent with the prescription medicinal material category. If both checks pass, the one-time release certificate generation module generates the first one-time release certificate. This certificate is bound to the task identifier of the current dispensing task, the first verification event identifier, and the encapsulation execution agency identifier, and includes a certificate serial number, validity period, and unused usage status.
[0057] The one-time release certificate generation module sends the first one-time release certificate to the packaging controller. Upon receiving the certificate, the packaging controller independently verifies it before executing the packaging action: the task identifier bound to the certificate matches the current task identifier stored in the controller; the verification event identifier bound to the certificate matches the currently valid verification event identifier stored in the controller; the packaging execution mechanism identifier bound to the certificate matches the packaging execution mechanism to be driven; the certificate is within its validity period; the certificate sequence number meets the monotonically increasing order requirement within the task; and the certificate has not been used. After all the above verifications pass, the packaging controller drives the packaging execution mechanism to perform a bagging or sealing action.
[0058] After the encapsulation actuator completes its action, it returns an execution receipt to the encapsulation controller. Upon receiving the execution receipt, the encapsulation controller associates the execution receipt with the task identifier, the first verification event identifier, the credential identifier, and the action sequence number. After saving the association, it marks the first one-time release credential as used. Then, it associates the execution receipt with the task identifier, the first verification event identifier, and the credential, and outputs it to the execution receipt and traceability storage module for storage.
[0059] Example 2 This embodiment, based on Embodiment 1, is used to illustrate the processing method under task switching conditions.
[0060] The first relocation task has completed event consistency verification and joint verification. The one-time release certificate generation module has generated a first one-time release certificate binding the first task identifier, the first verification event identifier, and the encapsulation execution mechanism identifier, and has sent it to the encapsulation controller. During the period before the first one-time release certificate has been verified by the encapsulation controller and the encapsulation action has been performed, the current relocation task is switched or canceled.
[0061] When a task is switched or canceled, the task management module outputs the updated current task status to the encapsulation controller, meaning the current task identifier is changed to the task identifier of the second reassigned task. Simultaneously, the one-time release certificate generation module sets any unused one-time release certificates related to the first task to an invalid state.
[0062] If, due to communication delays, the first one-time release credential, which has already been generated and sent, arrives at the encapsulation controller only after the task switch, the encapsulation controller will compare the task identifier bound to the credential with the current task identifier stored in its own memory when verifying the credential. If the two do not match, the encapsulation controller will reject the credential and keep the encapsulation execution mechanism in a prohibited execution state.
[0063] Example 3 This embodiment, based on Embodiment 1, illustrates the handling method under the condition of receipt timeout.
[0064] The encapsulation controller has successfully verified the one-time release certificate and output a one-time encapsulation action signal to the encapsulation execution mechanism. After outputting the action signal, the encapsulation controller starts a retrieval waiting timer. Due to a communication path anomaly, although the encapsulation execution mechanism has completed the encapsulation action, its returned execution retrieval was not received by the encapsulation controller.
[0065] If the encapsulation controller does not receive an execution receipt within the preset receipt waiting time, it will set the corresponding one-time release document to a pending verification locked state, prohibiting the repeated output of encapsulation action signals using the original one-time release document. The encapsulation controller will not reuse the original document, nor will it automatically repeat the output of action signals.
[0066] The equipment confirms the actual action status through position sensors or status feedback of the encapsulated actuator. If it is confirmed that the action has been completed, a manual confirmation is made, an execution receipt is recorded, and the voucher is cancelled. If it is confirmed that the action was not performed and the condition of the medicinal materials has not changed, the preset recovery process is followed. No recovery action can directly reuse the original one-time release voucher that is in a pending verification / locked state.
[0067] Example 4 This embodiment, based on Embodiment 1, illustrates the processing method for re-retrieving and re-authorizing abnormal medicinal materials.
[0068] A certain verification event fails during event consistency verification or joint verification. The exception recovery module generates an exception flag, sets the failed verification event to an invalid state, and records the correspondence between the exception flag and the current reassignment task, the failed verification event, and the reason for the failure. Since the failed verification event fails verification, the one-time release certificate generation module does not generate a one-time release certificate for it; if a certificate has already been generated for this failed verification event and has not yet been used, the one-time release certificate generation module will cancel it.
[0069] After the operator removes the abnormal medicinal material from the weighing area and re-collects it, the anomaly recovery module, based on the saved anomaly identifier and its correspondence with the current dispensing task, triggers the event management module to create a new verification event for the same dispensing task. The event management module then associates and saves the verification event identifier of this new verification event with the anomaly identifier, the same dispensing task, and the failed verification event.
[0070] The new verification event re-executes all steps of weighing stability triggering, image acquisition, event data binding, event consistency verification, and joint verification. Only after the correlation between the anomaly identifier, the same transfer task, and the new verification event is correct, and the new verification event passes the event consistency verification and joint verification, will the one-time release certificate generation module regenerate the one-time release certificate bound to the new verification event.
[0071] Example 5 This embodiment, based on Embodiment 1, illustrates the implementation method of binding the label on the packaging container carrier.
[0072] A barcode reader, QR code reader, or RFID reader is installed at the loading location of the sealed bag or packaging container as a carrier identification reader. The carrier identification reader is connected to the packaging controller.
[0073] When a verification event is established, the carrier identifier reader reads the carrier identifier of the packaging container at the current loading location, and the event management module writes this carrier identifier as part of the verification event record. When the one-time release certificate generation module generates the one-time release certificate, it also writes the carrier identifier from the verification event record into the one-time release certificate.
[0074] Before executing the sealing action, the sealing controller reads the carrier identifier of the packaging container at the current loading location again using the carrier identifier reader, and compares the carrier identifier read on-site with the carrier identifier bound to the one-time release document. The sealing controller only allows the sealing action to be executed if the read carrier identifier matches the carrier identifier bound to the one-time release document.
[0075] The parameters in the preset stability conditions mentioned above, such as the fluctuation range and duration, preset associated time window, validity period of the one-time release certificate, and preset receipt waiting time, are not fixed values. Those skilled in the art, after reading this specification, can determine the applicable implementation scope through conventional experiments based on the actual equipment's sampling cycle, camera trigger delay, communication method, and the action duration of the encapsulation execution mechanism. The image recognition model used by the image acquisition and recognition module is not limited to a specific network structure, and the one-time release certificate is not limited to a specific data frame format. The modules can be centrally deployed in the same industrial control computer or distributed as needed, without affecting the implementation of this invention.
Claims
1. A traditional Chinese medicine packaging interlocking control system, characterized in that: It includes a task management module, a weighing acquisition module, an image acquisition and recognition module, an event management module, an event consistency verification module, a weight and category joint verification module, a one-time release certificate generation module, a packaging controller, a packaging actuator, an exception recovery module, and an execution receipt and traceability storage module; The task management module is connected to the packaging controller and is used to synchronize the current task status with the packaging controller; The event management module is connected to the task management module, the weighing acquisition module, the image acquisition and recognition module, and the event consistency verification module, respectively. It is used to create a unique verification event identifier in response to the weight stability event output by the weighing acquisition module, and trigger the image acquisition and recognition module to acquire the medicinal material image in the weighing area with the verification event identifier. It also writes the task identifier of the current dispensing task, the verification event identifier, the stable weight in the weight data, the medicinal material image, and the medicinal material category identification result identified by the image acquisition and recognition module into the same verification event record. The event consistency verification module is connected to the weight and category joint verification module and the anomaly recovery module, respectively, and is used to perform event consistency verification on the verification event record before joint verification to confirm that the task identifier, the stable weight, the medicinal material image and the medicinal material category identification result belong to the same dispensing task and are generated by the same verification event. The weight and category joint verification module is connected to the one-time release certificate generation module and the anomaly recovery module, respectively, and is used to perform joint verification based on whether the stable weight meets the prescription weight requirements and whether the medicinal material category identification result meets the prescription medicinal material category requirements after the event consistency verification is passed; The one-time release certificate generation module is connected to the encapsulation controller and is used to generate a one-time release certificate only after the event consistency check and the joint check have both passed, and to bind the one-time release certificate to the task identifier, the check event identifier and the encapsulation execution mechanism identifier respectively; The encapsulation controller is connected to the encapsulation execution mechanism and is used to independently verify the one-time release certificate before driving the encapsulation execution mechanism. The independent verification includes at least verifying whether the task identifier, verification event identifier, and encapsulation execution mechanism identifier bound to the one-time release certificate match the current task, the current valid verification event, and the encapsulation execution mechanism to be driven, respectively, and verifying whether the one-time release certificate is within its validity period and whether the certificate sequence number meets the order requirements and has not been used. The encapsulation controller independently stores the current task identifier, the current valid verification event identifier, and the cancelled certificate sequence number. The encapsulation controller is also used to drive the encapsulation execution mechanism to perform an encapsulation action after the independent verification is passed, and while outputting the encapsulation action signal, switch the status of the one-time release certificate to the executing state, and refuse to trigger the encapsulation action again for certificates in the same executing state. The encapsulation execution mechanism is connected to the execution receipt and traceability storage module, and is used to perform encapsulation actions and return execution receipts to the encapsulation controller. The execution receipts are associated with at least the task identifier, the verification event identifier, the voucher identifier of the one-time release certificate, and the action sequence number. The execution receipts include the execution status and information that can uniquely identify this action. The execution receipt and traceability storage module is connected to the event management module, the one-time release certificate generation module, the encapsulated execution mechanism and the exception recovery module, respectively, and is used to associate and save the task identifier, the verification event identifier, the certificate identifier of the one-time release certificate and the execution receipt to complete the certificate cancellation; The anomaly recovery module is connected to the event consistency verification module, the weight and category joint verification module, and the event management module, respectively. It is used to generate an anomaly identifier when the event consistency verification or the joint verification fails, set the failed verification event to an invalid state, and if the failed verification event has generated an unused one-time release certificate, immediately revoke the certificate, and the failed verification event and its certificate cannot be reused. After removing the abnormal medicinal materials and re-retrieving the materials, the event management module is triggered to create a new verification event for the same dispensing task. The anomaly recovery module is also used to associate and save the anomaly identifier with the same dispensing task, the failed verification event, and the new verification event. The execution receipt and traceability storage module is also used to save the association between the exception identifier and the same reassignment task, the failure verification event, and the new verification event.
2. The traditional Chinese medicinal material packaging interlocking control system according to claim 1, characterized in that: It also includes a carrier identification reader, which is located at the loading position of the packaging container and is used to read the carrier identification of the packaging container at the current loading position; the carrier identification reader is connected to the packaging controller.
3. A traditional Chinese medicinal material packaging interlocking control method, implemented by using the traditional Chinese medicinal material packaging interlocking control system according to any one of claims 1 to 2, characterized in that, Includes the following steps: S1. Task creation and verification event creation: Create the current dispensing task, generate a task identifier, and put the encapsulation execution mechanism in a prohibited execution state; in response to the weight data output by the weighing acquisition module meeting the preset stability conditions, the event management module creates a verification event and triggers the image acquisition and recognition module to acquire images of medicinal materials in the weighing area; S2. Event Data Binding: The event management module writes the task identifier of the current dispensing task, the verification event identifier of the verification event, the stable weight in the weight data, the medicinal material image, and the medicinal material category identification result identified by the image acquisition and recognition module based on the medicinal material image into the same verification event record. S3. Event Consistency Verification: The event consistency verification module performs event consistency verification on the verification event record to confirm that the task identifier, the stable weight, the medicinal material image, and the medicinal material category identification result belong to the same dispensing task and are generated by the same verification event. S4. Joint Verification: After the event consistency verification is passed, the weight and category joint verification module performs joint verification based on whether the stable weight meets the prescription weight requirements and whether the medicinal material category identification result meets the prescription medicinal material category requirements. S5. One-time release certificate generation: After the joint verification passes, the one-time release certificate generation module generates a one-time release certificate and binds the one-time release certificate to the task identifier, the verification event identifier, and the encapsulation execution mechanism identifier respectively; only one one-time release certificate is generated for each verification event, and a new verification event must be created when reauthorization is required; when the current adjustment task is switched or canceled, the weighing area is re-released, the one-time release certificate expires, or the verification event is replaced by a new verification event, the unused one-time release certificate is set to invalid; S6. Execution End Certificate Verification: After obtaining the one-time release certificate, the encapsulation controller independently verifies the one-time release certificate before executing the encapsulation action. The independent verification includes at least verifying whether the task identifier, verification event identifier, and encapsulation execution mechanism identifier bound to the one-time release certificate match the current task, the current valid verification event, and the encapsulation execution mechanism to be driven, respectively; and verifying whether the one-time release certificate is within its validity period and whether the certificate number meets the requirement of monotonically increasing order within the task and has not been used. The encapsulation controller rejects one-time release certificates with a certificate number less than or equal to the most recently cancelled certificate number. The encapsulation controller independently stores the current task identifier, the current valid verification event identifier, and the cancelled certificate number from the event consistency verification module. S7. Encapsulation Action Execution: After the independent verification is passed, the encapsulation controller drives the encapsulation execution mechanism to perform one encapsulation action; each one-time release certificate corresponds to only one encapsulation action; while outputting the encapsulation action signal, the encapsulation controller switches the status of the one-time release certificate to the executing state and refuses to trigger the encapsulation action again for certificates in the same executing state; S8. Execution Receipt Association and Voucher Verification: After the encapsulation controller obtains the execution receipt returned by the encapsulation execution mechanism, it associates the execution receipt with at least the task identifier, the verification event identifier, the voucher identifier of the one-time release voucher, and the action sequence number. After the association is saved, the one-time release voucher is verified. The execution receipt includes the execution status and information that can uniquely identify this action. S9. Anomaly Re-inspection and Re-authorization: If the event consistency verification or the joint verification fails, the anomaly recovery module generates an anomaly identifier and sets the failed verification event to an invalid state; if the failed verification event has generated an unused one-time release certificate, the certificate is immediately revoked, and the failed verification event and its certificate cannot be reused; after removing the abnormal medicinal materials and re-retrieving the materials, the event management module is triggered to create a new verification event for the same dispensing task based on the anomaly identifier; The anomaly recovery module associates and saves the anomaly identifier with the same reassignment task, the failed verification event, and the new verification event. Only when the association between the anomaly identifier, the same reassignment task, and the new verification event is correct, and the new verification event passes the event consistency verification and the joint verification, will a one-time release certificate bound to the new verification event be regenerated.
4. The traditional Chinese medicinal material packaging interlocking control method according to claim 3, characterized in that: The preset stability condition in S1 is that the fluctuation range between multiple weight values obtained continuously within a preset time period is less than or equal to a preset threshold, or the weight stability signal output by the weighing acquisition module is valid.
5. The traditional Chinese medicinal material packaging interlocking control method according to claim 3, characterized in that: The event consistency verification in S3 includes the following specific verification methods: verifying that the task identifier in the verification event record is consistent with the task identifier of the current reassignment task; The verification process confirms that the medicinal herb image was acquired triggered by this verification event; the verification process also confirms that the image referenced in the medicinal herb category identification result is consistent with the medicinal herb image in the verification event record. The time difference between the moment when the weight data meets the preset stability condition and the moment when the image of the medicinal material is acquired is within a preset range; And to verify whether the preset fields of the verification event record are complete.
6. The traditional Chinese medicinal material packaging interlocking control method according to claim 3, characterized in that: In step S8, when the packaging controller has output a packaging action signal but has not received the execution receipt within a preset waiting time, the corresponding one-time release certificate is set to a pending verification lock state. When the packaging controller outputs a packaging action signal, it immediately registers the corresponding certificate number as being in execution and saves it permanently. The packaging controller also rejects one-time release certificates whose certificate number is equal to the certificate number in the current execution state or the pending verification lock state. The verified certificate number, the currently executing certificate number, and the certificate number in the pending verification lock state are permanently saved in the packaging controller and must not be lost after the program restarts or the device is powered off.
7. The method for interlocking control of packaging of traditional Chinese medicine materials according to claim 3, characterized in that: The verification event record in S2 also includes the carrier identifier of the packaging container, and the one-time release certificate in S5 also includes the carrier identifier; in S6, the packaging controller reads the carrier identifier of the current loading position before performing the packaging action, and only allows the packaging action to be performed when the read carrier identifier is consistent with the carrier identifier bound in the one-time release certificate.
