# `Sp_Zld_BtnEventClaim` (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_Zld_BtnEventClaim`'`._

## Narrative

**Business context:** 制造 → 资料袋 (`mftdatabagmaster`) — 资料袋领用 (customer-specific 千彩 override per the `script/客户/千彩/` install path). Toolbar handler that lets a department claim a 资料袋 (production "data bag" — order-package the shop floor uses to carry job specs / 文件) once, and logs the action.

**What it does:** Validates `sProInParam`; parses `$.params[i].value[j].sId / sClaimPerson / sClaimDepartment`. For each row reads existing `(sState, sClaimPerson, sClaimDepartment, tClaimDate)` from `mftdatabagmaster`. If `sState='2'` it aborts with `领用，不能再次领用` reason concatenated from the existing claimer. Otherwise `UPDATE mftdatabagmaster SET sClaimPerson, sClaimDepartment, tClaimDate = <new>` and `INSERT INTO mftdatabaglog(sId, sParentId=p_sId, sType='2', sHandleDepartment, sHandlePerson, tHandleDate, sMakePerson)` — `sType='2'` denotes the claim event.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — fired by a 领用 button on the 资料袋 grid. Not bound on `gdsmodule` or `gdsconfigformmaster`; the only xly-src reference is the customer override script `script/客户/千彩/Sp_Zld_BtnEventClaim.sql`. Verify deployment per tenant before relying on it.
