# `Sp_Customer_BtnEventInvalid` (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_Customer_BtnEventInvalid`'`._

## Narrative

**Business context:** 基础资料 → 客户 (`elecustomer`) — button handler for "客户作废". Soft-deletes the selected customer rows (`bInvalid=1`) and writes one `syslog` audit row per customer with `sOperationType='作废客户'` and the customer name, keyed back to the customer form (`sFormId='192116810111915048607109671'`).

**What it does:** Validates `sProInParam`, parses `$.params[].value[].sId` from the JSON payload. The `sId` field may be a `-`-separated list, so it explodes it via `SUBSTRING_INDEX`. For each `sIdOne`: reads `sCustomerName` to build the log message (`'作废客户：' + sCustomerName`), runs `UPDATE elecustomer SET bInvalid=1 WHERE sId=p_sIdOne AND sBrandsId AND sSubsidiaryId`, then `INSERT INTO syslog` with the audit trail. Empty selection raises `chooseData` ("请选择数据") via `Fun_Sis_GetConstNew`.

**Invocation:** `sp_btn_action*`-style — dispatched by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` when the 作废 button on the 客户 form fires. No `gdsmodule` hook reference; the button binding lives in the form's button configuration. No xly-src install script ships with this routine in the standard 30100101 bundle — the proc is live in the DB only.
