# `Sp_Calc_sOpi1` (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(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_sOpi1`'`._

## Narrative

**Business context:** Audit-toggle variant for 整单发外入库 (`OpsOutsideInStoreMaster`) — operates on the same outsource-processing receipt that `Sp_Calc_sOpi` covers, with a slightly different qty-rollup branch on `mftworkorderslave`. Likely a forked copy kept for a customer-specific tweak or an older revision.

**What it does:** Same shape as `Sp_Calc_sOpi`: validates `sGuid`, refuses when `bInvalid=1` or already at the target `bCheck` state, then flips `bCheck/sStatus/sCheckPerson/tCheckDate` on `OpsOutsideInStoreMaster` + `opsoutsideinstoreslave` and reconciles received qty against `mftworkorderslave`. No KPI insert.

**Invocation:** Status: appears orphaned. No `gdsmodule.sProcName/sSaveProName`, `gdsconfigformmaster` form-master, sibling-routine or xly-src reference points at `Sp_Calc_sOpi1` — the live 整单发外入库 module routes to `Sp_Calc_sOpi`. Candidate for maintainer audit: confirm whether any tenant override script binds this and drop it if not.
