예제 #1
0
        public WaveData[] LoadWaveDatas(RepairConfiguration repairConf)
        {
            WaveData[] datas = new WaveData[2];
            string     query =
                "SELECT TOP 1 [AsyncData],[AsyncFMax],[AsyncLine] " +
                "FROM [" + DataConnection.Database + "].[dbo].[WaveData] " +
                "WHERE [ChannelId]=" + repairConf.Channel.Id + " AND [DateTime] BETWEEN '" + repairConf.StartDateStr + "' AND '" + repairConf.BeforeRepairDate.ToString("yyyy-MM-dd") + "' ";
            DataTable table = GetResultByQuery(query, DataConnection);

            if (table.Rows.Count > 0)
            {
                DataRow data    = table.Rows[0];
                byte[]  binData = data.ItemArray[0] as byte[];
                float[] waveArr = new float[binData.Length / 4];
                for (int i = 0; i < waveArr.Length; i++)
                {
                    waveArr[i] = BitConverter.ToSingle(binData, i * 4);
                }
                datas[0] = new WaveData()
                {
                    AsyncData = waveArr, FMax = Convert.ToInt32(data.ItemArray[1]), Line = Convert.ToInt32(data.ItemArray[2])
                };
            }
            query =
                "SELECT TOP 1 [AsyncData],[AsyncFMax],[AsyncLine] " +
                "FROM [" + DataConnection.Database + "].[dbo].[WaveData] " +
                "WHERE [ChannelId]=" + repairConf.Channel.Id + " AND [DateTime] BETWEEN '" + repairConf.AfterRepairDate.ToString("yyyy-MM-dd") + "' AND '" + repairConf.EndDateStr + "' ";
            table = GetResultByQuery(query, DataConnection);
            if (table.Rows.Count > 0)
            {
                DataRow data    = table.Rows[0];
                byte[]  binData = data.ItemArray[0] as byte[];
                float[] waveArr = new float[binData.Length / 4];
                for (int i = 0; i < waveArr.Length; i++)
                {
                    waveArr[i] = BitConverter.ToSingle(binData, i * 4);
                }
                datas[1] = new WaveData()
                {
                    AsyncData = waveArr, FMax = Convert.ToInt32(data.ItemArray[1]), Line = Convert.ToInt32(data.ItemArray[2])
                };
            }
            return(datas);
        }
예제 #2
0
        public List <DataTable> LoadRepairData(RepairConfiguration repairConf)
        {
            List <DataTable> dataList = new List <DataTable>();
            string           query    = string.Empty;

            foreach (var bandpass in repairConf.Channel.BandpassArr)
            {
                if (bandpass.Active)
                {
                    query =
                        "SELECT [DateTime]," + repairConf.ValueMeasureType + "([" + bandpass.BandpassName + "]) " +
                        "FROM " + DataConnection.Database + ".[dbo].[VectorData_day_" + repairConf.ValueMeasureType + "] " +
                        "WHERE [ChannelId]=" + repairConf.Channel.Id + " AND [DateTime] BETWEEN '" + repairConf.StartDateStr + "' AND '" + repairConf.EndDateStr + "' " +
                        "GROUP BY [DateTime] " +
                        "ORDER BY [DateTime]";
                    DataTable dt = GetResultByQuery(query, DataConnection);
                    dt.TableName = bandpass.OverrideInfo.OverrideName;
                    dataList.Add(dt);
                }
            }
            return(dataList);
        }
예제 #3
0
        public MainForm()
        {
            InitializeComponent();

            #region MultiLang
            BtnReport_BandpassTrend.Text = MultiLang.TrendOfMeasurements;
            BtnReport_PointTrend.Text    = MultiLang.TrendOfPoint;
            BtnReport_DayOfWeek.Text     = MultiLang.WeeklyComparison;
            BtnReport_Period.Text        = MultiLang.PeriodicComparison;
            BtnReport_Daily.Text         = MultiLang.Daily;
            BtnReport_Repair.Text        = MultiLang.MaintenanceTask;
            BtnReport_PeriodDays.Text    = MultiLang.PeriodDays;
            BtnReport_GeneralTrend.Text  = MultiLang.GenaralTrend;

            BtnConfig_BandpassTrend.Text = MultiLang.Configuration;
            BtnConfig_PointTrend.Text    = MultiLang.Configuration;
            BtnConfig_DayOfWeek.Text     = MultiLang.Configuration;
            BtnConfig_Period.Text        = MultiLang.Configuration;
            BtnConfig_Daily.Text         = MultiLang.Configuration;
            BtnConfig_Repair.Text        = MultiLang.Configuration;
            BtnConfig_PeriodDays.Text    = MultiLang.Configuration;
            BtnConfig_GeneralTrend.Text  = MultiLang.Configuration;

            BtnPreview_BandpassTrend.Text = MultiLang.Preview;
            BtnPreview_PointTrend.Text    = MultiLang.Preview;
            BtnPreview_DayOfWeek.Text     = MultiLang.Preview;
            BtnPreview_Period.Text        = MultiLang.Preview;
            BtnPreview_Daily.Text         = MultiLang.Preview;
            BtnPreview_Repair.Text        = MultiLang.Preview;
            BtnPreview_PeriodDays.Text    = MultiLang.Preview;
            BtnPreview_GeneralTrend.Text  = MultiLang.Preview;
            #endregion

            SQLRepository.Init();
            LogGenerator.CreateLogFile();
            CreatePreviewSample();
            DBConn           = new DBConnector();
            ExcelManager     = new ExcelIOManager();
            MultiBandConf    = new MultiMeasureConfiguration();
            MultiPointConf   = new MultiPointConfiguration();
            DayOfWeekConf    = new DayOfWeekConfiguration();
            PeriodConf       = new PeriodConfiguration();
            DailyConf        = new DailyConfiguration();
            RepairConf       = new RepairConfiguration();
            PeriodDaysConf   = new PeriodDaysConfiguration();
            GeneralTrendConf = new GeneralTrendConfiguration();


            PeriodDaysConfigDlg = new PeriodDaysDlg(PeriodDaysConf)
            {
                Owner = this
            };
            DailyConfDlg = new DailyConfigDlg(DailyConf)
            {
                Owner = this
            };
            MultiBandConfigDlg = new MultiMeasureConfigDlg(MultiBandConf)
            {
                Owner = this
            };
            MultiPointConfigDlg = new MultiPointConfigDlg(MultiPointConf)
            {
                Owner = this
            };
            DayOfWeekConfigDlg = new DayOfWeekConfigDlg(DayOfWeekConf)
            {
                Owner = this
            };
            PeriodConfigDlg = new PeriodConfigDlg(PeriodConf)
            {
                Owner = this
            };
            RepairConfigDlg = new RepairConfigDlg(RepairConf)
            {
                Owner = this
            };
            GeneralTrendConfigDlg = new GeneralConfigDlg(GeneralTrendConf)
            {
                Owner = this
            };
        }