# `Sp_Calc_sOppbecome` (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_sOppbecome`'`._

## Narrative

**Business context:** Audit handler for 成品外购价格变更 (outsource-processing price-change) on `opsoutsideprocessbecomemaster`. After AP discovers the vendor priced a 工序发外 / 整单发外 line differently from the dispatch record, this doc rewrites material price/amount/tax across the affected `opsoutsideprocessslave` and `opsoutsideinstoreslave` rows so the downstream 发外对账 / settlement reflects the new price.

**What it does:** Validates `sGuid`, refuses re-audit when `bCheck=1`, then flips `bCheck/sStatus/sCheckPerson/tCheckDate` on `opsoutsideprocessbecomemaster`. Joins `opsoutsideprocessbecomeslave` (the change-rows) back to `opsoutsideprocessslave` (dispatch) and `opsoutsideinstoreslave` (receipts), rewriting `dMaterialsPrice / dMaterialsMoney / dMaterialsNoTaxPrice / dMaterialsNoTaxMoney / dMaterialsTaxMoney / dMaterialsTaxForeignMoney / dMaterialsForeignMoney` against `sistax.dRate`. `iFlag=0` reverses the flags but does not unwind the rewritten prices.

**Invocation:** Status: appears orphaned. No `gdsmodule.sProcName/sSaveProName`, `gdsconfigformmaster` form-master, sibling-routine, or xly-src reference points at `Sp_Calc_sOppbecome`. Candidate for maintainer audit — confirm whether the 成品外购价格变更 feature ships in this tenant's UI; the proc body is consistent and ready to run if a module is later bound.
