예제 #1
0
        void load_show()
        {
            //Console.WriteLine("开始执行显示");
            int first = page * size,
                last  = (page + 1) * size;

            if (last > list.Count)
            {
                last = list.Count;
            }

            int idx = 0;

            for (int i = first; i < last; i++)
            {
                this.Invoke(new MethodInvoker(delegate {
                    eList item    = (eList)panelbody.Controls[idx];
                    item.GoodName = list[i]["sphh"].ToString();
                    item.number   = list[i]["sl"].ToString();
                    if (list[i]["sjsl"] != null)
                    {
                        item.number2 = list[i]["sjsl"].ToString();
                    }
                    item.CutSn        = list[i]["ch"].ToString();
                    item.Group        = list[i]["bmmc"].ToString();
                    item.Unit         = list[i]["dw"].ToString();
                    item.CatName      = list[i]["CatName"].ToString();
                    item.MaterialName = list[i]["chmc"].ToString();
                    item.status       = int.Parse(list[i]["ddzt"].ToString());
                    item.MaterialCode = list[i]["chdm"].ToString();
                    item.RequestTime  = DateTime.Parse(list[i]["bfsqrq"].ToString());
                    if (list[i].ContainsKey("ccblr"))
                    {//测试
                        item.ccblr = list[i]["ccblr"].ToString();
                    }
                    if (list[i].ContainsKey("cjllr"))
                    {
                        item.cjllr = list[i]["cjllr"].ToString();
                    }

                    item.load_data();
                    if (int.Parse(list[i]["ddzt"].ToString()) == 4)
                    {//通知领料的是绿色
                        item.BackColor = Color.Green;
                    }
                    item.Show();
                    Application.DoEvents();
                    idx++;
                    if (item.status == 1)
                    {
                        _borcast.add(item.Group, item.GoodName, item.CutSn);
                    }
                }));

                Thread.Sleep(100);
            }
            Thread.Sleep(120000);
            //Application.DoEvents();
            //Console.WriteLine("开始执行Hide");
            load_hide();
            if (last == list.Count) //最后1页,重新加载,非最后页加载下一页
            {
                list = null;
                load_list();
            }
            else
            {
                page++;
                load_show();
            }
        }