Sp_Check_sPis (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_sPis'._
Narrative
Business context: KPI流程操作菜单 → 物料采购流程 → 采购入库 — post-save validator on purpurchaseinstoremaster. Combines 红冲 (red-impound) consistency checks on the slave qty totals with the standard 正算/反算 money/tax recompute used across the procurement family.
What it does: Reads NetMoney/NetPrice precision from SysSystemSettings. If sMinusSrcId is set on the master, sums dAuxiliaryQty from purpurchaseinstoreslave rows that reference each prior slave via sMinusSrcSlaveId (against non-bInvalid masters) and counts rows whose net is non-zero; on hit, aborts with sCcprkHaveRedData (已存在红冲数据,不允许重复提交). Then gates on IFNULL(sFormGuid,'') <> '' and opens a cursor over purpurchaseinstoreslave joined to elematerials/sistax, recomputing per-row money/tax/qty fields against the chosen 正算/反算 formula and tax rate.
Invocation: Bound to gdsmodule.sSaveProName (post-save) on 采购入库 (192116810113315220315711060, under KPI流程操作菜单 → 物料采购流程). Dispatched by BusinessBaseServiceImpl.checkUpdate(..., "sSaveProName") after the save batch commits. xly-src ships script/标版/30100101/Sp_Check_sPis.sql as the install body.