# `Sp_BtnEvent_MaterialsItestType` (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 | `sUserId` | `varchar(100)` |
| 4 | IN | `sBrId` | `varchar(100)` |
| 5 | IN | `sSuId` | `varchar(100)` |
| 6 | OUT | `sReturn` | `varchar(1000)` |
| 7 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 基础资料 / 材料 (elematerials) — button-click handler that promotes selected `elematerials` rows to 免检 (exempt from incoming inspection) by setting their `iTestType=3` on the material master, so future purchase-arrivals of the same material auto-skip QC.

**What it does:** Validates `sProInParam` length, parses `$.params[*].value[*].sMaterialsId`, and per id `UPDATE elematerials SET iTestType=3, tSetTestDate=NOW() WHERE sId=p_sId`. Default `sReturn='财务确认成功！'` (a copy-pasted message).

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — the 设置免检 toolbar button on `elematerials` / 材料 grids names `Sp_BtnEvent_MaterialsItestType` as the action. Companion of `Sp_BtnEvent_MaterialsItestFast` (per-arrival fast-check). No static caller, no `gdsmodule` hook.

Flag: default `sReturn` ("财务确认成功！") is wrong for this proc — should be `设置免检成功`. The hardcoded `iTestType=3` constant assumes the type-3 enum stays mapped to "免检" in `Fun_Sis_GetConst` / `eleparamslist`.
