Beispiel #1
0
        private Task <DataTable> GetDataToTable()
        {
            return(Task.Run(() =>
            {
                GetTableName();
                GetSernoList();
                GetInslist();
                Vo.SernoDataTable = new DataTable();
                Vo.InspectDataTable = new DataTable();
                PQMDataViewerVo inspectable = (PQMDataViewerVo)DefaultCbmInvoker
                                              .Invoke(new GetInspectDataTablePQMCbm(), new PQMDataViewerVo()
                {
                    PQMConnectionString = Vo.PQMConnectionString,
                    SernoDBList = Vo.SernoDBList,
                    InspectList = Vo.InspectList,
                    SernoList = Vo.SernoList,
                    DateTimeFrom = Vo.DateTimeFrom,
                    DateTimeTo = Vo.DateTimeTo,
                    CheckLot = Vo.CheckLot
                }
                                                      , connection);
                PQMDataViewerVo sernotable = (PQMDataViewerVo)DefaultCbmInvoker
                                             .Invoke(new GetSernoDataTablePQMCbm(), new PQMDataViewerVo()
                {
                    PQMConnectionString = Vo.PQMConnectionString,
                    SernoDBList = Vo.SernoDBList,
                    SernoList = Vo.SernoList,
                    DateTimeFrom = Vo.DateTimeFrom,
                    DateTimeTo = Vo.DateTimeTo,
                    CheckLot = Vo.CheckLot
                }
                                                     , connection);
                Vo.InspectDataTable = inspectable.InspectDataTable;
                Vo.SernoDataTable = sernotable.SernoDataTable;
                DataTable pivot = new DataTable();
                pivot = LinQ_Class.Pivot(Vo.InspectDataTable, Vo.InspectDataTable.Columns["inspect"]
                                         , Vo.InspectDataTable.Columns["inspectdata"], Vo.InspectDataTable.Columns["judge"]);

                //if (rbtnData.Checked)
                //{
                //    Vo.InspectDataTable.Columns.Remove("judge");
                //    pivot = LinQ_Class.Pivot(Vo.InspectDataTable, Vo.InspectDataTable.Columns["inspect"]
                //        , Vo.InspectDataTable.Columns["inspectdata"]);
                //}
                //if (rbtnJudge.Checked)
                //{
                //    Vo.InspectDataTable.Columns.Remove("inspectdata");
                //    pivot = LinQ_Class.Pivot(Vo.InspectDataTable, Vo.InspectDataTable.Columns["inspect"]
                //            , Vo.InspectDataTable.Columns["judge"]);
                //}
                Vo.JoinedTable = LinQ_Class.Joined(Vo.SernoDataTable, pivot);
                pivot.Clear();
                //Vo.ThreadComplete = true;
                //GetTable.Abort();
                return Vo.JoinedTable;
            }));
        }
Beispiel #2
0
 private void GetDataToTable()
 {
     try
     {
         GetTableName();
         GetSernoList();
         GetInslist();
         Vo.SernoDataTable   = new DataTable();
         Vo.InspectDataTable = new DataTable();
         PQMDataViewerVo inspectable = (PQMDataViewerVo)DefaultCbmInvoker
                                       .Invoke(new GetInspectDataTablePQMCbm(), new PQMDataViewerVo()
         {
             PQMConnectionString = Vo.PQMConnectionString,
             SernoDBList         = Vo.SernoDBList,
             InspectList         = Vo.InspectList,
             SernoList           = Vo.SernoList,
             DateTimeFrom        = Vo.DateTimeFrom,
             DateTimeTo          = Vo.DateTimeTo,
             CheckLot            = Vo.CheckLot
         }
                                               , connection);
         PQMDataViewerVo sernotable = (PQMDataViewerVo)DefaultCbmInvoker
                                      .Invoke(new GetSernoDataTablePQMCbm(), new PQMDataViewerVo()
         {
             PQMConnectionString = Vo.PQMConnectionString,
             SernoDBList         = Vo.SernoDBList,
             SernoList           = Vo.SernoList,
             DateTimeFrom        = Vo.DateTimeFrom,
             DateTimeTo          = Vo.DateTimeTo,
             CheckLot            = Vo.CheckLot
         }
                                              , connection);
         Vo.InspectDataTable = inspectable.InspectDataTable;
         Vo.SernoDataTable   = sernotable.SernoDataTable;
         DataTable pivot = new DataTable();
         pivot = LinQ_Class.Pivot(Vo.InspectDataTable, Vo.InspectDataTable.Columns["inspect"]
                                  , Vo.InspectDataTable.Columns["inspectdata"]);
         Vo.JoinedTable = LinQ_Class.Joined(Vo.SernoDataTable, pivot);
         pivot.Clear();
         Vo.ThreadComplete = true;
         GetTable.Abort();
     }
     catch (Framework.SystemException ex)
     {
         MessageBox.Show("Please select model and inspect before search data!");
         //MessageBox.Show(ex.GetMessageData().ToString());
     }
 }
Beispiel #3
0
        private async Task GetDataTable()
        {
            try
            {
                PostgresDatabase database = new PostgresDatabase();
                string           table    = DefineTableName();
                string           sSQL     = "SELECT a.serno, a.lot, a.model, a.site, a.factory, a.line, a.process, a.inspectdate, a.tjudge ";
                sSQL += "FROM " + table + " a WHERE 1=1 ";
                //sSQL += "FROM " + table + " a LEFT JOIN " + table + "data b on a.serno = b.serno and a.inspectdate = b.inspectdate WHERE 1=1 ";
                if (cbLine.Checked)
                {
                    sSQL += "and line ='" + cmbLine.Text + "' ";
                }
                if (cbProcess.Checked)
                {
                    sSQL += "and process ='" + cmbProcess.Text + "' ";
                }
                if (!string.IsNullOrEmpty(txtbarcode.Text))
                {
                    string serno = SerialString();
                    if (rbLot.Checked)
                    {
                        sSQL += "and lot in (" + serno + ") ";
                    }
                    if (rbSerial.Checked)
                    {
                        sSQL += "and serno in (" + serno + ") ";
                    }
                }
                if (cbCheckDate.Checked)
                {
                    sSQL += "and inspectdate >= '" + dtpFromDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
                    sSQL += "' and inspectdate <= '" + dtpToDate.Value.ToString("yyyy-MM-dd HH:mm:ss") + "' ";
                }
                sSQL += "ORDER BY inspectdate ASC, serno ASC";
                DataSet results1 = await database.GetDatasetAsync(SQLConnectString, sSQL);

                dt1 = results1.Tables[0];

                if (rbData.Checked)
                {
                    sSQL = "SELECT b.serno, b.inspectdate, b.inspect,  b.inspectdata ";
                }
                if (rbJudge.Checked)
                {
                    sSQL = "SELECT b.serno, b.inspectdate, b.inspect,  b.judge ";
                }
                sSQL += "FROM " + table + "data b WHERE 1=1 ";
                if (!string.IsNullOrEmpty(txtbarcode.Text))
                {
                    string serno = SerialString();
                    if (rbLot.Checked)
                    {
                        sSQL += "and lot in (" + serno + ") ";
                    }
                    if (rbSerial.Checked)
                    {
                        sSQL += "and serno in (" + serno + ") ";
                    }
                }
                if (cbInspect.Checked)
                {
                    string inspect = InspectString();
                    sSQL += "and inspect in (" + inspect + ") ";
                }
                if (cbCheckDate.Checked)
                {
                    sSQL += "and inspectdate >= '" + dtpFromDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
                    sSQL += "' and inspectdate <= '" + dtpToDate.Value.ToString("yyyy-MM-dd HH:mm:ss") + "' ";
                }
                sSQL += "ORDER BY inspectdate ASC, serno ASC";

                DataSet results2 = await database.GetDatasetAsync(SQLConnectString, sSQL);

                dt2 = results2.Tables[0];
                DataTable pivot = new DataTable();
                pivot        = LinQ_Class.Pivot(dt2, dt2.Columns["inspect"], dt2.Columns[3]);
                PQMDataTable = LinQ_Class.Joined(dt1, pivot);
                MessageBox.Show("Completed!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }