Пример #1
0
 private void MakeSeriesPoint(IList <SeriesPointDTO> lstPoints, DateTime?curSensorDate, decimal?valueNumber)
 {
     if (valueNumber != null && valueNumber.HasValue)
     {
         SeriesPointDTO sp = new SeriesPointDTO();
         sp.Argument     = curSensorDate.Value.ToString("yyyy-MM-dd HH:mm:ss.fff");
         sp.Values       = new double[] { Convert.ToDouble(valueNumber.Value) };
         sp.ReceivedDate = curSensorDate;
         lstPoints.Add(sp);
     }
 }
Пример #2
0
        private SeriesDTO ToSeriesDTO(SensorDataHeadEntity eHead, string seriesName, DataRow[] rows)
        {
            if (rows != null && rows.Length > 0)
            {
                IList <SeriesPointDTO> lstPoints = new List <SeriesPointDTO>();
                SeriesPointDTO         sp        = null;

                int      spCount       = 0;
                DateTime?curSensorDate = null;
                DateTime?preSensorDate = null;
                double   dif           = 0;
                foreach (DataRow row in rows)
                {
                    long sts = Convert.ToInt64(row["SensorTimeSpan"]);

                    curSensorDate = ParseHelper.ParseToDateTime(row["SensorDate"]);

                    // 间隔
                    spCount++;
                    if (spCount > 1 && spCount < rows.Length)
                    {
                        dif = curSensorDate.Value.Subtract(preSensorDate.Value).TotalMilliseconds;

                        if (dif < mReadingInterval)
                        {
                            continue;
                        }
                    }

                    sp              = new SeriesPointDTO();
                    sp.Argument     = curSensorDate.Value.ToString("yyyy-MM-dd HH:mm:ss.fff");
                    sp.Values       = new double[] { Convert.ToDouble(row["ContentNumber"]) };
                    sp.ReceivedDate = Convert.ToDateTime(row["ReceivedDate"]);

                    lstPoints.Add(sp);

                    preSensorDate = curSensorDate;
                }

                SeriesDTO s = new SeriesDTO();
                s.SeriesTitle = seriesName;
                s.Points      = lstPoints;
                return(s);
            }
            else
            {
                return(null);
            }
        }
Пример #3
0
        private SeriesDTO ToSeriesDTO(string seriesName, IList <MonitorCollectDataEntryEntity> lstDetail, string propertyName)
        {
            if (lstDetail != null && lstDetail.Count > 0)
            {
                IList <SeriesPointDTO> lstPoints = new List <SeriesPointDTO>();
                SeriesPointDTO         sp        = null;

                int      spCount       = 0;
                DateTime?curSensorDate = null;
                DateTime?preSensorDate = null;
                double   dif           = 0;
                foreach (MonitorCollectDataEntryEntity row in lstDetail)
                {
                    curSensorDate = row.FDate;

                    // 间隔
                    spCount++;
                    if (spCount > 1 && spCount < lstDetail.Count)
                    {
                        dif = curSensorDate.Value.Subtract(preSensorDate.Value).TotalMilliseconds;

                        if (dif < mReadingInterval)
                        {
                            continue;
                        }
                    }

                    sp              = new SeriesPointDTO();
                    sp.Argument     = curSensorDate.Value.ToString("yyyy-MM-dd HH:mm:ss.fff");
                    sp.Values       = new double[] { Convert.ToDouble(Common.Utility.GetValueByProperty(row, propertyName)) };
                    sp.ReceivedDate = curSensorDate;

                    lstPoints.Add(sp);

                    preSensorDate = curSensorDate;
                }

                SeriesDTO s = new SeriesDTO();
                s.SeriesTitle = seriesName;
                s.Points      = lstPoints;
                return(s);
            }
            else
            {
                return(null);
            }
        }