# `Fun_GetknifeProcessQty` (function)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sKnifeMouldGuid` | `varchar(100)` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTION `Fun_GetknifeProcessQty`'`._

## Narrative

**Business context:** Knife-mould (刀模 / cutting-die) cumulative-usage estimator. For a given knife-mould id it sums the planned machine quantity (`dSumMachineAllQty`) across every active work-order control row that uses the die, so dies near their service-life ceiling can be flagged for replacement.

**What it does:** joins `mftworkorderprocess A → mftworkordercontrol B → mftworkordermaster C` on `A.sKnifeMouldId = sKnifeMouldGuid` filtering `C.bInvalid = 0` and `C.bCheck = 1`. Groups by `B.sId` then sums `B.dSumMachineAllQty`; returns `0` if no rows match.

**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. Likely once embedded in a knife-mould lifetime report that has since been retired.
