# `Sp_Manufacture_ProductionWorkCenter` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sWorkOrderNo` | `varchar(100)` |
| 2 | IN | `sManualNo` | `varchar(100)` |
| 3 | IN | `sOrderNo` | `varchar(100)` |
| 4 | IN | `sCustomerName` | `varchar(100)` |
| 5 | IN | `sSaleManName` | `varchar(100)` |
| 6 | IN | `tStartDate` | `datetime` |
| 7 | IN | `tEndDate` | `datetime` |
| 8 | IN | `iType` | `int` |
| 9 | IN | `sLoginId` | `varchar(100)` |
| 10 | IN | `sBrId` | `varchar(100)` |
| 11 | IN | `sSuId` | `varchar(100)` |
| 12 | IN | `bFilter` | `varchar(5000)` |
| 13 | IN | `pageNum` | `int` |
| 14 | IN | `pageSize` | `int` |
| 15 | OUT | `totalCount` | `int` |
| 16 | IN | `countCloumn` | `varchar(5000)` |
| 17 | OUT | `countMapJson` | `longtext` |
| 18 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 19 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 20 | 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_ProductionWorkCenter`'`._

## Narrative

**Business context:** Cross-module — bound by four 分析 forms: 采购管理 → 采购分析报表 → 采购大数据分析, PLM管理 → 研发数据管理(雅昌), 生产实效分析 → 工单效率分析(暂不开放), and 采购管理 → 询价比价 → 采购价格分析查询. Despite the name "WorkCenter", the proc is reused as a generic work-order pivot — filters by 工单号 / 手单号 / 订单号 / 客户名 / 业务员 / 日期 / `iType` and returns a per-工单中心 (work-center) progress + cost/qty pivot.

**What it does:** Materialises scratch `P_TMP_MftWorkCenter` (and a `_tmp` companion) from `sisworkcenter` joined with `MftWorkOrderMaster/Slave`, then layers reports from `Viw_MftProductionReport`, outside-process state from `Viw_OpsOutsideProcess`, inbound store from `Viw_PitProductInStore`, and delivery from `Viw_SalDeliverGoods` keyed by `eleproduct`. Switches behaviour on `SysSystemSettings.CbxProductionReport` and applies the cut-paper/check tags. Final paging via `Sp_Outstanding_Query`. ~22K body.

**Invocation:** Bound as `gdsconfigformmaster.sSqlStr` on:
- 采购大数据分析 form `19211681019715708471874930` — 采购管理 → 采购分析报表
- 研发数据管理(雅昌) form `19211681019715708719759210` — PLM管理
- 工单效率分析(暂不开放) form `19211681019715708722218530` — 生产实效分析
- 采购价格分析查询 form `101251240115015889205266110` — 采购管理 → 询价比价

Also referenced by `Fun_getInitColumnByProName` for grid-column metadata. Shipped as `script/标版/30100101/Sp_Manufacture_ProductionWorkCenter.sql`.
