# `Sp_Check_sDgda_phone` (procedure)

> 材料送货单单据（PDA）保存之前数据校验


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

## Parameters

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

## Body

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

## Narrative

**Business context:** 销售管理 → PDA 扫码送货 — PDA-side adapter that chains the after-save handler `Sp_afterSave_sDgda_phone` and then delegates to the desktop validator [`Sp_Check_sDgda`](Sp_Check_sDgda.md). Keeps the mobile and desktop save paths in lockstep on `saldelivergoodsmaster` (material-side delivery).

**What it does:** Initialises `sCode=1`, `iFlag=0`, `sReturn=''`. If `sReturn` is already non-empty leaves with `sCode=-1`. Otherwise calls `Sp_afterSave_sDgda_phone(sGuid, sBrId, sSuId, sCode, sReturn)` for the PDA-specific post-save routine, then forwards all parameters to `Sp_Check_sDgda` to share its 红冲/库存/数量校验 logic.

**Invocation:** Called from `Sp_Calc_sDgd` and the PDA delivery save path (no direct `gdsmodule` hook — wired by code rather than metadata; the procedure name appears in the desktop validator's source body as `CALL Sp_Check_sDgda`). xly-src has no SQL install script for this proc — it lives only in the live database.
