# `Sp_beforeSaveReturn_sSmo` (procedure)

> 半成品入库申请存前反写数量


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sGuid` | `longtext` |
| 2 | IN | `sBrId` | `varchar(100)` |
| 3 | IN | `sSuId` | `varchar(100)` |
| 4 | IN | `iTag` | `int` |
| 5 | OUT | `sCode` | `int` |
| 6 | OUT | `sReturn` | `longtext` |

## Body

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

## Narrative

**Business context:** 仓库管理 / 半成品出库 — parallel-fork variant of the half-finished-goods outbound-issue save-hook. Comment header is copy-pasted (`半成品入库申请存前反写数量`) but the body operates on `sgdsemigoodsoutstoreslave` / `sgdsemigoodsoutstoreapplyslave`. The active chain for 半成品出库 is `Sp_beforeSave_sSmo` → `Sp_saveReturn_sSmo`.

**What it does:** Parses CSV `sGuid` into a temp table, joins `sgdsemigoodsoutstoreslave` ↔ master, computes `p_MftworkOrderSlave_tmp` of issued quantities, then in each `iTag` branch updates `sgdsemigoodsoutstoreapplyslave` (issue-against-application backwrite), `salsalesorderslave`, and `developorderslave` so the consumption is reflected on upstream demand rows.

**Invocation:** Status: appears orphaned. No caller found in any channel. Candidate for maintainer audit — superseded by `Sp_saveReturn_sSmo`.
