# `Sp_unifiedPlanning_BtnCalculation_Machine_time` (procedure)

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


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

## Parameters

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

## Body

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

## Narrative

**Business context:** 生产管理 → 生产排程 → 统一规划 — single-plan time recompute. Narrower companion to `Sp_unifiedPlanning_BtnCalculation_Machine`: takes one `(p_sMachineId, p_planId)` pair and recomputes that plan slave's start/finish times only.

**What it does:** Looks up the plan row, walks the routing flow + 上报 progress, and rewrites `tStartDate`/`tEndDate` on the single `mftproductionplanslave` identified by `(p_sMachineId, p_planId)`. Used as a fine-grained patch when a single plan row needs reflowing without re-running the whole machine.

**Invocation:** Called by `Sp_unifiedPlanning_BtnCalculation_workorder_calc` inside the routing-walk to refresh predecessor/successor pairs. No direct form-master, gdsmodule hook, or Java caller; reached only through the calc chain.
