# `Sp_BtnRepair_UpdateLogSlavePrice` (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_UpdateLogSlavePrice`'`._

## Narrative

**Business context:** 物流单 / 重新计算物流单从表金额 — bulk "批量修改" dialog handler that recalculates `logisticsorderslave` per-line material money/price by allocating the master total proportionally to a chosen base (product price × auxiliary qty, or materials price × auxiliary qty), rather than per-line manual entry.

**What it does:** For each master `sId` in the payload, runs a multi-step recalc on `logisticsorderslave`: (1) populate `dSrcMoney` from a fallback chain (`B.dProductPrice * A.dAuxiliaryQty`, then `B.dMaterialsPrice * A.dAuxiliaryQty`); (2) sum `dSrcMoney` into `p_dSrcTotalMoney` and `dProductMoney` into `p_dTotalMoney`; (3) re-distribute `dMaterialsMoney = ROUND(dSrcMoney / p_dSrcTotalMoney * p_dTotalMoney, 2)` and back-derive `dMaterialsPrice` per line.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — front-end "重新计算金额" dialog on the 物流单 grid registers this procedure name. Built from the `sButtonParam.sql` template; only the textareaValue memo is parsed from changeValue (no per-field values).
