# `Sp_ComematerialsInspection_BtnRepair` (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_ComematerialsInspection_BtnRepair`'`._ ## Narrative **Business context:** 质量管理 → 采购进料检验(IQC) — "异常/不合格" button on the 来料检验 (incoming-materials inspection) list. Stamps the selected `qlycomematerialstestmaster` rows as failed inspection (`iTestResult = 2`) and writes the operator-provided exception memo onto each one, optionally merging in extra column changes from the same dialog. **What it does:** Validates JSON parameter `sProInParam` (rejected with `Sp_Sis_GetConst('paramsErro', …)` when shorter than 5 chars), then extracts `.params` (the selected-row list with `sId` values) and `.changeValue` (the column-change payload, including `textareaValue` for the exception memo and a `valueKey` list of extra columns to also update). For each `valueKey` it builds a `SET col = value, …` fragment, then unconditionally appends `iTestResult = 2, sExceptionMemo = `. For each selected row it `PREPARE`s a dynamic `UPDATE qlycomematerialstestmaster SET WHERE sId = '' AND sBrandsId = … AND sSubsidiaryId = …` and executes it. Builds the SQL via raw string concatenation — relies on the dialog producing pre-quoted JSON values, so any unescaped quote in the memo would break the prepared statement. **Invocation:** Dispatched generically by `GenericProcedureCallController.doGenericProcedureCall()` → `GenericProcedureCallServiceImpl` — the front-end "btnRepair" button posts the proc name with the JSON payload. No `gdsmodule` hook, no form-master binding, no other proc references this one, no install script ships in xly-src — the body lives only in the live DB.