Sp_Check_sSck (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 PROCEDURESpCheck_sSck'._
Narrative
Business context: 销售管理 → 销售送货流程 → 销售对账&开票 — post-save validator on salsalescheckingmaster/salsalescheckingslave/salsalescheckingchild. Ensures the reconciliation qty (dProductQty+dGiveQty) on each line does not exceed the corresponding 送货单 (delivery note) qty, then recomputes the per-line money columns from the foreign-currency total at the configured precision.
What it does: Sets sCode=1, iFlag=0, clears sReturn. Reads NetMoney/NetPrice precisions. When sFormGuid is set, opens a cursor over salsalescheckingslave rows for sParentId=sGuid. For each row with a non-empty sSrcSlaveId: aggregates summed dProductQty+dGiveQty per sSrcSlaveId and joins to SalDeliverGoodsSlave — if the summed reconciliation qty exceeds the delivery qty (Q.dProductQty + Q.dGiveQty), aborts with concatenated 对账数量已超过送货单数量; plus the offending bill number. A symmetric overrun guard runs again against the quotation/order qty (the same group concat / count idiom). Then recomputes dProductMoney = ROUND(dProductForeignMoney * dCurrencyRate, p_NetMoney), dProductNoTaxMoney = ROUND(dProductMoney / (1 + dRate/100), p_NetMoney), dProductTaxMoney = dProductMoney - dProductNoTaxMoney per row and writes them back via a dynamic UPDATE salsalescheckingslave. Finally calls Sp_afterSave_sSck.
Invocation: Bound to gdsmodule.sSaveProName on 销售对账单据 (11811781131121915184849572550) — 销售管理 → 销售送货流程 (KPI流程操作菜单). Dispatched by BusinessBaseServiceImpl.checkUpdate(..., "sSaveProName") after the save batch commits. Pre-save peer is Sp_beforeSave_sSck. xly-src ships script/标版/30100101/Sp_Check_sSck.sql as the install body.