Beispiel #1
0
        public void gettable()
        {
            DataTable dts = new DataTable();
            DataTable dti = new DataTable();
            string    cmd = "select serno, lot, model, site, factory, line, process, inspectdate from laa10_003201908 where serno like 'K820%' and inspectdate > '2019-08-20 06:00' and inspectdate < '2019-08-20 12:00'";

            dts = ConnectionDataTableSql.callsql(cmd);
            string cmd2 = "select serno, inspectdate, inspect, inspectdata from laa10_003201908data where serno like 'K820%' and inspectdate > '2019-08-20 06:00' and inspectdate < '2019-08-20 12:00'";

            dti = ConnectionDataTableSql.callsql(cmd2);

            DataTable view = dti.DefaultView.ToTable(true, "inspect");

            for (int i = 0; i < view.Rows.Count; i++)
            {
                dts.Columns.Add(view.Rows[i]["inspect"].ToString());
            }
            for (int row = 0; row < dts.Rows.Count; row++)
            {
                for (int irow = 0; irow < dti.Rows.Count; irow++)
                {
                    if (dts.Rows[row]["serno"].ToString() == dti.Rows[irow]["serno"].ToString())
                    {
                        for (int col = 0; col < dts.Columns.Count; col++)
                        {
                            if (dts.Columns[col].ToString() == dti.Rows[irow]["inspect"].ToString())
                            {
                                dts.Rows[row][col] = dti.Rows[irow]["inspectdata"].ToString();
                            }
                        }
                    }
                }
            }
            ds = dts;
        }
Beispiel #2
0
        /// <summary>
        /// Get model list
        /// </summary>
        void ModelList()
        {
            DataTable dt = ConnectionDataTableSql.callsql("select distinct model from procinsplink");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cmbModel.Items.Add(dt.Rows[i]["model"]);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Get treeview
 /// </summary>
 /// <param name="model"></param>
 void GetTreeview(string model)
 {
     if (model != "")
     {
         TreeNode root = new TreeNode(model);
         trInspect.Nodes.Add(root);
         DataTable dt = ConnectionDataTableSql.callsql("select distinct inspect from procinsplink"
                                                       + " where model = '" + model + "'");
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             root.Nodes.Add(dt.Rows[i]["inspect"].ToString());
         }
     }
 }
Beispiel #4
0
        public void gettable()
        {
            string    serno   = multxt();
            string    inspect = inspects();
            DataTable dts     = new DataTable();
            DataTable dti     = new DataTable();

            string cmd;
            string cmd2;

            if (serno != "''")
            {
                cmd  = "select serno, lot, model, site, factory, line, process, inspectdate from " + sernodb + " where serno in(" + serno + ") ";
                cmd2 = "select serno, inspectdate, inspect, inspectdata from " + inspectdb + " where serno in(" + serno + ") and inspect in(" + inspect + ")";
            }
            else if (serno == "''" && datef != "" && datet != "")
            {
                cmd  = "select serno, lot, model, site, factory, line, process, inspectdate from " + sernodb + " where inspectdate > '" + datef + "' and inspectdate < '" + datet + "'";
                cmd2 = "select serno, inspectdate, inspect, inspectdata from " + inspectdb + " where inspect in(" + inspect + ") and inspectdate > '" + datef + "' and inspectdate < '" + datet + "'";
            }
            else
            {
                cmd  = "select serno, lot, model, site, factory, line, process, inspectdate from " + sernodb;
                cmd2 = "select serno, inspectdate, inspect, inspectdata from " + inspectdb + " where inspect in(" + inspect + ")";
            }
            dts = ConnectionDataTableSql.callsql(cmd);
            dti = ConnectionDataTableSql.callsql(cmd2);

            DataTable view = dti.DefaultView.ToTable(true, "inspect");

            for (int i = 0; i < view.Rows.Count; i++)
            {
                dts.Columns.Add(view.Rows[i]["inspect"].ToString());
            }
            //string filename = "data";
            //string path = filename + ".csv";
            //if (File.Exists(path))
            //{
            //    filename = filename + 1;
            //    path = filename + "csv";
            //}
            //using (StreamWriter sw = new StreamWriter(path, false, Encoding.UTF8))
            {
                for (int row = 0; row < dts.Rows.Count; row++)
                {
                    for (int irow = 0; irow < dti.Rows.Count; irow++)
                    {
                        if (dts.Rows[row]["serno"].ToString() == dti.Rows[irow]["serno"].ToString())
                        {
                            for (int col = 0; col < dts.Columns.Count; col++)
                            {
                                if (dts.Columns[col].ToString() == dti.Rows[irow]["inspect"].ToString())
                                {
                                    dts.Rows[row][col] = dti.Rows[irow]["inspectdata"].ToString();
                                    //sw.WriteLine(dts.Rows[row]);
                                    //sw.Flush();
                                }
                            }
                        }
                    }
                }
                //sw.Close();
            }
            ds = dts;
        }