# `Sp_productionMainPlan_BtnEventReSet` (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_BtnEventReSet`'`._

## Narrative

**Business context:** 生产管理 / 主计划 → 重置 — planner-grid "reset plan" button. Wipes machine-assignment state from a main-plan row so it can be re-planned from scratch (re-排程) — clears assigned machine, scheduling state, and freeze flag on every slave row under the work-order.

**What it does:** Parses `$.params[*].value[*].sId`. For each plan id: `UPDATE mftproductionplan SET sState='2'`. Then for every `mftproductionplanslave` keyed by that plan's `sWorkOrderId`: `bFrozen=0, sState='0', sMachineId=''`. No outsourcing / state-precondition guards — caller is expected to gate.

**Invocation:** Standard `Sp_<Module>_BtnEvent*` slot — dispatched by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` when the 主计划 grid's 重置 button names this procedure. xly-src ships `script/标版/30100101/Sp_productionMainPlan_BtnEventReSet.sql`.
