# `Sp_DieCut_BtnEventReceive` (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 | IN | `sMachineId` | `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_DieCut_BtnEventReceive`'`._

## Narrative

**Business context:** 移动端管理 → 现场 → 功能操作 → 领用模具 — die-cut / knife-mould checkout button on the mobile shopfloor app. The worker scans the knife-mould product on a machine; this proc flips the mould's state to "in use", stamps the recipient, and logs a store-out history row.

**What it does:** Validates `sProInParam` as JSON (aborts with localized "paramsErro" if not), extracts `$.params[0].value` (the slave array, "请选择数据" if empty). For each row: resolves the knife-mould master `sParentId` from `eleknifemouldproduct.sId = p_sSlaveId`; `UPDATE eleknifemould SET sState=2 (领用中), sRecipientPerson=sMakePerson, tRecipientPerson=NOW()`; reads `elemachine.sMachineName` for the destination; computes next `iOrder` from `eleknifemouldproductstore`; `INSERT INTO eleknifemouldproductstore` a history row carrying the product/customer/technology-ver/recipient/machine/state(=领用)/knife-mould-id/`sSrcFormId`.

**Invocation:** Parameter shape matches the `GenericProcedureCallServiceImpl.doGenericProcedureCall` toolbar-button contract (`Sp_<Module>_BtnEvent*`). No live `gdsmodule` hook, no `gdsconfigformmaster` data-source, no other routine references it, and the only xly-src hit is the install script `script/标版/30100101/Sp_DieCut_BtnEventReceive.sql`. Wired up via a `sysbtn`/toolbar action descriptor in the mobile shopfloor `领用模具` page (sId `101251240115015902879009710`) — verify in BACK that the binding is still attached. Paired with `Sp_DieCut_BtnEventReturn` for the mould return.
