# `Sp_productionMainPlan_BtnEventSuspend` (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_productionMainPlan_BtnEventSuspend`'`._

## Narrative

**Business context:** 生产管理 / 主计划 → 暂停 — planner-grid "suspend plan" button. Parks a work-order's main plan row at `sState='4'` (paused) while remembering its prior state in `sPriorState` so the matching 恢复 button (`Sp_productionMainPlan_BtnEventReCovert`) can wind it back. Slave rows under the work-order are dropped to `sState='3'` so the machine-scheduler stops dispatching them.

**What it does:** Parses `$.params[*].value[*].sId`. For each plan id: snapshots `sState` into `sPriorState`, sets `sState='4'`. Then `UPDATE mftproductionplanslave SET sState='3'` for every row keyed by that plan's `sWorkOrderId`. No state-precondition check; runs on any row supplied.

**Invocation:** Standard `Sp_<Module>_BtnEvent*` slot — dispatched by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` when the 主计划 grid's 暂停 button names this procedure. xly-src ships `script/标版/30100101/schedule/Sp_productionMainPlan_BtnEventSuspend.sql`. Phase-specific variants: `Sp_productionMainPlan_BtnEventSuspend_YH` (印刷暂停, only `sType>'1'` slaves), `Sp_productionMainPlan_BtnEventSuspend_ZY` (折后暂停, post-folding processes via temporary table).
