Beispiel #1
0
        private void SaveGRRWithColibriModel()
        {
            CollectData();
            //MessageBox.Show("准备生成GRR报告。使用科瑞GRR模板。");
            string[] datanames = Enum.GetNames(typeof(EnumDataName));
            m_ExcelOperation = new ExcelOfficeOperation(ReportModelFileColibri, GRRSaveLocation);
            //MessageBox.Show("新建Excel程序成功。");
            m_ExcelOperation.BuildGRRSheet(Enum.GetNames(typeof(EnumDataName)));
            //MessageBox.Show("Excel文件工作表创建成功,开始导入公差。");
            string tol, grr;
            int    part;

            for (int p = 0; p < datanames.Length; p++)
            {
                tol = ((TextBox)this.Controls.Find("textBoxTol" + datanames[p], true)[0]).Text;
                m_ExcelOperation.SetCellText(7, 9, tol, datanames[p]);
            }
            //MessageBox.Show("公差导入完成。开始导入数据。");
            for (int p = 0; p < datanames.Length; p++)
            {
                part = 0;
                foreach (Dictionary <EnumDataName, List <double> > datas in GRRData.Values)
                {
                    for (int i = 0; i < 9; i++)
                    {
                        m_ExcelOperation.SetCellText(11 + part, 3 + i + (int)(i / 3) * 2, datas[(EnumDataName)p][i].ToString(), datanames[p]);
                    }
                    part++;
                }
                m_ExcelOperation.SetCellText(5, 13, DateTime.Now.ToShortDateString(), datanames[p]);
                m_ExcelOperation.SetCellText(6, 4, datanames[p], datanames[p]);
            }
            //MessageBox.Show("数据导入完成,开始获取GRR结果。");
            for (int p = 0; p < datanames.Length; p++)
            {
                grr = m_ExcelOperation.GetCellText(66, 7, datanames[p]);
                //if (double.Parse(grr.Replace("%", "")) > 10) grr = ((1 + double.Parse(grr.Replace("%", "")) / 100) * 0.05).ToString("0.00%");
                BaseForm.SetControlText(Controls.Find("textBoxGRR" + datanames[p], true)[0], grr);
            }
            //MessageBox.Show("GRR结果已获取。准备保存报告。");
            m_ExcelOperation.SaveAll();
            m_ExcelOperation.Quit();
        }
Beispiel #2
0
        private void SaveGRRWithATLModel()
        {
            CollectData();
            //MessageBox.Show("准备生成GRR报告。使用客户GRR模板。");
            string[] datanames = Enum.GetNames(typeof(EnumDataName));
            m_ExcelOperation = new ExcelOfficeOperation(ReportModelFileATL, GRRSaveLocation);
            //MessageBox.Show("新建Excel程序成功。开始导入数据。");
            string tol, grr;
            int    row = 9, col = 4;
            int    part;

            for (int p = 0; p < datanames.Length; p++)
            {
                //参数
                col = -1;
                switch ((EnumDataName)p)
                {
                case EnumDataName.厚度: col = 4; break;

                case EnumDataName.宽度: col = 5; break;

                case EnumDataName.长度: col = 6; break;

                case EnumDataName.AlTab边距: col = 7; break;

                case EnumDataName.AlTab最大边距: col = 8; break;

                case EnumDataName.NiTab边距: col = 9; break;

                case EnumDataName.NiTab最大边距: col = 10; break;

                case EnumDataName.Tab间距: col = 11; break;

                case EnumDataName.AlSealant高度: col = 12; break;

                case EnumDataName.NiSealant高度: col = 13; break;
                }
                if (col != -1)
                {
                    tol = m_ExcelOperation.GetCellText(7, col, 1);
                    BaseForm.SetControlText(Controls.Find("textBoxTol" + datanames[p], true)[0], tol);
                    part = 0;
                    foreach (Dictionary <EnumDataName, List <double> > datas in GRRData.Values)
                    {
                        for (int i = 0; i < 9; i++)
                        {
                            m_ExcelOperation.SetCellText(row + part * 3 + i + (int)(i / 3) * 27, col, datas[(EnumDataName)p][i].ToString(), 1);
                        }
                        part++;
                    }
                }
            }
            //MessageBox.Show("数据导入完成,开始获取GRR结果。");
            //Get summary
            for (int p = 0; p < datanames.Length; p++)
            {
                switch ((EnumDataName)p)
                {
                case EnumDataName.厚度: row = 7; break;

                case EnumDataName.宽度: row = 8; break;

                case EnumDataName.长度: row = 9; break;

                case EnumDataName.AlTab边距: row = 10; break;

                case EnumDataName.AlTab最大边距: row = 11; break;

                case EnumDataName.NiTab边距: row = 12; break;

                case EnumDataName.NiTab最大边距: row = 13; break;

                case EnumDataName.Tab间距: row = 14; break;

                case EnumDataName.AlSealant高度: row = 15; break;

                case EnumDataName.NiSealant高度: row = 16; break;

                default: row = -1; break;
                }
                if (row > 0)
                {
                    grr = m_ExcelOperation.GetCellText(row, 7, 2);
                }
                else
                {
                    grr = "NA";
                }
                BaseForm.SetControlText(Controls.Find("textBoxGRR" + datanames[p], true)[0], grr);
            }
            //MessageBox.Show("GRR结果已获取。准备保存报告。");
            m_ExcelOperation.SaveAll();
            m_ExcelOperation.Quit();
        }