# `Sp_Invalidation` (procedure) > 根据模块sId删除模块(包含子模块) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sGuids` | `varchar(255)` | | 2 | IN | `sFormGuid` | `varchar(100)` | | 3 | IN | `sHandleType` | `varchar(255)` | | 4 | IN | `sTableName` | `varchar(255)` | | 5 | IN | `sBrId` | `varchar(255)` | | 6 | IN | `sSuId` | `varchar(255)` | | 7 | OUT | `sCode` | `int` | | 8 | OUT | `sReturn` | `varchar(255)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Invalidation`'`._ ## Narrative **Business context:** Generic 作废 / 取消作废 (void / unvoid) engine. Sits behind every "作废" toolbar button across the ERP — drives the row-level flag flip on `bInvalid` for any master/slave table, then chains the per-form back-write via `Sp_Invalid_backwriting`. Effectively the cross-module counterpart of `Sp_Sis_Delete` for the soft-delete path. **What it does:** Validates `sGuids` / `sTableName` / `sBrId` / `sSuId` / `sHandleType` (returns the localised `paramsErro` from `Sp_Sis_GetConst` if any is empty). `CALL Sp_GetMasterSlave(sTableName, …)` to resolve master/slave table names, save-table list, master/slave delete-id columns. Sets `bInvalid=1` when `sHandleType<>'cancel'`, else `0`. Updates the master rows' `bInvalid` flag and propagates to the slave tables. Finally `call Sp_Invalid_backwriting(sGuid, sFormGuid, sTableName, bInvalid, …)` to dispatch the per-form upstream/downstream reversal logic. **Invocation:** Called by `CheckmodelServiceImpl.invalidationCheckModel()` (xly-src `xlyBusinessService/.../CheckmodelServiceImpl.java`) — the constant `String Sp_Invalidation = "Sp_Invalidation"` is dispatched via `procedureService.getDoProMap()` + `getCallPro()` whenever the user clicks 作废 / 取消作废 on any module. Java-side pre-check `checkCanbInvalid()` filters out the master-data tables (`elecustomer`/`elematerials`/`eleproduct`/`elemachine`/`elesupply`/`eleworkcenter`/`eleprocess`) before the call. Install script `script/标版/30100101/Sp_Invalidation.sql`.