# `Sp_Manufacture_ProducttionPlan_List` (procedure)

> 生成排程


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `iStates` | `int` |
| 2 | IN | `iOperType` | `int` |
| 3 | IN | `sWorkCenterId` | `varchar(100)` |
| 4 | IN | `sSqlCondition` | `varchar(4000)` |
| 5 | IN | `sIds` | `varchar(4000)` |
| 6 | IN | `sMachineId` | `varchar(50)` |
| 7 | IN | `sTeamId` | `varchar(50)` |
| 8 | IN | `sLoginId` | `varchar(100)` |
| 9 | IN | `sBrId` | `varchar(100)` |
| 10 | IN | `sSuId` | `varchar(100)` |
| 11 | OUT | `sCode` | `int` |
| 12 | OUT | `sReturn` | `varchar(4000)` |

## Body

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

## Narrative

**Business context:** 生产管理 → 生产计划管理 → 生成排程 — proc is named with the typo `Producttion`. Used by 生成排程 (generate-plan) screens to drive the left-side list/summary panel: given a state/operation filter plus a work-center / machine / team / SQL-condition / id-set, returns the aggregated rows for the planner to select rows to schedule. COMMENT is `生成排程`.

**What it does:** Branches on `iOperType` (0 = list-summary mode). For `iStates=8` (a special status) groups rows from `mftproductionplanslave` joined to `sisworkcenter` by `(s.sId, s.sName)` summing `dHour` and `dProcessQty`; otherwise the same group but filtered by `iState = iStates`. The dynamic SQL is built via `CONCAT` with `sBrId`/`sSuId`/`sSqlCondition` interpolated and then `PREPARE`/`EXECUTE`d. Other `iOperType` branches handle by-machine and by-team summaries.

**Invocation:** No form-master binding, no `gdsmodule` hook, no other-routine caller in `information_schema.ROUTINES`. xly-src only ships the install script `script/标版/30100101/Sp_Manufacture_ProducttionPlan_List.sql` — no Java/XML reference. Status: appears orphaned in the metadata channels — probably dispatched as a button via the generic procedure-call endpoint (typical for `sCode`/`sReturn`-shaped procs), but the caller wasn't located. Candidate for maintainer audit.
