# `Sp_Salesdevplan_CommonGtChar` (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 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 6 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 7 | IN | `sGroupby_group_sql` | `varchar(5000)` |
| 8 | OUT | `sCode` | `int` |
| 9 | OUT | `sReturn` | `longtext` |

## Body

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

## Narrative

**Business context:** PLM管理 → 研发项目管理(雅昌) → 项目进度 → 项目进度甘特图 — Gantt-chart data feed for `salsalesdevplanmaster`/`salsalesdevplanslave` (项目立项 master/slave). Returns the JSON (`{zoom,data,links}`) consumed by the dhtmlxGantt-style front-end. The header constant on the wiki page (项目立项甘特图) is the proc's `COMMENT`; the actual form name in `gdsconfigformmaster` is 项目进度甘特图.

**What it does:** Builds a temporary table `tmp_gt_PlanInfo` from `salsalesdevplanmaster` joined to `salsalesdevplanslave` (filtered to `bCheck=1, bInvalid=0` and tenant), translates the optional `bFilter` JSON to a WHERE-clause via `Fun_bFilter_toWhere`. Iterates the master rows with a cursor, emitting one `data` entry per master (id/text/start_date/end_date/parent) and then, for each child slave row, emits a second `data` entry plus a `link` joining successive slaves in `iOrder` sequence. Returns the assembled JSON in `sReturn` with `zoom={scale:Minutes,step:30}`.

**Invocation:** Bound as the data-source of the 项目进度甘特图 form `gfm.sId=101251240115016149122423040` via `gdsconfigformmaster.sSqlStr='Sp_Salesdevplan_CommonGtChar'` — under module 项目进度 (parent: 研发项目管理(雅昌)). Loaded when the user opens the gantt board. Install script: `script/标版/30100101/Sp_Salesdevplan_CommonGtChar.sql`; form-master row in `script/标版/20210323/gdsconfigformmaster.sql`.
