# `Sp_Calc_sPct2` (procedure) > @author:zhucx @date:2021.11.21 封存 @describe: 1.移动端-生产巡检-保存自动调用本过程,当系统设定中本单据为自动审核时 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `iFlag` | `int` | | 2 | IN | `iTmpCheck` | `int` | | 3 | IN | `sFormGuid` | `varchar(100)` | | 4 | IN | `sGuid` | `varchar(100)` | | 5 | IN | `sLoginId` | `varchar(100)` | | 6 | OUT | `sReturn` | `varchar(4000)` | | 7 | IN | `sBrId` | `varchar(100)` | | 8 | IN | `sSuId` | `varchar(100)` | | 9 | OUT | `sCode` | `int` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Calc_sPct2`'`._ ## Narrative **Business context:** Two-bind audit for the QC 巡检 (patrol / in-process inspection) family on `QlyProcessTestMaster`. Header authorship: `zhucx 2021.11.21 封存`. Serves the mobile 品质巡检 form and the desktop 品质巡检 PC variant. 巡检 records sample-check results during the run (after 首检, before 末检); on approval the inspection is frozen and the production-plan slave's patrol flag is updated. **What it does:** Validates `sGuid`, refuses re-audit when `bCheck=1`, then `Update QlyProcessTestMaster` to set `bCheck=1, sStatus=1, sCheckPerson, tCheckDate=NOW()`. Joins back through `mftproductionplanslave` to flag the patrol pass on the matching production-plan slave. `iFlag=0` reverses the flags. **Invocation:** Bound to `gdsmodule.sProcName` on: - `品质巡检(mobile单据)` (sId `12012615914116371307197380`) — 移动端管理 → 现场 → 功能操作 - `品质巡检PC` (sId `101801153119616487082337640`) — 质量管理 → 过程质量控制(PQC) Dispatched by `BusinessBaseServiceImpl.getPrcName(sFormGuid, …)`. Auto-invoked from the mobile save path when the module's auto-audit flag is on. Install scripts at `script/标版/30100101/Sp_Calc_sPct2.sql` and `script/标版/optimize/Sp_Calc_sPct2.sql`.