# `Sp_bd_MachinePlanStatus` (procedure) > 机台当前转台饼形图 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sPlcNo` | `varchar(100)` | | 2 | IN | `sLoginId` | `varchar(100)` | | 3 | OUT | `sReturn` | `varchar(4000)` | | 4 | IN | `sBrId` | `varchar(100)` | | 5 | IN | `sSuId` | `varchar(100)` | | 6 | OUT | `sCode` | `int` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_bd_MachinePlanStatus`'`._ ## Narrative **Business context:** 机台当前转台饼形图 — single-machine current-shift pie chart on the 看板管理 / 车间效率综合看板 dashboard. For one PLC machine (parameter `sPlcNo`), splits hours since the shift began into 总时间 / 设备保养 / 设备异常 / 待料 / 调机 / 生产 buckets. **What it does:** Resolves the target machine from `elemachine` by `iPlcNo=sPlcNo`, calls `Fun_GetMachineWorkStartDate(p_iPlcNo, sBrId, sSuId)` to find the current shift start, and aggregates `plc_machinedata.dProduceHour/3600` per `sStatus` since that start into `p_bd_MachinePlanStatus(sName,sValue)` rows including '设备保养' (`sStatus='maintain'`), '设备异常' (`abnormal`), '待料' (`waitingWork`), '调机' (`dAdjustableQty>0`), '生产' (`endWorked`). Returns the table as the pie JSON envelope. Returns `sCode=-1` "传入机台机次号错误" when the machine lookup is empty. **Invocation:** Installed by `xly-src/script/标版/30100101/Sp_bd_MachinePlanStatus.sql`. No form-master sSqlStr, no `gdsmodule` hook, no other-routine caller, no Java caller. Reachable only via an external dashboard HTTP endpoint that invokes the proc by name.