# `Sp_beforeSave_sCldApply` (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_beforeSave_sCldApply`'`._

## Narrative

**Business context:** 子产品出库申请返回 — before-save dispatcher intended for the child-product outbound-application (子产品出库申请) document family. Wraps `sGuid` and delegates to `Sp_saveReturn_sCldApply` to backwrite related counters before the master save commits.

**What it does:** Normalises `sGuid` to a quoted-CSV form, then `CALL Sp_saveReturn_sCldApply(sGuid, sBrId, sSuId, 1, @sCode, @sReturn)`. The downstream proc holds the actual writeback logic.

**Invocation:** Status: appears orphaned as a primary hook. No `gdsmodule` row references this proc, no form-master sSqlStr. Referenced only by dispatcher `Sp_delete_backwriting` (per the standard `Sp_*_backwriting → Sp_afterSave_s<Code>` replay pattern), but its `sSaveProNameBefore` hook is never wired — the writeback only runs on delete-cascade, not on the original save. Candidate for maintainer audit.
