# `Sp_beforeSaveReturn_sSck` (procedure)

> 销售对账保存前反写数量


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sGuid` | `longtext` |
| 2 | IN | `sBrId` | `varchar(100)` |
| 3 | IN | `sSuId` | `varchar(100)` |
| 4 | IN | `iTag` | `int` |
| 5 | OUT | `sCode` | `int` |
| 6 | OUT | `sReturn` | `longtext` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_beforeSaveReturn_sSck`'`._

## Narrative

**Business context:** 销售对账 (Sales reconciliation) — would-be before-save backwriter for the sales-reconciliation document family, intended to recompute reconciled-quantity / settled-money columns on every upstream document that contributed to the reconciliation. Header comment: `销售对账保存前反写数量`.

**What it does:** Loads `sGuid` (CSV) into `p_t_sId` / `p_sSrcSlaveId_tmp` / `p_MftworkOrderSlave_tmp`, then runs `UPDATE` against `salsalescheckingmaster`, `SalSalesOrderSlave`, `SalDeliverGoodsSlave`, `SalDeliverGoodsdedSlave`, `SalRejectGoodsSlave`, `SalQualityAbnormalSlave`, `MftWorkOrderSlave`, `accproductinitslave`, `cahfinancialadjustslave`, and `CahCustomerInit` to recompute their reconciled aggregates from the joined reconciliation lines.

**Invocation:** Status: appears orphaned. No caller in any channel (form-master, gdsmodule hooks, other routines, xly-src grep). The wired-up reconciliation path is `Sp_beforeSave_sSck` (dispatched by `Sp_Invalid_backwriting` / `Sp_delete_backwriting` on form `11811781131121915184849572550` 销售对账单据 / 销售送货流程). This `_sSck` variant appears to be a comprehensive draft never put into service — candidate for maintainer audit.
