Beispiel #1
0
        // Event when a module is scanned
        private void txtProductSerial_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                // Disenalbe the extbox to block scanning
                txtProductSerial.Enabled = false;

                string serLong = txtProductSerial.Text;
                string serShort;
                string m_short = VBStrings.Mid(serLong, 3, 2);
                //switch (m_short)
                //{
                //    case "3L":
                serShort = serLong;
                //}
                DateTime sDate = DateTime.Today;
A:
                string filterkey = decideReferenceTable(serShort, sDate);
                if (serLong != String.Empty)
                {
                    // Get the tester data from current month's table and store it in datatable
                    string filterLine = string.Empty;
                    if (filterkey == "LA10")
                    {
                        filterLine = fltlaa;
                    }
                    else
                    {
                        filterLine = fltls;
                    }

                    string sql = "select serno, process, judge, inspectdate from " +
                                 "(select serno, process, judge, max(inspectdate) as inspectdate, row_number() OVER (PARTITION BY process ORDER BY max(inspectdate) desc) as flag from (" +
                                 "(select serno, process, case when tjudge = '0' then 'PASS' else 'FAIL' end as judge, inspectdate from " + testerTableThisMonth + " where " + filterLine + " and serno = '" + serShort + "') union all " +
                                 "(select serno, process, case when tjudge = '0' then 'PASS' else 'FAIL' end as judge, inspectdate from " + testerTableLastMonth + " where " + filterLine + " and serno = '" + serShort + "')" +
                                 ") d group by serno, judge, process order by judge desc, process) b where flag = 1";
                    DataTable dt1 = new DataTable();
                    ShSQL     tf  = new ShSQL();
                    tf.sqlDataAdapterFillDatatableFromTesterDb(sql, ref dt1);
                    if (dt1.Rows.Count <= 0)
                    {
                        if (sDate.Year.ToString() == "2015")
                        {
                            MessageBox.Show("Not Found!");
                            goto B;
                        }
                        sDate = sDate.AddMonths(-1);
                        goto A;
                    }
B:
                    System.Diagnostics.Debug.Print(sql);

                    // Get the tester data from last month's table and store it in the same datatable
                    //sql = "SELECT serno, process, tjudge, inspectdate" +
                    //    " FROM " + testerTableLastMonth +
                    //    " WHERE serno = '" + serShort + "'";
                    //tf.sqlDataAdapterFillDatatableFromTesterDb(sql, ref dt1);

                    System.Diagnostics.Debug.Print(sql);

                    DataView dv = new DataView(dt1);
                    //dv.RowFilter = filterLine;
                    //dv.Sort = "tjudge, inspectdate desc";

                    System.Diagnostics.Debug.Print(System.Environment.NewLine + "Inline:");
                    printDataView(dv);
                    DataTable dt2 = dv.ToTable();

                    //�@インライン
                    // 一時テーブルへの登録準備
                    string lot   = string.Empty;
                    string fact  = "2A";
                    string model = string.Empty;
                    switch (m_short)
                    {
                    case "4A":
                        model = "LS4A";
                        lot   = VBStrings.Mid(serShort, 5, 3);
                        break;

                    case "4D":
                        model = "LS4D";
                        lot   = VBStrings.Mid(serShort, 5, 3);
                        break;

                    case "3D":
                        model = "LS3D";
                        lot   = VBStrings.Mid(serShort, 5, 3);
                        break;

                    case "3E":
                        model = "LS3E";
                        lot   = VBStrings.Mid(serShort, 5, 3);
                        break;

                    case "3F":
                        model = "LS3F";
                        lot   = VBStrings.Mid(serShort, 5, 3);
                        break;

                    case "3K":
                        model = "LS3K";
                        lot   = VBStrings.Mid(serShort, 5, 3);
                        break;

                    case "3J":
                        model = "LS3J";
                        lot   = VBStrings.Mid(serShort, 5, 3);
                        break;

                    case "3P":
                        model = "LS3P";
                        lot   = VBStrings.Mid(serShort, 5, 3);
                        break;

                    default:
                        if (serLong.Length == 13)
                        {
                            model = "BMS69"; lot = VBStrings.Mid(serShort, 3, 3);
                        }
                        else if (serLong.Length == 8)
                        {
                            model = "LA10"; lot = VBStrings.Mid(serShort, 5, 3);
                        }
                        else if (VBStrings.Mid(serLong, 6, 1) == "L")
                        {
                            model = "LS3L"; lot = VBStrings.Mid(serShort, 3, 3);
                        }
                        else if (VBStrings.Left(serLong, 1) == "M")
                        {
                            model = "LMOD"; lot = VBStrings.Mid(serShort, 5, 3);
                        }
                        else
                        {
                            model = "Error";
                        }
                        break;
                    }

                    // Even when no tester data is found, the module have to appear in the datagridview
                    DataRow newrow = dtOverall.NewRow();
                    newrow["serialno"] = serLong;
                    newrow["model"]    = model;
                    newrow["lot"]      = lot;
                    newrow["fact"]     = fact;

                    // If tester data exists, show it in the datagridview
                    if (dt2.Rows.Count != 0)
                    {
                        string process  = dt2.Rows[0][1].ToString();
                        string linepass = dt2.Rows[0][2].ToString();
                        //string buff =
                        //if (buff == "0") linepass = "******";
                        //else if (buff == "1") linepass = "******";
                        //else linepass = "******";
                        DateTime testtime = (DateTime)dt2.Rows[0][3];
                        newrow["process"]  = process;
                        newrow["linepass"] = linepass;
                        newrow["testtime"] = testtime;
                    }

                    // Add the row to the datatable
                    dtOverall.Rows.Add(newrow);

                    //Set limit
                    if (dtOverall.Rows.Count == 1)
                    {
                        string m = dtOverall.Rows[0]["model"].ToString();
                        switch (m)
                        {
                        case "LS4A":
                            limit = limitls4a;
                            break;

                        case "LS4D":
                            limit = limitls4a;
                            break;

                        case "LS3D":
                        case "LS3E":
                        case "LS3F":
                        case "LS3J":
                        case "LS3K":
                        case "LS3L":
                        case "LS3P":
                        case "LMOD":
                        case "BMS69":
                            limit = limitls12;
                            break;

                        case "LA10":
                            limit = limitlaa;
                            break;

                        default:
                            limit = 9999;
                            break;
                        }
                        //if (m == "LS4A") limit = limitls4a;
                        //else if (m == "LS3D" || m == "LS3E" || m == "LS3F" || m == "LS3J" || m == "LS3K" || m == "LS3L") limit = limitls12;
                        //else if (m == "LA10") limit = limitlaa;
                        //else limit = 9999;

                        // USER9がLIMITを設定した場合は、それに従う
                        if (limit1 != 0)
                        {
                            limit = limit1;
                        }
                    }
                    // データグリットビューの更新
                    updateDataGripViews(dtOverall, ref dgvProductSerial);
                }

                // For the operator to continue scanning, enable the scan text box and select the text in the box
                if (okCount >= limit)
                {
                    txtProductSerial.Enabled = false;
                }
                else
                {
                    txtProductSerial.Enabled = true;
                    txtProductSerial.Focus();
                    txtProductSerial.SelectAll();
                }
            }
        }
Beispiel #2
0
        // シリアル付帯情報を取得する
        private void setSerialInfoAndTesterResult(string serLong)
        {
            DateTime tbdate = DateTime.Today;

B:
            string filterkey = decideReferenceTable(serLong, tbdate);

            if (serLong != String.Empty)
            {
                // Get the tester data from current month's table and store it in datatable
                string sql = "SELECT serno, process, tjudge, inspectdate" +
                             " FROM " + testerTableThisMonth +
                             " WHERE serno = '" + serLong + "'";
                DataTable dt1 = new DataTable();
                ShSQL     tf  = new ShSQL();
                tf.sqlDataAdapterFillDatatableFromTesterDb(sql, ref dt1);

                System.Diagnostics.Debug.Print(sql);

                // Get the tester data from last month's table and store it in the same datatable
                sql = "SELECT serno, process, tjudge, inspectdate" +
                      " FROM " + testerTableLastMonth +
                      " WHERE serno = '" + serLong + "'";
                tf.sqlDataAdapterFillDatatableFromTesterDb(sql, ref dt1);
                if (dt1.Rows.Count <= 0)
                {
                    tbdate = tbdate.AddMonths(-1);
                    goto B;
                }
                System.Diagnostics.Debug.Print(sql);

                string filterLine = string.Empty;
                if (filterkey == "LD4")
                {
                    filterLine = fltld4;
                }
                else
                {
                    filterLine = fltld25;
                }

                DataView dv = new DataView(dt1);
                dv.RowFilter = filterLine;
                dv.Sort      = "tjudge, inspectdate desc";
                System.Diagnostics.Debug.Print(System.Environment.NewLine + "In-Line:");
                printDataView(dv);
                DataTable dt2 = dv.ToTable();

                string lot    = VBStrings.Mid(serLong, 3, 4);
                string line   = VBStrings.Mid(serLong, 7, 1);
                string config = VBStrings.Mid(serLong, 1, 2);
                string model  = string.Empty;
                if (VBStrings.Mid(serLong, 1, 2) == "1C" || VBStrings.Mid(serLong, 1, 2) == "1D")
                {
                    model = "LD04";
                }
                else
                {
                    model = "LD25";
                }

                // Even when no tester data is found, the module have to appear in the datagridview
                DataRow newr = dtReplace.NewRow();
                newr["serialno"] = serLong;
                newr["model"]    = model;
                newr["lot"]      = lot;
                newr["line"]     = line;
                newr["config"]   = config;

                // If tester data exists, show it in the datagridview
                if (dt2.Rows.Count != 0)
                {
                    string process  = dt2.Rows[0][1].ToString();
                    string linepass = String.Empty;
                    string buff     = dt2.Rows[0][2].ToString();
                    if (buff == "0")
                    {
                        linepass = "******";
                    }
                    else if (buff == "1")
                    {
                        linepass = "******";
                    }
                    else
                    {
                        linepass = "******";
                    }
                    DateTime testtime = (DateTime)dt2.Rows[0][3];
                    newr["process"]  = process;
                    newr["linepass"] = linepass;
                    newr["testtime"] = testtime;
                }

                dtReplace.Rows.Add(newr);
            }
        }
Beispiel #3
0
        private void txtAfterSerial_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string serLong   = txtAfterSerial.Text;
                string filterkey = decideReferenceTable(serLong);
                if (serLong != String.Empty)
                {
                    // Get the tester data from current month's table and store it in datatable
                    string sql = "SELECT serno, process, tjudge, inspectdate" +
                                 " FROM " + testerTableThisMonth +
                                 " WHERE serno = '" + serLong + "' order by tjudge, inspectdate desc limit 1";

                    DataTable dtReplace = new DataTable();
                    defineAndReadDtOverall(ref dtReplace);
                    DataTable dt1 = new DataTable();
                    tf.sqlDataAdapterFillDatatableFromTesterDb(sql, ref dt1);

                    // Get the tester data from last month's table and store it in the same datatable
                    sql = "SELECT serno, process, tjudge, inspectdate" +
                          " FROM " + testerTableLastMonth +
                          " WHERE serno = '" + serLong + "' order by tjudge, inspectdate desc limit 1";
                    tf.sqlDataAdapterFillDatatableFromTesterDb(sql, ref dt1);

                    // Even when no tester data is found, the module have to appear in the datagridview
                    DataRow newr = dtReplace.NewRow();

                    string lot    = VBStrings.Mid(serLong, 3, 4);
                    string line   = string.Empty;
                    string config = VBStrings.Mid(serLong, 1, 2);
                    string model  = string.Empty;
                    if (VBStrings.Mid(serLong, 1, 2) == "1C" || VBStrings.Mid(serLong, 1, 2) == "1D")
                    {
                        model = "LD04";
                    }
                    else if (serLong.Length == 8)
                    {
                        model = "LA10";
                    }
                    else
                    {
                        model = "LD25";
                    }

                    if (model == "LA10")
                    {
                        line = "1";
                        lot  = VBStrings.Mid(serLong, 1, 4);
                    }
                    else
                    {
                        line = VBStrings.Mid(serLong, 7, 1);
                        lot  = VBStrings.Mid(serLong, 3, 4);
                    }

                    // If tester data exists, show it in the datagridview
                    if (dt1.Rows.Count != 0)
                    {
                        string process  = dt1.Rows[0][1].ToString();
                        string linepass = String.Empty;
                        string buff     = dt1.Rows[0][2].ToString();
                        if (buff == "0")
                        {
                            linepass = "******";
                        }
                        else if (buff == "1")
                        {
                            linepass = "******";
                        }
                        else
                        {
                            linepass = "******";
                        }
                        DateTime testtime = (DateTime)dt1.Rows[0][3];
                        newr["process"]  = process;
                        newr["linepass"] = linepass;
                        newr["testtime"] = testtime;
                    }

                    newr["serialno"] = serLong;
                    newr["model"]    = model;
                    newr["lot"]      = lot;
                    newr["line"]     = line;
                    newr["config"]   = config;

                    //Add the row to the datatable
                    dtReplace.Rows.Add(newr);
                    dgvProductSerial.DataSource = dtReplace;
                    txtRep.Focus();
                    bool col = colorViewForFailAndBlank(ref dgvProductSerial);
                    if (col)
                    {
                        btnReplace.Enabled = true; txtAfterSerial.Enabled = false; txtBeforeSerial.Enabled = false;
                    }
                    else
                    {
                        txtAfterSerial.Focus(); txtAfterSerial.SelectAll();
                    }
                }
            }
        }
Beispiel #4
0
        // Event when a module is scanned
        private void txtProductSerial_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                // Disenalbe the textbox to block scanning
                txtProductSerial.Enabled = false;

                string   serLong  = txtProductSerial.Text;
                string   serShort = serLong;
                DateTime tbDate   = DateTime.Today;
A:
                string filterkey = decideReferenceTable(serShort, tbDate);
                if (serLong != String.Empty)
                {
                    // Get the tester data from current month's table and store it in datatable
                    string sql = "SELECT serno, process, tjudge, inspectdate" +
                                 " FROM " + testerTableThisMonth +
                                 " WHERE serno = '" + serShort + "'";
                    DataTable dt1 = new DataTable();
                    ShSQL     tf  = new ShSQL();
                    tf.sqlDataAdapterFillDatatableFromTesterDb(sql, ref dt1);

                    System.Diagnostics.Debug.Print(sql);

                    // Get the tester data from last month's table and store it in the same datatable
                    sql = "SELECT serno, process, tjudge, inspectdate" +
                          " FROM " + testerTableLastMonth +
                          " WHERE serno = '" + serShort + "'";
                    tf.sqlDataAdapterFillDatatableFromTesterDb(sql, ref dt1);
                    if (dt1.Rows.Count <= 0)
                    {
                        tbDate = tbDate.AddMonths(-1);
                        goto A;
                    }
                    System.Diagnostics.Debug.Print(sql);

                    string filterLine = string.Empty;
                    if (filterkey == "LD4")
                    {
                        filterLine = fltld4;
                    }
                    else if (filterkey == "LA10" || filterkey == "BMA60" || filterkey == "BMA-")
                    {
                        filterLine = fltlaa;
                    }
                    else
                    {
                        filterLine = fltld25;
                    }

                    DataView dv = new DataView(dt1);
                    dv.RowFilter = filterLine;
                    dv.Sort      = "tjudge, inspectdate desc";
                    System.Diagnostics.Debug.Print(System.Environment.NewLine + "In-Line:");
                    printDataView(dv);
                    DataTable dt2 = dv.ToTable();

                    //�@インライン
                    // 一時テーブルへの登録準備
                    string lot    = string.Empty;
                    string line   = string.Empty;
                    string config = VBStrings.Mid(serShort, 1, 2);
                    string model  = string.Empty;
                    if (VBStrings.Mid(serLong, 1, 2) == "1C" || VBStrings.Mid(serLong, 1, 2) == "1D")
                    {
                        model = "LD04";
                    }
                    else if (serLong.Length == 8)
                    {
                        //model = "LA10";
                        model = "BMA60";
                    }
                    else
                    {
                        model = "LD25";
                    }

                    if (model == "BMA60")
                    {
                        line = "1";
                        lot  = VBStrings.Mid(serShort, 1, 4);
                    }
                    else
                    {
                        line = VBStrings.Mid(serShort, 7, 1);
                        lot  = VBStrings.Mid(serShort, 3, 4);
                    }



                    // Even when no tester data is found, the module have to appear in the datagridview
                    DataRow newrow = dtOverall.NewRow();
                    newrow["serialno"] = serLong;
                    newrow["model"]    = model;
                    newrow["lot"]      = lot;
                    newrow["line"]     = line;
                    newrow["config"]   = config;

                    // If tester data exists, show it in the datagridview
                    if (dt2.Rows.Count != 0)
                    {
                        string process  = dt2.Rows[0][1].ToString();
                        string linepass = String.Empty;
                        string buff     = dt2.Rows[0][2].ToString();
                        if (buff == "0")
                        {
                            linepass = "******";
                        }
                        else if (buff == "1")
                        {
                            linepass = "******";
                        }
                        else
                        {
                            linepass = "******";
                        }
                        DateTime testtime = (DateTime)dt2.Rows[0][3];
                        newrow["process"]  = process;
                        newrow["linepass"] = linepass;
                        newrow["testtime"] = testtime;
                    }

                    // Add the row to the datatable
                    dtOverall.Rows.Add(newrow);

                    //Set limit
                    if (dtOverall.Rows.Count >= 1)
                    {
                        string m = dtOverall.Rows[0]["model"].ToString();
                        switch (m)
                        {
                        case "LD04":
                            limit = limitld4;
                            break;

                        case "LD25":
                            limit = limitld;
                            break;

                        case "LA10":
                        case "BMA60":
                        case "BMA-":
                            limit = limitlaa;
                            break;

                        default:
                            limit = 9999;
                            break;
                        }

                        txtLimit.Text = limit.ToString();
                        // USER9がLIMITを設定した場合は、それに従う
                        if (limit1 != 0)
                        {
                            limit = limit1;
                        }
                    }

                    // データグリットビューの更新
                    updateDataGripViews(dtOverall, ref dgvProductSerial);
                }

                // For the operator to continue scanning, enable the scan text box and select the text in the box
                if (okCount >= limit)
                {
                    txtProductSerial.Enabled = false;
                }
                else
                {
                    txtProductSerial.Enabled = true;
                    txtProductSerial.Focus();
                    txtProductSerial.SelectAll();
                }
            }
        }
Beispiel #5
0
        // シリアル付帯情報を取得する
        private void setSerialInfoAndTesterResult(string serLong)
        {
            if (serLong != String.Empty)
            {
                // Get the tester data from current month's table and store it in datatable
                string sql = "SELECT serno, process, tjudge, inspectdate" +
                             " FROM " + testerTableThisMonth +
                             " WHERE serno = '" + serLong + "'";
                DataTable dt1 = new DataTable();
                ShSQL     tf  = new ShSQL();
                tf.sqlDataAdapterFillDatatableFromTesterDb(sql, ref dt1);

                System.Diagnostics.Debug.Print(sql);

                // Get the tester data from last month's table and store it in the same datatable
                sql = "SELECT serno, process, tjudge, inspectdate" +
                      " FROM " + testerTableLastMonth +
                      " WHERE serno = '" + serLong + "'";
                tf.sqlDataAdapterFillDatatableFromTesterDb(sql, ref dt1);

                System.Diagnostics.Debug.Print(sql);

                DataView dv = new DataView(dt1);
                dv.Sort = "tjudge desc, inspectdate";
                DataTable dt2 = dv.ToTable();

                // 一時テーブルへの登録準備
                string lot   = VBStrings.Mid(serLong, 5, 3);
                string fact  = VBStrings.Mid(serLong, 8, 1);
                string model = string.Empty;
                if (VBStrings.Mid(serLong, 3, 2) == "4A")
                {
                    model = "LS4A";
                }
                else if (VBStrings.Mid(serLong, 3, 2) == "3D")
                {
                    model = "LS3D";
                }
                else if (VBStrings.Mid(serLong, 3, 2) == "3E")
                {
                    model = "LS3E";
                }
                else if (VBStrings.Mid(serLong, 3, 2) == "3F")
                {
                    model = "LS3F";
                }
                else if (VBStrings.Mid(serLong, 3, 2) == "3J")
                {
                    model = "LS3J";
                }
                else
                {
                    model = "Error";
                }

                // テスターデータに該当がない場合でも、ユーザーに認識させるために表示する
                // また、本フォームのDATATABLEは、常に1件のみのデータ保持でよい
                dataTable.Clear();
                DataRow newrow = dataTable.NewRow();
                newrow["serialno"] = serLong;
                newrow["model"]    = model;
                newrow["lot"]      = lot;
                newrow["fact"]     = fact;

                // テスターデータに該当がある場合、当然表示する
                if (dt2.Rows.Count != 0)
                {
                    string process  = dt2.Rows[0][1].ToString();
                    string linepass = String.Empty;
                    string buff     = dt2.Rows[0][2].ToString();
                    if (buff == "0")
                    {
                        linepass = "******";
                    }
                    else if (buff == "1")
                    {
                        linepass = "******";
                    }
                    else
                    {
                        linepass = "******";
                    }
                    DateTime testtime = (DateTime)dt2.Rows[0][3];

                    newrow["process"]  = process;
                    newrow["linepass"] = linepass;
                    newrow["testtime"] = testtime;
                }

                // メモリ上のテーブルにレコードを追加
                dataTable.Rows.Add(newrow);
            }
        }