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

## Body

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

## Narrative

**Business context:** 派车单 (vehicle-dispatch bill) post-save freight-fee back-writer for `salsendcarmaster`/`salsendcarslave`. After the 派车单 is saved, this proc calls the formula engine (`Sp_System_ReplaceField_New`) with a 运费公式 ID, the carrier/customer/product context, and the dispatcher's 主表/从表 row IDs, then writes the resulting 运费 back to `salsendcarmaster.dProductMoney`.

**What it does:** Counts `salsendcarmaster` rows for `sGuid`; if found, opens a block where it builds the formula's argument string `sAllGuids = sId,sSlaveId,sCustomerId,sProductId` by joining `salsendcarslave` to `salsendcarmaster`, declares the table list `'SalSendCarMaster,SalSendCarSlave,EleCustomer,EleProduct'` and type list `'billMaster,billSlave,baseCustomer,baseProduct'`. Sets `p_sCarFormulaId=''` (note: hard-coded blank in the snapshot — the formula ID must be supplied by configuration before this proc is useful) and `p_dProductMoney=0`, then calls `Sp_System_ReplaceField_New` to evaluate the formula. Updates `salsendcarmaster.dProductMoney` with the returned `p_dProductMoney` for `sId=sGuid`. A larger cursor-driven per-slave variant is fully commented out — only the master-level single-row branch is live.

**Invocation:** Status: appears orphaned. No `gdsmodule.sSaveProName`/`sSaveProNameBefore`/`sProcName` hook, no `gdsconfigformmaster` binding, no other-routine caller, no xly-src reference. The proc's COMMENT (`'派车单保存后调用计算回写单据金额'`) and signature mirror the 派车 freight-calc hook pattern, so it is likely scaffolded for the 派车单 module but the configured 运费公式 ID is empty in the snapshot — the proc is effectively dormant until both the formula and the dispatch wiring are filled in. Candidate for maintainer audit.
