# `Sp_beforeSave_sPct1` (procedure)

> 品质首检(mobile单据)存前反写数量


- **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_sPct1`'`._

## Narrative

**Business context:** 质量管理单据 / 品质首检(mobile单据) — before-save dispatcher for the mobile first-article inspection document. Wraps `sGuid` and delegates to `Sp_saveReturn_sPct1` to backwrite first-article-inspected quantities onto the upstream work-order / process-card chain before the master save commits. Comment header: `品质首检(mobile单据)存前反写数量`.

**What it does:** Normalises `sGuid` to a quoted-CSV form, then `CALL Sp_saveReturn_sPct1(sGuid, sBrId, sSuId, 1, @sCode, @sReturn)`.

**Invocation:** **Not** hooked on any `gdsmodule` row directly. Reached only via dispatcher procs `Sp_Invalid_backwriting` and `Sp_delete_backwriting`, which branch to this proc when `sFormGuid = '12012615914116373957014740'` (品质首检 mobile form). The save-time before-save hook is presumably configured at the form-master / customer-override layer rather than on a gdsmodule node.
