# `Sp_Calc_sOpn` (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_sOpn`'`._ ## Narrative **Business context:** Audit handler for an 成外购到货 / 发外到货 (outsource-processing arrival) doc on `opsoutsidearrivemaster` — body header comments declare authorship `zhucx 2022/12/02`. On approval it freezes the arrival rows and rolls received qty back into `opsoutsideprocessslave` (the original 工序发外 line) so the dispatching record knows what came back. **What it does:** Standard `Sp_Calc_*` shape — validates `sGuid`, guards on `bInvalid`/`bCheck`, then `Update opsoutsidearrivemaster` and `opsoutsidearriveslave` to set `bCheck=1, sStatus=1, sCheckPerson, tCheckDate=NOW()`; joins back to `opsoutsideprocessslave` to accumulate received quantity. `iFlag=0` reverses. **Invocation:** Status: appears orphaned. The live 发外到货 module (sId `101251240115016068101173850`) under 质量管理 → 质量管理单据 is bound to `Sp_Calc_sOsa`, not `Sp_Calc_sOpn`. No `gdsmodule.sProcName/sSaveProName`, form-master, or sibling-routine reference picks `Sp_Calc_sOpn`. Only xly-src install scripts (`script/标版/30100101/Sp_Calc_sOpn.sql`, `script/标版/optimize/Sp_Calc_sOpn.sql`) ship the body. Candidate for maintainer audit — likely a superseded predecessor of `Sp_Calc_sOsa`.