# `Sp_Check_QlyMaterialRule` (procedure) > 检测同一个物料分类不能存在两个标准之中 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sGuid` | `varchar(100)` | | 2 | IN | `sFormGuid` | `varchar(100)` | | 3 | IN | `sLoginId` | `varchar(100)` | | 4 | IN | `sBrId` | `varchar(100)` | | 5 | IN | `sSuId` | `varchar(100)` | | 6 | IN | `iFlag` | `int` | | 7 | OUT | `sCode` | `int` | | 8 | OUT | `sReturn` | `varchar(4000)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Check_QlyMaterialRule`'`._ ## Narrative **Business context:** 品质管理 → 进料检验规则单据 (`gdsmodule.sId='12012615914116374916774630'`) — post-save validator that prevents the same 物料分类 from appearing on two simultaneously-active 进料检验标准 (`EleTestStandard`) records. Runs after the user saves a 进料检验规则 to guarantee a single rule wins per material category. **What it does:** Sums `eleteststandardobject.sTestObjectId` group counts across all `EleTestStandard` rows where `sFormId='12012615914116374916774630'` for the tenant; if any `sTestObjectId` appears more than once and is also on the just-saved standard (`sParentId=sGuid`), joins `sismaterialsclassify` to render the offending names into `p_sNames` and aborts with `sCode=-8, sReturn=' 重复,不能存在于不同的标准之中'`. On the happy path leaves `sReturn='保存成功!'`. **Invocation:** Status: no caller found. No `gdsmodule` hook references it (`sSaveProName`/`sSaveProNameBefore` are blank on the 进料检验规则单据 module), no other routine references it, and `xly-src` has no match. Likely registered for a removed module variant or wired by metadata not captured in this database — candidate for maintainer audit.