Exemplo n.º 1
0
        private void InialPlineGridInfo()
        {
            PlineInfo line1 = new PlineInfo();

            line1.PLineID = "Line1";
            List <string> pnlist1 = new List <string>();

            pnlist1.Add("102032");
            pnlist1.Add("10332");
            pnlist1.Add("104232");
            pnlist1.Add("156332");
            pnlist1.Add("132332");

            List <string> pnlist2 = new List <string>();

            pnlist2.Add("201234");
            pnlist2.Add("201564");
            pnlist2.Add("207334");
            pnlist2.Add("101234");
            pnlist2.Add("421034");



            List <string> pnlist3 = new List <string>();

            pnlist3.Add("342343");
            pnlist3.Add("674354");
            pnlist3.Add("104232");
            pnlist3.Add("156332");
            pnlist3.Add("189923");


            List <string> pnlist4 = new List <string>();

            pnlist4.Add("212032");
            pnlist2.Add("323324");
            pnlist4.Add("404232");
            pnlist4.Add("213325");
            pnlist4.Add("232332");

            line1.PN = pnlist1;

            List <int> pList = new List <int>();

            pList.Add(1200);
            pList.Add(1300);
            pList.Add(1450);
            pList.Add(1420);
            pList.Add(1220);
            line1.PLAN = pList;

            List <int> actualList = new List <int>();

            actualList.Add(1254);
            actualList.Add(1249);
            actualList.Add(1239);
            actualList.Add(1322);
            actualList.Add(1122);
            line1.Actual = actualList;
            List <int> oeeList = new List <int>();

            oeeList.Add(86);
            oeeList.Add(88);
            oeeList.Add(90);
            oeeList.Add(92);
            oeeList.Add(92);
            line1.OEE = oeeList;

            plinelist.Add(line1);

            PlineInfo line2 = new PlineInfo();

            line2.PLineID = "Line2";
            line2.PN      = pnlist2;
            line2.PLAN    = pList;
            line2.Actual  = actualList;
            line2.OEE     = oeeList;
            plinelist.Add(line2);

            PlineInfo line3 = new PlineInfo();

            line3.PLineID = "Line3";
            line3.PN      = pnlist3;
            line3.PLAN    = pList;
            line3.Actual  = actualList;
            line3.OEE     = oeeList;
            plinelist.Add(line3);

            PlineInfo line4 = new PlineInfo();

            line4.PLineID = "MGU\r\tLine";
            line4.PN      = pnlist4;
            line4.PLAN    = pList;
            line4.Actual  = actualList;
            line4.OEE     = oeeList;
            plinelist.Add(line4);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 初始化数据列表
        /// </summary>
        private void LoadDataGrid2()
        {
            if (index >= 4)
            {
                index = 0;
            }

            ArrayList list = new ArrayList();

            list.Add("MGU Lin1");
            list.Add("PN");
            list.Add("PLAN");
            list.Add("ACTUAL");
            list.Add("OEE");

            PlineInfo info = (PlineInfo)plinelist[index];

            int rowHeight = (int)((double)this.dataGridView1.Height / 5) - 6;
            //if (pItems == null)
            //    return;

            Random ran     = new Random();
            int    RandKey = ran.Next(100, 999);

            DataGridViewRow row = new DataGridViewRow();


            for (int i = 0; i < 5; i++)
            {
                DataGridViewTextBoxCell contentCell = new DataGridViewTextBoxCell();
                if (i > 0)
                {
                    contentCell.Value = list[i].ToString();
                }
                else
                {
                    contentCell.Value = "";
                }


                contentCell.Style.ForeColor = Color.White;
                row.Cells.Add(contentCell);
            }


            row.Height = rowHeight;
            row.DefaultCellStyle.Font = new Font("黑体", 9, FontStyle.Bold);

            row.DefaultCellStyle.WrapMode  = DataGridViewTriState.True;
            row.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            this.dataGridView1.Rows.Add(row);


            for (int c = 0; c < 4; c++)
            {
                row = new DataGridViewRow();

                double oee  = 0.0;
                int    plan = 0;
                for (int i = 0; i < 5; i++)
                {
                    DataGridViewTextBoxCell contentCell = new DataGridViewTextBoxCell();



                    switch (i)
                    {
                    case 0:

                        //contentCell.Value = "MGU Lin1";
                        contentCell.Value = info.PLineID;
                        break;

                    case 1:
                        //contentCell.Value = string.Empty;
                        contentCell.Value = info.PN[c];
                        break;

                    case 2:
                        //RandKey = ran.Next(500, 800);
                        //contentCell.Value = (RandKey ).ToString();
                        // contentCell.Value = string.Empty;
                        plan = (int)CommUitls.GetRandomNumber(info.PLAN[c] - 10, info.PLAN[c] + 50, 2);
                        contentCell.Value = plan.ToString();
                        break;

                    case 3:

                        //contentCell.Value = (RandKey - 40).ToString();
                        // contentCell.Value = string.Empty;

                        oee = (int)CommUitls.GetRandomNumber(info.OEE[c] - 4, info.OEE[c] + 3, 2);

                        double changeVal = oee / 100;
                        // int actual = (int)CommUitls.GetRandomNumber(info.Actual[c] - 10, info.Actual[c] + 50, 2);
                        int actual = (int)(plan * changeVal);

                        contentCell.Value = actual.ToString();
                        //contentCell.Value = info.Actual[i].ToString();
                        break;

                    case 4:
                        //RandKey = ran.Next(88, 95);
                        //contentCell.Value = RandKey.ToString() + "%";
                        // contentCell.Value = string.Empty;

                        // int oee = (int)CommUitls.GetRandomNumber(info.OEE[c] - 4, info.OEE[c] + 3, 2);
                        //   int oee = GetRandomValue(info.PLineID, 2);
                        contentCell.Value = ((int)oee).ToString() + "%";
                        //contentCell.Value = info.OEE[i].ToString() + "%";
                        break;

                    default:
                        break;
                    }

                    contentCell.Style.ForeColor = Color.White;
                    row.Cells.Add(contentCell);
                }
                row.Height = rowHeight;
                row.DefaultCellStyle.Font = new Font("黑体", 9, FontStyle.Bold);

                row.DefaultCellStyle.WrapMode  = DataGridViewTriState.True;
                row.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                this.dataGridView1.Rows.Add(row);
            }

            index++;
        }