# `Sp_MachineSpeedanalysis_1` (procedure)

> 单个机台时间分析


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `tStartDate` | `datetime` |
| 2 | IN | `tEndDate` | `datetime` |
| 3 | IN | `p_sMachineId` | `varchar(100)` |
| 4 | IN | `p_sTeamId` | `varchar(100)` |
| 5 | IN | `sBrId` | `varchar(100)` |
| 6 | IN | `sSuId` | `varchar(100)` |
| 7 | OUT | `sCode` | `int` |
| 8 | OUT | `sReturn` | `varchar(5000)` |

## Body

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

## Narrative

**Business context:** 生产管理 → 设备速度看板 — single-machine 时间分析 dashboard pie/donut tile keyed by 设备状态. Drill-in companion of `Sp_MachineSpeedanalysis` (the paged grid). Near-identical sibling of `Sp_MachinePoweranalysis_1` (same shape, but the 能耗 variant aggregates `dElectricityQty`).

**What it does:** Reads `elemachine.sOffWork`/`sShiftsWork` for `p_sMachineId` (defaults `8:00`/`17:30`), shifts `tStartDate`/`tEndDate` to those shift boundaries, drops/creates `p_bd_EqStatus(sName, sValue)`. The active aggregation block in the body is commented-out — the live shape is set up identically to `Sp_MachinePoweranalysis_1` but the population SELECT is disabled. Returns `sReturn` as a chart-master `{"data":[{x,y}]}` JSON.

**Invocation:** Status: appears orphaned. No `gdsconfigcharmaster.sProcedureName` binding, no `gdsmodule.sProcName`, no caller in xly-src or other routines, no install script. Body's main SELECT is commented out — proc may be in a partially-disabled state. Candidate for maintainer audit.
