# `Sp_Calc_plateprocessing` (procedure)

> 内部加工审核


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

## Parameters

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

## Body

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

## Narrative

**Business context:** 制造 / 内部加工审核 — internal plate-processing approval: checks/unchecks a `plateprocessing` row and propagates the processed quantity back to the originating `mftworkorderprocess` work-order line so that downstream production reporting reflects the outsourced or in-house plate processing done against the work order.

**What it does:** Validates `sGuid`; refuses if the bill is `bInvalid=1`. With `iFlag=1`: refuses if already checked (`bCheck=1`); on `mftworkorderprocess` joined to `plateprocessing` by `sSrcSlaveId`, sets `bOutSideComplete=1` and increments `dOutsideProcessQty` by `M.dProcessQty`; then stamps `plateprocessing.bCheck=1, sCheckPerson, tCheckDate`. With `iFlag=0`: symmetric reverse — decrements `dOutsideProcessQty`, sets `bOutSideComplete=0`, clears `bCheck`. Scoped by `sBrandsId/sSubsidiaryId`.

**Invocation:** Status: appears orphaned in this DB instance. No `gdsmodule.sCalcProName`, `gdsmoduleflow`, form-master, or routine-level caller. xly-src lookup finds only the deployment-bundle copy at `script/标版/30100101/Sp_Calc_plateprocessing.sql`. Standard `Sp_Calc_*` check-hook signature — likely bound from a customer-specific module override.

Flag: variable named `iCount` is referenced in the `iFlag=1` branch (`IF iCount > 0 THEN`) but the local declaration is `p_iCount` — the IF reads an undefined/session variable, so the "already checked" guard never fires in that branch.
