Sp_bd_EqAnalysis.md 1.85 KB

Sp_bd_EqAnalysis (procedure)

设备状态全面分析

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

Parameters

# Mode Name Type
1 IN sBrId varchar(100)
2 IN sSuId varchar(100)
3 OUT sCode int
4 OUT sReturn varchar(255)

Body

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

Narrative

Business context: 大屏展示 → 功能模块 → 小模块-设备全面分析 — full-status equipment dashboard tile, reports per-machine 当前工单/当前状态/班次类型/计划数量/已完成数量 across all production machines for live wallboard display.

What it does: Builds p_bd_EqAnalysis with per-machine attributes from elemachine (iPlcNo>0 and MOD(iPlcNo,14) BETWEEN 1 AND 12), then joins plc_currentmachinevalue (by sPlcsStatusName='当前工单号' and status-code lookups: 256→生产中, etc.) to fill 当前状态/工单/产量, also joining mft_workorder* for the work-order's customer/product/part. Emits the table-as-JSON into sReturn (note: declared as varchar(255) — likely too narrow for the multi-machine JSON, callers may see truncation).

Invocation: Form-master sSqlStr in gdsconfigformmaster.sId=101251240115016087744264440 under 大屏展示 → 功能模块 → 小模块-设备全面分析. Installed by xly-src/script/标版/30100101/Sp_bd_EqAnalysis.sql. No gdsmodule hook, no other-routine caller, no Java caller (form-master is the live channel).

Flag: sReturn varchar(255) output is narrower than the full-machine JSON — likely truncates in production; callers should compare expected length vs LENGTH(sReturn). MOD(iPlcNo,14) filter shares the test-PLC convention with sibling EqAdjust/Eqabnormal.