# `Sp_chart_EquipmentLast` (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_EquipmentLast`'`._

## Narrative

**Business context:** 制造管理 / 仪表盘 — 设备负荷考虑工作日历 (last-scheduled-day per machine). Dashboard chart showing, for each machine that still has un-finished plans, the furthest-out planned start date — a horizon view of how far ahead each piece of equipment is booked.

**What it does:** For each machine, picks `MAX(mftproductionplanslave.tStartDate)` where `DATEDIFF(tStartDate, SYSDATE()) > 0` and `sState in (1,2,3)` (planned/running/dispatched but not closed), joins `elemachine` for the display name, then builds a `{"data": [{"x": "yy.mm.dd", "y": "<machineName>"}, ...], "xUnit": "", "yUnit": ""}` JSON string into OUT `sReturn`.

**Invocation:** Status: appears orphaned. No form-master, gdsmodule hook, other-routine caller, or Java caller — only the install script `script/标版/30100101/Sp_chart_EquipmentLast.sql`. Naming and JSON output shape match the front-end dashboard tile family; if a tile still references "EquipmentLast" check whether the binding lives in front-end config rather than `gdsconfigformmaster`. Otherwise dead code.
