# `Sp_chart_ThisMonthQty` (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` | `varchar(5000)` |

## Body

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

## Narrative

**Business context:** 生产图表分析 → 图表分析 → 决策支持 (also reused under 移动端工作台 → 图表分析 and the 大屏展示 → 看板系统 template family) — the dashboard card 本月设备产量 / 达标指数 ranks machines by reported production quantity so managers can compare equipment throughput.

**What it does:** Aggregates `viw_mftproductionreport` joined to `elemachine` for the current `sBrandsId`/`sSubsidiaryId`, restricts to checked rows with a non-empty `sMachineId`, groups by machine name, sums `dProcessQty`, and emits a JSON `{data: [{y: 设备名称, x: 数量}…]}` payload. The intended `DATE_FORMAT(tCheckDate,'%Y-%m') = p_dNow` filter is commented out — despite the name, the result is cumulative across all checked reports.

**Invocation:** Bound via `gdsconfigcharmaster.sProcedureName` on chart cards including `15922812410008049188179768108000`, `15934052500006102241076896059000`, several `101251240115016087751856320` (3*5 55" 拼接屏) layout cards, and `101251240115016238222206297` (T2-1-3-达标指数) on 左中右布局模板.
