Esempio n. 1
0
        // (16)
        public void OnJobLoaded(IList<IFlawTypeName> flawTypes, IList<ILaneInfo> lanes, IList<ISeverityInfo> severityInfo, IJobInfo jobInfo)
        {
            // WriteHelper.Log("OnJobLoaded()");
            // Reset to default.
            _cuts = new List<double>();
            //_newCuts = new List<Cut>();
            lblNowPage.Text = "---";
            lblTotalPage.Text = "---";
            btnNextFlawImages.Enabled = false;
            btnPrevFlawImages.Enabled = false;
            btnShowGoPage.Enabled = false;
            _nowPage = 0;
            _totalPage = 0;
            _dvFiliter = new DataView();

            // save datas in global helper.
            JobHelper.FlawTypes = flawTypes;
            JobHelper.JobInfo = jobInfo;
            JobHelper.Lanes = lanes;
            JobHelper.SeverityInfo = severityInfo;

            //update dgvFlaw HeaderText + (Unit)
            NowUnit unitFlawListCD = _units.Find(x => x.ComponentName == "Flaw List CD");
            dgvFlaw.Columns["CD"].HeaderText = dgvFlaw.Columns["CD"].Name + String.Format("({0})", unitFlawListCD.Symbol);
            NowUnit unitFlawListMD = _units.Find(x => x.ComponentName == "Flaw List MD");
            dgvFlaw.Columns["MD"].HeaderText = dgvFlaw.Columns["MD"].Name + String.Format("({0})", unitFlawListMD.Symbol);
            NowUnit unitFlawListWidth = _units.Find(x => x.ComponentName == "Flaw List Width");
            dgvFlaw.Columns["Width"].HeaderText = dgvFlaw.Columns["Width"].Name + String.Format("({0})", unitFlawListWidth.Symbol);
            NowUnit unitFlawListLength = _units.Find(x => x.ComponentName == "Flaw List Height");
            dgvFlaw.Columns["Length"].HeaderText =  dgvFlaw.Columns["Length"].Name + String.Format("({0})", unitFlawListLength.Symbol);
            NowUnit unitFlawListArea = _units.Find(x => x.ComponentName == "Flaw List Area");
            dgvFlaw.Columns["Area"].HeaderText = dgvFlaw.Columns["Area"].Name + String.Format("({0})", unitFlawListArea.Symbol);

            // initialize datatable  flaw format without data.
            _dtbFlaws = new DataTable("Flaws");

            _dtbFlaws.Columns.Add("FlawID", typeof(int));
            _dtbFlaws.Columns.Add("CD", typeof(double));
            _dtbFlaws.Columns.Add("MD", typeof(double));
            _dtbFlaws.Columns.Add("Area", typeof(string));
            _dtbFlaws.Columns.Add("FlawClass", typeof(string));
            _dtbFlaws.Columns.Add("FlawType", typeof(int));
            _dtbFlaws.Columns.Add("Images", typeof(IList<IImageInfo>));
            _dtbFlaws.Columns.Add("LeftEdge", typeof(double));
            _dtbFlaws.Columns.Add("RightEdge", typeof(double));
            _dtbFlaws.Columns.Add("Length", typeof(double));
            _dtbFlaws.Columns.Add("Width", typeof(double));
            _dtbFlaws.Columns.Add("Roll", typeof(int));
            _dtbFlaws.Columns.Add("RollMD", typeof(double));
            _dtbFlaws.Columns.Add("RightRollCD", typeof(double));
            _dtbFlaws.Columns.Add("LeftRollCD", typeof(double));
            _dtbFlaws.Columns.Add("DateTime", typeof(DateTime));

            // other columns for deal grade and score.
            _dtbFlaws.Columns.Add("Priority", typeof(int));
            _dtbFlaws.Columns.Add("PointScore", typeof(double));
            _dtbFlaws.Columns.Add("SubPieceName", typeof(string));

            // sort by default column
            ConfigHelper ch = new ConfigHelper();
            _dtbFlaws.DefaultView.Sort = String.Format("{0} ASC", ch.GetSortByColumnName().Trim());

            // set dgvFlaws datasource
            dgvFlaw.DataSource = _dtbFlaws;

            // Refresh TableLayoutPanel
            tlpFlawImages.Controls.Clear();
            tlpFlawImages.ColumnStyles.Clear();
            tlpFlawImages.ColumnCount = ch.GettlpFlawImagesColumns();
            tlpFlawImages.RowCount = ch.GettlpFlawImagesRows();
            int phdHeight = tlpFlawImages.Height / tlpFlawImages.RowCount;
            int phdrWidth = tlpFlawImages.Width / tlpFlawImages.ColumnCount;
            for (int i = 0; i < tlpFlawImages.RowCount; i++)
            {
                tlpFlawImages.RowStyles.Add(new RowStyle(SizeType.Percent, 50));
            }

            for (int i = 0; i < tlpFlawImages.ColumnCount; i++)
            {
                tlpFlawImages.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50));
            }

            // For MapWindow.cs
            //---------------------------------------------------------------------------

            // Setting MapWindow
            _mp.InitJobInfo(jobInfo);
            _mp.InitFlawLegendGrid();
            _mp.InitDatatableFlaws(ref _dtbFlaws);
            _mp.InitUnits(ref _units);
            _mp.InitCutList(ref _cuts);

            // UNDONE: New Cut List
            // _mp.InitCutList(ref _newCuts);
            _mp.InitFire(ref Fire);

            // Initial Flaw Chart FlawLegend
            NowUnit unitFlawMapCD = _units.Find(x => x.ComponentName == "Flaw Map CD");
            double mapWidth = JobHelper.PxPInfo.Width * unitFlawMapCD.Conversion;
            double mapHeight = JobHelper.PxPInfo.Height * unitFlawMapCD.Conversion;
            _mp.InitChart(mapWidth, mapHeight);
        }