private void ScreenPreview()
 {
     try
     {
         ProgressBarWindow ses = new ProgressBarWindow();
         ses.Show();
         ///String[] jobData = { jobNo, jobProduct, jobCustomer, jobStart, JobEnd, dataSet[2] + "-" + dataSet[3], dataSet[0], dataSet[1] };
         String[] dataIn = (String[])Application.Current.Properties["dataTable"];
         CultureInfo ci = new CultureInfo("en-US");
         String currentDate = DateTime.Now.ToString("dd/MM/yyyy", ci);
         String jobNo = dataIn[0];
         String jobProduct = dataIn[1];
         String jobCustomer = dataIn[2];
         String jobStart = dataIn[3];
         String JobEnd = dataIn[4];
         ReportDocument report = LoadingReport();
         report.SetParameterValue("runNumberTable", Convert.ToString(jobNo));
         report.SetParameterValue("productTable", Convert.ToString(jobProduct));
         report.SetParameterValue("customerTable", Convert.ToString(jobCustomer));
         report.SetParameterValue("startDateTable", Convert.ToString(jobStart));
         report.SetParameterValue("finishDateTable", Convert.ToString(JobEnd));
         report.SetParameterValue("dateQuery", Convert.ToString(currentDate));
         this.viewer.ViewerCore.ReportSource = report;
         if (report.IsLoaded == true)
         {
             ses.Close();
         }
     }
     catch (Exception e)
     {
         ErrorLogCreate(e);
         MessageBox.Show("เกิดข้อผิดพลาด ข้อมูล error บันทึกอยู่ในไฟล์ log กรุณาแจ้งข้อมูลดังกล่าวแก่ทีมติดตั้ง"
                             , "ข้อผิดพลาด", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Beispiel #2
0
        private void LoadingReport()
        {
            try
            {
                int type = (int)Application.Current.Properties["cardType"];
                if (type == 4)
                {
                    ProgressBarWindow ses = new ProgressBarWindow();
                    ses.Show();
                    string         currentDirectory = "C:\\FMreport";
                    string         filePath         = System.IO.Path.Combine(currentDirectory, "material.rpt");
                    ReportDocument report           = new ReportDocument();
                    report.Load(filePath);
                    List <List <String> > detailCardData = (List <List <String> >)Application.Current.Properties["cardDetail"];
                    List <String>         cardData       = (List <String>)Application.Current.Properties["cardMainData"];
                    List <String>         mainData       = (List <String>)Application.Current.Properties["cardData"];
                    MaterialReport(detailCardData, report, cardData, mainData);
                    this.viewer.ViewerCore.ReportSource = report;
                    if (report.IsLoaded)
                    {
                        ses.Close();
                    }
                }
                else if (type == 3)
                {
                    ProgressBarWindow ses = new ProgressBarWindow();
                    ses.Show();
                    string         currentDirectory = "C:\\FMreport";
                    string         filePath         = System.IO.Path.Combine(currentDirectory, "printing.rpt");
                    ReportDocument report           = new ReportDocument();
                    report.Load(filePath);
                    List <String> mainData = (List <String>)Application.Current.Properties["cardMainData"];
                    List <String> cardData = (List <String>)Application.Current.Properties["cardData"];
                    PrintReport(cardData, mainData, report);
                    this.viewer.ViewerCore.ReportSource = report;
                    if (report.IsLoaded)
                    {
                        ses.Close();
                    }
                }

                else if (type == 2)
                {
                    ProgressBarWindow ses = new ProgressBarWindow();
                    ses.Show();
                    string         currentDirectory = "C:\\FMreport";
                    string         filePath         = System.IO.Path.Combine(currentDirectory, "blowing.rpt");
                    ReportDocument report           = new ReportDocument();
                    report.Load(filePath);
                    List <String> mainData = (List <String>)Application.Current.Properties["cardMainData"];
                    List <String> cardData = (List <String>)Application.Current.Properties["cardData"];
                    BlowReport(cardData, mainData, report);
                    this.viewer.ViewerCore.ReportSource = report;
                    if (report.IsLoaded)
                    {
                        ses.Close();
                    }
                }

                else if (type == 1)
                {
                    ProgressBarWindow ses = new ProgressBarWindow();
                    ses.Show();
                    string         currentDirectory = "C:\\FMreport";
                    string         filePath         = System.IO.Path.Combine(currentDirectory, "cutting.rpt");
                    ReportDocument report           = new ReportDocument();
                    report.Load(filePath);
                    List <String> mainData = (List <String>)Application.Current.Properties["cardMainData"];
                    List <String> cardData = (List <String>)Application.Current.Properties["cardData"];
                    CutReport(cardData, mainData, report);
                    this.viewer.ViewerCore.ReportSource = report;
                    if (report.IsLoaded)
                    {
                        ses.Close();
                    }
                }
            }
            catch (Exception e)
            {
                ErrorLogCreate(e);
                MessageBox.Show("เกิดข้อผิดพลาด ข้อมูล error บันทึกอยู่ในไฟล์ log กรุณาแจ้งข้อมูลดังกล่าวแก่ทีมติดตั้ง"
                                , "ข้อผิดพลาด", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        private void LoadingReport()
        {
            try
            {
                int type = (int)Application.Current.Properties["cardType"];
                if (type == 4)
                {
                    ProgressBarWindow ses = new ProgressBarWindow();
                    ses.Show();
                    string currentDirectory = "C:\\FMreport";
                    string filePath = System.IO.Path.Combine(currentDirectory, "material.rpt");
                    ReportDocument report = new ReportDocument();
                    report.Load(filePath);
                    List<List<String>> detailCardData = (List<List<String>>)Application.Current.Properties["cardDetail"];
                    List<String> cardData = (List<String>)Application.Current.Properties["cardMainData"];
                    List<String> mainData = (List<String>)Application.Current.Properties["cardData"];
                    MaterialReport(detailCardData, report, cardData, mainData);
                    this.viewer.ViewerCore.ReportSource = report;
                    if (report.IsLoaded)
                    {
                        ses.Close();
                    }
                }
                else if (type == 3)
                {
                    ProgressBarWindow ses = new ProgressBarWindow();
                    ses.Show();
                    string currentDirectory = "C:\\FMreport";
                    string filePath = System.IO.Path.Combine(currentDirectory, "printing.rpt");
                    ReportDocument report = new ReportDocument();
                    report.Load(filePath);
                    List<String> mainData = (List<String>)Application.Current.Properties["cardMainData"];
                    List<String> cardData = (List<String>)Application.Current.Properties["cardData"];
                    PrintReport(cardData, mainData, report);
                    this.viewer.ViewerCore.ReportSource = report;
                    if (report.IsLoaded)
                    {
                        ses.Close();
                    }
                }

                else if (type == 2)
                {
                    ProgressBarWindow ses = new ProgressBarWindow();
                    ses.Show();
                    string currentDirectory = "C:\\FMreport";
                    string filePath = System.IO.Path.Combine(currentDirectory, "blowing.rpt");
                    ReportDocument report = new ReportDocument();
                    report.Load(filePath);
                    List<String> mainData = (List<String>)Application.Current.Properties["cardMainData"];
                    List<String> cardData = (List<String>)Application.Current.Properties["cardData"];
                    BlowReport(cardData, mainData, report);
                    this.viewer.ViewerCore.ReportSource = report;
                    if (report.IsLoaded)
                    {
                        ses.Close();
                    }
                }

                else if (type == 1)
                {
                    ProgressBarWindow ses = new ProgressBarWindow();
                    ses.Show();
                    string currentDirectory = "C:\\FMreport";
                    string filePath = System.IO.Path.Combine(currentDirectory, "cutting.rpt");
                    ReportDocument report = new ReportDocument();
                    report.Load(filePath);
                    List<String> mainData = (List<String>)Application.Current.Properties["cardMainData"];
                    List<String> cardData = (List<String>)Application.Current.Properties["cardData"];
                    CutReport(cardData, mainData, report);
                    this.viewer.ViewerCore.ReportSource = report;
                    if (report.IsLoaded)
                    {
                        ses.Close();
                    }

                }
            }
            catch (Exception e)
            {
                ErrorLogCreate(e);
                MessageBox.Show("เกิดข้อผิดพลาด ข้อมูล error บันทึกอยู่ในไฟล์ log กรุณาแจ้งข้อมูลดังกล่าวแก่ทีมติดตั้ง"
                                    , "ข้อผิดพลาด", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }