# `Sp_unifiedPlanning_BtnCalculationSecond` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `p_sMachineId` | `varchar(250)` |
| 2 | IN | `tCStartTime` | `datetime` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |

## Body

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

## Narrative

**Business context:** 生产管理 → 生产排程 → 统一规划 — alternate single-machine reschedule entry that ignores the routing walk and just lays out tasks on one machine's calendar. Used when the planner needs a faster "re-stack this machine only" pass rather than a full chain recompute.

**What it does:** Reads `elemachine` for the target `(p_sMachineId)` — `sCurrStatus`, `sOffWork`, `sWorkType`, `dWeek` — and from `tCStartTime` walks the machine's day/shift schedule, day by day, accumulating `dDayHour` until the machine's queued plan-slaves are placed. Updates `mftproductionplanslave` start/finish times for that machine only.

**Invocation:** Status: appears orphaned. Body comment marks it as a 主生产计划 alternate, but no caller is found in any channel — no form-master binding, no gdsmodule hook, no other proc references it, no xly-src grep hit beyond its install script. Candidate for maintainer audit; xly-src ships `script/标版/30100101/schedule/Sp_unifiedPlanning_BtnCalculationSecond.sql` (definition only).
