# `Sp_MachinePlanList_BtnEventRestoreRow` (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_MachinePlanList_BtnEventRestoreRow`'`._

## Narrative

**Business context:** 生产管理 → 生产计划 → 机台计划 — button handler that returns a row from the backup table back into the live 机台计划 (`mftproductionplanslave`). Used when a planner accidentally removed a task and needs to restore it from the auxiliary `mftproductionplanbillslave` ledger.

**What it does:** Parses `$.params[*].value[*].sId` from `sProInParam`. For each id, checks `mftproductionplanslave` for existence — if already present, returns `sCode=-1` with localised message `sMachinePlanExist` ("机台计划已存在") via `Fun_Sis_GetConst` and exits. Otherwise it `INSERT INTO mftproductionplanslave` a full row built from `mftproductionplanbillslave` (the bill/backup table), copying customer/工单/工序/机台/数量/工时/起止时间 and reset flags, then `UPDATE mftproductionplanbillslave` to flag the source row as restored.

**Invocation:** Dispatched by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — the 机台计划 grid's restore-row toolbar button names this proc by string. Install script: `script/标版/30100101/schedule/Sp_MachinePlanList_BtnEventRestoreRow.sql` (comment: 机台全部任务-从备份表返回到机台计划正式表). Sibling: `Sp_MachinePlanList_BtnEventRestoreRowBill` (also requires 机台 selection).
