# `Sp_MobileAdjust_BtnEventFinished` (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_MobileAdjust_BtnEventFinished`'`._

## Narrative

**Business context:** 生产管理 → 生产计划 → 调机完成 (mobile) — machine-side "调机完成" (machine-setup finished) action on the mobile app. After the operator presses 开工 (`Sp_MobileStart_BtnEventFinished`) and runs setup, this button marks the setup phase as done on the matching `mftproductionplanslave` row, capturing how long setup took.

**What it does:** Parses `$.params[*].value[*].sSlaveId` from `sProInParam`. For each plan-slave id, `UPDATE mftproductionplanslave SET tAdjustMachineDate = SYSDATE(), bAdjustMachineComplete = 1, dAdjustHour = TIMESTAMPDIFF(MINUTE, tStartDate, NOW()) WHERE sId = p_sId AND sBrandsId = sBrId AND sSubsidiaryId = sSuId`. `dAdjustHour` is wall-clock minutes between 开工 (`tStartDate`) and now — the setup-duration KPI.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — the 调机完成 button on the mobile app's machine task list names `Sp_MobileAdjust_BtnEventFinished` as the action. xly-src ships `script/标版/30100101/Sp_MobileAdjust_BtnEventFinished.sql` (install script). Predecessor: `Sp_MobileStart_BtnEventFinished` (开工).
