private void Cruise_LineAnalyseHotPic(int taskIndex, int tempValueType, IRCtrl irCtrl, TVCtrl tvCtrl) { MySqlConnection conn = GlobalCtrl.GetSqlConnection(); string strSql = "select * from cruise_lineset where MeasureTask_Index = @taskIndex"; List <MySqlParameter> parameters = new List <MySqlParameter>(); parameters.Add(new MySqlParameter("@taskIndex", taskIndex)); DataTable lineDatas = SqlHelper.QueryData(conn, strSql, parameters.ToArray()); if (lineDatas.Rows.Count != 0) { for (var i = 0; i < lineDatas.Rows.Count; i++) { switch (tempValueType) { case 0: //最大值 break; case 1: //平均值 break; case 2: //最小值 break; case 4: //差值 break; } } } }
private bool AddSpotMeaTempRecords(int taskId, double temperature) { MySqlConnection conn = GlobalCtrl.GetSqlConnection(); string strSql = "insert into record_tempmeasure (MeasureTask_Index,MonDev_Index,MeasureValueMin,MeasureValueAvg,MeasureValueMax,AirTemperature,Humidity,Electricty,RecordTime," + "TVFilePath,IRFilePath,TVVImgPath,IRVImgPath,IRHImgPath,Readed) values(@MeasureTask_Index,@MonDev_Index,@MeasureValueMin,@MeasureValueAvg,@MeasureValueMax,@AirTemperature," + "@Humidity,@Electricty,@RecordTime,@TVFilePath,@IRFilePath,@TVVImgPath,@IRVImgPath,@IRHImgPath,@Readed)"; List <MySqlParameter> parameters = new List <MySqlParameter>(); parameters.Add(new MySqlParameter("@MeasureTask_Index", taskId)); parameters.Add(new MySqlParameter("@MonDev_Index", 0)); parameters.Add(new MySqlParameter("@MeasureValueMin", temperature)); parameters.Add(new MySqlParameter("@MeasureValueAvg", temperature)); parameters.Add(new MySqlParameter("@MeasureValueMax", temperature)); parameters.Add(new MySqlParameter("@AirTemperature", 0)); parameters.Add(new MySqlParameter("@Humidity", 0)); parameters.Add(new MySqlParameter("@Electricty", 0)); parameters.Add(new MySqlParameter("@RecordTime", DateTime.Now)); parameters.Add(new MySqlParameter("@TVFilePath", null)); parameters.Add(new MySqlParameter("@IRFilePath", null)); parameters.Add(new MySqlParameter("@TVVImgPath", null)); parameters.Add(new MySqlParameter("@IRVImgPath", null)); parameters.Add(new MySqlParameter("@IRHImgPath", null)); parameters.Add(new MySqlParameter("@Readed", false)); return(SqlHelper.AddData(conn, strSql, parameters.ToArray())); }
public void SqlStatusScan() { while (true) { Debug.WriteLine(">>>>>>>>>>>>>>>>数据库状态监控线程:" + Thread.CurrentThread.Name + ";数据库状态:" + globalCtrl.GetSqlConnectionStatus()); if (!globalCtrl.GetSqlConnectionStatus()) { SqlReconnectCount++; GlobalCtrl.GetSqlConnection(); } else { SqlReconnectCount = 0; } Thread.Sleep(4000); } }
private void Cruise_SpotAnalyseHotPic(int taskId, IRCtrl irCtrl, TVCtrl tvCtrl, string IRImagefileName) { MySqlConnection conn = GlobalCtrl.GetSqlConnection(); double temperature = 0; string strSql = "select * from cruise_spotset where MeasureTask_Index = @taskId"; List <MySqlParameter> parameters = new List <MySqlParameter>(); parameters.Add(new MySqlParameter("@taskId", taskId)); DataTable spotDatas = SqlHelper.QueryData(conn, strSql, parameters.ToArray()); if (spotDatas.Rows.Count != 0) { for (var i = 0; i < spotDatas.Rows.Count; i++) { } } }
private void button1_Click(object sender, EventArgs e) { Position pos = new Position(); pos.PositionName = pos_name.Text; pos.Station_Index = Convert.ToInt32(pos_stationIndex.Value); string sql = null; List <MySqlParameter> pamList = new List <MySqlParameter>(); if (pos_cruiseType.Text.ToString().Equals("隔时巡检")) { pos.CruiseType = 0; pos.CruiseInterval = Convert.ToInt32(pos_interval.Value); sql = "insert into cruise_position(Station_Index,PositionName,CruiseInterval,CruiseType) values(@Station_Index,@PositionName,@CruiseInterval,@CruiseType)"; pamList.Add(new MySqlParameter("@Station_Index", pos.Station_Index)); pamList.Add(new MySqlParameter("@PositionName", pos.PositionName)); pamList.Add(new MySqlParameter("@CruiseInterval", pos.CruiseInterval)); pamList.Add(new MySqlParameter("@CruiseType", pos.CruiseType)); } else if (pos_cruiseType.Text.ToString().Equals("定时巡检")) { pos.CruiseType = 1; pos.StartCruiseTime = pos_cruiseStartTime.Value; sql = "insert into cruise_position(Station_Index, PositionName, StartCruiseTime, CruiseType) values(@Station_Index,@PositionName,@StartCruiseTime,@CruiseType)"; pamList.Add(new MySqlParameter("@Station_Index", pos.Station_Index)); pamList.Add(new MySqlParameter("@PositionName", pos.PositionName)); pamList.Add(new MySqlParameter("@StartCruiseTime", pos.StartCruiseTime)); pamList.Add(new MySqlParameter("@CruiseType", pos.CruiseType)); } MySqlConnection conn = GlobalCtrl.GetSqlConnection(); if (SqlHelper.AddData(conn, sql, pamList.ToArray())) { sql = "select * from cruise_position where Position_Index = (select max(Position_Index) from cruise_position)"; DataTable data = SqlHelper.QueryData(conn, sql, null); MessageBox.Show("固定点添加成功"); } else { MessageBox.Show("固定点添加失败"); } }
public void actionOneTaskCruise(int taskId, IRCtrl irCtrl, TVCtrl tvCtrl) { //Check PrePosImf MySqlConnection conn = GlobalCtrl.GetSqlConnection(); string strSql = "SELECT m.MeasureTask_Index,m.PrePosSet_Index,m.DeviceInfo_Index,m.MeaType,m.TaskName,m.GetValueType," + "p.Position_Index,p.PrePositionNO,p.PrePositionName,p.PrePosType,p.TVZoom,p.IRFocus,p.GoPrePosDelays,p.PanAngle,p.TiltAngle,p.PTZHorAngle,p.PTZVerAngle,p.PaletteType " + "from cruise_measuretaskset m, cruise_prepositionset p where m.PrePosSet_Index = p.PrePosSet_Index and p.EnbleMeasure = 1 and m.MeasureTask_Index = @taskId"; List <MySqlParameter> parmList = new List <MySqlParameter>(); parmList.Add(new MySqlParameter("@taskId", taskId)); DataTable datas = SqlHelper.QueryData(conn, strSql, parmList.ToArray()); //根据巡检任务id获取对应的预置位相关的信息 if (datas.Rows.Count != 0) { for (var i = 0; i < datas.Rows.Count; i++) { //check IR Camera Seting irCtrl.SetFocusPos(Convert.ToInt32(datas.Rows[i]["IRFocus"])); //Goto PrePos; tvCtrl.InvokePrePos(Convert.ToInt32(datas.Rows[i]["PrePosSet_Index"])); //Sleep Time wait for Pantilt to Position Thread.Sleep(3000); //Autofocus Or Manual Focus; irCtrl.SetAutoFocus(); //sleep time wait for Auto Focus Finish Thread.Sleep(3000); //Snap Picture; string IRImagefileName = ""; string TVImagefileName = ""; CruiseSnapPictures(taskId, datas.Rows[i]["Position_Index"].ToString(), datas.Rows[i]["PrePositionName"].ToString(), irCtrl, tvCtrl, out IRImagefileName, out TVImagefileName); //sleep wiait for FIle save finish Thread.Sleep(3000); //Analyse Hot Picture; switch (Convert.ToInt32(datas.Rows[i]["MeaType"])) { case 0: //点温 Cruise_SpotAnalyseHotPic(taskId, irCtrl, tvCtrl, IRImagefileName); break; case 1: //线温 Cruise_LineAnalyseHotPic(taskId, Convert.ToInt32(datas.Rows[i]["GetValueType"]), irCtrl, tvCtrl); break; case 2: //区域测温 Cruise_AreaAnalyseHotPic(taskId, Convert.ToInt32(datas.Rows[i]["GetValueType"]), irCtrl, tvCtrl); break; case 3: //多边形测温 Cruise_PolygonAnalyseHotPic(taskId, Convert.ToInt32(datas.Rows[i]["GetValueType"]), irCtrl, tvCtrl); break; case 4: //圆形测温 Cruise_CircleAnalyseHotPic(taskId, Convert.ToInt32(datas.Rows[i]["GetValueType"]), irCtrl, tvCtrl); break; } //Create Temptrue Record //Analyse AlarmRecord; //Upload FTP File //check File } } }