Fun_GetMaterialsQtyUnitSupple.md 1.53 KB

Fun_GetMaterialsQtyUnitSupple (function)

  • Type: FUNCTION
  • Returns: varchar(100)
  • 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)

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTIONFunGetMaterialsQtyUnitSupple'._

Narrative

Business context: Supplementary material-qty conversion — the board / 瓦楞 (corrugated) variant of Fun_GetMaterialsQtyUnit. Loads the same EleMaterials row but additionally pulls dThickness, then forces the carrier unit to 'M' (length) and folds thickness into dGramWeight, so the same area×weight formulas yield linear-meter consumption for sheet/board stock.

What it does: Same dispatch as Fun_GetMaterialsQtyUnit (parse style, branch on dimension count / unit / reel flag, apply CbxMaterialsUnit-scaled formula), but with sMaterialsUnit ← sAuxiliaryUnit, sAuxiliaryUnit ← 'M', dGramWeight *= IFNULL(NULLIF(dThickness,0),1) applied up front.

Invocation: Called by Sp_Quotation_CalcDataFlex and Sp_WorkOrder_CalcDataFlex — the soft-pack / 柔性 quotation and work-order cost-calculation procedures (the "Flex" branch in 报价 / 工单 standard-cost). Sibling of Fun_GetMaterialsQtyUnit.