# `Sp_Supply_setLevel` (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_Supply_setLevel`'`._

## Narrative

**Business context:** 基础资料 → 供应商与外协加工商 → 供应商评估 — 评级 (set rating) toolbar action. Final step of the supplier-evaluation flow after [`Sp_Supply_submit`](Sp_Supply_submit.md) and [`Sp_Supply_filecheck`](Sp_Supply_filecheck.md): records the assigned rating against the supplier row.

**What it does:** Parses `$.params[*].value[*].sSlaveId` and `$.changeValue` (the rating-form field set). For each `valueKey` column listed in `changeValue[0].valueKey` (comma-separated), splices a `<col>=<val>` term into `p_setSql`. Always appends `sLevelMemo=<changeValue.textareaValue>`. Then builds and executes `UPDATE elesupply SET <p_setSql> WHERE sId=p_sId AND sBrandsId=… AND sSubsidiaryId=…`. Returns the localised `paramsErro` via `Sp_Sis_GetConst` when `sProInParam` is empty. Reverse pair with [`Sp_Supply_reLevel`](Sp_Supply_reLevel.md).

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` — 供应商评估 grid's 评级 button names this proc, with the rating-dialog fields flowing through `changeValue`. Install script: `script/标版/30100101/Sp_Supply_setLevel.sql`. Caveat: the body leaves `SELECT @sSqlStmt` in place (debug echo) which can leak the assembled SQL into the response.
