# `Sp_beforeSave_sPpr` (procedure)

> 产量上报保存前反写数量


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sGuid` | `varchar(2000)` |
| 2 | IN | `sBrId` | `varchar(100)` |
| 3 | IN | `sSuId` | `varchar(100)` |
| 4 | OUT | `sCode` | `int` |
| 5 | OUT | `sReturn` | `varchar(4000)` |

## Body

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

## Narrative

**Business context:** 订单生产流程 / 产量上报 — before-save dispatcher for the production-output report document. Wraps `sGuid` and delegates to `Sp_saveReturn_sPpr` to backwrite reported output quantities onto the upstream work-order / schedule documents before the master save commits.

**What it does:** Declares unused `sProductionReport` local, normalises `sGuid` to a quoted-CSV form, then `CALL Sp_saveReturn_sPpr(sGuid, sBrId, sSuId, 1, @sCode, @sReturn)`. A `-- LEAVE top;` line is commented out — dev escape hatch.

**Invocation:** Hooked as `gdsmodule.sSaveProNameBefore` on `产量上报` (sId `19211681019715476042694840`). Also called by dispatcher procs `Sp_Invalid_backwriting` and `Sp_delete_backwriting`.
