# `Sp_Manufacture_PlanReport` (procedure)


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

## Parameters

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

## Narrative

**Business context:** 生产管理 → 生产计划管理 — machine-keyed plan-vs-report dashboard proc. Sibling of `Sp_Manufacture_ProcessReport`: where that one summarises by 工序, this one summarises by 机台/计划. Pulls each machine's planned work-orders and overlays the latest production-report figures so a planner / 班组长 can see, per machine, the open plan and what has already been reported.

**What it does:** Allocates temp `p_Tmp_ProductionReport`, inserts the machine's planned rows joined out of `mftworkordermaster` / `sgdsemigoodsmatchbillmaster` filtered by `sMachineId_s` (single or `sProceeAllMachine='1'`-style all-machine flag), `sLoginId`, `sBrId`, `sSuId`. Then `UPDATE`s the temp set with reject totals from `SalRejectGoodsSlave`, login info from `SftLoginInfo`, system setting flags from `SysSystemSettings`, and machine-process metadata from `eleprocessmachine`. `sUnTaskFormId` lets the caller scope by which task type the report is presented in.

**Invocation:** Standard form-master report signature, but no `gdsconfigformmaster.sSqlStr` row in the live DB currently references `Sp_Manufacture_PlanReport` — appears unbound in this snapshot. No xly-src install script either (likely DB-only or migrated). Candidate for a maintainer audit: confirm whether a 生产计划/机台报工 form's data-source has been rewired elsewhere or whether the routine is now dormant.
