public bool AddOneTempMeasureRecord(TempMeasure oneTempMeaRecord) { string sql = "insert into record_tempmeasure(MeasureTask_Index,MonDev_Index,MeasureValueMin,MeasureValueAvg,MeasureValueMax,AirTemperature,Humidity,Electricty,RecordTime,TVFilePath," + "IRFilePath,VTVFilePath,IRAFilePath,VIRFilePath,TVVImgPath,IRVImgPath,IRHImgPath,Readed) " + " values(@MeasureTask_Index,@MonDev_Index,@MeasureValueMin,@MeasureValueAvg,@MeasureValueMax,@AirTemperature,@Humidity,@Electricty,@RecordTime,@TVFilePath," + "@IRFilePath,@VTVFilePath,@IRAFilePath,@VIRFilePath,@TVVImgPath,@IRVImgPath,@IRHImgPath,@Readed)"; List <MySqlParameter> parmList = new List <MySqlParameter>(); parmList.Add(new MySqlParameter("@MeasureTask_Index", oneTempMeaRecord.MeasureTask_Index)); parmList.Add(new MySqlParameter("@MonDev_Index", oneTempMeaRecord.MonDev_Index)); parmList.Add(new MySqlParameter("@MeasureValueMin", oneTempMeaRecord.MeasureValueMin)); parmList.Add(new MySqlParameter("@MeasureValueAvg", oneTempMeaRecord.MeasureValueAvg)); parmList.Add(new MySqlParameter("@MeasureValueMax", oneTempMeaRecord.MeasureValueMax)); parmList.Add(new MySqlParameter("@AirTemperature", oneTempMeaRecord.AirTemperature)); parmList.Add(new MySqlParameter("@Humidity", oneTempMeaRecord.Humidity)); parmList.Add(new MySqlParameter("@Electricty", oneTempMeaRecord.Electricty)); parmList.Add(new MySqlParameter("@RecordTime", oneTempMeaRecord.RecordTime)); parmList.Add(new MySqlParameter("@TVFilePath", oneTempMeaRecord.TVFilePath)); parmList.Add(new MySqlParameter("@IRFilePath", oneTempMeaRecord.IRFilePath)); parmList.Add(new MySqlParameter("@VTVFilePath", oneTempMeaRecord.VTVFilePath)); parmList.Add(new MySqlParameter("@IRAFilePath", oneTempMeaRecord.IRAFilePath)); parmList.Add(new MySqlParameter("@VIRFilePath", oneTempMeaRecord.VIRFilePath)); parmList.Add(new MySqlParameter("@TVVImgPath", oneTempMeaRecord.TVVImgPath)); parmList.Add(new MySqlParameter("@IRVImgPath", oneTempMeaRecord.IRVImgPath)); parmList.Add(new MySqlParameter("@IRHImgPath", oneTempMeaRecord.IRHImgPath)); parmList.Add(new MySqlParameter("@Readed", oneTempMeaRecord.Readed)); MySqlConnection conn = SqlHelper.GetConnection(ip, port, username, password, databaseName); return(SqlHelper.AddData(conn, sql, parmList.ToArray())); }
public void TestMethod7() { //MeasureTaskSetDao dao1 = new MeasureTaskSetDao(); //List<int> IndexList = dao1.GetMeasureTaskIndex(); // int i = IndexList.Count; // PrePositionSetDao dao2 = new PrePositionSetDao(); // List< PrePositionSet> prePositionList= dao2.GetPrePosIndexByTaskIndex(1); string sql = "select * from record_tempmeasure where TempMeasure_Index=1"; MySqlConnection conn = SqlHelper.getConnection(); DataTable dt = SqlHelper.QueryData(conn, sql, null); for (int i = 0; i < dt.Rows.Count; i++) { TempMeasure tempMeasure = new TempMeasure(); tempMeasure.TVFilePath = dt.Rows[i]["TVFilePath"].ToString(); } }
public bool AddMeaTempRecords(TempMeasure oneTempMeaRecord) { return(tempMeasureDao.AddOneTempMeasureRecord(oneTempMeaRecord)); }
public void actionOneTaskCruise(int taskIndex, IRCtrl irCtrl, TVCtrl tvCtrl) { //Check PrePosImf gLogWriter.WriteLog("巡检进行中--根据任务点查询对应的预置位,当前任务点Index:" + taskIndex.ToString(), ""); cruiseLogMsgs.Add("巡检进行中--根据任务点查询对应的预置位,当前任务点Index:" + taskIndex.ToString()); List <PrePositionSet> prePosList = GetPrePosInfos(taskIndex); //check IR Camera Seting gLogWriter.WriteLog("巡检进行中--检查红外相机的配置", ""); cruiseLogMsgs.Add("巡检进行中--检查红外相机的配置"); //Goto PrePos; for (var i = 0; i < prePosList.Count; i++) { gLogWriter.WriteLog("巡检进行中--走预置位,预置位编号:" + prePosList[i].PrePositionNO, "当前任务点Index=" + taskIndex); cruiseLogMsgs.Add("巡检进行中--走预置位,预置位编号:" + prePosList[i].PrePositionNO + ",当前任务点Index:" + taskIndex); // tvCtrl.InvokePrePos(prePosList[i].PrePositionNO); //Sleep Time wait for Pantilt to Position Thread.Sleep(50); //Autofocus Or Manual Focus; gLogWriter.WriteLog("巡检进行中--红外聚焦", ""); cruiseLogMsgs.Add("巡检进行中--红外聚焦"); //if (prePosList[i].IRFocus == 0) //{ // gLogWriter.WriteLog("巡检进行中--红外自动聚焦", ""); // cruiseLogMsgs.Add("巡检进行中--红外自动聚焦"); // irCtrl.SetAutoFocus(); //} //else //{ // gLogWriter.WriteLog("巡检进行中--红外手动聚焦", "焦距值"+ prePosList[i].IRFocus); // cruiseLogMsgs.Add("巡检进行中--红外手动聚焦"); // irCtrl.SetManualFocus(prePosList[i].IRFocus); //} //sleep time wait for Auto Focus Finish Thread.Sleep(500); //Snap Picture; gLogWriter.WriteLog("巡检进行中--可见光、红外抓图", ""); cruiseLogMsgs.Add("巡检进行中--可见光、红外抓图"); string IRImagefilePath = null; string TVImagefilePath = null; CruiseSnapPictures(taskIndex, 1, "测试预置位" + taskIndex + "-" + prePosList[i].PrePositionNO, irCtrl, tvCtrl, out IRImagefilePath, out TVImagefilePath); //路径为本地目录,暂未上传到ftp服务器 //sleep wiait for FIle save finish Thread.Sleep(2000); //Analyse Hot Picture; gLogWriter.WriteLog("巡检进行中--分析图片并获取温度值", ""); cruiseLogMsgs.Add("巡检进行中--分析图片并获取温度值"); double temp = 0; switch (prePosList[i].OneTask.MeaType) { case 0: //点温 temp = Cruise_SpotAnalyseHotPic(taskIndex, irCtrl, tvCtrl, IRImagefilePath); break; case 1: //线温 Cruise_LineAnalyseHotPic(taskIndex, prePosList[i].OneTask.GetValueType, irCtrl, tvCtrl); break; case 2: //区域测温 Cruise_AreaAnalyseHotPic(taskIndex, prePosList[i].OneTask.GetValueType, irCtrl, tvCtrl); break; case 3: //多边形测温 Cruise_PolygonAnalyseHotPic(taskIndex, prePosList[i].OneTask.GetValueType, irCtrl, tvCtrl); break; case 4: //圆形测温 Cruise_CircleAnalyseHotPic(taskIndex, prePosList[i].OneTask.GetValueType, irCtrl, tvCtrl); break; } //Create Temptrue Record TempMeasure oneTempMeaRecord = new TempMeasure(); oneTempMeaRecord.MeasureTask_Index = taskIndex; oneTempMeaRecord.MonDev_Index = 1; oneTempMeaRecord.MeasureValueMin = temp; oneTempMeaRecord.MeasureValueAvg = temp; oneTempMeaRecord.MeasureValueMax = temp; oneTempMeaRecord.AirTemperature = 37.00; oneTempMeaRecord.RecordTime = DateTime.Now; oneTempMeaRecord.TVFilePath = ""; oneTempMeaRecord.IRFilePath = ""; oneTempMeaRecord.VTVFilePath = ""; oneTempMeaRecord.IRAFilePath = ""; oneTempMeaRecord.VIRFilePath = ""; oneTempMeaRecord.Readed = false; //Upload FTP File string TVUploadToFtpPath = null; string IRUploadToFtpPath = null; UploadPicFilesToFTP(TVImagefilePath, IRImagefilePath, out TVUploadToFtpPath, out IRUploadToFtpPath); gLogWriter.WriteLog("巡检进行中--上传图片到FTP", ""); cruiseLogMsgs.Add("巡检进行中--上传图片到FTP"); string regex = "IR"; string[] TVPath = TVUploadToFtpPath.Split(new string[] { regex }, StringSplitOptions.None); string[] IRPath = IRUploadToFtpPath.Split(new string[] { regex }, StringSplitOptions.None); oneTempMeaRecord.TVVImgPath = regex + TVPath[1]; oneTempMeaRecord.IRVImgPath = Constant.ftp_autoCruiseFilePath + "20200225/红外视频截图-测试.jpg"; oneTempMeaRecord.IRHImgPath = regex + IRPath[1]; if (AddMeaTempRecords(oneTempMeaRecord)) { gLogWriter.WriteLog("巡检进行中--生成一条温度测量记录到数据库", ""); cruiseLogMsgs.Add("巡检进行中--生成一条温度测量记录到数据库"); } //Analyse AlarmRecord; AlarmRecord alarmRecord = new AlarmRecord(); Random rd = new Random(); alarmRecord.TempMeasure_Index = rd.Next(1, 15); alarmRecord.Rule_Index = rd.Next(1, 20); alarmRecord.Rule_Type = rd.Next(1, 4); alarmRecord.AlarmType = 1; alarmRecord.AlarmRecordTime = DateTime.Now; alarmRecord.RelMeaVal = temp; alarmRecord.RefPreAlarmVal = 20.00; alarmRecord.RefAlarmVal = 25; alarmRecord.RefSuperAlarmVal = 30; alarmRecord.Readed = false; if (AddAlarmRecords(alarmRecord)) { gLogWriter.WriteLog("巡检进行中--生成一条报警记录到数据库", ""); cruiseLogMsgs.Add("巡检进行中--生成一条报警记录到数据库"); } //Upload FTP File //gLogWriter.WriteLog("巡检进行中--上传图片到FTP", ""); //cruiseLogMsgs.Add("巡检进行中--上传图片到FTP"); //UploadPicFilesToFTP(); //check File gLogWriter.WriteLog("巡检进行中--检查FTP服务器图片", ""); cruiseLogMsgs.Add("巡检进行中--检查FTP服务器图片"); CheckFTPPicFiles(); } }