# `Sp_Check_sDgd` (procedure) > 送货单单据保存之前数据校验 - **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_sDgd`'`._ ## Narrative **Business context:** 销售管理 → 销售送货流程 → 送货单 (`saldelivergoodsmaster/slave`) — post-save validator and money/qty back-calculator on the 送货单 family. Also serves 扫码送货(单据) (`101251240115015959853077870`), where lines are scanned barcodes. **What it does:** First runs the standard 红冲 guard against `saldelivergoodsmaster.sMinusSrcId` (refuses a duplicate red-stroke). Reads `NetMoney`/`NetPrice` from `SysSystemSettings`. Then opens a cursor over `saldelivergoodsslave`, joins `salsalesorderslave` (the originating order), re-derives `dProductMoney/dProductPrice/dProductNoTaxMoney/dProductTaxMoney/dProductForeignMoney` using `sistax.dRate` and the order's `dCurrencyRate` (forward/reverse calc by `bInverse`), and writes the recomputed values back. Splits the auxiliary money fields (`dProofingMoney`, `dPlateMoney`, `dKnifeMouldMoney`) per line. Aborts with the localised `sCcprkHaveRedData` message on duplicate red-stroke. **Invocation:** Bound to `gdsmodule.sSaveProName` on `送货单单据` (`11811781131121915179924491520`), `扫码送货(单据)` (`101251240115015959853077870`), and `材料送货单` (`101251240115016140459724020`) — all under 销售管理 → 销售送货流程. Dispatched by `BusinessBaseServiceImpl.checkUpdate(..., "sSaveProName")` after the save batch commits. Pre-save peer is `Sp_beforeSave_sDgd`; audit handler is `Sp_Calc_sDgd`. xly-src ships `script/标版/30100101/Sp_Check_sDgd.sql` as the install body.