# `Sp_BtnRepair_UpdateSalesSlave` (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_UpdateSalesSlave`'`._

## Narrative

**Business context:** 销售订单 / 变更从表数据 — bulk "批量修改" dialog handler for sales-order detail lines. Overwrites `sCustomerProductNo`, `sBillType`, `tDeliverDate` on selected `salsalesorderslave` rows; updates `sBillTypeNo` only on reorder ("翻单") lines; cascades the new `sCustomerProductNo` to downstream `saldelivernotifyslave` rows.

**What it does:** Parses per-row `sId` plus `$.changeValue.{sBillType, sBillTypeNo, sCustomerProductNo, tDeliverDate}`. For each row: (1) `UPDATE salsalesorderslave SET sBillTypeNo = ... WHERE sId = p_sId AND LOCATE('翻单', sBillType) > 0`; (2) `UPDATE salsalesorderslave SET sCustomerProductNo, sBillType, tDeliverDate ...` using `IF(IFNULL(p_x, '') = '', A.x, p_x)` per field; (3) cascade to `saldelivernotifyslave A JOIN salsalesorderslave B ON A.sOrderSlaveId=B.sId SET A.sCustomerProductNo=B.sCustomerProductNo WHERE A.sCustomerProductNo=''`. A parallel cascade to `saldelivergoodsslave` is commented out.

**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_UpdateSalesMaster`.
