# `Sp_Calc_sDgd_1226` (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_sDgd_1226`'`._

## Narrative

**Business context:** Backup variant of `Sp_Calc_sDgd` (the 送货单 audit on `saldelivergoodsmaster`). The `_1226` suffix is a date-stamped snapshot (12-26) kept around for rollback. Per wiki convention, backup objects are not narrated in depth.

**What it does:** Same as `Sp_Calc_sDgd` at the time of copy — validates `sGuid`, on `iFlag=1` deducts stock and back-writes delivered qty into the upstream `SalSalesOrderSlave`, `MftWorkOrderSlave`/`mftworkordermaster`, `mftproductionplan`/`mftproductionplanslave`, `OpsOutsideInStoreSlave`, `PitProductInStoreSlave`, `PitProductStoreVirtual`, `SalDeliverNotifySlave`, `SalRejectGoodsSlave`, then `INSERT INTO MitMaterialsStore` / `INSERT INTO EleMaterialsStock` / `UPDATE EleProductStock` and `CALL Sp_Bill_Used` + `CALL Sp_System_AutoMaterialsPriceSingle`. 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 reference. Not expected to be called from production — verify before relying on it. Sibling backup `Sp_Calc_sDgd_20250612` also exists (later snapshot). The live audit is `Sp_Calc_sDgd`.
