# `Sp_Apply_Flow_PurOrder` (procedure)

> 流程启动前调用


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sFormGuid` | `varchar(100)` |
| 2 | IN | `sGuid` | `varchar(100)` |
| 3 | IN | `sSrcNo` | `varchar(100)` |
| 4 | IN | `sLoginId` | `varchar(100)` |
| 5 | OUT | `sTableParams` | `longtext` |
| 6 | OUT | `sSrcReportData` | `longtext` |
| 7 | OUT | `sTableParamsValue` | `longtext` |
| 8 | OUT | `sReturn` | `varchar(4000)` |
| 9 | IN | `sBrId` | `varchar(100)` |
| 10 | IN | `sSuId` | `varchar(100)` |
| 11 | OUT | `sCode` | `int` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Apply_Flow_PurOrder`'`._

## Narrative

**Business context:** 采购订单 — minimal workflow-apply data builder for an older 采购订单 approval flow on `purpurchaseordermaster`. Tiny payload — header line only, no employee-tier resolution. Superseded by the much richer `Sp_Apply_Flow_PurpurchaseOrder` which carries tier roster + variance flags.

**What it does:** Reads `purpurchaseordermaster` for `sGuid` joined to `purpurchaseorderslave` + `elesupply`. Payload exposes `sBillNo`, `sSupplyName`, `dAuxiliaryQty` (SUM), `dMoney` (SUM `dMaterialsMoney`), `sType` (1 if any `dAdvanceMoney>0` else 0), and a hardcoded `sUser` = "管广飞".

**Invocation:** Dispatched dynamically by Java `CheckExamineFlowDataServiceImpl.doSendCheckFolwData()` via `doProByNameFlow(..., sApplyProName, ...)` from `gdsmoduleflow.sApplyProName` (empty in this DB).

Flag: hardcoded user literal `"管广飞"` in `sUser` — tenant-specific developer scaffolding. Likely never bound in production; the live 采购订单 flow uses `Sp_Apply_Flow_PurpurchaseOrder` instead.
