Sp_bd_EqSpeed.md 1.87 KB

Sp_bd_EqSpeed (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 varchar(5000)

Body

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

Narrative

Business context: 速度嫁动率 — speed-utilization (速度稼动率) bar chart on the 看板管理 / 数字工厂 dashboard. For each MES-instrumented machine, divides actual produced quantity by dProduceTime × dAvgRate over the last 24-hour shift window to produce a 0–120% utilization percentage.

What it does: Materialises p_bd_EqSpeed from elemachine (filtered by tenant + MOD(iPlcNo,14) BETWEEN 1 AND 12 test-PLC exemption, default dAvgRate=8000 when missing). Walks plc_machinedata between yesterday's sOffWork and today's sOffWork per-machine to sum dProcessQty (max minus min per work-order) into dTotalQty and dProduceHour/3600 into dTotalTime (only for endWorked/waitingWork rows). Returns JSON {"data":[{"x":<utilizationPct>,"y":"<sMachineName>"}], "xUnit":"%","yUnit":""} capping the per-machine value at 120%.

Invocation: Installed by xly-src/script/标版/30100101/Sp_bd_EqSpeed.sql. The four Sp_plc_implementation* procs each carry a -- call Sp_bd_EqSpeed(...) debug comment but never actually invoke it. No form-master sSqlStr, no gdsmodule hook, no Java caller — reachable only via an external dashboard HTTP endpoint that invokes the proc by name.

Tenant-specific MOD(iPlcNo,14) BETWEEN 1 AND 12 test-PLC exemption — re-mapping needed if PLC numbering differs.