# `Sp_Calc_sOpp` (procedure)

> @author:zhucx 
		     
	 @date: 2022/12/02
				 
	 @describe: 成品外购审核


- **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(4000)` |
| 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_sOpp`'`._

## Narrative

**Business context:** Audit handler for 成品外购审核 (finished-goods outsource-purchase approval) on `OpsOutsideProcessMaster` — the 工序发外 / 整单发外 dispatch master. Header comments declare authorship `zhucx 2022/12/02`. Sister of `Sp_Calc_sOpc`, which is the proc actually wired to the 工序发外 / 整单发外 modules today.

**What it does:** Standard audit-toggle shape — validates `sGuid`/`bInvalid`, then `Update`s `OpsOutsideProcessMaster` + `OpsOutsideProcessSlave` flipping `bCheck/sStatus/sCheckPerson/tCheckDate`. Joins to the outsource slave to keep related records consistent.

**Invocation:** Status: appears orphaned. The 整单发外 module (sId `192116810113315234963208090`) and 工序发外 module (sId `192116810113315232400087230`) both bind `sProcName=Sp_Calc_sOpc` and `sSaveProName=Sp_Check_sOpp` — note `sOpp` here is the pre-save guard, not the audit. No `gdsmodule.sProcName/sSaveProName`, form-master, sibling routine, or xly-src reference (beyond the install scripts at `script/标版/30100101/` and `script/标版/optimize/`) targets `Sp_Calc_sOpp`. Candidate for maintainer audit — likely a superseded predecessor of `Sp_Calc_sOpc`.
