# `Sp_Machine_TeamNew` (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_TeamNew`'`._

## Narrative

**Business context:** 生产管理 → 班组产量报表 (`gdsmodule sId 19211681019715780368511470`) — paged per-machine ×  班组 production statistics. Carries the standard report-proc signature with date range + `sMachineName/sTeamName/sDeptName` filters and the page/group OUT params; output adds `dProcessQty`(合格数), `dAjustReportPlanQty`(确认上报数), `dColorNum`(色数), `dCalculateMoney`(产值计算金额), `dAllHour`(总工时) and a breakdown 调机/二次调机/纸张异常/文件异常/设备保养/设备异常/用户看色 hours.

**What it does:** Defaults `tStartDate/tEndDate` to the current month, drops/creates `p_TempTable` keyed by (设备, 班组, 部门), pulls aggregated stats from production-report sources into the temp, then re-paginates the temp via a dynamic SQL applying `bFilter`/`sFilterOrderBy` and groupby splice.

**Invocation:** Status: appears orphaned by formal channels. The 班组产量报表 module exists at `gdsmodule.sId 19211681019715780368511470` (parent `19211681019715323325710100` 机台作业任务执行 → `11811781131121915216205010990` 生产管理) but no `gdsconfigformmaster.sSqlStr` row binds this proc, and no other routine, view, trigger, or xly-src file references it. The intended report form-master sId is unidentified — candidate for maintainer audit.
