Beispiel #1
0
        /// <summary>
        /// 计算遗漏
        /// </summary>
        public void CaculateLeftSpan(int day)
        {
            //5天 6天 7天遗漏
            //P2 NOW MAX MIN
            Statatics stat = new Statatics();
            List<NumSpanData> spans = stat.GetMaxLeft(CaiData, day);
            ListViewData lvd = new ListViewData();
            lvd.name = CaiData.CaiType + " " + CaiData.NumType + " 遗漏 " + CaiData.NowCaculate.ToString("MM-dd");
            lvd.title = new string[] { CaiData.NumType, "p", "now", "max", "avg",
                "times","1day","2day","3day","4day","5day","6days","7days"};
            lvd.values = new List<string[]>();

            foreach (NumSpanData span in spans)
            {
                string[] values = new string[] {
                    span.num,
                    span.p,
                    span.SpanTillNow.ToString(),
                    span.SpanMax.ToString(),
                    span.SpanAvg.ToString(),
                    span.Times.ToString(),
                    span.TimesDay1.ToString(),
                    span.TimesDay2.ToString(),
                    span.TimesDay3.ToString(),
                    span.TimesDay4.ToString(),
                    span.TimesDay5.ToString(),
                    span.TimesDay6.ToString(),
                    span.TimesDay7.ToString()
                };
                lvd.values.Add(values);
            }
            lvd.values = lvd.values.OrderBy(x => int.Parse(x[5])).ToList();
            list = lvd;
        }
Beispiel #2
0
        /// <summary>
        /// 计算遗漏
        /// </summary>
        public void CaculateLeftSpan(int day)
        {
            //5天 6天 7天遗漏
            //P2 NOW MAX MIN
            Statatics          stat  = new Statatics();
            List <NumSpanData> spans = stat.GetMaxLeft(CaiData, day);
            ListViewData       lvd   = new ListViewData();

            lvd.name  = CaiData.CaiType + " " + CaiData.NumType + " 遗漏 " + CaiData.NowCaculate.ToString("MM-dd");
            lvd.title = new string[] { CaiData.NumType, "p", "now", "max", "avg",
                                       "times", "1day", "2day", "3day", "4day", "5day", "6days", "7days" };
            lvd.values = new List <string[]>();

            foreach (NumSpanData span in spans)
            {
                string[] values = new string[] {
                    span.num,
                    span.p,
                    span.SpanTillNow.ToString(),
                    span.SpanMax.ToString(),
                    span.SpanAvg.ToString(),
                    span.Times.ToString(),
                    span.TimesDay1.ToString(),
                    span.TimesDay2.ToString(),
                    span.TimesDay3.ToString(),
                    span.TimesDay4.ToString(),
                    span.TimesDay5.ToString(),
                    span.TimesDay6.ToString(),
                    span.TimesDay7.ToString()
                };
                lvd.values.Add(values);
            }
            lvd.values = lvd.values.OrderBy(x => int.Parse(x[5])).ToList();
            list       = lvd;
        }
Beispiel #3
0
        /// <summary>
        /// 显示最新开出的数字
        /// </summary>
        private void ShowNewNumber()
        {
            string date = BizBase.GetDateNow();

            if (DateTime.Now.Hour < CaiData.TimeBeginHour)
            {
                date = DateTime.Now.AddDays(-1).ToString("yyyyMMdd");
            }

            DwNumberDAO     da        = new DwNumberDAO(ConfigHelper.GetConnString(CaiData.CaiType));
            string          condition = "where date= " + date + " order by p desc";
            List <DwNumber> lists     = da.SelectTopN(CaiData.PeriodPerDay, condition, null);
            ListViewData    lvd       = new ListViewData();

            lvd.name   = CaiData.CaiType + " NEW";
            lvd.title  = new string[] { "p2", "n", "p5" };
            lvd.width  = new int[] { 60, 60, 100 };
            lvd.values = new List <string[]>();
            foreach (DwNumber dto in lists)
            {
                string[] values = new string[] { dto.P2, dto.N.ToString(), dto.P5.ToString() };
                lvd.values.Add(values);
            }
            this.SetListView(listViewRealTime, lvd);
            groupBox1.Text = "Real Time " + DateTime.Now.ToString("yyyy-MM-dd HH:mm");
        }
Beispiel #4
0
        /// <summary>
        /// 设置指定listview的数据
        /// </summary>
        /// <param name="lv">listview控件</param>
        /// <param name="lvd">listview数据对象</param>
        private void SetListView(ListView lv, ListViewData lvd)
        {
            //清空listview里边的数据
            lv.Clear();
            //添加表头
            foreach (string title in lvd.title)
            {
                lv.Columns.Add(title, 60);
            }

            //设置宽度
            if (lvd.width != null)
            {
                for (int w = 0; w < lvd.width.Length; w++)
                {
                    lv.Columns[w].Width = lvd.width[w];
                }
            }

            //设置各列的值
            if (lvd.values.Count > 0)
            {
                ListViewItem[] items = new ListViewItem[lvd.values.Count];
                for (int l = 0; l < lvd.values.Count; l++)
                {
                    items[l] = new ListViewItem(lvd.values[l]);
                    //item[l].SubItems[0].BackColor = Color.Red; //用于设置某行的背景颜色
                }
                lv.Items.AddRange(items);
            }
        }
Beispiel #5
0
        private void toolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = (ToolStripMenuItem)sender;
            ListView          lv   = getCurrentListView();
            ListViewData      lvd  = new ListViewData();

            lvd.name = tabControl1.SelectedTab.Text;
            lvd      = getCachedListView(lvd);
            int index = Convert.ToInt32(item.Text);

            lvd.values = lvd.values.OrderBy(x => int.Parse(x[index])).ToList();
            SetListView(lv, lvd);
        }
Beispiel #6
0
        private ListViewData getCachedListView(ListViewData newlvd)
        {
            bool isIn = false;

            foreach (ListViewData lvd in lvds)
            {
                if (lvd.name == newlvd.name)
                {
                    isIn = true;
                    return(lvd);
                }
            }
            if (!isIn)
            {
                lvds.Add(newlvd);
            }
            return(newlvd);
        }
Beispiel #7
0
        /// <summary>
        /// 创建一个TAB,并添加一个ListView
        /// </summary>
        /// <param name="lvd"></param>
        public void CreateListView(ListViewData lvd)
        {
            lvd = getCachedListView(lvd);
            TabPage tp = new TabPage();

            tp.Dock   = DockStyle.Fill;
            tp.Text   = lvd.name;
            tp.Parent = tabControl1;
            ListView lv = new ListView();

            //ListView lv = listView1;
            lv.Dock          = DockStyle.Fill;
            lv.View          = View.Details;
            lv.FullRowSelect = true;
            lv.GridLines     = true;
            tp.Controls.Add(lv);
            SetListView(lv, lvd);
            tabControl1.SelectedTab = tp;
            lv.ContextMenuStrip     = contextMenuStripClose;
        }
Beispiel #8
0
        /// <summary>
        /// 实时计算span cyle
        /// </summary>
        public void AnalysisSpanCycle()
        {
            Statatics stat = new Statatics();
            List<NumSpanData> spans = stat.GetSpanCount(CaiData);
            ListViewData lvd = new ListViewData();
            lvd.name = CaiData.CaiType + " " + CaiData.NumType + " 周期 " + CaiData.NowCaculate.ToString("yyyy-MM-dd");
            lvd.title = new string[] { CaiData.NumType, "p", "now", "next", "nexttest", "nextability","nextall", "max", "avg",
                "times","1day","2day","3day","4day","5day","6days","7days","hot","hottrend","hotrec"};
            lvd.values = new List<string[]>();

            foreach (NumSpanData span in spans)
            {
                string[] values = new string[] { span.num,span.p, span.SpanTillNow.ToString(),span.Next,span.NextTest.ToString(),span.NextAbility,span.NextAll, span.SpanMax.ToString(), span.SpanAvg.ToString(),
                    span.Times.ToString(),span.TimesDay1.ToString(),span.TimesDay2.ToString(),
                    span.TimesDay3.ToString(),span.TimesDay4.ToString(),span.TimesDay5.ToString(),
                    span.TimesDay6.ToString(),span.TimesDay7.ToString(),
                    span.HotType.ToString(),span.HotTrend.ToString(),span.HotRecent};
                lvd.values.Add(values);
            }
            lvd.values = lvd.values.OrderBy(x => int.Parse(x[4])).ToList();
            list = lvd;
        }
Beispiel #9
0
        /// <summary>
        /// 实时计算span cyle
        /// </summary>
        public void AnalysisSpanCycle()
        {
            Statatics          stat  = new Statatics();
            List <NumSpanData> spans = stat.GetSpanCount(CaiData);
            ListViewData       lvd   = new ListViewData();

            lvd.name  = CaiData.CaiType + " " + CaiData.NumType + " 周期 " + CaiData.NowCaculate.ToString("yyyy-MM-dd");
            lvd.title = new string[] { CaiData.NumType, "p", "now", "next", "nexttest", "nextability", "nextall", "max", "avg",
                                       "times", "1day", "2day", "3day", "4day", "5day", "6days", "7days", "hot", "hottrend", "hotrec" };
            lvd.values = new List <string[]>();

            foreach (NumSpanData span in spans)
            {
                string[] values = new string[] { span.num, span.p, span.SpanTillNow.ToString(), span.Next, span.NextTest.ToString(), span.NextAbility, span.NextAll, span.SpanMax.ToString(), span.SpanAvg.ToString(),
                                                 span.Times.ToString(), span.TimesDay1.ToString(), span.TimesDay2.ToString(),
                                                 span.TimesDay3.ToString(), span.TimesDay4.ToString(), span.TimesDay5.ToString(),
                                                 span.TimesDay6.ToString(), span.TimesDay7.ToString(),
                                                 span.HotType.ToString(), span.HotTrend.ToString(), span.HotRecent };
                lvd.values.Add(values);
            }
            lvd.values = lvd.values.OrderBy(x => int.Parse(x[4])).ToList();
            list       = lvd;
        }
Beispiel #10
0
 private void toolStripMenuItem_Click(object sender, EventArgs e)
 {
     ToolStripMenuItem item = (ToolStripMenuItem)sender;
     ListView lv = getCurrentListView();
     ListViewData lvd = new ListViewData();
     lvd.name = tabControl1.SelectedTab.Text;
     lvd = getCachedListView(lvd);
     int index = Convert.ToInt32(item.Text);
     lvd.values = lvd.values.OrderBy(x => int.Parse(x[index])).ToList();
     SetListView(lv, lvd);
 }
Beispiel #11
0
        /// <summary>
        /// 显示最新开出的数字
        /// </summary>
        private void ShowNewNumber()
        {
            string date = BizBase.GetDateNow();
            if (DateTime.Now.Hour < CaiData.TimeBeginHour)
                date = DateTime.Now.AddDays(-1).ToString("yyyyMMdd");

            DwNumberDAO da = new DwNumberDAO(ConfigHelper.GetConnString(CaiData.CaiType));
            string condition = "where date= " + date + " order by p desc";
            List<DwNumber> lists = da.SelectTopN(CaiData.PeriodPerDay, condition, null);
            ListViewData lvd = new ListViewData();
            lvd.name = CaiData.CaiType + " NEW";
            lvd.title = new string[] { "p2", "n", "p5" };
            lvd.width = new int[] { 60, 60, 100 };
            lvd.values = new List<string[]>();
            foreach (DwNumber dto in lists)
            {
                string[] values = new string[] { dto.P2, dto.N.ToString(), dto.P5.ToString() };
                lvd.values.Add(values);
            }
            this.SetListView(listViewRealTime, lvd);
            groupBox1.Text = "Real Time " + DateTime.Now.ToString("yyyy-MM-dd HH:mm");
        }
Beispiel #12
0
        /// <summary>
        /// 设置指定listview的数据
        /// </summary>
        /// <param name="lv">listview控件</param>
        /// <param name="lvd">listview数据对象</param>
        private void SetListView(ListView lv, ListViewData lvd)
        {
            //清空listview里边的数据
            lv.Clear();
            //添加表头
            foreach (string title in lvd.title)
            {
                lv.Columns.Add(title, 60);
            }

            //设置宽度
            if (lvd.width != null)
            {
                for (int w = 0; w < lvd.width.Length; w++)
                {
                    lv.Columns[w].Width = lvd.width[w];
                }
            }

            //设置各列的值
            if (lvd.values.Count > 0)
            {
                ListViewItem[] items = new ListViewItem[lvd.values.Count];
                for (int l = 0; l < lvd.values.Count; l++)
                {
                    items[l] = new ListViewItem(lvd.values[l]);
                    //item[l].SubItems[0].BackColor = Color.Red; //用于设置某行的背景颜色
                }
                lv.Items.AddRange(items);
            }
        }
Beispiel #13
0
 private ListViewData getCachedListView(ListViewData newlvd)
 {
     bool isIn = false;
     foreach (ListViewData lvd in lvds)
     {
         if (lvd.name == newlvd.name)
         {
             isIn = true;
             return lvd;
         }
     }
     if (!isIn)
     {
         lvds.Add(newlvd);
     }
     return newlvd;
 }
Beispiel #14
0
 /// <summary>
 /// 创建一个TAB,并添加一个ListView
 /// </summary>
 /// <param name="lvd"></param>
 public void CreateListView(ListViewData lvd)
 {
     lvd = getCachedListView(lvd);
     TabPage tp = new TabPage();
     tp.Dock = DockStyle.Fill;
     tp.Text = lvd.name;
     tp.Parent = tabControl1;
     ListView lv = new ListView();
     //ListView lv = listView1;
     lv.Dock = DockStyle.Fill;
     lv.View = View.Details;
     lv.FullRowSelect = true;
     lv.GridLines = true;
     tp.Controls.Add(lv);
     SetListView(lv, lvd);
     tabControl1.SelectedTab = tp;
     lv.ContextMenuStrip = contextMenuStripClose;
 }