# `Sp_chart_EquipmentLoad1` (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_EquipmentLoad1`'`._

## Narrative

**Business context:** 制造管理 / 仪表盘 — variant of `Sp_chart_EquipmentLoad`. Same heatmap of machine-hours per day across active production plans, with two tweaks: the horizon adapts to the furthest-out plan (capped at 30), and the machine list orders by `sType` instead of joining `elemachine.iOrder`.

**What it does:** Reads `DATEDIFF(MAX(tStartDate), SYSDATE())` from `mftproductionplanslave` (state in 1,2) and clamps to 30 days (0 when the max is negative or > 30). Builds `TMP_Machine` from distinct `sMachineId` ordered by `sType`, aggregates per-machine per-day hours into `TMP_MachineDate`, then loops to produce the same `[i,j,dHour]` triples, per-day labels, and machine-name array — same JSON shape `{"data":[...], "day":[...], "sMachines":[...]}` written to OUT `sReturn`. Includes a debug `SELECT p_sData, p_sDay, p_sMachines` before the final assign.

**Invocation:** Status: appears orphaned. No form-master, gdsmodule hook, other-routine caller, or Java caller — only its install script `script/标版/30100101/Sp_chart_EquipmentLoad1.sql`. Belongs to the dashboard-chart family whose bindings, if any, live in front-end config; the lingering debug `SELECT` suggests this is a development copy of `Sp_chart_EquipmentLoad`.
