# `sp_OEE_endWorked` (procedure)

> OEE 完工


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sMachineId` | `varchar(100)` |
| 2 | IN | `sBillNo` | `varchar(100)` |
| 3 | IN | `sPlanslaveId` | `varchar(100)` |
| 4 | IN | `sBrId` | `varchar(100)` |
| 5 | IN | `sSuId` | `varchar(100)` |
| 6 | OUT | `sReturn` | `varchar(1000)` |
| 7 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** OEE管理 — "完工" (end-of-work) hook for a machine workstation. Fires when the OEE shop-floor PLC dispatch signals that production on a given `mftproductionplanslave` is finished and the machine is going idle.

**What it does:** Currently a no-op stub: `IFNULL`-defaults its arguments and runs an empty `top: BEGIN … END` block — the procedure exists as a placeholder for the end-of-work side-effects, with the real bookkeeping handled by the surrounding Java service. Comment header tags it as `OEE 完工`.

**Invocation:** Wrapped by `PlcXmzServiceImpl.callSp_OEE_endWork(...)` (and the `PlcXmz2022ServiceImpl` / `PlcXmzServiceImplOld` twins) via the shared `doOeePro(... "sp_OEE_endWorked", ...)` `{CALL …}` template. Reached from the PLC dispatch path that watches machine state. Install scripts at `script/标版/30100101/sp_OEE_endWorked.sql` and the `upgrade/20211104单独升级后台包需要执行/` patch.
