# `Sp_BtnRepair_UpdateSalesMaster` (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_UpdateSalesMaster`'`._

## Narrative

**Business context:** 销售订单 / 变更主表数据 — bulk "批量修改" dialog handler that overwrites four sales-order-master fields on selected `salsalesordermaster` rows: customer-order-no, accident-no, NPD flag, and memo.

**What it does:** Parses `$.params[*].value[*].sId` plus `$.changeValue.{sCustomerOrderNo, sAccidentNo, iNPD, sMemo}` from `sProInParam`. For each master id, `UPDATE salsalesordermaster SET sCustomerOrderNo=p_sCustomerOrderNo, sAccidentNo=p_sAccidentNo, iNPD=p_iNPD, sMemo=p_sMemo WHERE sId=p_sId` — all four fields overwritten unconditionally, blanks blank the row.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — front-end "批量修改" dialog on the 销售订单 master grid registers this procedure name. Built from the `sButtonParam.sql` template. Sibling of `Sp_BtnRepair_UpdateSalesSlave` and the rest of the `Sp_BtnRepair_Update*` family.

Caveat: no `IF(IFNULL(..)='', A.x, p_x)` guard — unset dialog fields will blank the underlying columns rather than preserve them.
