# `Sp_Calc_sEmt` (procedure) > 商机跟进 - **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(5000)` | | 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_sEmt`'`._ ## Narrative **Business context:** 设备管理 → 设备单据 → 设备保养登记 — equipment-maintenance-registration check / uncheck on `eptmachinemaintainmaster`. Approves a 设备保养登记 (per-machine maintenance log) and writes back the executed maintenance into the matching plan slave so the plan board updates. **What it does:** Validates `sGuid`, refuses when `bInvalid=1`. With `iFlag=1`: guards on already-`bCheck=1`, `Update eptmachinemaintainmaster` setting `bCheck=1, sStatus=1, sCheckPerson, tCheckDate`, then `Update EptMachineMaintainPlanSlave` to flip the matching plan slave `bAlreadyMaintain=1` and stamp `tActualMaintainDate=NOW()` so the plan-tracking grid reflects the executed registration. Uncheck reverses both. **Invocation:** Bound to `gdsmodule.sProcName` on `设备保养登记` (sId `101251240115016055988181430`), parent `设备单据` → 设备管理. Dispatched by Java `BusinessBaseServiceImpl.getPrcName(...)` on the audit/un-audit button. xly-src ships `script/标版/30100101/Sp_Calc_sEmt.sql` (install) and `script/标版/optimize/Sp_Calc_sEmt.sql` (patch). Note: COMMENT `'商机跟进'` is a copy-paste artefact, ignore.