# `Sp_Work_WorkOfDayRecord` (procedure)

> 生产记录表


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

## Parameters

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

## Body

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

## Narrative

**Business context:** 生产管理 → 生产运营报表 → CQZY生产日报分析表 (生产记录表) — paged daily production-record report for the 重庆中烟 customer scope. One row per work-order/product with the full production-card context: work-order #, 客户名称, 产品分类, 印版号, 折算率, 膜宽, 排版数, 标准用料, 总升放, 版周长, 机组数, plus per-material breakdown.

**What it does:** Defaults `tStartDate=NOW()-3 MONTH`, `tEndDate=NOW()`. Builds temp `SAS` (`sWorkOrderId, sCustomerId, sProductId, sWorkOrderNo, sCustomerNo, sProductNo, sProductName, dProductQty, sProductionCenter, sProductionClassify, dConversionRate, dMaterialsWidth, dSinglePQty, dSumMachineQty, dSumStretchQty, dMaterialsLength, dCrew, sMaterialsId, sMaterialsName, sMaterialsNo, dCoefficient …`) and populates it from `viw_mftworkorder` + materials/process joins for the date window. Hands the final `SELECT` to the standard paging helper for `pageNum`/`pageSize`/`bFilter`/`countCloumn`.

**Invocation:** Bound as the data-source of the 生产运营报表 → CQZY生产日报分析表 form `gfm.sId=101251240115016219884052520` (parent module 101251240115016219884051700 → 生产运营报表 → 生产管理). Loaded when the user opens the report. xly-src ships the form-master row in `script/标版/20210323/gdsconfigformmaster.sql`; the proc body itself is DB-only (no install script).
