# `Sp_SalesOrder_KpiObsoleteClose` (procedure)

> @author:zhucx 
		     @date: 
				 @describe:


- **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_KpiObsoleteClose`'`._

## Narrative

**Business context:** 销售管理 → 销售订单管理 → 销售订单 KPI 跟踪 (`salsalesorderslave`) — toolbar that marks an order line as "已作废 / 已结案" for KPI purposes: sets `bKpiObsolete=1` and stamps `tKpiObsoleteCloseDate=SYSDATE()` so the operator's quote-then-lose case is closed out of the open-KPI pipeline. Paired with `Sp_SalesOrder_KpiObsoleteMemo` (the memo-edit variant) and the parallel quotation-side pair `Sp_SalesOrder_KpiQuoClose` / `Sp_SalesOrder_KpiQuoMemo`.

**What it does:** Validates `sProInParam`, parses `$.params[*].value[*].sOrderSlaveId`, and for each line runs `UPDATE salsalesorderslave SET bKpiObsolete=1, tKpiObsoleteCloseDate=SYSDATE() WHERE sId=p_sId AND sBrandsId=sBrId AND sSubsidiaryId=sSuId`.

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