# `Sp_WorkDayReport` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `tStartDate` | `datetime` |
| 2 | IN | `tEndDate` | `datetime` |
| 3 | IN | `sLoginId` | `varchar(100)` |
| 4 | IN | `sBrId` | `varchar(100)` |
| 5 | IN | `sSuId` | `varchar(100)` |
| 6 | OUT | `sReturn` | `varchar(1000)` |
| 7 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 生产管理 / 设备日报表 (intended) — daily-output pivot by machine: one row per `sMachineId` with 31 columns `dReport1Qty..dReport31Qty` (sum of `dProcessQty` per day-of-month) plus `dSumQty`. Designed as a 设备产量日报 grid feeding off `viw_mftproductionreport` between `tStartDate` and `tEndDate`.

**What it does:** Creates temp `WorkDayReport`, inserts one row per machine grouped by date with a 31-arm `CASE WHEN date_format(tCreateDate,'%d')='NN'` pivot, joins `elemachine` to fill `sMachineName`, sums the 31 columns into `dSumQty`, then `SELECT *` from the temp table as the result set. Side-effect-free; the date-range is the only filter.

**Invocation:** Status: appears orphaned. No caller found in any channel — no `gdsconfigformmaster.sSqlStr` binding, no `gdsmodule` hook, no other routine references the name, and the only xly-src hit is its own install script `script/标版/30100101/Sp_WorkDayReport.sql`. The signature (`tStartDate, tEndDate, sLoginId, sBrId, sSuId, OUT sReturn, OUT sCode`) lacks the paging/`bFilter`/`countMapJson` parameters of live report data-source procs, suggesting it was an earlier prototype superseded by a paged variant. Candidate for maintainer audit.
