Пример #1
0
        public GPSXY getCenter(String cCameraID, float P, float T, float X)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append("SELECT * FROM XT_CAMERA_CONFIG WHERE DEVICE_ID='" + cCameraID + "'");
            DataTable dtRows = WebSQL.QueryData(sql.ToString());

            if (dtRows != null && dtRows.Rows.Count > 0)
            {
                GPSXY vGPS = new GPSXY();
                //113.807187 34.170334
                vGPS.X = StringEx.GetDouble(dtRows, 0, "X");
                vGPS.Y = StringEx.GetDouble(dtRows, 0, "Y");

                Double dOffsetX = StringEx.GetDouble(dtRows, 0, "OFFSET_X");
                Double dOffsetY = StringEx.GetDouble(dtRows, 0, "OFFSET_Y");

                Double dStartP = StringEx.GetDouble(dtRows, 0, "START_P");
                Double dStartT = StringEx.GetDouble(dtRows, 0, "START_T");
                Double dStartX = StringEx.GetDouble(dtRows, 0, "START_X");
                Double dStartH = StringEx.GetDouble(dtRows, 0, "START_H");

                return(vGPS);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        private void frmTask_Load(object sender, EventArgs e)
        {
            iskin.SkinFile = "skins/PageColor2.ssk";
            btnLoad_Click(null, null);
            String cORG_ID    = INIConfig.ReadString("Config", AppConfig.ORG_ID);
            String cLeftCount = WebSQL.GetStrValue("SELECT COUNT(1) FROM XT_TASK_LIST WHERE ORG_ID LIKE '" + cORG_ID + "%' ");
            int    iLeftCount = StringEx.getInt(cLeftCount);

            if (iLeftCount > 0)
            {
                this.timAfter.Enabled = true;
            }
        }
Пример #3
0
        public void btnAutoTake_Click(object sender, EventArgs e)
        {
            String cORG_ID    = INIConfig.ReadString("Config", AppConfig.ORG_ID);
            String cLeftCount = WebSQL.GetStrValue("SELECT COUNT(1) FROM XT_TASK_LIST WHERE ORG_ID LIKE '" + cORG_ID + "%' ");
            int    iLeftCount = StringEx.getInt(cLeftCount);

            if (iLeftCount == 0)
            {
                int iCode = WebSQL.ExecSQL("INSERT INTO XT_TASK_LIST(DEVICE_ID,ORG_ID) "
                                           + " SELECT DEVICE_ID,ORG_ID "
                                           + " FROM XT_CAMERA WHERE ORG_ID like '" + cORG_ID + "%' "
                                           + " AND NOT EXISTS(SELECT 1 FROM XT_TASK_LIST X WHERE X.DEVICE_ID=XT_CAMERA.DEVICE_ID AND X.ORG_ID='" + cORG_ID + "') ");
            }
            this.timAfter.Enabled = true;
        }
Пример #4
0
        public Boolean getTaskCameraCode(String cOrgID)
        {
            String    sql    = "SELECT TOP 1 DEVICE_ID,(SELECT COUNT(1) FROM  XT_TASK_LIST X WHERE X.ORG_ID='" + cOrgID + "') AS LEFT_TASK FROM XT_TASK_LIST WHERE ORG_ID='" + cOrgID + "' ";
            DataTable dtRows = WebSQL.QueryData(sql);

            if (dtRows != null && dtRows.Rows.Count > 0)
            {
                ActiveDevice_ID = StringEx.getString(dtRows, 0, "DEVICE_ID");
                ActiveLeftCount = StringEx.getString(dtRows, 0, "LEFT_TASK");
                int iLeftCount = StringEx.getInt(ActiveLeftCount) - 1;
                this.LB_MSG.Text = "剩余任务:" + StringEx.getString(iLeftCount);
                WebSQL.ExecSQL(" DELETE FROM XT_TASK_LIST WHERE ORG_ID='" + cOrgID + "' AND DEVICE_ID='" + ActiveDevice_ID + "'");
                return(true);
            }
            return(false);
        }
Пример #5
0
        private void onIdle_Event(object sender, EventArgs e)
        {
            if (!LOAD_FLAG)
            {
                LOAD_FLAG = true;
                InitCameraLogin();
                dtInfo    = WebSQL.QueryData("SELECT * FROM XT_CAMERA WHERE DEVICE_ID='" + ActiveCameraCode + "'");
                this.Text = StringEx.getString(dtInfo, 0, "CAMERA_NAME");

                X = StringEx.GetDouble(dtInfo, 0, "X");
                Y = StringEx.GetDouble(dtInfo, 0, "Y");
                if (X > 0 && Y > 0)
                {
                    String cWebUrl = INIConfig.ReadString("Config", AppConfig.WEB_URL, "");
                    String cUrl    = "http://" + cWebUrl + "/pages/webgis.aspx?TOKEN=" + ApplicationEvent.Token + "&TYPE_ID=2&X=" + X.ToString() + "&Y=" + Y.ToString();
                    //geckoWeb.Navigate(cUrl);
                }
                btnStartReal_Click(null, null);
            }
        }
Пример #6
0
        public String getOrgKey(String cORG_ID, String cKeyName)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append(" SELECT KEYVALUE ");
            sql.Append(" FROM S_ORG_CONFIG ");
            sql.Append(" WHERE ORG_ID='" + cORG_ID + "' ");
            sql.Append(" and KEYNAME='" + cKeyName + "'");
            DataTable dtRows = WebSQL.QueryData(sql.ToString());

            if (dtRows != null && dtRows.Rows.Count > 0)
            {
                return(WebSQL.GetStrValue(sql.ToString()));
            }
            else
            {
                WebSQL.ExecSQL("INSERT INTO S_ORG_CONFIG(ORG_ID,KEYNAME) VALUES('" + cORG_ID + "','" + cKeyName + "')");
                return("");
            }
        }
Пример #7
0
        public Boolean CheckTask(String cTaskID)
        {
            Boolean AllowTask = INIConfig.ReadInt("TASK", cTaskID + "_FLAG") > 0;
            String  cDayHour  = DateTime.Now.ToString("HHmm");
            String  cDay      = DateTime.Now.ToString("yyyyMMdd");
            String  cORG_ID   = INIConfig.ReadString("Config", AppConfig.ORG_ID);

            if (AllowTask)
            {
                String cTASK = INIConfig.ReadString("TASK", cTaskID);
                if (cTASK.Equals(cDayHour))
                {
                    String cTASK_DAY = INIConfig.ReadString("TASK", cTaskID + "_DAY");
                    if (!cTASK_DAY.Equals(cDay))
                    {
                        JActiveTable aTable = new JActiveTable();
                        aTable.TableName = "XT_TASK";
                        aTable.AddField("TASK_ID", cTaskID);
                        aTable.AddField("TASK_TIME", cTASK);
                        aTable.AddField("TASK_DAY", cDay);
                        aTable.AddField("ORG_ID", cORG_ID);
                        String sql   = aTable.getUpdateSQL(" ORG_ID='" + cORG_ID + "' AND TASK_ID='" + cTaskID + "'");
                        int    iCode = WebSQL.ExecSQL(sql);
                        if (iCode == 0)
                        {
                            sql   = aTable.getInsertSQL();
                            iCode = WebSQL.ExecSQL(sql);
                        }
                        INIConfig.Write("TASK", cTaskID + "_DAY", cDay);
                        return(iCode > 0);
                    }
                }
                return(false);
            }
            else
            {
                return(false);
            }
        }
Пример #8
0
        public static ChartTool LoadConfig(int iTypeID)
        {
            ChartTool vo = new ChartTool();

            vo.dtConfig = WebSQL.QueryData("select * from XT_CHART where CHART_ID='" + iTypeID + "'");
            DataTable dtRows = vo.dtConfig;

            if ((dtRows != null) && (dtRows.Rows.Count > 0))
            {
                vo.CHART_ID   = StringEx.getInt(dtRows, 0, "CHART_ID");
                vo.CHART_NAME = StringEx.getString(dtRows, 0, "CHART_NAME");
                vo.TABLENAME  = StringEx.getString(dtRows, 0, "CHART_TABLENAME");
                vo.WHERE_PARM = StringEx.getString(dtRows, 0, "WHERE_PARM");
                vo.CHART_TYPE = StringEx.getInt(dtRows, 0, "CHART_TYPE");
                vo.GROUP_PARM = StringEx.getString(dtRows, 0, "GROUP_PARM");

                vo.ORDERBY_1 = StringEx.getString(dtRows, 0, "ORDERBY_1");
                vo.ORDERBY_2 = StringEx.getString(dtRows, 0, "ORDERBY_2");
            }

            vo.dtConfig = WebSQL.QueryData("select * from XT_CHART_CONFIG where CHART_ID='" + iTypeID + "'");
            return(vo);
        }
Пример #9
0
        private void timPreset_Tick(object sender, EventArgs e)
        {
            timPreset.Enabled = false;
            int iCode = 0;

            try
            {
                Boolean AllowWait = false;
                int     idx       = -1;
                if (YWZ_VAL_LIST.Count > 0)
                {
                    idx = YWZ_VAL_LIST.Count - 1;

                    IVS_PTZ_PRESET vPreset = (IVS_PTZ_PRESET)YWZ_VAL_LIST[idx];
                    YWZ_VAL_LIST.RemoveAt(idx);
                    YWZ_TXT_LIST.Items.RemoveAt(idx);
                    int pLockStatus = 0;
                    iCode = IVS_API.IVS_SDK_PtzControl(ApplicationEvent.iSession, ActiveCameraCode, 11, vPreset.cPresetName, "3", ref pLockStatus);
                    if (iCode > 0)
                    {
                        log4net.WriteLogFile("调用预置位失败");
                        return;
                    }
                    else
                    {
                        AllowWait = true;
                    }
                }
                if (AllowWait)
                {
                    Boolean isAbort = false;
                    int     iORD    = 0;
                    while (!isAbort)
                    {
                        Application.DoEvents();
                        Thread.Sleep(200);
                        iORD++;
                        if (iORD > 15)
                        {
                            isAbort = true;
                        }
                    }
                }
                isPlay = true;
                String cAppDir = INIConfig.ReadString("ALARM", "FILE_PATH", "");
                if (Directory.Exists(cAppDir))
                {
                    Directory.CreateDirectory(cAppDir);
                }

                int    iPRESET_ID = 9999;
                String cKeyID     = "";
                string cKeyGuid   = "";
                if (idx != -1)
                {
                    cKeyID     = AutoID.getAutoID() + "_" + String.Format("{0:0#00}", idx);
                    cKeyGuid   = ActiveCameraCode + "X" + String.Format("{0:0#00}", idx);
                    iPRESET_ID = idx;
                }
                else
                {
                    cKeyID     = AutoID.getAutoID() + "_0000";
                    cKeyGuid   = ActiveCameraCode + "X" + "0000";
                    iPRESET_ID = 9999;
                }

                cAppDir = cAppDir + cKeyID.Substring(0, 8);
                if (Directory.Exists(cAppDir))
                {
                    Directory.CreateDirectory(cAppDir);
                }

                String cFileName = cAppDir + "\\" + cKeyID + ".jpg";
                Application.DoEvents();
                iCode = IVS_API.IVS_SDK_LocalSnapshot(ApplicationEvent.iSession, (UInt32)ulRealPlayHandle, 1, cFileName);

                if (iCode == 0)
                {
                    cAppDir = INIConfig.ReadString("ANALYSE", "FILE_PATH", "");
                    String cAnalyseFile = cAppDir + cKeyID + ".jpg";
                    try
                    {
                        String cFilePath = Path.GetDirectoryName(cAnalyseFile);
                        if (!Directory.Exists(cFilePath))
                        {
                            Directory.CreateDirectory(cFilePath);
                        }
                        File.Copy(cFileName, cAnalyseFile);
                    }
                    catch (Exception ex)
                    {
                        log4net.WriteLogFile(ex.Message);
                    }

                    log4net.WriteLogFile("IVS_SDK_LocalSnapshot成功!" + cFileName);
                    String cKeyText = IMGAI.getImageText(cFileName);

                    List <String> sqls     = new List <string>();
                    String        cDayTime = DateTime.Now.ToString("yyyyMMddHHmmss");
                    JActiveTable  aMaster  = new JActiveTable();
                    aMaster.TableName = "XT_IMG_REC";
                    aMaster.AddField("REC_ID", cKeyID);
                    aMaster.AddField("CAMERA_ID", ActiveCameraCode);
                    aMaster.AddField("PRESET_ID", iPRESET_ID);

                    aMaster.AddField("AI_FLAG", 0);
                    aMaster.AddField("ALARM_FLAG", 0);
                    aMaster.AddField("ALARM_CHECKED", 0);
                    aMaster.AddField("IMAGE_REDRAW", 0);


                    if (!String.IsNullOrEmpty(cKeyText))
                    {
                        aMaster.AddField("P", IMGAI.getP(cKeyText));
                        aMaster.AddField("T", IMGAI.getT(cKeyText));
                        aMaster.AddField("X", IMGAI.getX(cKeyText));
                    }
                    aMaster.AddField("FILE_URL", "/dfs/" + cKeyID.Substring(0, 8) + "/" + cKeyID + ".jpg");
                    aMaster.AddField("CREATE_TIME", cDayTime);
                    aMaster.AddField("UPLOAD_FLAG", 1);

                    String       cMasterSQL = aMaster.getInsertSQL();
                    JActiveTable aSlave     = new JActiveTable();
                    aSlave.TableName = "XT_CAMERA_STATUS";
                    aSlave.AddField("UPDATE_TIME", cDayTime);
                    String cSlaveSQL = aSlave.getUpdateSQL("CAMERA_ID = '" + ActiveCameraCode + "' ");

                    sqls.Add(cMasterSQL);
                    sqls.Add(cSlaveSQL);
                    iCode = WebSQL.ExecSQL(sqls);
                    if (iCode > 0)
                    {
                        log4net.WriteLogFile(cKeyID + "插入数据库成功");
                    }
                }
                Application.DoEvents();
            }
            catch (Exception ex)
            {
                log4net.WriteLogFile("Camera_YZW_List失败!" + ex.Message);
            }
            finally
            {
                if (YWZ_VAL_LIST.Count > 0)
                {
                    timPreset.Enabled = true;
                }
                else if (YWZ_VAL_LIST.Count == 0)
                {
                    timAfter.Enabled = true;
                }
            }
        }