# `Sp_afterSave_sQtt` (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_sQtt`'`._

## Narrative

**Business context:** 01/04【新增】新报价单 → 估价管理流程 → KPI流程操作菜单 — header says 估价单保存后反写状态. Thin save-phase 反写 wrapper in the `Sp_afterSave_s<Code>` family that delegates the actual qty/state back-write to `Sp_saveReturn_sQtt`.

**What it does:** Wraps `sGuid` in double-quotes if not already quoted and unconditionally calls `Sp_saveReturn_sQtt(sGuid, sBrId, sSuId, 2, @sCode, @sReturn)` (iFlag=2 = "after save" phase). The body carries a large commented-out dynamic-SQL block that was once a `salsaleschanceproduct.sQuotationId` propagator across `quoquotationslave` joins — inert. Does not propagate the inner `@sCode`/`@sReturn` back to its own OUT params.

**Invocation:** Reached on two paths. (1) `Sp_Check_sQtt` (the save-commit dispatch proc bound via `gdsmodule.sSaveProName` on 01/04【新增】新报价单) calls this proc near the tail of a successful save. (2) `Sp_Invalid_backwriting` dispatches to this proc on 作废/取消作废 of form `101251240115016076506222050` (报价单), itself triggered from Java `CheckmodelServiceImpl` via `Sp_Invalidation`.
