# `Sp_bi_workshop_1` (procedure)

> @author:zhucx
							@date:20211224 
							@describe: 印刷车间


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

## Parameters

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

## Body

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

## Narrative

**Business context:** BI / 印刷车间 — workshop-dashboard data builder for the printing shop floor (`@describe: 印刷车间`, `@author:zhucx 20211224`). Aggregates real-time machine PLC telemetry, plan progress, and OEE into the `p_Bd_workshop` snapshot used by an external dashboard.

**What it does:** Pulls live data from `plc_machinedata`, `plc_machinedata_status`, `plc_oeeupdate`, and `mftproducereportmachinestate`, joins to `mftproductionplanslave` / `mftproductionreportslave` and the `viw_plc_machine` view, then materialises per-machine actual vs. plan counters into `p_Bd_workshop` (and `p_Bd_PlcNo_No` for unmapped PLC numbers). The commented header notes legacy `Mft_WorkOrder` / `Mft_WorkOrder_Parts_Process` references kept for reference.

**Invocation:** Status: appears orphaned. No caller found in the database (no other routine, no form-master, no gdsmodule hook); the only xly-src hit is `script/标版/30100101/Sp_bi_workshop_1.sql` (the install script itself). Likely invoked by an external BI dashboard via a direct `CALL`; not wired into the standard ERP module surface. Candidate for maintainer audit to confirm if any 大屏/可视化 client still reaches it.
