# `Sp_Calc_sOdt` (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_sOdt`'`._ ## Narrative **Business context:** 质量管理 → 质量管理单据 → 发外检验单据 (PC + mobile variants) — outsourced-process inbound-quality check audit / un-audit on `QlyOutSideProductTestMaster`. When goods return from an outsourced step (印刷, 模切, etc.), QC inspects them; approving the 发外检验 commits the accept/reject outcome and unblocks the upstream 发外加工 / 发外到货 rows so finance/warehouse can proceed. **What it does:** Defaults the IN params, branches on `iFlag`. On `iFlag=1` flips `QlyOutSideProductTestMaster.bCheck=1` plus audit person/date, and back-writes the inspection result onto `OpsOutsideProcessSlave` (the outsourced-process slave row) and `opsoutsidearriveslave` (the arrival/收货 slave row) so the next step in the workflow sees the QC verdict. `iFlag=0` clears those back-writes. **Invocation:** Bound to `gdsmodule.sProcName` on `发外检验单据` (sId `15827076660008241075501010830000`) under 质量管理 → 质量管理单据, and on the mobile-side `发外检验(mobile单据)` (sId `12012615914116374731690490`) under 移动端管理. Both modules also share `Sp_Check_sOdt` / `Sp_beforeSave_sOdt`. Dispatched by Java `BusinessBaseServiceImpl.getPrcName(sFormGuid, …)` on 审核/反审核. xly-src ships `script/标版/30100101/Sp_Calc_sOdt.sql` and `script/标版/optimize/Sp_Calc_sOdt.sql`.