# `Sp_mftproduct_BtnEventbEnable` (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_mftproduct_BtnEventbEnable`'`._

## Narrative

**Business context:** 产品管理 → 产品档案及SOP → 产品工艺卡 (also 轮转工艺卡 / 丝印工艺卡 / 材料工艺卡 — same master table `mftproductmaster`) — toolbar 启用版本号 handler. A 工艺卡 (process card) can carry multiple versions per `sProductId`; only one version is the live SOP. This proc flips the chosen card into the active version and disables siblings.

**What it does:** Parses `$.params[*].value[*].sId` from `sProInParam`. For each card id: confirms it exists in `mftproductmaster` (else returns `sCode=-8` with the localised `sMftproductNoGyk` "请先保存工艺卡，未找到要启用的工艺卡" from `Fun_Sis_GetConst`); for every sibling slave row sharing the same `sProductId` it `UPDATE mftproductslave SET bEnable = 0`; sets `bEnable=1, tEnableDate=NOW(), sEnablePerson=sMakePerson` on the chosen card's own slaves; finally back-writes `eleproduct.sProductVer = mftproductslave.sProductTechnologyVer` and `sCustomTechnologyVer = sCustomerOrderNo` so the product record reflects the new active version.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — the 启用 button on any 工艺卡 form names `Sp_mftproduct_BtnEventbEnable` as the action. xly-src ships `script/标版/30100101/cost/Sp_mftproduct_BtnEventbEnable.sql` (install script).
