# `Sp_Calc_sMpz` (procedure)

> 新材料测试申请(品质)


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `iFlag` | `int` |
| 2 | IN | `iTmpCheck` | `int` |
| 3 | IN | `sFormGuid` | `varchar(100)` |
| 4 | IN | `sGuid` | `varchar(100)` |
| 5 | IN | `sLoginId` | `varchar(100)` |
| 6 | OUT | `sReturn` | `varchar(5000)` |
| 7 | IN | `sBrId` | `varchar(100)` |
| 8 | IN | `sSuId` | `varchar(100)` |
| 9 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 新材料测试申请(品质) — quality-department new-material-test request audit / un-audit. Despite the form-title naming, the body's data touch is on `elematerials` and `salsalesdevplanmaster` rather than a `mft*test*` master — suggesting the audit, once approved, promotes the candidate material into `elematerials` and back-writes the test reference onto the originating 销售开发计划.

**What it does:** Validates `sGuid` with `bCheck`/`bInvalid` guards, branches on `iFlag`. On `iFlag=1` runs `insert into elematerials` (or `delete from elematerials` then re-insert) to materialise the approved material row, and `update salsalesdevplanmaster` to mark the dev-plan line as having a usable material. `iFlag=0` reverses by `delete from elematerials` and restoring the dev-plan flag.

**Invocation:** Status: appears orphaned. No `gdsmodule.sProcName` binding, no `gdsconfigformmaster` reference, no other routine refs, no xly-src grep hits. The 新材料测试申请 family (`Sp_Calc_sMft` / `Sp_Calc_sMpz` / `Sp_Calc_sMsc`) is collectively unbound — the live flow may have consolidated onto a different proc or moved to Java. Candidate for maintainer audit.
