예제 #1
0
        /// <summary>
        /// 获取新增报警断电信息
        /// </summary>
        public void getdata()
        {
            short       type    = 0;
            long        id      = 0;
            Jc_BInfo    jcb     = null;
            Jc_BInfo    obj     = null;
            DateTime    maxtime = timenow;
            long        key     = 0;
            List <long> listkey;

            lock (StaticClass.bjobj)
            {
                #region 获取开关量状态变动数据
                try
                {
                    listkey = StaticClass.jcbdata.Keys.ToList();
                    for (int kj = 0; kj < listkey.Count; kj++)
                    {
                        key  = listkey[kj];
                        jcb  = StaticClass.jcbdata[key];
                        type = jcb.Type;
                        if (jcb.Stime >= timenow)
                        {
                            if (OprFuction.IsKGL(jcb) && !jc_b.ContainsKey(long.Parse(jcb.ID)))
                            {
                                if (jcb.Stime > maxtime)
                                {
                                    maxtime = jcb.Stime;
                                    id      = long.Parse(jcb.ID);
                                }
                                #region 新增开关量状态
                                obj = OprFuction.NewDTO(jcb);
                                jc_b.Add(long.Parse(obj.ID), obj);
                                addlist.Add(long.Parse(obj.ID));
                                #endregion
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Basic.Framework.Logging.LogHelper.Error(ex);
                }
                if (id > dqid)
                {
                    dqid = id;
                }
                if (maxtime > timenow)
                {
                    timenow = maxtime;
                }
                #region 判断开关量状态记录是否可以删除
                DateTime now = Model.RealInterfaceFuction.GetServerNowTime();
                listkey = jc_b.Keys.ToList();
                for (int kj = 0; kj < listkey.Count; kj++)
                {
                    key = listkey[kj];
                    if ((now - jc_b[key].Stime).TotalMinutes > 1)
                    {
                        deletelist.Add(key);
                    }
                }
                #endregion
                #endregion
            }
        }