Пример #1
0
 private double SALongDurationByType(String tags, int alarmType, double alarmDuration)
 {
     double Result = 0.0f;
     String[] Tags = tags.Split(',');
     List<int?> Durations = new List<int?>();
     int? Duration = 0;
     using (KPI_OverLimitRecordDal DataAccess = new KPI_OverLimitRecordDal()) {
         foreach (String TagID in Tags) {
             if (!IsCalcShift) {
                 Duration = (from p in DataAccess.GetOverLimitRecords(BeginTime, EndTime, TagID, alarmType)
                             where p.Duration >= alarmDuration
                             select p.Duration).Sum();
                 Durations.Add(Duration);
             }
             if (IsCalcShift) {
                 Duration = (from p in DataAccess.GetShiftOverLimitRecords(BeginTime, EndTime, TagID, alarmType)
                             where p.Duration >= alarmDuration
                             select p.Duration).Sum();
                 Durations.Add(Duration);
             }
         }
     }
     Result = Convert.ToDouble(Durations.Sum());//超限时长单位:秒
     Result = Result / 60;//超限时长转换为分钟
     return Result;
 }
Пример #2
0
 private double SADurationByType(String tags, int alarmType)
 {
     double Result = 0.0f;
     String[] Tags = tags.Split(',');
     List<int?> Durations = new List<int?>();
     using (KPI_OverLimitRecordDal DataAccess = new KPI_OverLimitRecordDal()) {
         foreach (String TagID in Tags) {
             if (!IsCalcShift) Durations.Add(DataAccess.GetOverLimitRecords(BeginTime, EndTime, TagID, alarmType).Sum(p => p.Duration));
             if (IsCalcShift) Durations.Add(DataAccess.GetShiftOverLimitRecords(BeginTime, EndTime, TagID, alarmType).Sum(p => p.Duration));
         }
     }
     Result = Convert.ToDouble(Durations.Sum());//超限时长单位:秒
     Result = Math.Ceiling(Result / 60);//超限时长转换为分钟
     return Result;
 }
Пример #3
0
 private double SALongCountByType(string tags, double alarmDuration, int alarmType)
 {
     //double Result = 0.0f;
     String[] Tags = tags.Split(',');
     List<int> Counts = new List<int>();
     int Count;
     /*List<int?> Durations = new List<int?>();
     int? Duration = 0;
     using (KPI_OverLimitRecordDal DataAccess = new KPI_OverLimitRecordDal()) {
         foreach (String TagID in Tags) {
             Duration = (from p in DataAccess.GetOverLimitRecords(BeginTime, EndTime, TagID, alarmType)
                         where p.Duration >= alarmDuration
                         select p.Duration).Sum();
             Durations.Add(Duration);
         }
     }
     foreach (int? duration in Durations) {
         if (duration.HasValue) Result += duration.Value / alarmDuration;
     }*/
     using (KPI_OverLimitRecordDal DataAccess = new KPI_OverLimitRecordDal()) {
         foreach (String TagID in Tags) {
             if (!IsCalcShift) {
                 Count = (from p in DataAccess.GetOverLimitRecords(BeginTime, EndTime, TagID, alarmType)
                          where p.Duration >= alarmDuration
                          select p.Duration).Count();
                 Counts.Add(Count);
             }
             if (IsCalcShift) {
                 Count = (from p in DataAccess.GetShiftOverLimitRecords(BeginTime, EndTime, TagID, alarmType)
                          where p.Duration >= alarmDuration
                          select p.Duration).Count();
                 Counts.Add(Count);
             }
         }
     }
     return Counts.Sum();
 }
Пример #4
0
 private double SACountByType(string tags, int alarmType)
 {
     double Result = 0.0f;
     String[] Tags = tags.Split(',');
     List<int> Durations = new List<int>();
     using (KPI_OverLimitRecordDal DataAccess = new KPI_OverLimitRecordDal()) {
         foreach (String TagID in Tags) {
             if (!IsCalcShift) Durations.Add(DataAccess.GetOverLimitRecords(BeginTime, EndTime, TagID, alarmType).Count());
             if (IsCalcShift) Durations.Add(DataAccess.GetShiftOverLimitRecords(BeginTime, EndTime, TagID, alarmType).Count());
         }
     }
     Result = Durations.Sum();
     return Result;
 }