This invention discloses a method and
system for
processing the entire lifecycle of procurement contracts based on a unified
stored procedure with multiple TVPs and AI protection
verification, belonging to the field of
industrial software MES / ERP technology. This invention uses three sets of table-valued parameters (TVPs) as a unified
data entry point, integrating six core operations—adding, modifying, deleting, appending details, modifying details, and deleting details—in a single
stored procedure, and returning unified exception information through a single output parameter. The
system incorporates a two-level centralized parameter
verification mechanism. The first level performs a one-time empty table check on the three sets of TVP tables; if any table is empty, the transaction is immediately rolled back and an exception is returned. The second level performs centralized integrity and legality
verification on all business parameters, achieving security protection for AI and external calls, effectively intercepting
dirty data and illegal requests. This invention features a simple architecture, high execution efficiency, and comprehensive business coverage. The transaction mechanism ensures strong consistency of master-slave table data, supports compatible operation with both
SQL Server and GaussDB databases, and can securely integrate into the AI
ecosystem without business restructuring. It is particularly suitable for the high-stability and high-security procurement contract business
processing of complex factories with more than 11 production lines. This invention has been fully implemented in a real industrial ERP
system and can run stably in a real production environment for a long time, demonstrating mature
engineering value and industrial promotion capabilities.