# `Sp_Machine_ReportNew` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `tStartDate` | `datetime` |
| 2 | IN | `tEndDate` | `datetime` |
| 3 | IN | `sMachineName` | `varchar(100)` |
| 4 | IN | `sTeamName` | `varchar(100)` |
| 5 | IN | `sDeptName` | `varchar(100)` |
| 6 | IN | `sBrId` | `varchar(100)` |
| 7 | IN | `sSuId` | `varchar(100)` |
| 8 | IN | `sLoginId` | `varchar(100)` |
| 9 | IN | `bFilter` | `text` |
| 10 | IN | `pageNum` | `int` |
| 11 | IN | `pageSize` | `int` |
| 12 | OUT | `totalCount` | `int` |
| 13 | IN | `countCloumn` | `varchar(5000)` |
| 14 | OUT | `countMapJson` | `longtext` |
| 15 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 16 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 17 | IN | `sGroupby_group_sql` | `varchar(5000)` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Machine_ReportNew`'`._

## Narrative

**Business context:** 生产管理 — paged per-machine production-report aggregation, three-shift (班次1/2/3) layout. Carries report-proc parameters (`pageNum/pageSize/bFilter/countCloumn/countMapJson/sGroupby_*`) and date-range + 设备名/班组名/部门名 filters; produces per-机台 stats by shift: 合格数, 调机时间, 工时, 二次调机时间, 纸张异常时间, 文件异常时间, 设备保养时间, 设备异常时间, 主管确认工时, 确认后人工总工时, 效率.

**What it does:** Defaults `tStartDate/tEndDate` to the current month, drops/creates `p_TempTable` with one row per 设备 and 30+ stat columns per shift suffix (`_1/_2/_3`), populates the temp from production-report sources, then `UPDATE p_TempTable` to compute 效率 per shift and the dynamic SQL is paginated for the grid.

**Invocation:** Status: appears orphaned. No caller found in any channel — not in `gdsmodule.sProcName`/`sSaveProName*`, not in `gdsconfigformmaster.sSqlStr/sConfigSqlStr/sSqlCondition`, not referenced by any other routine, no view/trigger, not in xly-src (install script absent — DB-only). The paged-report signature implies it was intended as a form data-source but the binding is missing — candidate for maintainer audit. Sibling: `Sp_Machine_ReportNewNo`, `Sp_Machine_TeamNew`.
