# `Sp_Materials_BtnEventCancelInvalid` (procedure)

> 取消物料作废


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProInParam` | `varchar(10000)` |
| 2 | IN | `sMakePerson` | `varchar(100)` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | OUT | `sReturn` | `varchar(1000)` |
| 6 | OUT | `sCode` | `int` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Materials_BtnEventCancelInvalid`'`._

## Narrative

**Business context:** 基础数据 / 物料信息 — toolbar button-event "取消物料作废": un-invalidate one or more `elematerials` rows that had previously been marked obsolete. The complementary "作废物料" action sets `bInvalid=1`; this proc clears it so the material rejoins active master-data.

**What it does:** Parses `$.params[*].value[*].sId` from `sProInParam` (with the standard "请选择数据" guard via `Fun_Sis_GetConst('chooseData',...)` when empty). The selected `sId` may be a `-`-joined batch; the proc splits it on `-` and for each `sIdOne`: composes a "取消作废物料：<sMaterialsName>" `syslog` audit row (`INSERT into syslog`) and `UPDATE elematerials` clearing `bInvalid` for that material in the current `sBrandsId / sSubsidiaryId` scope.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` — the 取消作废 button on the 物料 grid names `Sp_Materials_BtnEventCancelInvalid` as the action (`Sp_<Module>_BtnEvent*` pattern). No gdsmodule hook, no form-master binding, no xly-src install script — DB-only.
