# `Sp_DieCut_BtnEventReturn` (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_BtnEventReturn`'`._

## Narrative

**Business context:** 移动端管理 → 现场 → 功能操作 → 归还模具 — die-cut / knife-mould return button on the mobile shopfloor app. Symmetric counterpart to `Sp_DieCut_BtnEventReceive`: when the operator returns a mould, this proc flips its state back to "归还", stamps the returner, and logs a store-in history row.

**What it does:** Validates `sProInParam` as JSON (aborts with localized "paramsErro" / "chooseData" otherwise). For each slave row: resolves the master `sParentId` from `eleknifemouldproduct.sId = p_sSlaveId`; `UPDATE eleknifemould SET sState=3 (归还), sRecipientReturnPerson=sMakePerson, tRecipientReturnPerson=NOW()`; reads `elemachine.sMachineName` for the source-machine label; computes next `iOrder` from `eleknifemouldproductstore`; `INSERT INTO eleknifemouldproductstore` a paired return-history row with product/customer/technology-ver/return-person/state(=归还).

**Invocation:** Parameter shape matches the `GenericProcedureCallServiceImpl.doGenericProcedureCall` toolbar-button contract. No live `gdsmodule` hook, no `gdsconfigformmaster` data-source, no other routine references it; only xly-src hit is `script/标版/30100101/Sp_DieCut_BtnEventReturn.sql`. Wired up via a `sysbtn`/toolbar action descriptor on 归还模具 (sId `101251240115015902879048590`); paired with `Sp_DieCut_BtnEventReceive` for the checkout.
