# `Sp_Quality_Materials` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `tStartDate` | `varchar(100)` | | 2 | IN | `tEndDate` | `varchar(100)` | | 3 | IN | `sBrId` | `varchar(100)` | | 4 | IN | `sSuId` | `varchar(100)` | | 5 | IN | `bFilter` | `varchar(5000)` | | 6 | IN | `page_num` | `int` | | 7 | IN | `page_size` | `int` | | 8 | OUT | `totalCount` | `int` | | 9 | IN | `countCloumn` | `varchar(5000)` | | 10 | OUT | `countMapJson` | `longtext` | | 11 | IN | `sFilterOrderBy` | `varchar(5000)` | | 12 | IN | `sGroupby_select_sql` | `varchar(5000)` | | 13 | IN | `sGroupby_group_sql` | `varchar(5000)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Quality_Materials`'`._ ## Narrative **Business context:** 质量管理 — would serve a materials-inspection pass-rate report grouped by 材料分类 (`sismaterialsclassify`), with one row per material category plus a 总计 grand-total row. Date-window driven (tStartDate/tEndDate), scoped to the two 来料检验单 form-ids `15827054010002527067474512475000` and `12012615914116374731613080`. **What it does:** Counts batches in `qlycomematerialstestmaster` (filtered by sBrId/sSuId/sFormId/tCreateDate window), joined to `elematerials` to roll up by `sParentId`. Builds temp `p_TempTable` (sSlaveId, sMaterialsClassifyId, sMaterialsClassifyName, iCount, iDisqualified, sRate, sMemo); a parallel temp `p_TempTable1` re-runs the same scan filtered to `iTestResult=1` for the disqualified count, then `UPDATE`-joins to merge. `sRate = ROUND((iCount-iDisqualified)/iCount*100,2) || '%'`. Appends a synthetic 总计 row with `sMaterialsClassifyId='111111'`. Returns via dynamic `SELECT * FROM p_TempTable` — note the proc never calls a paging helper despite declaring `page_num`/`page_size`/`totalCount`/`countMapJson` parameters. **Invocation:** No `gdsconfigformmaster.sSqlStr` binding, no `gdsmodule` hook, no other routine references it, and `grep -rln` on xly-src returns nothing. Status: appears orphaned; candidate for maintainer audit.