# `Sp_BtnRepair_UpdateWXSMaterialsMoney` (procedure)

> 外协商扣款金额修改


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProInParam` | `varchar(10000)` |
| 2 | IN | `sMakePerson` | `varchar(100)` |
| 3 | IN | `sUserId` | `varchar(100)` |
| 4 | IN | `sBrId` | `varchar(100)` |
| 5 | IN | `sSuId` | `varchar(100)` |
| 6 | OUT | `sReturn` | `varchar(1000)` |
| 7 | OUT | `sCode` | `int` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_BtnRepair_UpdateWXSMaterialsMoney`'`._

## Narrative

**Business context:** 委外入库 / 外协商扣款金额修改 — bulk "批量修改" dialog handler that lets ops finance overwrite the line amount `dMaterialsMoney` on `opsoutsideinstorededslave` (outsourced-supplier deduction adjustments), then re-derives unit price and tax breakdown from `sistax.dRate`.

**What it does:** For each `sId` in the payload, executes (1) `UPDATE opsoutsideinstorededslave A JOIN sistax B ON A.sTaxId=B.sId SET A.dMaterialsMoney = p_dMaterialsMoney WHERE A.sId = p_sId`, then (2) recomputes `dMaterialsPrice = dMaterialsMoney/dMaterialsQty` plus `dMaterialsNoTaxPrice`, `dMaterialsNoTaxMoney`, `dMaterialsTaxMoney`, `dMaterialsTaxForeignMoney`, `dMaterialsForeignMoney` via the tax-rate factor `1+B.dRate/100`. Stamps `sChangePerson = sMakePerson`, `tChangeDate = NOW()`.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — front-end "外协商扣款金额修改" dialog on the 委外入库 detail grid registers this procedure name. Built from the `sButtonParam.sql` template. Sibling of `Sp_BtnRepair_UpdateGYSMaterialsMoney` (purchase-in-storage counterpart).
