# `Sp_QualityAccident_Reason` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProInParam` | `longtext` |
| 2 | IN | `sMakePerson` | `varchar(100)` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | OUT | `sReturn` | `text` |
| 6 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 制造管理 → 质量事故报告 (mftqualityaccidentslave) — toolbar/button handler that lets the user fill in 原因分析 (cause analysis) and 短期/长期/临时改善对策 once and apply the four strings to every selected slave row.

**What it does:** Parses `sProInParam` as the standard generic-dispatch JSON (`$.params[*].value[*].sId` for selection, `$.changeValue` for the form values). On empty payload calls `Sp_Sis_GetConst('paramsErro', …)` to localise the error. For each `sId`, runs `UPDATE mftqualityaccidentslave SET sShortTermImproveStrategy, sLongTermImproveStrategy, sCauseAnalysis, sTmpImproveStrategy` scoped by `sBrandsId`/`sSubsidiaryId`. No status flip and no master touch.

**Invocation:** Signature is the canonical `Sp_BtnEvent_*` shape (`sProInParam, sMakePerson, sBrId, sSuId, OUT sReturn, OUT sCode`) dispatched by `GenericProcedureCallServiceImpl.doGenericProcedureCall()`. No DB hook (`gdsmodule.sSaveProName`/`sProcName` empty), no other routine references it, and `grep -rln` on xly-src returns nothing. Status: appears orphaned in the live config — the button likely existed in an older 质量事故 grid and was retired. Candidate for maintainer audit.
