Ejemplo n.º 1
0
        private void Fetch()
        {
            recipeSet.Fetch();
            RecNo  = recipeSet.RecNo;
            Code   = recipeSet.Name;
            Memo   = recipeSet.Memo;
            ST1_X  = recipeSet.ST1_X;
            ST1_Y  = recipeSet.ST1_Y;
            ST1_QR = recipeSet.ST1_QR;
            ST2_X  = recipeSet.ST2_X;
            ST2_Y  = recipeSet.ST2_Y;
            ST2_QR = recipeSet.ST2_QR;

            Work    = new WorkObject(RecNo);
            Pattern = new PatternList(RecNo);
            Rank    = new RankList(RecNo);
            Bin     = new BinList(RecNo);

            List <BinObject> bins = Bin.ToList();

            foreach (BinObject bin in bins)
            {
                foreach (BinFormulaObject formula in bin.Formulas)
                {
                    if (string.IsNullOrWhiteSpace(formula.Token.ItemName) == false)
                    {
                        if (string.IsNullOrWhiteSpace(Work.Reports[formula.Token.ItemName].ItemRef) == false)
                        {
                            int refNo = (int)AppHelper.ExtractRecNo(Work.Reports[formula.Token.ItemName].ItemRef);
                            formula.Type = Work.Tests[refNo].ItemType;
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void Initialize()
        {
            workObject = null;
            Dock       = DockStyle.Fill;

            workBook.Document.LoadDocument(AppRes.Properties.FormWork);
            resultBook.Document.LoadDocument(AppRes.Properties.FormResult);
        }
Ejemplo n.º 3
0
        public void SetWorkObjects(WorkObject work)
        {
            workObject = work;
            TestWorkList   tests   = workObject.Tests;
            ReportWorkList reports = workObject.Reports;
            Worksheet      sheet   = workBook.Document.Worksheets[0];

            workBook.BeginUpdate();

            try
            {
                sheet.ClearContents(sheet["B1:ZZ17"]);

                for (int i = 0; i < tests.Count; i++)
                {
                    sheet.Cells[0, i + 1].Value = tests[i + 1].Index;
                    sheet.Cells[1, i + 1].Value = tests[i + 1].ItemType.ToString();
                    sheet.Cells[2, i + 1].Value = tests[i + 1].ItemCode.ToString();
                    sheet.Cells[3, i + 1].Value = tests[i + 1].ItemName;
                    sheet.Cells[4, i + 1].Value = tests[i + 1].ItemRef;
                    sheet.Cells[5, i + 1].Value = tests[i + 1].TestPattern;
                    sheet.Cells[6, i + 1].Value = tests[i + 1].BiasCH;
                    sheet.Cells[7, i + 1].Value = tests[i + 1].BiasRange;
                    sheet.Cells[8, i + 1].Value = tests[i + 1].BiasValue;
                    sheet.Cells[9, i + 1].Value = tests[i + 1].ApplyTime;
                }

                for (int i = 0; i < reports.Count; i++)
                {
                    sheet.Cells[12, i + 1].Value = reports[i + 1].Index;
                    sheet.Cells[13, i + 1].Value = reports[i + 1].ItemCode.ToString();
                    sheet.Cells[14, i + 1].Value = reports[i + 1].ItemName;
                    sheet.Cells[15, i + 1].Value = reports[i + 1].ItemRef;
                    sheet.Cells[16, i + 1].Value = reports[i + 1].BiasCH;
                }

                int maxCount = (tests.Count > reports.Count) ? tests.Count + 1 : reports.Count + 1;

                //if (maxCount < 12)
                //{
                //    maxCount = 12;
                //    workBook.Options.HorizontalScrollbar.Visibility = SpreadsheetScrollbarVisibility.Hidden;
                //}
                //else
                //{
                //    workBook.Options.HorizontalScrollbar.Visibility = SpreadsheetScrollbarVisibility.Visible;
                //}

                workBook.WorksheetDisplayArea.SetSize(0, maxCount, 17);
            }
            finally
            {
                workBook.EndUpdate();
            }

            sheet = resultBook.Document.Worksheets[0];
            resultBook.BeginUpdate();
            try
            {
                sheet.ClearContents(sheet["A1:ZZ1000"]);
                sheet.Cells["A1"].Value = "DateTime";
                sheet.Cells["B1"].Value = "Elapsed Time";
                sheet.Cells["C1"].Value = "Bin";

                for (int i = 0; i < reports.Count; i++)
                {
                    sheet.Cells[0, i + 3].Value = reports[i + 1].ItemName;
                }

                int maxCount = reports.Count + 3;

                if (maxCount < 12)
                {
                    maxCount = 12;
                    resultBook.Options.HorizontalScrollbar.Visibility = SpreadsheetScrollbarVisibility.Hidden;
                }
                else
                {
                    resultBook.Options.HorizontalScrollbar.Visibility = SpreadsheetScrollbarVisibility.Visible;
                }

                resultBook.WorksheetDisplayArea.SetSize(0, maxCount, 500);
            }
            finally
            {
                resultBook.EndUpdate();
            }
        }