# `Sp_bi_workshop_2` (procedure)

> 单机主数据源


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

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

## Body

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

## Narrative

**Business context:** BI / 单机主数据源 — per-machine dashboard datasource (header comment: `单机主数据源`). Builds the "current machine card" payload — machine name, current process, team, planned vs. produced quantities, hourly rate — for one PLC number `sPlcNo`.

**What it does:** Reads `viw_plc_machine` and `plc_machinedata` for the supplied `sPlcNo`, looks up the machine's current work order / process / team via `mftproductionreportmaster` joined to `eleproduct` and `eleteam`, sums planned quantity from `mftproductionplanslave` and reported quantity from `mftproductionreportslave`, and computes hourly throughput using the `p_bd_MachinePlanTemplate` template row.

**Invocation:** Status: appears orphaned. No caller found in any channel (form-master, gdsmodule hooks, other routines, xly-src grep). Likely invoked by an external single-machine BI screen via direct `CALL Sp_bi_workshop_2(?, ?, ?)`. Candidate for maintainer audit.
