# `Sp_QlyOutSideJudge` (procedure)

> 发外检验自动判断抽检及合格


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sFormGuid` | `varchar(100)` |
| 2 | IN | `sGuid` | `varchar(100)` |
| 3 | IN | `sTableName` | `varchar(100)` |
| 4 | IN | `sLoginId` | `varchar(100)` |
| 5 | OUT | `sReturn` | `varchar(4000)` |
| 6 | IN | `sBrId` | `varchar(100)` |
| 7 | IN | `sSuId` | `varchar(100)` |
| 8 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 质量管理 / 发外检验 — auto-evaluates a 发外检验 record (`qlyoutsideproducttestmaster` / `QlyOutSideProductTestSlave`) against the AQL sampling standard. Twin of `Sp_QlyComeMaterialsJudge` but for the outsourced-processing inspection flow rather than incoming-material.

**What it does:** A single `UPDATE QlyOutSideProductTestSlave A INNER JOIN EleTestStandardItem B ON A.sAqlstandardId = B.sParentId INNER JOIN qlyoutsideproducttestmaster C ON A.sParentId = C.sId SET A.dSampleQty = B.iSample, A.iAcQty = B.iAccept, A.iReQty = B.iReject WHERE A.sParentId = sGuid AND C.dSampleQty BETWEEN B.iQuantityFrom AND B.iQuantityTo` — populates the slave's sample/accept/reject from the standard band keyed by the master's `dSampleQty`. All further per-line pass/fail and master rollup logic is commented out in the current body, so this implementation only fills in sampling thresholds without auto-judging.

**Invocation:** Status: appears orphaned. No caller found in any channel (form-master, gdsmodule sSaveProName/sCalcProName, other routines, xly-src grep across all extensions). Signature matches the standard button-action contract (`sFormGuid, sGuid, sTableName, sLoginId, sReturn, sBrId, sSuId, sCode`) — likely intended as the 自动判断 button hook on 发外检验 (`sQod`/`sOod` form code), invoked dynamically by name from a Java handler not present in xly-src; candidate for maintainer audit.
