# `Sp_afterSave_sPct` (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_afterSave_sPct`'`._

## Narrative

**Business context:** 工序检验单据 → 质量管理单据 → 质量管理 — header says 品质首检(mobile单据)存后反写数量 (the header is mis-copied from the mobile `_sPct1` sibling; the form-id `Sp_Invalid_backwriting` dispatches into this proc points at 工序检验单据). Thin save-phase wrapper in the `Sp_afterSave_s<Code>` family that delegates the qty back-write to `Sp_saveReturn_sPct`.

**What it does:** Wraps `sGuid` in double-quotes if not already quoted and, when `sGuid` is non-empty, calls `Sp_saveReturn_sPct(sGuid, sBrId, sSuId, 2, @sCode, @sReturn)`. Does not propagate the inner `@sCode`/`@sReturn` to its own OUT params.

**Invocation:** Reached via `Sp_Invalid_backwriting` (Java `CheckmodelServiceImpl` → `Sp_Invalidation`) on 作废/取消作废 of form `15818303350003257780407017498600` (工序检验单据). The save-commit chain through `Sp_Check_sPct` is also wired (its body calls this), though `Sp_Check_sPct` itself currently has no `gdsmodule` binding — likely dispatched dynamically by a parent-module entry.
