| | |
| | | ObjectID = configure.ObjectID, |
| | | DataTime = DateTime.Now, |
| | | RSa = Yw.Run.RunStatus.Shut, |
| | | ContinueTime = configure.Frequency, |
| | | TotalShutTime = configure.Frequency, |
| | | ContinueTime = 0, |
| | | TotalShutTime = 0, |
| | | TotalRunTime = 0, |
| | | BootTimes = 0, |
| | | AnalyStatus = Yw.Run.AnalyStatus.Normal, |
| | |
| | | if (lastRunRecord == null) |
| | | { |
| | | runRecord.AnalyInfo = "首次分析"; |
| | | if (lastRecord == null) |
| | | { |
| | | runRecord.AnalyStatus = Yw.Run.AnalyStatus.Missing; |
| | | } |
| | | else |
| | | { |
| | | if (Yw.Monitor.DataStatus.HasError(lastRecord.DataStatus)) |
| | | { |
| | | runRecord.AnalyStatus = Yw.Run.AnalyStatus.Abnormal; |
| | | } |
| | | else |
| | | { |
| | | if (int.TryParse(lastRecord.DataValue, out int intDataValue)) |
| | | { |
| | | if (intDataValue > Yw.Monitor.RunStatus.Shut) |
| | | { |
| | | runRecord.RSa = Yw.Run.RunStatus.Run; |
| | | runRecord.BootTimes += 1; |
| | | runRecord.TotalRunTime += configure.Frequency; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | runRecord.AnalyStatus = Yw.Run.AnalyStatus.Error; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | runRecord.TotalShutTime = lastRunRecord.TotalShutTime; |
| | | runRecord.TotalRunTime = lastRunRecord.TotalRunTime; |
| | | runRecord.BootTimes = lastRunRecord.BootTimes; |
| | | |
| | | if (EMWSRunAnalyChangeTimesHelper.HasChanged(configure.ID, configure.ChangeTimes)) |
| | | { |
| | | runRecord.RSa = runRecord.RSa == Yw.Run.RunStatus.Run ? Yw.Run.RunStatus.Shut : Yw.Run.RunStatus.Run; |
| | | runRecord.ContinueTime = configure.Frequency; |
| | | if (runRecord.RSa == Yw.Run.RunStatus.Run) |
| | | { |
| | | runRecord.BootTimes += 1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | runRecord.ContinueTime += configure.Frequency; |
| | | } |
| | | |
| | | if (runRecord.RSa == Yw.Run.RunStatus.Shut) |
| | | { |
| | | runRecord.TotalShutTime += configure.Frequency; |
| | | } |
| | | else |
| | | { |
| | | runRecord.TotalRunTime += configure.Frequency; |
| | | } |
| | | |
| | | var rsa = Yw.Run.RunStatus.Shut; |
| | | if (lastRecord == null) |
| | | { |
| | | runRecord.AnalyStatus = Yw.Run.AnalyStatus.Missing; |
| | |
| | | runRecord.AnalyStatus = Yw.Run.AnalyStatus.Interrupt; |
| | | } |
| | | } |
| | | if (int.TryParse(lastRecord.DataValue, out int intDataValue)) |
| | | { |
| | | rsa = intDataValue > Yw.Monitor.RunStatus.Shut ? Yw.Run.RunStatus.Run : Yw.Run.RunStatus.Shut; |
| | | } |
| | | } |
| | | |
| | | //发生改变 |
| | | if (runRecord.RSa != rsa) |
| | | { |
| | | if (EquipmentRunAnalyChangeTimesHelper.HasChanged(configure.ID, configure.ChangeTimes)) |
| | | { |
| | | runRecord.RSa = rsa; |
| | | runRecord.ContinueTime = 0; |
| | | if (runRecord.RSa == Yw.Run.RunStatus.Run) |
| | | { |
| | | runRecord.BootTimes += 1; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //持续时间 |
| | | runRecord.ContinueTime += configure.Frequency; |
| | | |
| | | //总关机时间 |
| | | if (runRecord.RSa == Yw.Run.RunStatus.Shut) |
| | | { |
| | | runRecord.TotalShutTime += configure.Frequency; |
| | | } |
| | | |
| | | //总运行时间 |
| | | if (runRecord.RSa == Yw.Run.RunStatus.Run) |
| | | { |
| | | runRecord.TotalRunTime += configure.Frequency; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 数据存储 |