# `fun_workproduct_used` (function)

> 工单从表使用情况


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `p_workorderslaveId` | `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_workproduct_used`'`._

## Narrative

**Business context:** Work-order finished-product usage check — for a given `mftworkorderslave.sId`, returns a human-readable string naming the first downstream bill (finished-goods put-away or customer receipt) tied to that slave row. Header gloss: "工单从表使用情况".

**What it does:** Looks for the slave row's sId in `Viw_PitProductInStore.sSrcSlaveId` → returns `'成品入库:<sBillNo>'`. Otherwise checks `viw_cahreceipt.sSrcSlaveId` → returns `'收款单:<sBillNo>'`. Empty string if neither hit.

**Invocation:** Status: appears orphaned. No routine, form-master, gdsmodule, or xly-src caller. Companion to `fun_workmaterials_used` / `fun_workprocess_used` — the trio was clearly designed for a save-time "can-delete?" gate on the work-order edit form, but the consuming `Sp_WorkOrder_CheckUpdateNew` proc is itself unhooked, leaving this function with no live path. Candidate for maintainer audit.
