Sp_MachinePoweranalysis_2.md 1.79 KB

Sp_MachinePoweranalysis_2 (procedure)

机台用电分析_折线

  • Type: PROCEDURE
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sLoginId varchar(100)
2 IN tStartDate datetime
3 IN tEndDate datetime
4 IN p_sMachineId varchar(100)
5 IN sBrId varchar(100)
6 IN sSuId varchar(100)
7 IN bFilter varchar(5000)
8 OUT sCode int
9 OUT sReturn longtext

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpMachinePoweranalysis_2'._

Narrative

Business context: 生产管理 → 设备能耗看板 — single-machine 折线 dashboard chart returning the last ~25 hours of 度数 (dElectricityQty) on a 10-minute grid from plc_machinedata. Companion of Sp_MachinePoweranalysis_1 (pie).

What it does: Treats tEndDate as "now" (truncated to the minute), seeds a 150-row p_index temp filled with 10-minute slots back to tEndDate - 1500 min (~25h). Walks plc_machinedata rows for p_sMachineId in the window via a cursor and distributes each row's dElectricityQty across the overlapping p_index slots (the proc reuses Sp_MachineSpeedanalysis_2-prefixed temp-table names — sibling layout, no CALL). Returns sReturn as a chart-master {"data":[{x:tCreateDate, y:dRate}, …]} JSON via GROUP_CONCAT.

Invocation: Status: appears orphaned. No gdsconfigcharmaster.sProcedureName binding, no gdsmodule.sProcName, not referenced by any other routine (only sibling temp-table name re-use), not present in xly-src. Output shape matches dashboard chart conventions — candidate for maintainer audit to confirm which chart tile owns it.