# `Sp_System_Checkquoquo` (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 | `sTableName` | `varchar(100)` |
| 4 | IN | `sLoginId` | `varchar(100)` |
| 5 | OUT | `sReturn` | `varchar(4000)` |
| 6 | IN | `sBrId` | `varchar(100)` |
| 7 | IN | `sSuId` | `varchar(100)` |
| 8 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 销售变更单保存校验 — refuses to save a 报价单 (quotation) edit on `quoquotationmaster` when any downstream 销售订单 it spawned has already been picked up by a 销售对账 (sales reconciliation) line. Prevents tenants from amending a quote whose money has already entered the AR workflow.

**What it does:** On `sTableName='QuoQuotationmaster'`, joins `viw_quoquotation M → viw_salsalesorder E ON E.sSrcId=M.sSrcId` filtered to `M.sFormId='10110110111016576940332730'` and `M.sParentId=sGuid`, then `GROUP_CONCAT`s any `E.sBillNo` whose `sOrderNo` appears in `salsalescheckingslave`. If matches exist, sets `sCode=-8` and returns `'此报价单生成的销售订单：<list> 已做销售对账不能变更！'`. Otherwise leaves `sCode=1`.

**Invocation:** Status: appears orphaned. No caller found in any channel (form-master, `gdsmodule` hooks, other routines, xly-src grep, dynamic-dispatch search). Name pattern (`Check…quoquo`) and signature match the `gdsmodule.sSaveProName` post-save slot dispatched by `BusinessBaseServiceImpl.checkUpdate(..., "sSaveProName")`, but no row currently binds it in this DB instance — likely a customer-specific check awaiting configuration; candidate for maintainer audit.
