# `Sp_afterSave_sOpn` (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_afterSave_sOpn`'`._

## Narrative

**Business context:** 发外到货 (outsource-delivery receipt) — historically lived under 发外加工流程 → KPI流程操作菜单 but the binding has decayed. Header says 发外到货存后反写数量. Thin save-phase wrapper in the `Sp_afterSave_s<Code>` family that delegates the qty back-write to `Sp_saveReturn_sOpn`.

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

**Invocation:** Status: appears orphaned. `Sp_Check_sOpn` (the would-be save-commit caller) is not bound to any `gdsmodule.sSaveProName`/`sSaveProNameBefore` slot, so the save chain does not fire. `Sp_Invalid_backwriting` dispatches to this proc on form-ids `101801153119616635492000790` and `101801153119616635492273100`, both of which are absent from the current `gdsmodule` table — stale dispatch entries from an earlier deployment. No live caller found in any channel (form-master, current gdsmodule hooks, xly-src). Candidate for maintainer audit.
