# `Sp_Check_sSod` (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_sSod`'`._ ## Narrative **Business context:** 订单生产流程 → 1/3 新增销售订单 / 1/3 新增轮转销售订单 — post-save validator on `salsalesordermaster`/`salsalesorderslave`. Caps the order qty per source quotation slave (`quoquotationslave.dProductQty`), then re-derives money fields per row from foreign-currency × exchange rate, recomputing 不含税金额, 税额 and 净价 (`dNProductMoney`/`dNProductPrice`) after subtracting 打样费/版费/刀模费 (`dProofingMoney`/`dPlateMoney`/`dKnifeMouldMoney`). **What it does:** Reads `NetMoney`/`NetPrice` precisions and the master `dCurrencyRate`. Opens a cursor over `salsalesorderslave` joined on `sistax`. For each slave with a non-empty `sSrcSlaveId`, joins `quoquotationslave` and emits `sOrderQtyUpQuo` ("订单数已超过报价数量") with the offending product + bill numbers when the cumulative ordered qty exceeds the quotation qty. Then for every row: recomputes `dProductMoney = dProductForeignMoney * dCurrencyRate` (rounded to `p_NetMoney`), `dProductPrice = dProductMoney / dProductQty`, `dNProductMoney = dProductMoney - dProofingMoney - dPlateMoney - dKnifeMouldMoney`, `dNProductPrice = dNProductMoney / dProductQty`, `dProductNoTaxMoney = dProductMoney / (1 + dRate/100)`, `dProductTaxMoney = dProductMoney - dProductNoTaxMoney`. Builds a dynamic `Update salsalesorderslave` statement per row to persist the recalculated fields. **Invocation:** Bound to `gdsmodule.sSaveProName` on `1/3 新增销售订单` (sId `101251240115016086186007360`) and `1/3 新增轮转销售订单` (sId `101251240115015878710737470`) — 订单生产流程 (KPI流程操作菜单). Dispatched by `BusinessBaseServiceImpl.checkUpdate(..., "sSaveProName")` after the save batch commits. Additionally re-invoked by `Sp_SalSalesOrder_CheckUpdate` (the 销售订单保存插入工艺卡 chain) so the recalculations stay in sync when the 工艺卡 generator runs.