# `Sp_System_AutoSendCheckMsg` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sFormGuid` | `varchar(100)` | | 2 | IN | `sBillKey` | `varchar(100)` | | 3 | IN | `sTbName` | `varchar(100)` | | 4 | IN | `sGuid` | `varchar(100)` | | 5 | IN | `sBillNo` | `varchar(100)` | | 6 | IN | `sCheckCondition` | `varchar(4000)` | | 7 | IN | `sMemo` | `varchar(4000)` | | 8 | IN | `sCheckModelGuid` | `varchar(100)` | | 9 | IN | `sCheckPerson` | `longtext` | | 10 | IN | `sLoginId` | `varchar(100)` | | 11 | IN | `sBrId` | `varchar(100)` | | 12 | IN | `sSuId` | `varchar(100)` | | 13 | OUT | `sCode` | `int` | | 14 | OUT | `sReturn` | `varchar(5000)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_System_AutoSendCheckMsg`'`._ ## Narrative **Business context:** 系统平台 → 审核流程 / 消息中心 — when a 业务单据 enters an approval workflow (`elecheckmodel` + `elecheckmodelphase`), this proc materialises the in-app inbox: it writes a `sysMsg` envelope, one `sysmsguser` row per approver, and a placeholder `sysbillcheckresult` for each phase, so approvers see the bill in their pending list and the audit trail rows are pre-staged. **What it does:** Validates `sFormGuid` / `sGuid` / `sTbName` / current login (`Fun_GetLoginUser`) — bails with `sCode=-1` if any are empty. Builds dynamic SQL `Select tCreateDate, sBillNo From Where sId=` to read the bill date / number. Deletes any prior `sysbillcheckresult` / `sysmsguser` / `sysMsg` rows for the same `sBillId` (idempotency). Resolves the localised "审核申请" title via `Sp_Sis_GetConst('BillCheckApply', …)` with `sBillNo` interpolated, then `INSERT INTO sysMsg` the envelope. If `sCheckPerson` is empty, joins `sischeckphase` ⇨ `sischeckphaselogininfo` for the first phase of the active model (`elecheckmodel.bActivate=1`, ordered by `iOrder LIMIT 1`) to seed approvers; otherwise tokenises the comma-list and writes one row per name. For each approver, writes the matching `sysbillcheckresult` placeholder so the審核 detail screen has its skeleton. **Invocation:** Status: appears orphaned at this snapshot. No `gdsmodule.sProcName` hook, no other-routine caller in `information_schema.ROUTINES`, no xly-src reference outside the install script `script/标版/30100101/Sp_System_AutoSendCheckMsg.sql`. The signature (sFormGuid + sBillKey + sTbName + sCheckModelGuid + sCheckPerson) is the standard "kick off a multi-phase check" envelope, so the live close-loop is almost certainly Java-driven (`CheckExamineFlowDataServiceImpl` family) bypassing this proc — flag for maintainer audit to confirm whether any deployed flow still routes through it.