# `fun_getWorkProcess_NextQty` (function)

> 获取工单工序下投入数


- **Type:** FUNCTION
- **Returns:** `longtext`
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `p_sWorkOrderControlId` | `varchar(255)` |
| 2 | IN | `sBrId` | `varchar(255)` |
| 3 | IN | `sSuId` | `varchar(255)` |

## Body

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

## Narrative

**Business context:** Next-process input-quantity probe — for a given `mftworkordercontrol.sId`, returns the `dProcessInQty` (next-process input quantity / 下道工序投入数) of the first finished-process (`sType=3`) step in the same work-order. Used by work-order standards-aggregator routines that need to plan how much of a finished product the next stage consumes.

**What it does:** `SELECT sParentId FROM mftworkordercontrol WHERE sId=p_sWorkOrderControlId` → `p_sWorkOrderId`, then `SELECT dProcessInQty FROM mftworkorderprocess WHERE sParentId=p_sWorkOrderId AND sType=3 ORDER BY iOrder LIMIT 1`.

**Invocation:** referenced by `Sp_Calc_sWod` (work-order delivery 工单delivery std-calc), `Sp_WorkOrder_CalcDataPackLastStd` and `Sp_WorkOrder_CalcDataPackProductStd`. Building block of the work-order calc chain.
