Sp_System_CheckFlow.md 2.23 KB

Sp_System_CheckFlow (procedure)

业务单据校验

  • Type: PROCEDURE
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sAllGuids varchar(1000)
2 IN sSlaveGuid varchar(1000)
3 IN sTbNames varchar(1000)
4 IN sTypes varchar(1000)
5 IN sFormGuid varchar(100)
6 IN sGuid varchar(100)
7 OUT sReturn varchar(4000)
8 IN sLoginId varchar(100)
9 IN sBrId varchar(100)
10 IN sSuId varchar(100)
11 OUT sCode int

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpSystem_CheckFlow'._

Narrative

Business context: Generic 审批流条件检查 — evaluates every active elecheckmodel row tied to a form id against the candidate bill's joined master/slave/base-entity values via Sisformula, returning a pipe-delimited slave-master-formula digest of which conditions matched. Invoked by the Sp_Calc_s* audit slot of every business module whose SysSystemSettings.CkxDefineCheck=1, so 销售/采购/生产/委外/品质 audit buttons all share this single approval-routing engine.

What it does: First rejects re-submission while sysMsg already holds a pending 审批 message for the same sGuid/sType=2. Then cursors over elecheckmodel WHERE sFormId=sFormGuid AND bActivate=1, and inside each model cursors elecheckmodelcondition joined to Sisformula; for every condition it calls Sp_System_ReplaceField with the caller's sAllGuids/sTbNames/sTypes payload to evaluate the formula and, if the returned p_sFieldsReturn=1, appends slaveGuid-modelGuid-formulaName to sReturn. sCode stays 1 unless Sp_System_ReplaceField itself reports an error.

Invocation: Static CALL Sp_System_CheckFlow(...) from virtually every Sp_Calc_s<Code> (e.g. Sp_Calc_sAcc, Sp_Calc_sDgn, Sp_Calc_sQtt_hm, ~50 more) inside their iFlag=1 AND iDefineCheck=1 AND iTmpCheck<>1 audit branch. No direct form-master / gdsmodule / Java wiring — exclusively a helper for the Sp_Calc_s* audit family. Install script at script/标版/30100101/Sp_System_CheckFlow.sql.