# `Sp_productionPlanInfo_BtnEventCompletion` (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_productionPlanInfo_BtnEventCompletion`'`._

## Narrative

**Business context:** 生产管理 → 生产计划管理 → 生产排程 — toolbar handler "机台计划：加工完成" (mark machining complete) on `mftproductionplanslave`. Closes a scheduled machine-plan row when the operator confirms the process is finished, propagating completion into the originating work-order process row.

**What it does:** Parses `sProInParam.params[*].value[*].sId` (dash-split for batch). Per row: reads `sState`/`bFrozen`; refuses if `sState=3` (paused) with `sProductionPlanInfoPause` or `bFrozen=1` with `sProductionPlanInfoOrderDj`. Otherwise `UPDATE mftproductionplanslave SET sState='5', iComplete=1, bProductionPlanComplete=1, sReportCompletePerson=sMakePerson, tReportCompleteDate=NOW(), iFormState=2, dOldProductionReportQty=dProductionReportQty` and `UPDATE MftWorkOrderProcess SET bProductionComplete=1` where `sId=mftproductionplanslave.sSrcSlaveId`. Logs a 加工完成 row to `syslog` with `sFormId='101251240115016110217762400'` (生产排程).

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` — 生产排程 form's "加工完成" button. Inverse: `Sp_productionPlanInfo_BtnEventCompletionRelease`. xly-src ships `script/标版/30100101/schedule/Sp_productionPlanInfo_BtnEventCompletion.sql`.
