# `Sp_beforeSave_sOsa` (procedure)

> 采购到货保存前反写报价数量


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

## Parameters

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

## Body

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

## Narrative

**Business context:** 采购到货 (purchase-arrival) — before-save delegator that backwrites the quote-priced arrival quantities onto upstream purchase-order documents before the master save commits. Comment header: `采购到货保存前反写报价数量` (quote-quantity variant; the sibling `Sp_beforeSave_sPca` covers the plain-quantity writeback).

**What it does:** Normalises `sGuid` to a quoted-CSV form, then `CALL Sp_saveReturn_sOsa(sGuid, sBrId, sSuId, 1, @sCode, @sReturn)`. The body carries an inline note `-- 反写报价数量` and a trailing commented-out `set sCode = 1;` debug line.

**Invocation:** Status: appears orphaned. No `gdsmodule` hook references this name, no form-master sSqlStr embeds it, the standard `Sp_Invalid_backwriting` / `Sp_delete_backwriting` dispatchers do not call it, and no xly-src file references it. The companion `Sp_saveReturn_sOsa` exists in the DB. Looks like a never-wired variant — candidate for maintainer audit.
