Fun_GetPackQty.md 1.31 KB

Fun_GetPackQty (function)

获取PackQty

  • 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 FUNCTIONFunGetPackQty'._

Narrative

Business context: OEE管理 → 打印成品标签(OEE) — when printing finished-product carton labels, decides how many pieces go into one pack based on the product's paper size (A5/A4/A3/A2/A1, 32开/16开/8开/4开/2开, or explicit WxH like 210*140, 285*210, 570*870) so each carton stays under a per-size cap (5000, 2500, or 2000 pieces, scaled by CEIL(qty/cap)).

What it does: A large CASE keyed on LOCATE(<size>, p_sProductStyle); for each size class, returns either the full qty when it fits in one carton, or qty / CEIL(qty / cap) (an even split into the minimum number of cartons). Unknown styles return null.

Invocation: Embedded in form gdsconfigformmaster.sId='16054917120005195223325896784000' (parent module 打印成品标签(OEE)OEE管理), alongside the sibling Fun_GetTrunkQty, against mftworkorderslave + eleproduct.