# `Sp_unifiedPlanning_BtnCalculation_Machine` (procedure)

> 根据工艺流、上报 来计算排程开始完工时间


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sMakePerson` | `varchar(100)` |
| 2 | IN | `sBrId` | `varchar(100)` |
| 3 | IN | `sSuId` | `varchar(100)` |
| 4 | OUT | `sReturn` | `varchar(1000)` |
| 5 | OUT | `sCode` | `int` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_unifiedPlanning_BtnCalculation_Machine`'`._

## Narrative

**Business context:** 生产管理 → 生产排程 → 统一规划 — per-machine start/finish-time recompute "根据工艺流、上报 来计算排程开始完工时间" (recompute schedule start/finish times from routing flow and progress reports). A tl/ (toolbox) helper that runs after planner-side rescheduling so each `mftproductionplanslave` reflects current production progress.

**What it does:** Iterates active machine-assigned plan slaves, joins to the workorder-process routing and 上报 progress (`hrmftworkorderprocess`), and updates `tStartDate`/`tEndDate` on `mftproductionplanslave` based on `dCapacityHour`, hand-off times, and predecessor completion.

**Invocation:** Called by `Sp_unifiedPlanning_BtnCalculation_workorder_calc` per work-order during the 统一规划 routing-walk; also invoked from `Sp_unifiedPlanning_BtnCalculation_workorder` and the top-level `Sp_unifiedPlanning_BtnCalculation`. No direct form-master or Java binding; reached only through the calc chain. xly-src ships `script/标版/30100101/schedule/tl/Sp_unifiedPlanning_BtnCalculation_Machine.sql`.
