Fun_GetProcessAuxiliaryQty (function)
- Type: FUNCTION
-
Returns:
varchar(100) - Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sMaterialsStyle |
varchar(100) |
| 2 | IN | sAuxiliaryUnit |
varchar(100) |
| 3 | IN | sMaterialsUnit |
varchar(100) |
| 4 | IN | dAuxiliaryQty |
decimal(18,6) |
| 5 | IN | sBrId |
varchar(100) |
| 6 | IN | sSuId |
varchar(100) |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTIONFunGetProcessAuxiliaryQty'._
Narrative
Business context: Process-step area conversion — when a process records its qty in 张 (sheets) but the material is stocked in M2, converts sheet-count to square-metres using the sheet size (WxH parsed from sMaterialsStyle) and the global CbxMaterialsUnit system setting (MM/CM/INCH, with NetConversionRate for inch→m). When the auxiliary unit already matches the material unit or the material unit isn't M2, returns dAuxiliaryQty unchanged.
What it does: Loads CbxMaterialsUnit (and NetConversionRate for INCH) via Fun_GetSystemSetting; counts * in style; if exactly one * and the units differ and material is M2, splits dimensions, computes qty * left * right with the scale factor for MM/CM/INCH; else passes qty through.
Invocation: Called by Sp_Check_sOis, Sp_Check_sOpc, Sp_Check_sOpkg, Sp_Check_sOpn, Sp_Check_sOpn1 — the Sp_Check_* audit procedures that verify per-process auxiliary quantities against material-unit totals in inspection/check workflows.