# `Sp_Calc_sOsa` (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_sOsa`'`._ ## Narrative **Business context:** Two-bind audit for the outsource arrival doc on `opsoutsidearrivemaster` — covers the 质量管理 → 质量管理单据 → 发外到货 form (vendor delivery returning material from a 工序发外 dispatch) and the 质量管理 → 发外进料检验(IQC) → 已发外未到货任务列表 list. The page's `> 采购到货` label is misleading: the wired table is the 发外 (outsource) arrival, not `PurPurchaseArrive*`. **What it does:** Standard validate-and-flip — guards `sGuid`/`bInvalid`/`bCheck`, then `Update opsoutsidearrivemaster` to set `bCheck=1, sStatus=1, sCheckPerson, tCheckDate=NOW()`. `iFlag=0` reverses the flags. No additional qty roll-up in the sampled body. **Invocation:** Bound to `gdsmodule.sProcName` on: - `发外到货` (sId `101251240115016068101173850`) — 质量管理 → 质量管理单据 - `已发外未到货任务列表` (sId `101251240115016068102785410`) — 质量管理 → 发外进料检验(IQC) Dispatched by `BusinessBaseServiceImpl.getPrcName(sFormGuid, …)` on the audit/un-audit button. Install scripts ship at `script/标版/30100101/Sp_Calc_sOsa.sql` and `script/标版/optimize/Sp_Calc_sOsa.sql`.