Fun_GetReelAuxiliaryQtyUnit.md 2.02 KB

Fun_GetReelAuxiliaryQtyUnit (function)

  • Type: FUNCTION
  • Returns: varchar(100)
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sWorkOrderMaterialsTbId varchar(100)
2 IN sMaterialsGuid varchar(100)
3 IN sMaterialsStyle varchar(100)
4 IN dAuxiliaryQty decimal(18,6)
5 IN iType int
6 IN sBrId varchar(100)
7 IN sSuId varchar(100)

Body

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

Narrative

Business context: Reel (卷筒) variant of Fun_GetAuxiliaryQtyUnit — performs the same auxiliary-unit ↔ purchase-unit conversion for materials but is keyed off MftWorkOrderMaterials instead of MftPurchaseDetailMaterials. The work-order context lets it consult both the materials master (EleMaterials.dGramWeight, bReel, bInverse, dCoefficient) and the per-line auxiliary unit (MftWorkOrderMaterials.sAuxiliaryUnit).

What it does: reads NetSquareM, CbxMaterialsUnit and NetConversionRate from SysSystemSettings (via Fun_GetSystemSetting); reads gram-weight/reel-flag/coefficient/inverse-flag from EleMaterials and the auxiliary/main unit from MftWorkOrderMaterials. Branches on sMaterialsStyle (e.g. 787*1092), the material's main unit (吨/噸/Ton/KG/克/M/M2), and iReel, returning the converted quantity in the requested target unit. iType=0 returns the converted quantity, iType=1 returns the unit string.

Invocation: referenced only by Sp_saveReturn_sPmd (which itself has no discoverable caller). No form-master sSqlStr, gdsmodule hook, in-scope routine caller, or xly-src reference uses this function directly. Status: appears orphaned via dead-caller chain — candidate for maintainer audit. Compare with the production-active siblings Fun_GetAuxiliaryQtyUnit and Fun_GetMaterialsQtyUnit.