コード例 #1
0
        /// <summary>
        /// 保存反馈数据
        /// </summary>
        public void save()
        {
            ActiveResult   vret   = new ActiveResult();
            String         cKeyID = StringEx.getString(request[AppConfig.__DBKEY]);
            XT_JB_FEEDBACK vo     = new XT_JB_FEEDBACK();

            vo    = (XT_JB_FEEDBACK)RequestUtil.readFromRequest(request, vo);
            vo.id = AutoID.getAutoID();
            int iCode = dao.save(vo, "");

            vret = ActiveResult.Valid(iCode);
            response.Write(vret.toJSONString());
        }
コード例 #2
0
ファイル: NoticeService.cs プロジェクト: memoryrobber/VideoAI
        public void save()
        {
            ActiveResult vret    = new ActiveResult();
            String       cKeyID  = StringEx.getString(request[AppConfig.__DBKEY]);
            String       cORG_ID = StringEx.getString(request[AppConfig.ORG_ID]);
            XT_NOTICE    vo      = new XT_NOTICE();

            vo             = (XT_NOTICE)RequestUtil.readFromRequest(request, vo);
            vo.notice_date = vo.notice_date.Replace("-", "");
            vo.notice_id   = AutoID.getAutoID(cORG_ID);
            int iCode = dao.save(vo, cKeyID);

            vret = ActiveResult.Valid(iCode);
            response.Write(vret.toJSONString());
        }
コード例 #3
0
        public List <UploadFileInfo> getUploadList(String cOrgID, String cDir)
        {
            List <UploadFileInfo> KeyList = new List <UploadFileInfo>();

            if (String.IsNullOrEmpty(cDir))
            {
                cDir = "Upload";
            }
            List <String> sqls = new List <string>();
            String        cFileName;
            String        cFileUrl;

            String cKeyID   = AutoID.getAutoID();
            String cAppDir  = System.Web.HttpContext.Current.Server.MapPath("~/");
            String cFileDir = cAppDir + cDir + "\\";

            if (!Directory.Exists(cFileDir))
            {
                Directory.CreateDirectory(cFileDir);
            }
            cFileDir = cFileDir + cKeyID.Substring(0, 8) + "\\";
            if (!Directory.Exists(cFileDir))
            {
                Directory.CreateDirectory(cFileDir);
            }
            for (int i = 0; i < System.Web.HttpContext.Current.Request.Files.Count; i++)
            {
                cKeyID = AutoID.getAutoID();
                UploadFileInfo vUpload = new UploadFileInfo();
                HttpPostedFile vf      = System.Web.HttpContext.Current.Request.Files[i];
                cFileName = Path.GetFileName(vf.FileName);
                String cFileExt = Path.GetExtension(vf.FileName);

                vf.SaveAs(cFileDir + cKeyID + cFileExt);
                cFileUrl         = "/" + cDir + "/" + cKeyID.Substring(0, 8) + "/" + cKeyID + cFileExt;
                vUpload.FileName = cFileName;
                vUpload.ID       = cKeyID;
                vUpload.ORG_ID   = cOrgID;
                vUpload.ResID    = cKeyID;
                vUpload.Url      = cFileUrl;
                log4net.WriteLogFile("getUploadList:" + cOrgID + ":" + cKeyID);
                KeyList.Add(vUpload);
            }
            return(KeyList);
        }
コード例 #4
0
        private void btnTake_Click(object sender, EventArgs e)
        {
            String cAppDir = Path.GetDirectoryName(Application.ExecutablePath) + "\\Images\\";

            if (Directory.Exists(cAppDir))
            {
                Directory.CreateDirectory(cAppDir);
            }

            String cKeyID         = AutoID.getAutoID();
            String cImageFileName = cAppDir + cKeyID + ".jpg";
            int    iCode          = IVS_API.IVS_SDK_LocalSnapshot(ApplicationEvent.iSession, (UInt32)ulRealPlayHandle, 1, cImageFileName);

            if (iCode == 0)
            {
            }
            else
            {
                log4net.WriteLogFile("IVS_SDK_LocalSnapshot:" + iCode);
            }
        }
コード例 #5
0
        public void save()
        {
            ActiveResult vret    = ActiveResult.Valid(AppConfig.SUCCESS);
            String       cKeyID  = StringEx.getString(request["ID"]);
            String       cREC_ID = StringEx.getString(request["REC_ID"]);

            if (String.IsNullOrWhiteSpace(cREC_ID))
            {
                vret = ActiveResult.Valid("参数传递错误!");
            }
            else
            {
                String        cDeviceID = DbManager.GetStrValue("SELECT CAMERA_ID FROM XT_IMG_REC WHERE REC_ID='" + cREC_ID + "'");
                XT_CAMERA_Dao dao       = new XT_CAMERA_Dao();
                XT_CAMERA     mv        = dao.FindItem(cDeviceID);

                String cAddress = mv.addr;
                String CX       = StringEx.getString(mv.x);
                String CY       = StringEx.getString(mv.y);
                String ID       = AutoID.getAutoID();

                List <String> sqls = new List <string>();
                sqls.Add("  update XT_IMG_REC SET ALARM_CHECKED =1 WHERE REC_ID = '" + cREC_ID + "' ");
                JActiveTable aTable = new JActiveTable();
                aTable.TableName = "XT_JB";
                aTable.AddField("ID", ID);
                aTable.AddField("ADRESS", cAddress);
                aTable.AddField("X", CX);
                aTable.AddField("Y", CY);
                sqls.Add(aTable.getInsertSQL());

                int iCode = DbManager.ExecSQL(sqls);
                vret = ActiveResult.Valid(iCode);
            }

            response.Write(vret.toJSONString());
        }
コード例 #6
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;
                }
            }
        }
コード例 #7
0
        public bool UpdateAnalyseFile(String cFileName)
        {
            Boolean      isUpload = false;
            JActiveTable aMaster  = new JActiveTable();
            JActiveTable aSlave   = new JActiveTable();

            aSlave.TableName  = "XT_IMG_LIST";
            aMaster.TableName = "XT_IMG_REC";

            log4net.WriteLogFile("分析线程正在运行中......");
            if (String.IsNullOrWhiteSpace(cFileName))
            {
                return(false);
            }

            String          cFileExt        = Path.GetExtension(cFileName);
            String          cREC_ID         = Path.GetFileName(cFileName).Replace(cFileExt, "");
            List <KeyValue> ImageList       = IMGAI.getImageList(cFileName, iMinVal, iMaxVal, iGrayMinVal, iGrayMaxVal);
            String          cExportFileName = Application.StartupPath + "\\" + cREC_ID + ".zip";
            int             iCode           = 0;
            Boolean         MustRemoveFile  = false;

            if ((ImageList != null) && (ImageList.Count > 0))
            {
                List <String> sqls = new List <string>();
                for (int k = 0; (ImageList != null) && (k < ImageList.Count); k++)
                {
                    Application.DoEvents();
                    KeyValue rowKey = ImageList[k];
                    aSlave.ClearField();
                    String cKeyID = StringEx.getString(k + 1000);
                    aSlave.AddField("ID", AutoID.getAutoID() + "_" + cKeyID);
                    aSlave.AddField("ALARM_FLAG", 0);
                    aSlave.AddField("REC_ID", cREC_ID);
                    aSlave.AddField("CREATE_TIME", DateUtils.getDayTimeNum());
                    aSlave.AddField("POINT_LIST", rowKey.Val);
                    sqls.Add(aSlave.getInsertSQL());
                }
                sqls.Insert(0, "DELETE FROM XT_IMG_REC WHERE REC_ID='" + cREC_ID + "'");
                iCode = WebSQL.ExecSQL(sqls);

                if (iCode > 0)
                {
                    if (File.Exists(cExportFileName))
                    {
                        SftpClient ftp = getAnalyseClient();
                        isUpload = CopyUnit.SSH_Upload(ftp, cExportFileName, "ANALYSE");
                    }
                }
                if (isUpload)
                {
                    MustRemoveFile = true;
                    log4net.WriteLogFile("UploadTask.文件上传成功!");
                }
                else
                {
                    log4net.WriteLogFile("UploadTask." + cREC_ID + ":文件上传失败!");
                }
            }
            else
            {
                log4net.WriteLogFile("UploadTask." + cREC_ID + ":图片拆分失败!");
                MustRemoveFile = true;
            }
            if (MustRemoveFile)
            {
                try
                {
                    File.Delete(cFileName);
                }
                catch (Exception ex)
                {
                    log4net.WriteLogFile(ex.Message);
                }
                try
                {
                    File.Delete(cExportFileName);
                }
                catch (Exception ex)
                {
                    log4net.WriteLogFile(ex.Message);
                }
            }

            aMaster.ClearField();
            if (iCode > 0)
            {
                aMaster.AddField("AI_FLAG", 1);
            }
            else
            {
                aMaster.AddField("AI_FLAG", 2);
            }
            iCode = WebSQL.ExecSQL(aMaster.getUpdateSQL(" REC_ID='" + cREC_ID + "' "));
            if (iCode > 0)
            {
                log4net.WriteLogFile("REC_ID为:" + cREC_ID + "的图片抠图成功!");
            }
            return(true);
        }
コード例 #8
0
        public void GTWS()
        {
            ActiveResult vert = new ActiveResult();
            XT_JB        vo   = new XT_JB();

            vo.jbtype    = "GTWS";
            vo.time      = DateTime.Now.ToString("yyyy-MM-dd");
            vo.sd_result = 0;
            String cOrgID = StringEx.getString(request["org_id"]);

            vo.org_id  = cOrgID;
            vo.adress  = StringEx.getString(request["Address"]);
            vo.neirong = StringEx.getString(request["Content"]);
            vo.open_id = StringEx.getString(request["open_id"]);

            vo.danwei = DbManager.GetStrValue("SELECT ORG_ID FROM XT_CAMERA WHERE DEVICE_ID='" + vo.open_id + "'");
            String cAppDir  = System.Web.HttpContext.Current.Server.MapPath("~/");
            String cFileDir = cAppDir + "GTWSUpload\\";

            if (!Directory.Exists(cFileDir))
            {
                Directory.CreateDirectory(cFileDir);
            }
            String cKeyID = AutoID.getAutoID();

            vo.id    = cKeyID;
            cFileDir = cFileDir + cKeyID.Substring(0, 8) + "\\";
            if (!Directory.Exists(cFileDir))
            {
                Directory.CreateDirectory(cFileDir);
            }

            List <string> sqls = new List <string>();

            List <UploadFileInfo> FileList = this.getUploadList(cOrgID, "GTWSUpload");
            String        cFile_ID         = null;
            List <String> sqlList          = getUploadSQL(FileList);

            for (int i = 0; (sqlList != null) && (i < sqlList.Count); i++)
            {
                sqls.Add(sqlList[i]);
                if (i == 0)
                {
                    cFile_ID = FileList[i].ID;
                }
                else
                {
                    cFile_ID = cFile_ID + "," + FileList[i].ID;
                }
            }
            vo.files_id = cFile_ID;

            string vMaster = dao.Insert(vo);

            sqls.Add(vMaster);

            int          iCode = DbManager.ExecSQL(sqls);
            ActiveResult vret  = ActiveResult.Valid(iCode);

            response.Write(vret.toJSONString());
        }