# `Sp_reportdata_QlyTest_OEE` (procedure)

> 数据源自定义


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sId` | `varchar(50)` |
| 2 | IN | `sUserId` | `varchar(100)` |
| 3 | IN | `sBrandsId` | `varchar(100)` |
| 4 | IN | `sSubsidiaryId` | `varchar(100)` |
| 5 | OUT | `sSlaveInfo` | `longtext` |
| 6 | OUT | `sCpjyInfo` | `longtext` |
| 7 | OUT | `sGxjyInfo` | `longtext` |
| 8 | OUT | `sGxsjInfo` | `longtext` |
| 9 | OUT | `sFwjyInfo` | `longtext` |
| 10 | OUT | `sCljyInfo` | `longtext` |
| 11 | OUT | `sKhtsInfo` | `longtext` |
| 12 | OUT | `sZlsgInfo` | `longtext` |
| 13 | OUT | `sJzzjInfo` | `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_OEE`'`._

## Narrative

**Business context:** 品质管理 → 检测报告 (OEE variant) — print/report data-source for a 质量检测 (QlyTest) report, paired with the OEE work-order view. COMMENT `'数据源自定义'`. Given a work-order `sId`, assembles JSON payloads for the slave row plus eight inspection categories: 成品检验 (`sCpjyInfo`), 工序检验 (`sGxjyInfo`), 工序首检 (`sGxsjInfo`), 复尾检 (`sFwjyInfo`), 材料检验 (`sCljyInfo`), 客户投诉 (`sKhtsInfo`), 质量事故 (`sZlsgInfo`), 巨/精装质检 (`sJzzjInfo`).

**What it does:** Treats `sId` as `mftworkorderslave.sParentId` (work-order id). Builds two TEMP tables `P_QlyTestWorkOrder` (master excerpt from `mftworkordermaster` filtered to `bCheck=1 AND bInvalid=0`) and `P_QlyTest` (consolidated detection rows). `sSlaveInfo` is a JSON array of `mftworkorderslave INNER JOIN elecustomer INNER JOIN eleproduct` rows with `dSrcQty, dStockupQty, dProductQty, dGiveQty, sCustomerProductNo, sCustomerName, sProductName, sProductNo`. The 8 detection OUT params are assembled via GROUP_CONCAT / JSON_OBJECT from the inspection tables (变更 / 复检 / 客投 etc.).

**Invocation:** Status: appears orphaned in this DB snapshot. Signature matches the print/report data-source convention `(sId, sUserId, sBrandsId, sSubsidiaryId, …OUT, sReturn, sCode)`, but not bound from `gdsmodule.sProcName`, `gdsconfigformmaster.sSqlStr`, other routines, or xly-src. Likely wired up via a Jasper template's customisation in production but missing from this catalog — candidate for maintainer audit.
