Пример #1
0
        // Calculate entiry piece score and send NG signal when piece fail
        public void CalcEntirePieceResult()
        {
            // get current using unit
            NowUnit ucd = _units.Find(x => x.ComponentName == "Flaw Map CD");

            int score = 0;
            double top = Convert.ToDouble(_cuts.Last()) - JobHelper.PxPInfo.Height;
            double bottom = Convert.ToDouble(_cuts.Last());
            string rowFilter = String.Format("MD > {0} AND MD < {1} AND CD > {2}", top, bottom, _tmpOffset);
            DataRow[] flawRows = _dtbFlaws.Select(rowFilter);

            ConfigHelper ch = new ConfigHelper();
            string gradeConfigFile = ch.GetDefaultGradeConfigName();
            DataTable gradeColumn = ch.GetDataTableOfdgvColumns(gradeConfigFile);
            DataTable gradeRow = ch.GetDataTableOfdgvRows(gradeConfigFile);
            string roiMode = ch.GetGradeNoRoiMode(gradeConfigFile);
            bool showScore = ch.IsGradePointEnable(gradeConfigFile);
            double limitScore = ch.GetPassFailScore(gradeConfigFile);

            if (roiMode == "Symmetrical" && showScore)
            {
                bool pieceResult;
                if (flawRows.Length > 0)
                {
                    foreach (DataRow drCol in gradeColumn.Rows)
                    {
                        foreach (DataRow drRow in gradeRow.Rows)
                        {
                            string rangeName = String.Format("{0}{1}", drCol["Name"], drRow["Name"]);

                            int subPieceScore = 0;
                            //string subPieceFilter = String.Format("(CD >= {0} AND CD <= {1}) AND (MD > {2} AND MD < {3})", drCol["Start"], drCol["End"], (Convert.ToDouble(drRow["Start"]) + top), (Convert.ToDouble(drRow["End"]) + top));
                            string subPieceFilter = String.Format("(CD >= {0} AND CD <= {1}) AND (MD > {2} AND MD < {3})", Convert.ToDouble(drCol["Start"]) / ucd.Conversion, Convert.ToDouble(drCol["End"]) / ucd.Conversion, (Convert.ToDouble(drRow["Start"]) / ucd.Conversion + top), (Convert.ToDouble(drRow["End"]) / ucd.Conversion + top));
                            DataRow[] subFlawRows = _dtbFlaws.Select(subPieceFilter);
                            foreach (DataRow dr in subFlawRows)
                            {
                                string pointFilter = String.Format("SubpieceName = 'ROI-{0}' AND ClassName = '{1}'", rangeName, dr["FlawClass"]);
                                subPieceScore += Convert.ToInt32(_dtbPoints.Select(pointFilter).First()["Score"]);
                            }

                            score += subPieceScore;
                        }
                    }
                    if (score >= limitScore)
                    {
                        pieceResult = false;
                    }
                    else
                    {
                        pieceResult = true;
                    }
                }
                else
                {
                    pieceResult = true;
                }
                _doffResult.Add(pieceResult);

                // Fire when doff is fail
                if (!JobHelper.IsOnpeHistory)
                {
                    if (pieceResult == false)
                    {
                        _fire.FireEvent(0, 0, 0);
                    }
                    else
                    {
                        _fire.FireEvent(1, 0, 0);
                    }
                }
            }
            else
            {
                _doffResult.Add(true);
            }

            // Calc flaw number of this job
            foreach (DataRow dr in flawRows)
            {
                string name = dr["FlawClass"].ToString();
                if (!_jobDoffNum.ContainsKey(name))
                {
                    _jobDoffNum.Add(name, 1);
                }
                else
                {
                    _jobDoffNum[name]++;
                }
            }
        }
Пример #2
0
        private void cmbConfig_DropDownClosed(object sender, EventArgs e)
        {
            ConfigHelper ch = new ConfigHelper();

            //ROI Settings
            //----------------------------------------------------------------------------------------//

            // Set Roi Mode
            RadioButton[] rdos = { rdoNoRoi, rdoSymmetrical };
            foreach (RadioButton rdo in rdos)
            {
                string roiMode = ch.GetGradeNoRoiMode(cmbConfig.SelectedItem.ToString());
                if (rdo.Text == roiMode)
                {
                    rdo.Checked = true;
                }
                else
                {
                    rdo.Checked = false;
                }
            }

            // Set TextBox of Columns, Rows
            txtColumns.Text = ch.GetGradeColumns(cmbConfig.SelectedItem.ToString()).ToString();
            txtRows.Text = ch.GetGradeRows(cmbConfig.SelectedItem.ToString()).ToString();

            // Reload DataTable of dgvColumns and dgvRows
            _dtbColumns.Clear();
            DataTable tmpColumns = ch.GetDataTableOfdgvColumns(cmbConfig.SelectedItem.ToString().Trim());
            foreach (DataRow dr in tmpColumns.Rows)
            {
                DataRow d = _dtbColumns.NewRow();
                d["Name"] = dr["Name"];
                d["Start"] = dr["Start"];
                d["End"] = dr["End"];
                _dtbColumns.Rows.Add(d);
            }
            tmpColumns.Dispose();
            _dtbRows.Clear();
            DataTable tmpRows = ch.GetDataTableOfdgvRows(cmbConfig.SelectedItem.ToString().Trim());
            foreach (DataRow dr in tmpRows.Rows)
            {
                DataRow d = _dtbRows.NewRow();
                d["Name"] = dr["Name"];
                d["Start"] = dr["Start"];
                d["End"] = dr["End"];
                _dtbRows.Rows.Add(d);
            }
            tmpRows.Dispose();

            // Grade Settings
            //----------------------------------------------------------------------------------------//

            // Initialize Point is enable.
            chkEnablePonit.Checked = ch.IsGradePointEnable(cmbConfig.SelectedItem.ToString().Trim());

            // Initialize SubPiece (cmbSubPoints)
            _pointsSubpieceNames = ch.GetSubPointsNameList(cmbConfig.SelectedItem.ToString().Trim());
            cmbSubPoints.DataSource = _pointsSubpieceNames;

            // Set dgvPoint datasource
            _dtbPoints.Clear();
            DataTable tmpPoints = ch.GetDataTabledgvPoints(cmbConfig.SelectedItem.ToString().Trim());
            foreach (DataRow dr in tmpPoints.Rows)
            {
                DataRow d = _dtbPoints.NewRow();
                d["SubpieceName"] = dr["SubpieceName"];
                d["ClassName"] = dr["ClassName"];
                d["Score"] = dr["Score"];
                _dtbPoints.Rows.Add(d);
            }
            DataView dvPoints = _dtbPoints.DefaultView;
            dvPoints.RowFilter = String.Format("SubpieceName='{0}'", cmbSubPoints.SelectedItem.ToString().Trim());
            tmpPoints.Dispose();

            // Initialize grade is enable (marks)
            chkEnableGrade.Checked = ch.IsGradeMarksEnable(cmbConfig.SelectedItem.ToString().Trim());

            // Initialize SubPiece (cmbSubPoints)
            cmbSubMarks.DataSource = ch.GetSubMarksNameList(cmbConfig.SelectedItem.ToString().Trim());

            // Set dgvGrade datasource
            _dtbGrades.Clear();
            DataTable tmpGrades = ch.GetDataTabledgvGrade(cmbConfig.SelectedItem.ToString().Trim());
            foreach (DataRow dr in tmpGrades.Rows)
            {
                DataRow d = _dtbGrades.NewRow();
                d["SubpieceName"] = dr["SubpieceName"];
                d["GradeName"] = dr["GradeName"];
                d["Score"] = dr["Score"];
                _dtbGrades.Rows.Add(d);
            }
            DataView dvGrade = _dtbGrades.DefaultView;
            dvGrade.RowFilter = String.Format("SubpieceName='{0}'", cmbSubMarks.SelectedItem.ToString().Trim());
            tmpGrades.Dispose();

            // Initialize Tab of grade/pass or fail
            chkEnablePFS.Checked = ch.IsGradePassFailEnable(cmbConfig.SelectedItem.ToString().Trim());
            txtFilterScore.Text = ch.GetPassFailScore(cmbConfig.SelectedItem.ToString().Trim()).ToString();
        }
Пример #3
0
        private void GradeSetup_Load(object sender, EventArgs e)
        {
            // Prepare cmbConfig datasource
            List<string> gradeConfigs = new List<string>();
            DirectoryInfo dirInfo = new DirectoryInfo(PathHelper.GradeConfigFolder);
            FileInfo[] files = dirInfo.GetFiles("*.xml");
            foreach (FileInfo file in files)
            {
                gradeConfigs.Add(file.Name.ToString().Substring(0, file.Name.ToString().LastIndexOf(".")));
            }
            // Binding cmbConfig
            cmbConfig.DataSource = gradeConfigs;
            ConfigHelper ch = new ConfigHelper();
            cmbConfig.SelectedItem = ch.GetDefaultGradeConfigName().Trim();

            //ROI Settings
            //----------------------------------------------------------------------------------------//

            // Initialize Roi Mode
            RadioButton[] rdos = { rdoNoRoi, rdoSymmetrical };
            foreach (RadioButton rdo in rdos)
            {
                string roiMode = ch.GetGradeNoRoiMode(cmbConfig.SelectedItem.ToString());
                if (rdo.Text == roiMode)
                {
                    rdo.Checked = true;
                }
                else
                {
                    rdo.Checked = false;
                }
            }

            // Initialize TextBox of Columns, Rows
            txtColumns.Text = ch.GetGradeColumns(cmbConfig.SelectedItem.ToString()).ToString();
            txtRows.Text = ch.GetGradeRows(cmbConfig.SelectedItem.ToString()).ToString();

            // Initialize dgvColumns without data.
            Column name = new Column(0, "Name", 75);
            Column start = new Column(1, "Start", 60);
            Column end = new Column(2, "End", 60);
            List<Column> columns = new List<Column>();
            columns.Add(name);
            columns.Add(start);
            columns.Add(end);
            foreach (Column c in columns)
            {
                DataGridViewCell cell = new DataGridViewTextBoxCell();
                DataGridViewColumn column = new DataGridViewColumn();
                column.CellTemplate = cell;
                column.Name = c.Name;
                column.HeaderText = c.Name;
                column.Width = c.Width;
                column.DataPropertyName = c.Name;
                column.SortMode = DataGridViewColumnSortMode.Automatic;
                column.FillWeight = c.Width;
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                if (column.Name == "Name")
                {
                    column.ReadOnly = true;
                }
                dgvColumns.Columns.Add(column);
            }
            dgvColumns.MultiSelect = false;
            dgvColumns.AutoGenerateColumns = false;

            // Initialize dgvRows without data.
            foreach (Column c in columns)
            {
                DataGridViewCell cell = new DataGridViewTextBoxCell();
                DataGridViewColumn column = new DataGridViewColumn();
                column.CellTemplate = cell;
                column.Name = c.Name;
                column.HeaderText = c.Name;
                column.Width = c.Width;
                column.DataPropertyName = c.Name;
                column.SortMode = DataGridViewColumnSortMode.Automatic;
                column.FillWeight = c.Width;
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                if (column.Name == "Name")
                {
                    column.ReadOnly = true;
                }
                dgvRows.Columns.Add(column);
            }
            dgvRows.MultiSelect = false;
            dgvRows.AutoGenerateColumns = false;

            // Initialize DataTable of dgvColumns and dgvRows
            _dtbColumns = ch.GetDataTableOfdgvColumns(cmbConfig.SelectedItem.ToString().Trim());
            dgvColumns.DataSource = _dtbColumns;
            _dtbRows = ch.GetDataTableOfdgvRows(cmbConfig.SelectedItem.ToString().Trim());
            dgvRows.DataSource = _dtbRows;

            // Grade Settings
            //----------------------------------------------------------------------------------------//

            // Initialize Point is enable.
            chkEnablePonit.Checked = ch.IsGradePointEnable(cmbConfig.SelectedItem.ToString().Trim());

            // Initialize SubPiece (cmbSubPoints)
            _pointsSubpieceNames = new List<string>();
            _pointsSubpieceNames = ch.GetSubPointsNameList(cmbConfig.SelectedItem.ToString().Trim());
            cmbSubPoints.DataSource = _pointsSubpieceNames;

            // Initialize dgvPoint without data
            Column className = new Column(0, "ClassName", 200);
            Column score = new Column(1, "Score", 200);
            columns = new List<Column>();
            columns.Add(className);
            columns.Add(score);
            foreach (Column c in columns)
            {
                DataGridViewCell cell = new DataGridViewTextBoxCell();
                DataGridViewColumn column = new DataGridViewColumn();
                column.CellTemplate = cell;
                column.Name = c.Name;
                column.HeaderText = c.Name;
                column.Width = c.Width;
                column.DataPropertyName = c.Name;
                column.SortMode = DataGridViewColumnSortMode.Automatic;
                column.FillWeight = c.Width;
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                if (c.Name == "ClassName")
                {
                    //column.ReadOnly = true;
                }
                dgvPoint.Columns.Add(column);
            }
            dgvPoint.MultiSelect = false;
            dgvPoint.AutoGenerateColumns = false;

            // Initialize dgvGrade without data
            Column gradeName = new Column(0, "GradeName", 200);
            score = new Column(1, "Score", 200);
            columns = new List<Column>();
            columns.Add(gradeName);
            columns.Add(score);
            foreach (Column c in columns)
            {
                DataGridViewCell cell = new DataGridViewTextBoxCell();
                DataGridViewColumn column = new DataGridViewColumn();
                column.CellTemplate = cell;
                column.Name = c.Name;
                column.HeaderText = c.Name;
                column.Width = c.Width;
                column.DataPropertyName = c.Name;
                column.SortMode = DataGridViewColumnSortMode.Automatic;
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                if (c.Name == "GradeName")
                {
                    //column.ReadOnly = true;
                }
                dgvGrade.Columns.Add(column);
            }
            dgvGrade.MultiSelect = false;
            dgvGrade.AutoGenerateColumns = false;

            // Set dgvPoint datasource
            _dtbPoints = ch.GetDataTabledgvPoints(cmbConfig.SelectedItem.ToString().Trim());
            dgvPoint.DataSource = _dtbPoints;
            DataView dvPoints = _dtbPoints.DefaultView;
            dvPoints.RowFilter = String.Format("SubpieceName='{0}'", cmbSubPoints.SelectedItem.ToString().Trim());

            // Initialize grade is enable (marks)
            chkEnableGrade.Checked = ch.IsGradeMarksEnable(cmbConfig.SelectedItem.ToString().Trim());

            // Initialize SubPiece (cmbSubPoints)
            _marksSubpieceNames = ch.GetSubMarksNameList(cmbConfig.SelectedItem.ToString().Trim());
            cmbSubMarks.DataSource = _marksSubpieceNames;

            // Set dgvGrade datasource
            _dtbGrades = ch.GetDataTabledgvGrade(cmbConfig.SelectedItem.ToString().Trim());
            dgvGrade.DataSource = _dtbGrades;
            DataView dvGrade = _dtbGrades.DefaultView;
            dvGrade.RowFilter = String.Format("SubpieceName='{0}'", cmbSubMarks.SelectedItem.ToString().Trim());

            // Initialize Tab of grade/pass or fail
            chkEnablePFS.Checked = ch.IsGradePassFailEnable(cmbConfig.SelectedItem.ToString().Trim());
            txtFilterScore.Text = ch.GetPassFailScore(cmbConfig.SelectedItem.ToString().Trim()).ToString();
        }
Пример #4
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure you want to reset subpiece setting?", "Reset Setting", MessageBoxButtons.YesNo,MessageBoxIcon.Warning);
            if (dialogResult == DialogResult.Yes)
            {
                // Prepare cmbConfig datasource
                List<string> gradeConfigs = new List<string>();
                DirectoryInfo dirInfo = new DirectoryInfo(PathHelper.GradeConfigFolder);
                FileInfo[] files = dirInfo.GetFiles("*.xml");
                foreach (FileInfo file in files)
                {
                    gradeConfigs.Add(file.Name.ToString().Substring(0, file.Name.ToString().LastIndexOf(".")));
                }
                // Binding cmbConfig
                cmbConfig.DataSource = gradeConfigs;
                ConfigHelper ch = new ConfigHelper();
                cmbConfig.SelectedItem = ch.GetDefaultGradeConfigName().Trim();

                //ROI Settings
                //----------------------------------------------------------------------------------------//

                // Initialize Roi Mode
                RadioButton[] rdos = { rdoNoRoi, rdoSymmetrical };
                foreach (RadioButton rdo in rdos)
                {
                    string roiMode = ch.GetGradeNoRoiMode(cmbConfig.SelectedItem.ToString());
                    if (rdo.Text == roiMode)
                    {
                        rdo.Checked = true;
                    }
                    else
                    {
                        rdo.Checked = false;
                    }
                }

                // Initialize TextBox of Columns, Rows
                txtColumns.Text = ch.GetGradeColumns(cmbConfig.SelectedItem.ToString()).ToString();
                txtRows.Text = ch.GetGradeRows(cmbConfig.SelectedItem.ToString()).ToString();

                // Initialize DataTable of dgvColumns and dgvRows
                _dtbColumns = ch.GetDataTableOfdgvColumns(cmbConfig.SelectedItem.ToString().Trim());
                dgvColumns.DataSource = _dtbColumns;
                _dtbRows = ch.GetDataTableOfdgvRows(cmbConfig.SelectedItem.ToString().Trim());
                dgvRows.DataSource = _dtbRows;

                // Grade Settings
                //----------------------------------------------------------------------------------------//

                // Initialize Point is enable.
                chkEnablePonit.Checked = ch.IsGradePointEnable(cmbConfig.SelectedItem.ToString().Trim());

                // Initialize SubPiece (cmbSubPoints)
                _pointsSubpieceNames = ch.GetSubPointsNameList(cmbConfig.SelectedItem.ToString().Trim());

                // Set dgvPoint datasource
                _dtbPoints = ch.GetDataTabledgvPoints(cmbConfig.SelectedItem.ToString().Trim());
                dgvPoint.DataSource = _dtbPoints;
                DataView dvPoints = _dtbPoints.DefaultView;
                dvPoints.RowFilter = String.Format("SubpieceName='{0}'", cmbSubPoints.SelectedItem.ToString().Trim());

                // Initialize grade is enable (marks)
                chkEnableGrade.Checked = ch.IsGradeMarksEnable(cmbConfig.SelectedItem.ToString().Trim());

                // Initialize SubPiece (cmbSubPoints)
                cmbSubMarks.DataSource = ch.GetSubMarksNameList(cmbConfig.SelectedItem.ToString().Trim());

                // Set dgvGrade datasource
                _dtbGrades = ch.GetDataTabledgvGrade(cmbConfig.SelectedItem.ToString().Trim());
                dgvGrade.DataSource = _dtbGrades;
                DataView dvGrade = _dtbGrades.DefaultView;
                dvGrade.RowFilter = String.Format("SubpieceName='{0}'", cmbSubMarks.SelectedItem.ToString().Trim());

                // Initialize Tab of grade/pass or fail
                chkEnablePFS.Checked = ch.IsGradePassFailEnable(cmbConfig.SelectedItem.ToString().Trim());
                txtFilterScore.Text = ch.GetPassFailScore(cmbConfig.SelectedItem.ToString().Trim()).ToString();
            }
        }