# `Sp_OEE_ProductionReport` (procedure)

> OEE：上报列表获取


- **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_OEE_ProductionReport`'`._

## Narrative

**Business context:** OEE管理 → OEE本设备生产任务 / OEE本设备对应工序任务 — paged "上报列表获取" (production-report task list) feed for an OEE machine workstation. Returns the production-task rows the operator at the given `sMachineId_s` (or "all machines" override) is expected to report against — one row per 工序 with derived qtys, colour counts, plate counts, customer, team, and work-order linkage. Comment header: `OEE：上报列表获取`.

**What it does:** Drops/recreates `p_Tmp_ProductionReport` (~80-column staging table holding plan/process/material/colour/parts/customer/team/reserves data), then branches on `iState` (normal vs. force-finish), `sProceeAllMachine` (process- vs. machine-scope) and the look-customer permission. Populates the staging table by joining `mftproductionplanslave` to its work-order, process, material, parts and customer scopes, then assembles a paging-shaped final SELECT and hands it to the form-master paging contract (`pageNum/pageSize/totalCount/countCloumn/countMapJson/sFilterOrderBy/sGroupby_*`) — typically through `Sp_Outstanding_Query`.

**Invocation:** Bound as the data-source of two forms via `gdsconfigformmaster.sSqlStr`: `gfm.sId=101251240115016087809801980` (OEE本设备对应工序任务) and `gfm.sId=101251240115016040215304930` (OEE本设备生产任务) — both under module OEE管理. Install scripts at `script/标版/20250616/Sp_OEE_ProductionReport.sql` (current) and `Sp_OEE_ProductionReport(old).sql` (previous); `Sp_OEE_ProductionReportAll.sql` ships an "all-machine" sibling.
