Sp_Check_sOpn (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_sOpn'._
Narrative
Business context: Post-save validator nominally for 发外到货单据 (per procedure summary), targeting opsoutsidearriveslave. Reads NetMoney/NetPrice precision from SysSystemSettings, opens a cursor over opsoutsidearriveslave joined to elematerials/sistax, and recomputes per-row money/tax/qty fields against the material's 正算/反算 formula and tax rate — the same recompute pattern as Sp_Check_sOis/Sp_Check_sOpc/Sp_Check_sOpn1.
What it does: Inside the top: block, gates on IFNULL(sFormGuid,'') <> ''. For each slave row pulls (sId, sMaterialsId, sMaterialsStyle, dMaterialsQty, dAuxiliaryQty, dMaterialsPrice, dMaterialsMoney, dRate, sSrcSlaveId, sMaterialsName, bInverse, sReComputeId, sComputeId, …) and re-derives the money fields rounded to p_NetMoney/p_NetPrice.
Invocation: Status: appears orphaned. No gdsmodule.sSaveProName/sSaveProNameBefore/sProcName/sDeleteProName row references it; no form-master sSqlStr ref; no other DB routine calls it; xly-src grep finds only script/标版/30100101/Sp_Check_sOpn.sql (the install body). The 发外到货 flow appears to use Sp_Check_sOpp (整单发外) and Sp_Check_sOpi (整单发外入库) instead — candidate for maintainer audit.