# `Sp_SalesOrder_KpiQuoMemo` (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 | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | OUT | `sReturn` | `varchar(1000)` |
| 6 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 销售管理 → 销售订单管理 → 销售订单 KPI 跟踪 (`salsalesorderslave`) — quotation-side KPI memo button: writes the operator's textarea note into `sKpiQuoMemo` on the selected order lines (plus any extra fields named in `valueKey`). Edit-variant of `Sp_SalesOrder_KpiQuoClose`; mirror of `Sp_SalesOrder_KpiObsoleteMemo` on the 作废 side.

**What it does:** Validates `sProInParam`, parses `$.params[*].value[*].sSlaveId` and `$.changeValue.textareaValue`. Splits `$.changeValue.valueKey` on commas and builds `p_setSql` from `$.changeValue[0].colN` so any extra grid-editable columns are merged in. Appends `sKpiQuoMemo=<textareaValue>` to the SET-clause. For each `sSlaveId` it CONCATs and PREPARE/EXECUTEs `UPDATE salsalesorderslave SET <setSql> WHERE sId=p_sTmpId AND sBrandsId=sBrId AND sSubsidiaryId=sSuId`.

**Invocation:** Generic-dispatch button signature `(sProInParam, sMakePerson, sBrId, sSuId, OUT sReturn, OUT sCode)` — dispatched by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` from the 销售订单 KPI 跟踪 grid's 报价备注 button. Install script: `script/标版/30100101/Sp_SalesOrder_KpiQuoMemo.sql`. No xly-src Java caller, no gdsmodule row — binding lives in the grid-button metadata.
