Example #1
0
        /// <summary>
        /// 获取最大遗漏
        /// </summary>
        /// <param name="CaiData">配置信息</param>
        /// <param name="day">天数</param>
        /// <returns>周期数据列表</returns>
        public List<NumSpanData> GetMaxLeft(CaiConfigData CaiData,int day)
        {
            List<NumSpanData> spans = new List<NumSpanData>();
            DwNumberDAO da = new DwNumberDAO(ConfigHelper.GetConnString(CaiData.CaiType));
            DwSpanDAO spanda = new DwSpanDAO(ConfigHelper.GetDwSpanTableName(CaiData.NumType), ConfigHelper.GetConnString(CaiData.CaiType));
            string pBegin = BizBase.getPByDate(CaiData.NowCaculate, CaiData);//开始计算的时间
            string condition = " where p < "+pBegin+" order by p desc";
            List<DwNumber> dtos = da.SelectTopN(day*CaiData.PeriodPerDay,condition,new string[]{"P","D1","N","P2","Date"});
            string[] numList = Data.Biz.D11X5.NumberCache.Instance.GetNumbers(CaiData.NumType).ToArray<string>();

            foreach (string num in numList)
            {
                NumSpanData span = new NumSpanData();
                span.num = num;
                span.p = da.GetPeroidBefore(span.num,CaiData.NumType, CaiData.NowCaculate);

                span.SpanMax = spanda.SelectMaxSpan(span.num);
                span.SpanTillNow = BizBase.getSpanTillNow(span.p,CaiData);
                span.SpanAvg = spanda.SelectAvgSpan(span.num);
                span = this.getTimesByNum(span,CaiData,dtos);

                spans.Add(span);
            }

            return spans;
        }
Example #2
0
        /// <summary>
        /// 获取最大遗漏
        /// </summary>
        /// <param name="CaiData">配置信息</param>
        /// <param name="day">天数</param>
        /// <returns>周期数据列表</returns>
        public List <NumSpanData> GetMaxLeft(CaiConfigData CaiData, int day)
        {
            List <NumSpanData> spans     = new List <NumSpanData>();
            DwNumberDAO        da        = new DwNumberDAO(ConfigHelper.GetConnString(CaiData.CaiType));
            DwSpanDAO          spanda    = new DwSpanDAO(ConfigHelper.GetDwSpanTableName(CaiData.NumType), ConfigHelper.GetConnString(CaiData.CaiType));
            string             pBegin    = BizBase.getPByDate(CaiData.NowCaculate, CaiData);//开始计算的时间
            string             condition = " where p < " + pBegin + " order by p desc";
            List <DwNumber>    dtos      = da.SelectTopN(day * CaiData.PeriodPerDay, condition, new string[] { "P", "D1", "N", "P2", "Date" });

            string[] numList = Data.Biz.D11X5.NumberCache.Instance.GetNumbers(CaiData.NumType).ToArray <string>();

            foreach (string num in numList)
            {
                NumSpanData span = new NumSpanData();
                span.num = num;
                span.p   = da.GetPeroidBefore(span.num, CaiData.NumType, CaiData.NowCaculate);

                span.SpanMax     = spanda.SelectMaxSpan(span.num);
                span.SpanTillNow = BizBase.getSpanTillNow(span.p, CaiData);
                span.SpanAvg     = spanda.SelectAvgSpan(span.num);
                span             = this.getTimesByNum(span, CaiData, dtos);

                spans.Add(span);
            }

            return(spans);
        }
Example #3
0
        /// <summary>
        /// 获取周期统计
        /// </summary>
        /// <param name="CaiData">配置数据对象</param>
        /// <returns>周期对象列表</returns>
        public List<NumSpanData> GetSpanCount(CaiConfigData CaiData)
        {
            if(CaiData.IsLoadFromCache){
                //从缓存中获取
                List<NumSpanData> re = BizBase.XMLDeserialize(CaiData);
                if (re != null)
                {
                    //计算一下next period
                    re = GetNextPeriod(CaiData, re);
                    return re;
                }
            }

             List<NumSpanData> spans = new List<NumSpanData>();

             DwSpanDAO da = new DwSpanDAO("DwPeroidSpan", ConfigHelper.GetConnString(CaiData.CaiType));

            //全部数字组合
             string[] numList = Data.Biz.D11X5.NumberCache.Instance.GetNumbers(CaiData.NumType).ToArray<string>();

            //获取今天出的全部号码
            DwNumberDAO nda = new DwNumberDAO(ConfigHelper.GetConnString(CaiData.CaiType));
            DateTime dt = CaiData.NowCaculate.AddDays(1);
            string NumCondition = "where date = "+dt.ToString("yyyyMMdd");
            List<DwNumber> TodayDtos = nda.SelectWithCondition(NumCondition,new string[]{"P","D1","N","P2","Date"});

            foreach (string num in numList)
            {
                NumSpanData span = new NumSpanData();
                span.num = num;

                string pBegin = BizBase.getPByDate(CaiData.NowCaculate, CaiData);//开始计算的时间

                DataSet dtos = da.SelectTopNSpan(num,1008,pBegin);
                List<int> spanList = new List<int>();
                int i = 0;
                foreach (DataRow dto in dtos.Tables[0].Rows)
                {
                    if (i == 0)
                    {
                        span.p = dto["P"].ToString();
                        span.SpanLast = Convert.ToInt32(dto["P2Spans"].ToString());
                        span.SpanTillNow = BizBase.getSpanTillNow(span.p, CaiData);
                    }
                    //span.SpanRec += dto["P2Span"].ToString() + ",";
                    i++;
                    spanList.Add(Convert.ToInt32(dto["P2Spans"].ToString()));

                }

                span.SpanMax = da.SelectMaxSpan(span.num);
                span.SpanAvg = da.SelectAvgSpan(span.num);
                span.NextAll = getNextCyclesByNum(span, spanList, CaiData);

                //pBegin后的第二天出现的期数
                span.Next = this.GETNFromDate(span.num,CaiData,TodayDtos);
                //最小误差
                span = this.GetNextTest(span);

                //最近出现的总次数及每日次数
                string numsql = " where p < "+pBegin+" order by p desc";
                List<DwNumber> numdtos = nda.SelectTopN((1008+(10*CaiData.PeriodPerDay)),numsql,new string[]{"P","D1","N","P2","Date"});
                span = this.getTimesByNum(span,CaiData,numdtos);
                span.TimesDay1 = span.Next.Split(',').Length-1;

                //最近周期
                span = this.getHotTrends(span,CaiData,numdtos);

                //周期热度
                if(span.Times<5)
                    span.HotType = -1;
                else if(span.Times>=12)
                    span.HotType = 1;
                else
                    span.HotType = 0;

                CaiData.StatusLabel = span.num+" Caculated!";
                spans.Add(span);
            }

            //计算一下next period
            spans = GetNextPeriod(CaiData,spans);

            //序列化保存至缓存
            BizBase.XMLSerialize(spans,CaiData);

            return spans;
        }
Example #4
0
        /// <summary>
        /// 获取周期统计
        /// </summary>
        /// <param name="CaiData">配置数据对象</param>
        /// <returns>周期对象列表</returns>
        public List <NumSpanData> GetSpanCount(CaiConfigData CaiData)
        {
            if (CaiData.IsLoadFromCache)
            {
                //从缓存中获取
                List <NumSpanData> re = BizBase.XMLDeserialize(CaiData);
                if (re != null)
                {
                    //计算一下next period
                    re = GetNextPeriod(CaiData, re);
                    return(re);
                }
            }

            List <NumSpanData> spans = new List <NumSpanData>();

            DwSpanDAO da = new DwSpanDAO("DwPeroidSpan", ConfigHelper.GetConnString(CaiData.CaiType));

            //全部数字组合
            string[] numList = Data.Biz.D11X5.NumberCache.Instance.GetNumbers(CaiData.NumType).ToArray <string>();

            //获取今天出的全部号码
            DwNumberDAO     nda          = new DwNumberDAO(ConfigHelper.GetConnString(CaiData.CaiType));
            DateTime        dt           = CaiData.NowCaculate.AddDays(1);
            string          NumCondition = "where date = " + dt.ToString("yyyyMMdd");
            List <DwNumber> TodayDtos    = nda.SelectWithCondition(NumCondition, new string[] { "P", "D1", "N", "P2", "Date" });

            foreach (string num in numList)
            {
                NumSpanData span = new NumSpanData();
                span.num = num;

                string pBegin = BizBase.getPByDate(CaiData.NowCaculate, CaiData);//开始计算的时间

                DataSet    dtos     = da.SelectTopNSpan(num, 1008, pBegin);
                List <int> spanList = new List <int>();
                int        i        = 0;
                foreach (DataRow dto in dtos.Tables[0].Rows)
                {
                    if (i == 0)
                    {
                        span.p           = dto["P"].ToString();
                        span.SpanLast    = Convert.ToInt32(dto["P2Spans"].ToString());
                        span.SpanTillNow = BizBase.getSpanTillNow(span.p, CaiData);
                    }
                    //span.SpanRec += dto["P2Span"].ToString() + ",";
                    i++;
                    spanList.Add(Convert.ToInt32(dto["P2Spans"].ToString()));
                }

                span.SpanMax = da.SelectMaxSpan(span.num);
                span.SpanAvg = da.SelectAvgSpan(span.num);
                span.NextAll = getNextCyclesByNum(span, spanList, CaiData);

                //pBegin后的第二天出现的期数
                span.Next = this.GETNFromDate(span.num, CaiData, TodayDtos);
                //最小误差
                span = this.GetNextTest(span);

                //最近出现的总次数及每日次数
                string          numsql  = " where p < " + pBegin + " order by p desc";
                List <DwNumber> numdtos = nda.SelectTopN((1008 + (10 * CaiData.PeriodPerDay)), numsql, new string[] { "P", "D1", "N", "P2", "Date" });
                span           = this.getTimesByNum(span, CaiData, numdtos);
                span.TimesDay1 = span.Next.Split(',').Length - 1;

                //最近周期
                span = this.getHotTrends(span, CaiData, numdtos);


                //周期热度
                if (span.Times < 5)
                {
                    span.HotType = -1;
                }
                else if (span.Times >= 12)
                {
                    span.HotType = 1;
                }
                else
                {
                    span.HotType = 0;
                }

                CaiData.StatusLabel = span.num + " Caculated!";
                spans.Add(span);
            }

            //计算一下next period
            spans = GetNextPeriod(CaiData, spans);

            //序列化保存至缓存
            BizBase.XMLSerialize(spans, CaiData);

            return(spans);
        }