# `Sp_eleteststandardPatrol_BeforeUpdate` (procedure)

> 生产巡检规则单据校验


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

## Parameters

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

## Body

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

## Narrative

**Business context:** 生产巡检规则单据校验 — pre-save uniqueness guard for the 生产巡检规则 (in-process patrol inspection rule) document. Each 工序 (`eleteststandardobject.sTestObjectId`) may appear on at most one rule scoped by `eleteststandard.sFormId='12012615914116374914703890'`; this proc blocks a save that would create a duplicate rule.

**What it does:** Walks `sAllData` for the `eleteststandardobject` slave block. For each `handleType='add'` row with a non-empty `sParentId`, counts other `eleteststandard` rows on the 巡检 form (`sFormId='12012615914116374914703890'`) sharing the same `sTestObjectId` but a different parent. On any hit, builds `sReturn='工序已在以下生产巡检规则单据中存在:<sTestName list>'`, sets `sCode=-1`, aborts. Otherwise `sCode=1`.

**Invocation:** Status: appears orphaned. Not bound to any gdsmodule hook, no form-master reference, no other routine references it, no xly-src reference. The `sFormId='12012615914116374914703890'` literal matches the 生产巡检规则 form — authored as that form's pre-save validator and never wired. Candidate for maintainer audit. (Cousin procs `Sp_eleteststandardFeed_BeforeUpdate`, `Sp_eleteststandardFirst_BeforeUpdate`, `Sp_eleteststandardProduct_BeforeUpdate` are identical except for the embedded form sId.)
