# `Sp_afterSave_sScd` (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_sScd`'`._

## Narrative

**Business context:** 长期合同单据 / 长期合同明细 → 销售订单管理 / 销售单据 → 销售管理 — header says 长期合同保存后反写报价数量. Thin save-phase 反写 wrapper in the `Sp_afterSave_s<Code>` family that delegates the actual qty back-write to `Sp_saveReturn_sScd`.

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

**Invocation:** Status: appears dormant. Its only caller `Sp_Check_sScd` is itself orphan: `gdsmodule.sSaveProName` slot on the 长期合同 forms is empty, and the live `sProcName` is `Sp_Calc_sScd` — so `Sp_Check_sScd` is not bound on any module. `Sp_Invalid_backwriting` has no dispatch entry for either 长期合同 form. Candidate for maintainer audit.
