# `Sp_Productionplan_Pie_Char_V10.1` (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_Productionplan_Pie_Char_V10.1`'`._

## Narrative

**Business context:** 生产计划管理 → 生管主计划 — 生成计划:卡片图 (per the COMMENT). V10.1 successor of `Sp_Productionplan_Pie_Char`: per-工作中心 load-card data-source. Adds an extra "发外" pseudo-row built from `Viw_OpsOutsideProcess` to surface outsourced work as its own card in the dashboard.

**What it does:** Same setup as the V10 sibling — read `CkxProcessFilter`, resolve user via `SftLoginInfo`, apply `Fun_GetLookProcess` whitelist. Builds `Productionplan_Pie_Char_Tmp` and inserts the dynamic GROUP-by-`sWorkCenterId` aggregation over `mftproductionplanslave` (planned qty, dHourSum, d2HourSum for today/tomorrow window). Joins `elemachine`+`sisworkcenter` for the `dStdWorkCenterHour` baseline, computes `sLimitDate`/`dRate`, flags the most-loaded 工作中心 as warning. Emits the JSON `{ data, subTitle:'工时', yUnit }` then `INSERT` an additional "发外" row aggregating `Viw_OpsOutsideProcess.dAuxiliaryQty` (where `bCopyLimit=0, bCheck=1, bInstoreComplete=0, bInvalid=0`) and orders by `sisworkcenter.iOrder`. Returns the table via final `SELECT * FROM Productionplan_Pie_Char_Tmp ORDER BY iOrder`.

**Invocation:** Not bound in `gdsconfigcharmaster`/`gdsconfigcharmaster0302`; no xly-src caller — Status: appears orphaned. Likely the staged replacement for `Sp_Productionplan_Pie_Char` not yet wired into the dashboard config. Candidate for maintainer audit.
