# `Sp_bd_TmAnalysis` (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_TmAnalysis`'`._ ## Narrative **Business context:** 看板管理 — "单个机台时间分析" donut tile. Time-by-status breakdown for one PLC-mapped press over the current shift window (anchored on `elemachine.sOffWork` / `sShiftsWork`). **What it does:** Resolves `sMachineGuid`, `sOffWork`, `sShiftsWork` from `elemachine` by `iPlcNo`/`sBrandsId`/`sSubsidiaryId`, computes the shift boundary, then SUMs `plc_machinedata.dProduceHour` grouped by `sStatus` (empty status coerced to `waitingWork`) for that machine in the last shift window. Each status is translated to its Chinese label (生产中 / 下班停机 / 设备异常 / 设备保养 / 文件异常 / 纸张异常 / 待料异常 / 停机待料) and serialised to a JSON donut payload `{"data":[{"x":