# `Sp_Manufacture_ProductionReport` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `iState` | `int` |
| 2 | IN | `sLoginId` | `varchar(100)` |
| 3 | IN | `sMachineId_s` | `varchar(100)` |
| 4 | IN | `sProceeAllMachine` | `varchar(10)` |
| 5 | IN | `sSuId` | `varchar(100)` |
| 6 | IN | `sBrId` | `varchar(100)` |
| 7 | IN | `bFilter` | `longtext` |
| 8 | IN | `sUnTaskFormId` | `varchar(100)` |
| 9 | IN | `pageNum` | `int` |
| 10 | IN | `pageSize` | `int` |
| 11 | OUT | `totalCount` | `int` |
| 12 | IN | `countCloumn` | `varchar(5000)` |
| 13 | OUT | `countMapJson` | `longtext` |
| 14 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 15 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 16 | 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_ProductionReport`'`._

## Narrative

**Business context:** 移动端管理 → 现场 → 功能操作 → 内部报工 / 成品发外 — and KPI流程操作菜单 → 订单生产流程 → 3/3 生产工单->产量上报. Data source for the operator-facing production-report grid that lists work-order rows pending or completed reporting for a given machine / process / state. Filters by `iState` (pending vs. reported), the operator's machine list (`sMachineId_s`), and a `bFilter` JSON.

**What it does:** Materialises scratch `p_Tmp_ProductionReport` with order/process/machine columns plus `sFactCapacityId/Name` and `sPayrollCalculate` (实际产能 metadata). Seeds from `mftworkorderprocess` joined with `eleprocessmachine` to filter to machines the operator owns, layers reject/quality stats from `SalRejectGoodsSlave`, and tags rows with the language-aware status strings from `SysSystemSettings`. Final result paged via the standard outstanding-query helper. ~34K body — see `SHOW CREATE PROCEDURE`.

**Invocation:** Bound as `gdsconfigformmaster.sSqlStr` on three forms — 3/3 生产工单->产量上报 (`19211681019715326710140550`, under KPI流程操作菜单 → 订单生产流程), 内部报工 (`101251240115015881530120280`, under 移动端管理 → 现场 → 功能操作), and 成品发外(单据) (`101251240115015903880377400`, same parent). Also referenced from `Fun_getInitColumnByProName` for column-init. Shipped as `script/标版/30100101/Sp_Manufacture_ProductionReport.sql`. Companion non-mobile/legacy variant: `Sp_Manufacture_Report`.
