# `sp_GetMaterialsQtyUnit` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sMaterialsGuid` | `varchar(100)` | | 2 | IN | `sMaterialsStyle` | `varchar(100)` | | 3 | IN | `dAuxiliaryQty` | `decimal(18,6)` | | 4 | IN | `iType` | `int` | | 5 | IN | `sBrId` | `varchar(100)` | | 6 | IN | `sSuId` | `varchar(100)` | | 7 | OUT | `sCode` | `int` | | 8 | OUT | `sReturn` | `varchar(5000)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `sp_GetMaterialsQtyUnit`'`._ ## Narrative **Business context:** Procedure variant of the material-qty unit converter — given a material guid + 规格 + 辅助数量, branches on `EleMaterials.sMaterialsUnit` vs `sAuxiliaryUnit` (令/张/吨/Ton/etc.) and the gram-weight + `CbxMaterialsUnit` (MM/CM/INCH) system setting to return either the converted quantity (`iType=0`) or the chosen auxiliary unit (`iType=1`). Same intent as the live `Fun_GetMaterialsQtyUnit` function but with the SELECT-returns-rowset shape instead of RETURN. **What it does:** Reads `EleMaterials` columns into locals, computes 张/令/吨/Ton conversions from the printed-format 长×宽 + 克重 + `NetConversionRate` (INCH path) or simple multiplier-of-500 (令↔张), and SELECTs the result. Handles `bInverse` inversion and `bReel` (卷材) carve-out. **Invocation:** Status: appears orphaned. No caller found in any channel (form-master, gdsmodule hooks, other routines, xly-src grep across all extensions). Superseded by the FUNCTION `Fun_GetMaterialsQtyUnit` (50+ proc callers + Java `CalculationStdServiceImpl`/`ReplaceFieldServiceImpl`) and its `Supple`/`BQ`/`_copy1` siblings — the function form fits MySQL's expression contexts the procedure cannot. Keep only as the pre-function reference implementation.