# `Sp_bd_TmTime` (procedure)

> 时间嫁动率(分组报表)机台


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sLoginId` | `varchar(100)` |
| 2 | IN | `sBrId` | `varchar(100)` |
| 3 | IN | `sSuId` | `varchar(100)` |
| 4 | IN | `bFilter` | `varchar(5000)` |
| 5 | OUT | `sCode` | `int` |
| 6 | OUT | `sReturn` | `longtext` |

## Body

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

## Narrative

**Business context:** 看板管理 / 时间嫁动率(分组报表)机台 — per-machine time-utilization ratio for the first rotary-press group (`elemachine.iPlcNo` 1-12). Reports productive-hour share across the four shift buckets 昨日白班 / 昨日晚班 / 今日白班 / 今日晚班.

**What it does:** Same `plc_machinedata` ingest as the sibling Tm procs. Aggregates per machine/team/shift into `p_bd_tmTime` where `y` reflects accumulated `dHour` against the standard shift duration. Classifies into 4 shift buckets via the same `sShiftsWork`/`sOffwork` rules, backfills zeroes for non-reporting machines, emits JSON `{data:[{type,y,x}],xUnit:"",yUnit:""}` ordered by `tCreateDate ASC`.

**Invocation:** Installed by `xly-src/script/标版/30100101/Sp_bd_TmTime.sql`. No form-master sSqlStr, no `gdsmodule` hook, no other-routine caller, no Java caller — reachable only via an external dashboard HTTP endpoint. `Sp_bd_TmTime2`/`Sp_bd_TmTime3` cover the PLC 15-26 / 29-40 groups.
