Sp_GET_OeeFistOneDataByMachineId.md 2.16 KB

Sp_GET_OeeFistOneDataByMachineId (procedure)

OEE获取第一条数据

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

Parameters

# Mode Name Type
1 IN sPlcId varchar(100)
2 IN sReportTag varchar(10)
3 IN sBrId varchar(100)
4 IN sSuId varchar(100)
5 OUT sCode int
6 OUT sReturn longtext

Body

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

Narrative

Business context: OEE 看板 / 报工 (Overall Equipment Effectiveness, shopfloor terminal). Header banner OEE获取第一条数据. Returns the latest plc_machinedata row for a machine plus the rolling adjust/produce/abnormal-time totals since the last production-report tCreateDate — used by the OEE terminal to bootstrap the screen and by the 上报 button to compute the time deltas it will write back.

What it does: With sReportTag='1' (the 上报按钮 path): looks up the latest plc_machinedata row for sMachineId to get p_sPlcDateId, p_sPlanSlaveId; reads viw_mftproductionreport for the last report tCreateDate (p_tlastreportDate). Then aggregates plc_machinedata per machine + plan-slave between p_tlastreportDate and now into three totals: p_dAdjustHour, p_dAdjustQty from rows with sStatus='adjustment' and dHour*60 > 1; p_dHour from sStatus IN ('startWorking','waitingWork','doWorkEnd'); p_dAbnormalHour from stops over 15 minutes. Returns these alongside the latest PLC snapshot.

Invocation: Called from Java by three call sites — all use procedureService.getDoProMap("Sp_GET_OeeFistOneDataByMachineId", …) + procedureService.getCallPro(…):

  • LoginController.userOeelogin(...) (/userOeelogin/{sBrandsId}/{sSubsidiaryId}/{sTeamId}/{sMachineId}) — bootstrap when the operator logs in at the machine terminal.
  • OeeServiceImpl (~line 459) — main OEE service refresh.
  • OeeHandleServiceImpl (~line 1022) — used by the 上报 handler. xly-src ships script/标版/30100101/schedule/Sp_GET_OeeFistOneDataByMachineId.sql.