# `Sp_Bd_bi20_1` (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)` |
| 4 | OUT | `sCode` | `int` |
| 5 | OUT | `sReturn` | `longtext` |

## Body

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

## Narrative

**Business context:** 喷码+分切现场 稼动图 — single-machine 稼动率 (OEE / utilization rate) sub-chart for one PLC machine on the 喷码现场 kanban. Companion to `Sp_Bd_bi20` (the multi-machine status board) — `_1` returns the utilization rate gauge for one machine identified by `sPlcNo`.

**What it does:** Reads `elemachine` + `viw_plc_machine` for `iPlcNo=sPlcNo` to resolve `sMachineGuid`, `sTeamId`, `sOffWork`/`sShiftsWork`, machine `sWorkType`. Computes the shift window (`p_tStartDate` = `FUN_GET_DATE_BC_STARTDATE_NEW(NOW(),p_sOffWork,p_sShiftsWork)`, `p_tEndDate=NOW()`), then aggregates `plc_machinedata.dProduceHour` per `sStatus` (working/idle/changeover/...) into `p_bd_MachinePlanTemplate3`, divides 实际生产秒 by 总秒数 to compute 时间稼动率 (`p_dTimeOee`), 速度稼动率 (`p_dSpeedOee`), and 总稼动率 (`p_dOee`), and emits a JSON gauge `{"data":[{"x":"OEE","y":...}], "subTitle":"<总稼动率%>"}` into `sReturn`.

**Invocation:** Installed by `xly-src/script/标版/30100101/kanban/Sp_Bd_bi20_1.sql`. No form-master sSqlStr, no `gdsmodule` hook, no other-routine caller (other than as a string in the `_new`/`_newZZT` evolution variants), no Java caller. Status: appears reachable only via an external dashboard HTTP endpoint that invokes the proc by name. Per wiki scope, kanban dashboard procs sit outside the routine call-graph wiring tracked in this catalog.
