# `Sp_Calc_sCldApply` (procedure)

> 子产品领用申请


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `iFlag` | `int` |
| 2 | IN | `iTmpCheck` | `int` |
| 3 | IN | `sFormGuid` | `varchar(100)` |
| 4 | IN | `sGuid` | `varchar(100)` |
| 5 | IN | `sLoginId` | `varchar(100)` |
| 6 | OUT | `sReturn` | `varchar(4000)` |
| 7 | IN | `sBrId` | `varchar(100)` |
| 8 | IN | `sSuId` | `varchar(100)` |
| 9 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 子产品领用申请 — child-product (kit-component) requisition-form check / uncheck on `salchildproductapplymaster`. When sales need to draw a sub-item from inventory against a parent product order, this audit approves the request so the delivery-notify / 送货 pipeline can fulfill it.

**What it does:** Validates `sGuid` and `SysLocking` (concurrent edit guard). Reads `SysSystemSettings.CbxDeliverGoodsNotify` to pick the delivery source (`sDeliverType`, default `salesorder`). Reads master `bInvalid`; refuses if invalid. With `iFlag=1`: refuses if already checked, then writes master `bCheck=1` and walks the slave rows to deduct from stock / append to the chosen 送货 source (full body continues with cursor logic, replace-field check-flow, and stock posting). With `iFlag=0`: symmetric uncheck.

**Invocation:** Status: appears orphaned. No `gdsmodule.sProcName/sSaveProName/sDeleteProName/sSaveProNameBefore` binding, no `gdsconfigformmaster` reference, no other procedure or function calls it, no xly-src hit. The 子产品领用申请 module exists in the schema (`salchildproductapplymaster`) but its audit handler is unwired in this DB instance. Candidate for maintainer audit.
