# `Sp_productionPlanInfo_BtnEventReturn` (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_BtnEventReturn`'`._

## Narrative

**Business context:** 生产管理 → 生产计划管理 → 生产排程 — toolbar handler "机台计划：返回重排" (return to re-schedule pool) on `mftproductionplanslave`. Strips the machine assignment and rolls `sState` back to 0 (待排) so the row goes back into the planner's APS input set.

**What it does:** Validates `sProInParam` (rejects short payload). Walks `sProInParam.params[*].value[*].sId`. Per `p_sId`: reads `bFrozen`, `sState`, `bLock`. Sets `sCode=1` (warning, continue) and skips with `sProductionPlanInfoPassFinishOrder` if completed (sState=5), `sColdOrderWaitOperation` if frozen, `sLockOrderWaitOperation` if locked. Otherwise `UPDATE mftproductionplanslave SET sState=0, sMachineId='', sMachineName='' WHERE sId=p_sId AND tenant matches`. No syslog row.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` — 生产排程 form's "返回重排" button. xly-src ships `script/标版/30100101/schedule/Sp_productionPlanInfo_BtnEventReturn.sql`.
