# `Sp_Calc_sDYDgd` (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_sDYDgd`'`._ ## Narrative **Business context:** 销售管理 → 销售送货流程 — variant 送货单 (delivery-note) audit on `SalDeliverGoodsMaster`. Functionally a near-duplicate of `Sp_Calc_sDgd` (the production 送货单 hook): same approval/uncheck mechanism that deducts finished-product stock, back-writes delivered qty into the upstream sales-order / work-order / outside-in-store / reject slaves, and stamps the bill as used. The `sDYDgd` name suffix suggests a customer- or feature-specific (大袋 / 单一货单?) cut of `sDgd` kept around as an alternate hook. **What it does:** Validates `sGuid`, refuses when invalid, checks `sysaccountperiod.bFrozen` per `SysSystemSettings.CkxIntervalMonthModifyBill`. On `iFlag=1`: runs the per-slave `Sp_System_CheckFlow` audit-workflow loop, `Update SalSalesOrderSlave` (delivered qty), `Update MftWorkOrderMaster/Slave`, `Update SalRejectGoodsSlave`, `Update mftproductionplan`, `Update PitProductStoreVirtual`; calls `Sp_System_AutoMaterialsPriceSingle` (auto-price), `Sp_ProductStoreVirtual`, `SP_Inventory_ProductCalcQty`; finally `CALL Sp_Bill_Used`. Symmetric uncheck on `iFlag=0`. **Invocation:** Status: dormant — no live `gdsmodule.sProcName` binding, no other-routine CALLs, no Java reference. Ships as `xly-src/script/标版/30100101/Sp_Calc_sDYDgd.sql` install script, suggesting the proc is deployed but its module hook is wired only in customer-specific overrides. Candidate for maintainer audit — confirm whether it duplicates `Sp_Calc_sDgd` or supersedes it for a specific 客户 / 表单.