# `Sp_PlanListCTP_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_PlanListCTP_BtnEventFinished`'`._

## Narrative

**Business context:** 生产管理 → 计划、排程 → 计划列表 — toolbar button on the production-plan slave grid that flags 出版/CTP completion for the selected plan rows. Drives the print-prep CTP stage handoff into the press process. Four narrower variants exist for specific sub-cases: `_Control` (per-workorder publish-qty), `_Qty` (publish qty + use qty + plate-style), `_UseQty` (use-qty only); `Sp_PlanListCTP_BtnRepair` reverses/repairs the same fields.

**What it does:** Parses `$.params[*].value[*].sId` for the selected `mftproductionplanslave` rows and `$.changeValue.valueKey` for the comma-separated list of fields to mutate. Builds a dynamic `UPDATE mftproductionplanslave SET <field1>=<val1>, <field2>=<val2>, … WHERE sId IN (…)` — `Sp_System_ReplaceField` resolves the typed values; the standard finished-fields are `bCTP=1`, `tCTPDate=NOW()`, `sCTPPerson=sMakePerson`. Validates `sProInParam` length up front; on bad JSON returns `sCode=-1` with the `paramsErro` localised message from `Sp_Sis_GetConst`.

**Invocation:** Dispatched by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — the 出版完工 toolbar button on the 计划列表 grid names this proc. Install script: `script/标版/30100101/Sp_PlanListCTP_BtnEventFinished.sql`.
