# `Sp_Bd_bi20_2new` (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` | `varchar(5000)` |

## Body

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

## Narrative

**Business context:** 单个机台时间分析 — current production rewrite of `Sp_Bd_bi20_2`. Same intent (single-machine per-status hour breakdown for the 喷码现场 kanban) installed via the 2025-06-16 install bundle.

**What it does:** Same shape as `Sp_Bd_bi20_2` — reads `elemachine` for `iPlcNo=sPlcNo`, computes shift window via `FUN_GET_DATE_BC_STARTDATE_NEW`, aggregates `plc_machinedata.dProduceHour` per `sStatus` (NULL → `waitingWork`), joins `plc_machinedata_status` for label+color, returns per-status rows.

**Invocation:** Installed by `xly-src/script/标版/20250616/Sp_Bd_bi20_2new.sql`. No form-master sSqlStr, no `gdsmodule` hook, no live other-routine caller (only as a comment-string in commented-out CALL lines in `Sp_MachinePoweranalysis_1`/`Sp_MachineSpeedanalysis_1`), 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.

Flag: `--  Call Sp_Bd_bi20_2(14, ...)` comment-header (note `_2`, not `_2new`) was copy-pasted from `_2` and not updated — minor doc drift.
