# `Sp_QlyTest` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sWorkOrderGuid` | `varchar(100)` |
| 2 | IN | `sWorkOrderId` | `varchar(100)` |
| 3 | IN | `sSuId` | `varchar(100)` |
| 4 | IN | `sBrId` | `varchar(100)` |
| 5 | IN | `bFilter` | `longtext` |
| 6 | IN | `sUnTaskFormId` | `varchar(100)` |
| 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_QlyTest`'`._

## Narrative

**Business context:** 质量管理 — would serve a per-工单 quality-test detail report combining all five test types (材料检验, 发外检验, 工序检验, 首检, 成品检验) into one flat row set keyed by `sWorkOrderId`. Designed as the slave drill-through of `Sp_QlyTestWorkOrder`.

**What it does:** Builds temp table `P_QlyTest` (sId, sBillNo, tCreateDate, sWorkOrderId, sTestType, sTestitemId, sTestStandardId, dSampleQty/dNoQualifyQty/dQualifyQty, sTestResult). Five `INSERT...SELECT` blocks pull from `QlyComeMaterialsTestMaster` (joined to `purpurchaseorderslave`/`purpurchaseorderDetail` for the materials side), `Qlyoutsideproducttestmaster` (发外), `QlyProcessTestMaster` (巡检/首检, with `sFormId='12012615914116373957014740'` overriding to '首检'), and `QlyProductTestMaster` (成品). Each row is filtered to `bCheck=1 AND bInvalid=0 AND sWorkOrderId/sSrcId = sWorkOrderGuid`. After population it joins `EleTestStandard`, `elematerials`, `eleprocess`, `eleproduct` to denormalise the item/standard names.

**Invocation:** No `gdsconfigformmaster` data-source binding, no `gdsmodule` hook, no other routine references it, and `grep -rln` on xly-src returns nothing. Signature matches the form-master report family (pageNum/pageSize/totalCount/countMapJson/bFilter/sFilterOrderBy) — the screen was likely planned but never wired, or the binding was deleted while the proc body stayed. Status: appears orphaned; candidate for maintainer audit.
