# `Sp_MaterialCheck_BtnEventMaterialCheckFail` (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_MaterialCheck_BtnEventMaterialCheckFail`'`._ ## Narrative **Business context:** 生产管理 — 主辅料稽查:稽查失败 (mark material-check fail). Per-row negative-disposition button: when stock cannot satisfy the line, the user clicks 稽查失败, optionally edits per-row fields (purchase ETA, supplier, memo) in the inline dialog, and this proc records the failure on each selected `mftworkordermaterials` row along with the captured fields. **What it does:** Parses `sProInParam`. Reads `$.changeValue` (the dialog's edited cells) into `p_changeValue`, expands `$[*].valueKey` (the comma-separated list of edited column names) into a dynamic `SET col=val, col=val ...` clause `p_updatefields`. Appends the `sMCMemo` textarea if present. Then for each selected `sId` issues `Update mftworkordermaterials` with `bPlanMaterialCheck=1, bPlanMaterialCheckResult=0` plus the dynamic field set. Empty payload returns the localised `paramsErro` message via `Sp_Sis_GetConst` and `sCode=-1`. **Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` — the 稽查失败 button on the 主辅料稽查 form names `Sp_MaterialCheck_BtnEventMaterialCheckFail` (`Sp__BtnEvent*` pattern). Companion to `Sp_MaterialCheck_BtnEventMaterialCheckPass` and the parent enumerator `Sp_MaterialCheck_BtnEventMaterialCheck`. Install script ships at `script/标版/30100101/schedule/Sp_MaterialCheck_BtnEventMaterialCheckFail.sql`.