# `Sp_MachinePlanList_BtnEventRestoreRowBill` (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_BtnEventRestoreRowBill`'`._

## Narrative

**Business context:** 生产管理 → 生产计划 → 机台计划 — restore-row sibling of `Sp_MachinePlanList_BtnEventRestoreRow` that also requires the planner to pick a 机台 (`sMachineName`) and rebinds the restored row to the chosen 机台 / 工作中心.

**What it does:** Parses `$.params[*].value[*].sId` + `$.changeValue.sMachineName` from `sProInParam`. If `sMachineName` is blank, aborts with `sSelectProcessMachine` ("请选择该工序的机台"). For each id, checks `mftproductionplanslave` for existing row, otherwise reads the chosen machine from `elemachine` (sId, sMachineNo, sCostCenterId) and `INSERT INTO mftproductionplanslave` a full row from `mftproductionplanbillslave` overriding `sMachineId/sMachineNo/sWorkCenterId` with the picked machine, then `UPDATE mftproductionplanbillslave` to flag the source row.

**Invocation:** Dispatched by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` — the 机台计划 grid's "restore row (assign machine)" toolbar button. Install script: `script/标版/30100101/schedule/Sp_MachinePlanList_BtnEventRestoreRowBill.sql` (same comment as RestoreRow). Sibling: `Sp_MachinePlanList_BtnEventRestoreRow` (uses the original 机台 from the backup row).
