示例#1
0
文件: Program.cs 项目: xy19xiaoyu/TG
        static void Main(string[] args)
        {
            //log4net.ILog log = log4net.LogManager.GetLogger("fileLog");
            Console.WriteLine(System.DateTime.Now.ToString() + "----开始更新");
            //log.Info(System.DateTime.Now.ToString() + "----开始更新");
            ScanSearch scan = new ScanSearch();
            List<Searches> lst = new List<Searches>();

            Console.WriteLine(System.DateTime.Now.ToString() + "----读取达到更新周期的检索式");
            //log.Info(System.DateTime.Now.ToString() + "----读取达到更新周期的检索式");
            //提取检索式
            lst = scan.ReadSearch();
            Console.WriteLine(System.DateTime.Now.ToString() + "----检索式:[" + lst.Count + "]条");
            //log.Info(System.DateTime.Now.ToString() + "----检索式:[" + lst.Count + "]条");
            for (int i = 0; i < lst.Count; i++)
            {
                //ManualResetEvent[] MREs = new ManualResetEvent[amountThread];

                //for (int k = 0; k < amountThread && i + k < lst.Count; k++)
                //{
                //    MREs[k] = new ManualResetEvent(false);//初始化事件对象为无信号状态(非终止)
                //    Searches se = lst[i + k] as Searches;

                //    PatentWarnning.TaskWarnning.ParamObject po = new PatentWarnning.TaskWarnning.ParamObject(MREs[k], se,k+10);
                //    Console.WriteLine(se.SearchName);
                //    //Task(se);
                //    Thread.Sleep(500);
                //    ThreadPool.QueueUserWorkItem(new WaitCallback(TaskWarnning.task), po);
                //}

                //ManualResetEvent[] MREs = new ManualResetEvent[amountThread];

                //for (int k = 0; k < 1; k++)
                //{
                //MREs[k] = new ManualResetEvent(false);//初始化事件对象为无信号状态(非终止)
                //Searches se = lst[i] as Searches;

                //PatentWarnning.TaskWarnning.ParamObject po = new PatentWarnning.TaskWarnning.ParamObject(MREs[k], se, k + 10);

                //TaskWarnning.task(po);
                //}

                Searches se = lst[i] as Searches;
                Console.WriteLine(string.Format("{0}/{1}:{2}", i + 1, lst.Count, se.SearchName));
                PatentWarnning.TaskWarnning.ParamObject po = new PatentWarnning.TaskWarnning.ParamObject(null, se, int.Parse(strYJUserID));
                TaskWarnning.task(po);
            }
            Console.WriteLine("OK!");
        }
示例#2
0
文件: YJini.cs 项目: xy19xiaoyu/TG
        public static void SearchYJini(int C_ID, int flag)
        {
            //log4net.ILog log = log4net.LogManager.GetLogger("fileLog");
            Console.WriteLine(System.DateTime.Now.ToString() + "----开始更新");
            //log.Info(System.DateTime.Now.ToString() + "----开始更新");
            ScanSearch scan = new ScanSearch();
            List<Searches> lst = new List<Searches>();

            Console.WriteLine(System.DateTime.Now.ToString() + "----读取达到更新周期的检索式");
            //log.Info(System.DateTime.Now.ToString() + "----读取达到更新周期的检索式");
            //提取检索式
            lst = scan.ReadSearch(C_ID, flag);
            Console.WriteLine(System.DateTime.Now.ToString() + "----检索式:[" + lst.Count + "]条");
            //log.Info(System.DateTime.Now.ToString() + "----检索式:[" + lst.Count + "]条");

            for (int i = 0; i < lst.Count; i++)
            {
                Searches se = lst[i] as Searches;
                PatentWarnning.TaskWarnning.ParamObject po = new PatentWarnning.TaskWarnning.ParamObject(null, se, int.Parse(strYJUserID));
                TaskWarnning.task(po);
            }
        }
示例#3
0
        /// <summary>
        /// 任务 :检索 + 插入数据 
        /// </summary>
        /// <param name="o"></param>
        public static void task(object o)
        {
            ParamObject po = o as ParamObject;
            Searches se = po._se;
            int userid = po.UserId;
            ScanSearch scan = new ScanSearch();
            try
            {
                PatentWarnning.ServiceReference.SearchDbType YjDbType = PatentWarnning.ServiceReference.SearchDbType.Cn;
                switch (se.DBSource.ToUpper().Trim())
                {
                    case "CN":
                        //送中文引擎
                        break;
                    case "DOCDB":
                    case "EN": //陈晓雨修改
                        //送英文引擎
                        YjDbType = PatentWarnning.ServiceReference.SearchDbType.DocDB;
                        break;
                }
                scan.SendSearch(se, 998, userid, YjDbType);

            }
            catch (Exception ex)
            {
                //log.Info(System.DateTime.Now + "--" + ex.Message);
                return;
            }
            finally
            {
                if (po.mre != null)
                {
                    //po.mre.Set();  //方法执行结束前,设置事件对象的信号发出(终止状态)
                }
            }
        }