# `Sp_chart_EquipmentLoad` (procedure)

> 设备负荷考虑工作日历


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sLoginId` | `varchar(100)` |
| 2 | IN | `sBrId` | `varchar(100)` |
| 3 | IN | `sSuId` | `varchar(100)` |
| 4 | IN | `bFilter` | `varchar(5000)` |
| 5 | OUT | `sCode` | `int` |
| 6 | OUT | `sReturn` | `longtext` |

## Body

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

## Narrative

**Business context:** 制造管理 / 仪表盘 — 设备负荷 (equipment-load heatmap). Builds a 30-day × N-machine load matrix in machine-hours per day, sourced from active production-plan slave rows. Output is the data block that a front-end heatmap/Gantt tile consumes.

**What it does:** Fixes the horizon at `p_iCount = 30` days, enumerates distinct machines with `sState in (1,2)` plans into `TMP_Machine` (ordered by `elemachine.iOrder DESC`), then aggregates `SUM(dHour)/60` per machine per day into `TMP_MachineDate`. Loops i ∈ [0,30), j ∈ [0,iMachineCount) and appends `[i,j,dHour]` triples into `p_sData`, plus per-day `["mm.dd"]` labels into `p_sDay`. A cursor over `TMP_Machine` joined to `elemachine` fills the machine-name array. Final string: `{"data":[...], "day":[...], "sMachines":[...]}` assigned to OUT `sReturn` (also `SELECT`-ed for ad-hoc callers).

**Invocation:** Status: appears orphaned. No form-master, gdsmodule hook, other-routine caller, or Java caller — only its install script `script/标版/30100101/Sp_chart_EquipmentLoad.sql` and a co-mention in the sibling `Sp_chart_EquipmentLoad1.sql`. Belongs to the dashboard-chart family whose bindings, if any, live in front-end config; otherwise dead code superseded by `Sp_chart_EquipmentLoad1` / `Sp_chart_EquipmentLod1`.
