# `Sp_Apply_Flow_MaterialsPrice` (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_MaterialsPrice`'`._

## Narrative

**Business context:** 物料指导价 / 材料询价比价 (catalog header: "流程启动前调用-物料指导价"; backing table `elematerialscoachmaster`, "材料价格辅导单" — the master record of the guidance-price proposal that finance must approve before quoting / purchasing). Per-form workflow-apply data builder for the price-setting approval flow.

**What it does:** Resolves eight approver tiers: 二级部门经理 (制单人's department head, chained via `eleemployee.sEmployeeName=B.sMakePerson` → `sisdepart.sEmployeeId`), 供应商管理部 (employees of hardcoded department sId `'20231120093820561209518017890988'`), 供应链部长 / 总经理 (`iPosition` 5 / 1), 国内副总 (`iPosition=34`), 副董执行董事 (`iPosition=38`), 财务经理 (`iPosition=11`), 董事长 (`iPosition=39`). Emits `sTableParams` (单据号/申请人/备注) and `sTableParamsValue` (master values + the eight approver name lists `OneFlow`/`TwoFlow`/`ThreeFlow`/`FourFlow`/`SixFlow`/`SevenFlow`/`EightFlow`/`NineFlow` — `FiveFlow` is skipped).

**Invocation:** Dispatched dynamically by Java `CheckExamineFlowDataServiceImpl.doSendCheckFolwData()` via `doProByNameFlow(..., sApplyProName, ...)` where `sApplyProName` is read from `gdsmoduleflow.sApplyProName` on the 物料指导价 workflow config row. `gdsmoduleflow` is empty in this database — workflow configs are tenant-provisioned per deployment.

Flags: 供应商管理部 lookup hardcodes department sId `'20231120093820561209518017890988'` — tenant-specific. The approver-tier numbering skips `FiveFlow` (visible gap in the JSON) — likely a slot reserved for a later-added position that never landed.
