Fun_GetTrunkQty.md 1.46 KB

Fun_GetTrunkQty (function)

获取TrunkQty

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

Parameters

# Mode Name Type
1 IN p_sProductStyle varchar(255)
2 IN p_dProductQty decimal(18,6)

Body

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

Narrative

Business context: Trunk/箱 count estimator for OEE finished-goods labelling (生产管理 → OEE → 打印成品标签(OEE), form sId 16054917120005195223325896784000). Given a product style code (paper-size names like A4, A3, 8开, or millimetre styles like 210*285) and a piece count, returns how many shipping trunks the run will fill.

What it does: big CASE over LOCATE(<style-tag>, p_sProductStyle) > 0: A5/210*140/32开/A4/210*285/16开 → CEIL(qty/5000); A3/285*420/8开/A2/420*570/4开/A1/570*870/2开 → CEIL(qty/2500); otherwise NULL. Returns the integer trunk count.

Invocation: referenced by the OEE label-print form-master sSqlStr at sId 16054917120005195223325896784000 (生产管理 → OEE → 打印成品标签(OEE)). The xly-src copy lives under script/标版/30000101/Fun_GetTrunkQty.sql and the form-master upgrade script under script/标版/20210323/gdsconfigformmaster.sql. The conversion ratios are hard-coded paper-product values; non-paper businesses will see NULL.