Sp_sTeamSpeedanalysis.md 2.5 KB

Sp_sTeamSpeedanalysis (procedure)

设备速度分析

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

Parameters

# Mode Name Type
1 IN tStartDate datetime
2 IN tEndDate datetime
3 IN sBrId varchar(100)
4 IN sSuId varchar(100)
5 IN sLoginId varchar(100)
6 IN bFilter varchar(5000)
7 IN pageNum int
8 IN pageSize int
9 OUT totalCount int
10 IN countCloumn varchar(5000)
11 OUT countMapJson longtext
12 IN sFilterOrderBy varchar(5000)
13 IN sGroupby_select_sql varchar(5000)
14 IN sGroupby_group_sql varchar(5000)

Body

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

Narrative

Business context: 生产分析 — 设备速度分析: aggregate machine production-hours per (machine, team) for a date window. Computes how many hours each machine spent producing under each team, joined to elemachine (machine name/no/type) and eleteam (team name) — i.e., the "设备速度" view used by 班组稼动率 / 设备效率 reports.

What it does: Defaults tStartDate to NOW() - 1 month if null, creates temp table Tmp_eleteam_1 (machine + team + total hours), INSERT ... SELECT P.sId, P.sMachineId, P.sTeamId, SUM(IFNULL(P.dProduceHour,0))/3600 AS dTotalTime FROM plc_machinedata P WHERE P.tStartDate >= tStartDate AND P.tStartDate < tEndDate GROUP BY sMachineId, sTeamId. Joins elemachine for sMachineName/sMachineNo/sMachineType, eleteam for sTeamName. Then defers to Sp_Do_UpdateByPageSizeBefore(bFilter, pageNum, pageSize, countCloumn, 'Tmp_eleteam_1', sFilterOrderBy, sGroupby_select_sql, sGroupby_group_sql, totalCount, countMapJson) for paging/aggregation, and finally SELECT * FROM Tmp_eleteam_1 AS A (orderable via sFilterOrderBy) as the result set.

Invocation: Standard paged-report signature (bFilter, pageNum, pageSize, countCloumn, sFilterOrderBy, sGroupby_*), but no gdsconfigformmaster.sSqlStr/sConfigSqlStr reference, no gdsmodule hook, no other DB caller, no xly-src reference. Status: appears orphaned — likely a draft or replaced report. The live 班组稼动率 / 设备速度 forms (19211681019715708722709010 etc.) bind to different SQL fragments over plc_machinedata directly, not to this proc. Candidate for maintainer audit.