# `Sp_BtnUpdate_SalesMaterials` (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_BtnUpdate_SalesMaterials`'`._

## Narrative

**Business context:** 研发工单 / 研发材料审批流 — R&D bill-of-materials approval: marks selected `mftworkorderslave` (work-order material lines) as material-checked and side-effects the underlying material master(s) into invalid state pending re-approval.

**What it does:** Parses `$.params[*].value[*].sSlaveId` and per line: (1) sets `mftworkorderslave.bMCheck=1` and `tMCheckDate=NOW()` (no toggle — always sets to 1); (2) joins back to `elematerials` via `sMaterialsId` and, for any referenced material whose `bCheck=0`, sets `bInvalid=1`. Effectively flags the work-order line as approved and invalidates the still-unchecked component records so they cannot be reused until re-approved.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — toolbar approval button on the 研发工单 / 研发材料 grid. No callers in DB metadata or xly-src grep for this DB instance.
