CALC_MATERIALS_SMAIL.md 1.38 KB

CALC_MATERIALS_SMAIL (function)

两变都小于305的材料(单位CM)

  • Type: FUNCTION
  • Returns: decimal(18,6)
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN dQty decimal(18,6)
2 IN dWidth decimal(18,6)
3 IN dLength decimal(18,6)

Body

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

Narrative

Business context: Material yield estimator for cuts taken from a stock board capped at 305 cm per side (board dimensions in cm). Header comment is 两变都小于305的材料(单位CM) ("both sides under 305, unit CM"). Counts how many 305-cm stock boards a batch of dQty pieces of size dWidth × dLength will consume, including offcut reuse.

What it does: sorts the long/short side, peels off any "whole-board" multiples when a side exceeds 305, then loops the remaining pieces along a 305-cm running cutline and uses a JSON list to track usable offcuts (料头). Returns the total board count. Does not read or write any table — pure arithmetic.

Invocation: Status: appears orphaned. No caller found in any channel (form-master sSqlStr, gdsmodule hooks, other routines, exhaustive xly-src grep, dynamic-dispatch search) — candidate for maintainer audit.