# `Sp_Oee_BtnEventFinished` (procedure)


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProInParam` | `varchar(10000)` |
| 2 | IN | `sMakePerson` | `varchar(100)` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | OUT | `sReturn` | `varchar(1000)` |
| 6 | OUT | `sCode` | `int` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Oee_BtnEventFinished`'`._

## Narrative

**Business context:** OEE管理 — toolbar "完工" (mark-finished) button on an OEE production-task grid. Lets the foreman flag selected `mftproductionplanslave` rows as finished from the OEE UI without going through the full production-report flow.

**What it does:** Parses `$.params[*].value[*]` from `sProInParam` (selected slave ids), and `$.changeValue` for the field-update spec (`valueKey` lists column names; their values are in `$[0].<col>`) — builds a `p_where` SET clause from those pairs. For each slave id it then derives related `sWorkOrderSlaveId / sWorkOrderControlId / sWorkOrderProcessTbId / sProductionReportId / sPlanId / sSrcSlaveId` and uses the composed update to mark the plan slave (and its work-order companions) finished. Returns errors via `Sp_Sis_GetConst('paramsErro', …)` if the param JSON is too short.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` — the standard `Sp_<Module>_BtnEvent*` slot for OEE buttons (the install script ships at `script/标版/30100101/schedule/Sp_Oee_BtnEventFinished.sql`). No `gdsconfigformmaster`/`gdsmodule` row in the current DB references this name, so the deployed binding is set only when the corresponding OEE form is loaded with this proc as its toolbar action.
