# `Sp_Machine_ReportAll` (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_ReportAll`'`._

## Narrative

**Business context:** Machine / shift production-report aggregator over a month-bounded window — produces a per-machine triple-shift (1=白班, 2=中班, 3=晚班) roll-up of qualified output qty, setup time (调机时间), other time, manhours, secondary-setup time, paper-error time, file-error time, maintenance time, abnormal time, and supervisor-confirmed manhours. Intended as the data-source for an "all machines" production-output report.

**What it does:** Defaults `tStartDate` to first-of-current-month at 00:00 and `tEndDate` to start-of-next-month. Drops/creates temp table `p_TempTable` keyed by machine / dept / team and three shift-suffixed columns each (`dProcessQty1/2/3`, `dAdjustableHour1/2/3`, etc.). Populates from `mftproductionreportmaster`/`...slave` filtered by `sMachineName` / `sTeamName` / `sDeptName` LIKE, joins `elemachine` and dept/team tables for display, then exposes the rowset paginated through `Sp_Outstanding_Query`.

**Invocation:** Status: appears orphaned. No form-master binding, no `gdsmodule` hook, no other DB caller, no xly-src reference. Self-contained machine-report variant not wired into any live form — candidate for maintainer audit; the production-report family uses `Sp_EquipmentOutput_Machine` (printing) and `Sp_EquipmentOutput_Machine_YH` (post-press) instead.
