# `Sp_productionPlan_BtnEventLockrow` (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_productionPlan_BtnEventLockrow`'`._

## Narrative

**Business context:** 生产计划管理 → 生管主计划 / 生产排程 — 计划锁定：移动到计划确认表 (per the COMMENT). Row-level (not 24-hour-window) lock variant — locks an explicit list of `mftproductionplanslave` rows by `sId`, moving them into `mftproductionplanslavelock`, then triggers downstream time recalculation.

**What it does:** Walks `$.params[*]` looking for `slave` / `slaveInfo` keys to harvest selected row IDs. For each `sId` (dash-separated): looks up the row's `bFrozen, sState, tStartDate, dHour` from `mftproductionplanslave`; rejects with `sStandardWorkHourZero` if `dHour=0`. Computes the row's 班次 via `FUN_GET_DATE_BC`, deletes any prior lock for that `sId`, copies the row into `mftproductionplanslavelock` via the `MftProductionPlanSlave_Tmp_div` temp table, then `UPDATE mftproductionplanslave` setting `bLock=1, sLock, tLock=NOW(), bEmploy=1, sEmployPerson, tEmploytime=NOW(), sState=2` (释放/employed status).

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` from the row-level 锁定 toolbar action on the 生产排程 grids. xly-src `script/标版/30100101/schedule/Sp_productionPlan_BtnEventLockrow.sql` ships the install copy. Paired variant: `Sp_productionPlan_BtnEventLockrowNotCalcTime` (skips time-recalc). Inverse: `Sp_productionPlan_BtnEventunLockrow`.
