示例#1
0
        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;
                    }
                }
            }
        }
示例#2
0
        public void CruiseExcute(IRCtrl irCtrl, TVCtrl tvCtrl)
        {
            gLogWriter.WriteLog("巡检进行中", "查询任务点");

            //查询任务列表
            if (GetCruiseTasks(1, out List <int> mlstintTastTable))
            {
                //for循环执行每个任务点
                for (int i = 0; i < mlstintTastTable.Count; i++)
                {
                    //if (CruiseSwtich == false)
                    //    break;
                    actionOneTaskCruise(mlstintTastTable[i], irCtrl, tvCtrl);
                }
            }
        }
示例#3
0
        private void Cruise_CircleAnalyseHotPic(int taskIndex, int tempValueType, IRCtrl irCtrl, TVCtrl tvCtrl)
        {
            switch (tempValueType)
            {
            case 0:     //最大值
                break;

            case 1:      //平均值
                break;

            case 2:      //最小值
                break;

            case 4:       //差值
                break;
            }
        }
示例#4
0
        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++)
                {
                }
            }
        }
示例#5
0
        public void CruiseExcute(IRCtrl irCtrl, TVCtrl tvCtrl)
        {
            Debug.WriteLine("^^^^^^^^^^^^^^^^^^^^^^^^^^系统执行巡检相关操作");

            //查询任务列表
            if (GetCruiseTasks(1, out List <int> mlstintTastTable))
            {
                //for循环执行每个任务点
                for (int i = 0; i < mlstintTastTable.Count; i++)
                {
                    if (CruiseSwtich == false)
                    {
                        break;
                    }
                    actionOneTaskCruise(mlstintTastTable[i], irCtrl, tvCtrl);
                }
            }
        }
示例#6
0
 public void CruisePicsAnalyse(int meaType, string IRImagefilePath, string TVImagefilePath, IRCtrl irCtrl, TVCtrl tvCtrl)
 {
 }
示例#7
0
        private void CruiseSnapPictures(int taskIndex, int positionIndex, string PrePositionName, IRCtrl irCtrl, TVCtrl tvCtrl, out string IRImagefilePath, out string TVImagefilePath)
        {
            string days          = DateTime.Now.ToString("yyyyMMdd");
            String imageSavePath = Constant.imageSavePath + @"\" + days;

            if (!Directory.Exists(imageSavePath))
            {
                Directory.CreateDirectory(imageSavePath);
            }
            string createTime = DateUtil.DateToString(DateTime.Now);

            IRImagefilePath = imageSavePath + @"\" + "红外热图_" + positionIndex + "_" + taskIndex + "_" + PrePositionName + "_" + createTime + ".jpg";
            TVImagefilePath = imageSavePath + @"\" + "可见光图_" + positionIndex + "_" + taskIndex + "_" + PrePositionName + "_" + createTime + ".JPG";
            //if (!irCtrl.SaveIRHotImage(IRImagefilePath))
            //{
            //    IRImagefilePath = null;
            //}
            //if (!tvCtrl.SaveImage(TVImagefilePath))
            //{
            //    TVImagefilePath = null;
            //}
        }
示例#8
0
        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();
            }
        }
示例#9
0
 private void CruiseSnapPictures(int taskId, string positionIndex, string PositionName, IRCtrl irCtrl, TVCtrl tvCtrl, out string IRImagefileName, out string TVImagefileName)
 {
     IRImagefileName = Constant.imageSavePath + "IR_" + positionIndex + "_" + taskId + "_" + PositionName + "_" + DateUtil.DateToString(DateTime.Now) + ".jpg";
     TVImagefileName = Constant.imageSavePath + "TV_" + positionIndex + "_" + taskId + "_" + PositionName + "_" + DateUtil.DateToString(DateTime.Now);
     if (!irCtrl.SaveIRHotImage(IRImagefileName))
     {
         IRImagefileName = null;
     }
     if (!tvCtrl.SaveImage(TVImagefileName))
     {
         TVImagefileName = null;
     }
 }
示例#10
0
        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
                }
            }
        }