# `Sp_Apply_Flow_salesreturn` (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_salesreturn`'`._

## Narrative

**Business context:** 销售退货 (流程启动前调用-销售退货) — workflow-apply data builder for the sales-return approval flow on `salrejectgoodsmaster` (executed-return header, not the apply). Builds a three-tier roster covering after-sales, quality, and warehousing.

**What it does:** Resolves tiers from `eleemployee.iPosition`: 4=客服经理, 18=品质部, 7=仓储. Emits per-line memo CONCAT-ing `产品名称➜退货数量` from `salrejectgoodsslave`. Renders `sType` (1=退货补送, else 直接退货) and master `sBillNo`, `sMemo` into `sTableParamsValue`.

**Invocation:** Dispatched dynamically by Java `CheckExamineFlowDataServiceImpl.doSendCheckFolwData()` via `doProByNameFlow(..., sApplyProName, ...)` from `gdsmoduleflow.sApplyProName` (empty in this DB — workflow configs tenant-provisioned per deployment). Companion to `Sp_Apply_Flow_salesreturnapply` (the upstream application that drives this return).
