# `Sp_Check_sLos` (procedure) > 物流单单据保存之前数据校验 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sTableName` | `varchar(100)` | | 2 | IN | `sGuid` | `varchar(100)` | | 3 | IN | `sFormGuid` | `varchar(100)` | | 4 | IN | `sLoginId` | `varchar(100)` | | 5 | IN | `sBrId` | `varchar(100)` | | 6 | IN | `sSuId` | `varchar(100)` | | 7 | IN | `iFlag` | `int` | | 8 | OUT | `sCode` | `int` | | 9 | OUT | `sReturn` | `varchar(4000)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Check_sLos`'`._ ## Narrative **Business context:** 销售管理 → 物流管理 → 物流单 (sLos = logistics-order, on `logisticsordermaster`/`logisticsorderslave`/`logisticsorderdetails`) — post-save validator and price-split back-calculator for the 物流单 form. Apportions one logistics-fee (`logisticsorderdetails.dProductMoney`) across the document's material lines (`logisticsorderslave`) proportionally to each line's source money. **What it does:** Refuses save when the document is a pre-audit (`bAheadComplete=1`) — `paramssLogisticPreReviewErro`. Enforces a single 税码 (`sTaxId`) and single 物流商 (`sSupplyId`) per 物流费用明细 (`sLogisticTaxNeedSame`, `sLogisticProviderNeedSame`). Verifies one `sSrcSlaveId` is not on multiple slaves. Reads `NetMoney/NetPrice` precision. Sums slave `dSrcMoney` and detail `dProductMoney`, then writes `dMaterialsMoney = ROUND(dSrcMoney/totalSrc * totalDetail, 2)` plus the derived `dMaterialsPrice/dMaterialsNoTaxPrice/dMaterialsNoTaxMoney/dMaterialsTaxMoney/dMaterialsForeignMoney/dMaterialsTaxForeignMoney/sTaxId` onto each slave so the freight cost is correctly distributed to each line for downstream cost analysis. **Invocation:** Bound to `gdsmodule.sSaveProName` on `物流单单据` (`101251240115016270322291050`) under 销售管理 → 物流管理. Dispatched by `BusinessBaseServiceImpl.checkUpdate(..., "sSaveProName")` after the save batch commits. Pre-save peer is `Sp_beforeSave_sLos`; audit handler is `Sp_Calc_sLos` (which also references `Sp_Check_sLosTest`, an earlier draft). xly-src ships `script/标版/30100101/Sp_Check_sLos.sql` as the install body.