# `Sp_Manufacture_MftPlanPhase` (procedure) > @author: zhucx @date:20220308 封存 @describe : 生产计划跟进(成品) 1.从计算表中取数据 2.按成品数据汇总,每个阶段取最后工序作为完结条件并显示 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sCustomerName` | `varchar(255)` | | 2 | IN | `tStartDate` | `datetime` | | 3 | IN | `tEndDate` | `datetime` | | 4 | IN | `sWorkOrderNos` | `varchar(255)` | | 5 | IN | `sPhase` | `varchar(255)` | | 6 | IN | `sPhaseplanDate` | `varchar(255)` | | 7 | IN | `iType` | `int` | | 8 | IN | `sEmpty` | `varchar(255)` | | 9 | IN | `sComplete` | `varchar(255)` | | 10 | IN | `sLoginId` | `varchar(4000)` | | 11 | IN | `sBrId` | `varchar(100)` | | 12 | IN | `sSuId` | `varchar(100)` | | 13 | IN | `bFilter` | `varchar(5000)` | | 14 | IN | `pageNum` | `int` | | 15 | IN | `pageSize` | `int` | | 16 | OUT | `totalCount` | `int` | | 17 | OUT | `billNum` | `int` | | 18 | IN | `countCloumn` | `varchar(5000)` | | 19 | OUT | `countMapJson` | `longtext` | | 20 | IN | `sFilterOrderBy` | `varchar(5000)` | | 21 | IN | `sGroupby_select_sql` | `varchar(5000)` | | 22 | IN | `sGroupby_group_sql` | `varchar(5000)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Manufacture_MftPlanPhase`'`._ ## Narrative **Business context:** 生产管理 → 生产计划管理 → 生产计划跟进表 — paged stage-tracking report. Per the COMMENT (@author zhucx, 封存 20220308): "生产计划跟进(成品) 1.从计算表中取数据 2.按成品数据汇总,每个阶段取最后工序作为完结条件并显示". The form shows one row per 部件 work-order with N dynamic per-phase column groups (锁定/计划/实际, three columns each). **What it does:** Builds the paged dataset from `CalcProductContralsPhase` (or `CalcProductContralsPhase_complete` when `sComplete='1'`) into temp `p_TempTable`. Filters by date range, `sWorkOrderNos`, `iType` (0 normal / 1 backup-plan via `bPlanB`), customer-scope (`Fun_GetLookCustomer`), and `bFilter`. Walks `eleprocessphase` to dynamically create three columns per phase (`s_-锁定`, `s_-计划_json`, `s_-实际_json`), with `sPhase`/`sPhaseplanDate` further filtering rows by stage. Returns total count + bill count + the paged result. **Invocation:** Bound as the data-source of four 生产计划跟进表 forms via `gdsconfigformmaster.sSqlStr` — `常用生产计划跟进(部件)` `2022030816063744384745643800279`, `常用生产计划跟进(成品)` `2022031217382686385844770892856`, `备用生产计划跟进(部件)` `2022031916390448749618987764232`, `备用生产计划跟进(成品)` `2022031916395365310062706616416` (each under its own module in 生产计划管理). Loaded when the user opens the report; the row-side calc table is pre-computed by `Sp_Manufacture_MftPlanPhase_BtnEventCalc` / `_product` (the 计算 buttons).