# `Sp_BtnEvent_NoPurchase` (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 | `sUserId` | `varchar(100)` |
| 4 | IN | `sBrId` | `varchar(100)` |
| 5 | IN | `sSuId` | `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_BtnEvent_NoPurchase`'`._

## Narrative

**Business context:** 采购 / 采购订单 — button-click handler that toggles 订单未采购 (`bNoPurchase`) on selected `purpurchaseorderslave` lines, flagging an order line as "not to be purchased" so requisition / MRP downstream skips it.

**What it does:** Validates `sProInParam` length, parses `$.params[*].value[*].sSlaveId`, and per id `UPDATE purpurchaseorderslave SET bNoPurchase=(CASE WHEN bNoPurchase=1 THEN 0 ELSE 1 END) WHERE sId=p_sSlaveId` — toggles, no person/date stamp captured.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — 采购订单 line-grid 未采购 toolbar button names `Sp_BtnEvent_NoPurchase` as the action. No static caller, no `gdsmodule` hook.

Flag: unlike other BtnEvent siblings, this proc captures no `sNoPurchasePerson`/`tNoPurchaseDate` — toggling leaves no audit trail for who marked or unmarked a line.
