# `Sp_reportdata_QlyTest` (procedure)

> 数据源自定义


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sMaintableId` | `varchar(50)` |
| 2 | IN | `sProductId` | `varchar(50)` |
| 3 | IN | `sUserId` | `varchar(100)` |
| 4 | IN | `sBrandsId` | `varchar(100)` |
| 5 | IN | `sSubsidiaryId` | `varchar(100)` |
| 6 | IN | `queryFilter` | `longtext` |
| 7 | OUT | `sSlaveInfo` | `longtext` |
| 8 | OUT | `sCpjyInfo` | `longtext` |
| 9 | OUT | `sGxjyInfo` | `longtext` |
| 10 | OUT | `sGxsjInfo` | `longtext` |
| 11 | OUT | `sFwjyInfo` | `longtext` |
| 12 | OUT | `sCljyInfo` | `longtext` |
| 13 | OUT | `sFhjyInfo` | `longtext` |
| 14 | OUT | `sReturn` | `longtext` |
| 15 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 品质管理 → 检测报告 — print/report data-source for the 质量检测 (QlyTest) report against a work-order slave row. COMMENT `'数据源自定义'`. Twin of `Sp_reportdata_QlyTest_OEE` but takes a `sMaintableId`/`queryFilter` pair (richer caller binding) and returns the 出货检 variant `sFhjyInfo` in place of the OEE-only 客户投诉/质量事故/精装检 categories.

**What it does:** Parses `queryFilter` JSON (`$.<sMaintableId>.bFilter[]`) to pull out the `sSlaveId` filter; resolves `mftworkorderslave.sParentId` from that. Builds `sSlaveInfo` JSON array (`mftworkorderslave INNER JOIN elecustomer INNER JOIN eleproduct` filtered to the slave + brand/sub). Creates TEMP `P_QlyTestWorkOrder` (master excerpt) and `P_QlyTest` (consolidated detection rows). Returns seven JSON OUTs: `sCpjyInfo`成品检验, `sGxjyInfo`工序检验, `sGxsjInfo`工序首检, `sFwjyInfo`复尾检, `sCljyInfo`材料检验, `sFhjyInfo`发货检验 — each assembled with GROUP_CONCAT / JSON_OBJECT from the matching inspection tables.

**Invocation:** Status: appears orphaned in this DB snapshot. Signature matches the report-data-source convention with a `sMaintableId`+`queryFilter` driver, so it's expected to be wired in via a Jasper template or form's `sSqlStr`, but no caller exists in `gdsmodule`, `gdsconfigformmaster`, other procedures, or xly-src — candidate for maintainer audit.
