# `Sp_Check_sLosTest` (procedure)

> 物流单单据保存之前数据校验


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

## Parameters

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

## Body

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

## Narrative

**Business context:** Earlier draft of [`Sp_Check_sLos`](Sp_Check_sLos.md) — the freight-cost apportionment block from 物流单 post-save, kept around as a `Test` variant called by `Sp_Calc_sLos`. Same 物流单 form (`logisticsordermaster`); same back-calculation; trimmed signature (no tenant/login parameters).

**What it does:** Updates `logisticsorderslave.dSrcMoney` from the joined source slave depending on `iSlaveLogType` (1/5 → `salsalesorderslave.dProductPrice * dAuxiliaryQty`; 2 → `purpurchaseorderslave.dMaterialsPrice * dAuxiliaryQty`; 3/4 → `opsoutsideprocessslave.dMaterialsPrice * dAuxiliaryQty`). Then sums slave `dSrcMoney` and detail `dProductMoney` and writes `dMaterialsMoney = ROUND(dSrcMoney/totalSrc * totalDetail, 2)` plus the derived no-tax/tax/foreign money fields onto every slave, joining `sistax` for `dRate`. Lacks the `bAheadComplete` / single-tax / single-supplier guards that `Sp_Check_sLos` later added.

**Invocation:** Called from `Sp_Calc_sLos` (the 物流单 audit handler) via a `CALL Sp_Check_sLosTest` line. Not module-bound. The `Test` suffix and the missing guard rails mark it as an in-place test stub; production validation goes through `Sp_Check_sLos`.
