示例#1
0
        public override bool txDDMI(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var)
        {
            try {
                bool _result = false;
                _testinfo.TXDDMIRESULT = Parameters.testStatus.Wait.ToString();
                _testinfo.SYSTEMLOG   += "--------------------------------------------------------------\r\n";
                _testinfo.SYSTEMLOG   += "STEP 3: TX DDMI\r\n";

                _var.Pwr_temp        = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                _testinfo.SYSTEMLOG += "Pwr_temp = " + _var.Pwr_temp + "\r\n";
                base.WriteLine("echo set_flash_register_default >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);
                base.WriteLine("echo set_flash_register_Tx_data >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);
                string RR;
                string RR_DAC;
                RR = (Math.Round(Math.Pow(10, (_var.Pwr_temp / 10)) * 100)).ToString();

                RR_DAC = int.Parse(RR).ToString("X");
                base.WriteLine("echo set_flash_register_DDMI_TxPower 0x00" + RR_DAC + " 0x40 >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);
                string str = base.Read();
                base.WriteLine("echo DDMI_check_8472 >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);

                str = base.Read();
                for (int n = 0; n < str.Split('\n').Length; n++)
                {
                    if (str.Split('\n')[n].Contains("Tx power"))
                    {
                        _var.TX_Power_DDMI   = str.Split('\n')[n].Split('=')[1].TrimEnd();
                        _var.TX_Power_DDMI   = (10 * Math.Log10(Convert.ToDouble(_var.TX_Power_DDMI) / 10000)).ToString("0.##");
                        _testinfo.SYSTEMLOG += "TX_Power_DDMI = " + _var.TX_Power_DDMI.ToString() + " dBm\r\n";

                        if (Convert.ToDouble(_var.TX_Power_DDMI) > (_var.Pwr_temp - 0.5) && Convert.ToDouble(_var.TX_Power_DDMI) < (_var.Pwr_temp + 0.5))
                        {
                            _result = true;
                        }
                        else
                        {
                            _result = false;
                        }
                    }
                }
                if (_result == false)
                {
                    _testinfo.ERRORCODE = "(Mã Lỗi: COT-MI-0001)";
                }
                _testinfo.SYSTEMLOG   += _result == true ? "Check Power DDMI: PASS.\r\n" : string.Format("Check Power DDMI: FAIL. {0}\r\n", _testinfo.ERRORCODE);
                _testinfo.TXDDMIRESULT = _result == true?Parameters.testStatus.PASS.ToString() : Parameters.testStatus.FAIL.ToString();

                return(_result);
            }
            catch (Exception ex) {
                _testinfo.ERRORCODE    = "(Mã Lỗi: COT-MI-0002)";
                _testinfo.SYSTEMLOG   += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
                _testinfo.TXDDMIRESULT = Parameters.testStatus.FAIL.ToString();
                return(false);
            }
        }
        bosainfo _getDataByBosaSN(string _bosaSN)
        {
            if (globalData.listBosaInfo.Count == 0)
            {
                return(null);
            }
            bosainfo tmp = null;

            foreach (var item in globalData.listBosaInfo)
            {
                if (item.BosaSN == _bosaSN)
                {
                    tmp = item;
                    break;
                }
            }
            return(tmp);
        }
示例#3
0
 public bool insertData(bosainfo _bs)
 {
     lock (thislock) {
         try {
             if (cn.State != System.Data.ConnectionState.Open)
             {
                 cn.Open();
             }
             cmd             = new SqlCommand();
             cmd.Connection  = cn;
             cmd.CommandType = System.Data.CommandType.Text;
             cmd.CommandText = string.Format("INSERT INTO Data (BosaSN,Ith,Vbr) VALUES('{0}','{1}','{2}')", _bs.BosaSN, _bs.Ith, _bs.Vbr);
             cmd.ExecuteNonQuery();
             return(true);
         }
         catch {
             return(false);
         }
     }
 }
示例#4
0
        public override bool verifySignal(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var)
        {
            try {
                bool _result = false;
                _testinfo.VERIFYSIGNALRESULT = Parameters.testStatus.Wait.ToString();
                _testinfo.SYSTEMLOG         += "--------------------------------------------------------------\r\n";
                _testinfo.SYSTEMLOG         += "STEP 6: VERIFY SIGNAL\r\n";

                base.WriteLine("echo GPON_pattern >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);

                _var.Pwr_temp        = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                _var.ER_temp         = Convert.ToDouble(GlobalData.erDevice.getER(Port));
                _testinfo.SYSTEMLOG += "ER_temp = " + _var.ER_temp + "\r\n";
                _testinfo.SYSTEMLOG += "Power_temp = " + _var.Pwr_temp + "\r\n";

                if (_var.Pwr_temp > 2 && _var.Pwr_temp < 3 && _var.ER_temp > 11.5 && _var.ER_temp < 13.5)
                {
                    _result = true;
                }
                else
                {
                    _result = false;
                }
                if (_result == false)
                {
                    _testinfo.ERRORCODE = "(Mã Lỗi: COT-VS-0001)";
                }
                _testinfo.SYSTEMLOG         += _result == true ? "Verify Signal: PASS.\r\n" : string.Format("Verify Signal: FAIL. {0}\r\n", _testinfo.ERRORCODE);
                _testinfo.VERIFYSIGNALRESULT = _result == true?Parameters.testStatus.PASS.ToString() : Parameters.testStatus.FAIL.ToString();

                return(_result);
            }
            catch (Exception ex) {
                _testinfo.ERRORCODE          = "(Mã Lỗi: COT-VS-0002)";
                _testinfo.SYSTEMLOG         += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
                _testinfo.VERIFYSIGNALRESULT = Parameters.testStatus.FAIL.ToString();
                return(false);
            }
        }
示例#5
0
        public override bool signalOff(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var)
        {
            try {
                bool _result = false;
                _testinfo.SIGNALOFFRESULT = Parameters.testStatus.Wait.ToString();
                _testinfo.SYSTEMLOG      += "--------------------------------------------------------------\r\n";
                _testinfo.SYSTEMLOG      += "STEP 4: TEST OFF SIGNAL\r\n";
                string str = base.Read();
                base.WriteLine("echo dis_pattern >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);
                str                  = base.Read();
                _var.Pwr_temp        = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                _testinfo.SYSTEMLOG += "Power_Off = " + _var.Pwr_temp + "\r\n";
                if (_var.Pwr_temp < -25)
                {
                    _result = true;
                }
                else
                {
                    _result = false;
                }
                if (_result == false)
                {
                    _testinfo.ERRORCODE = "(Mã Lỗi: COT-SO-0001)";
                }
                _testinfo.SYSTEMLOG      += _result == true ? "TxPower Off: PASS\r\n" : string.Format("TxPower Off: FAIL. {0}\r\n", _testinfo.ERRORCODE);
                _testinfo.SIGNALOFFRESULT = _result == true?Parameters.testStatus.PASS.ToString() : Parameters.testStatus.FAIL.ToString();

                return(_result);
            }
            catch (Exception ex) {
                _testinfo.ERRORCODE       = "(Mã Lỗi: COT-SO-0002)";
                _testinfo.SYSTEMLOG      += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
                _testinfo.SIGNALOFFRESULT = Parameters.testStatus.FAIL.ToString();
                return(false);
            }
        }
示例#6
0
        public bosainfo getDataByBosaSN(string _bosaSN)
        {
            lock (thislock) {
                try {
                    bosainfo bs = new bosainfo();
                    if (cn.State != System.Data.ConnectionState.Open)
                    {
                        cn.Open();
                    }
                    DataTable dt = new DataTable();

                    cmd               = new SqlCommand();
                    cmd.Connection    = cn;
                    cmd.CommandType   = System.Data.CommandType.Text;
                    cmd.CommandText   = string.Format("SELECT tbID,BosaSN,Ith,Vbr FROM Data WHERE BosaSN='{0}'", _bosaSN);
                    adp               = new SqlDataAdapter();
                    adp.SelectCommand = cmd;
                    adp.Fill(dt);
                    if (dt.Rows.Count > 0)
                    {
                        bs.tbID   = dt.Rows[0].ItemArray[0].ToString();
                        bs.BosaSN = dt.Rows[0].ItemArray[1].ToString();
                        bs.Ith    = dt.Rows[0].ItemArray[2].ToString();
                        bs.Vbr    = dt.Rows[0].ItemArray[3].ToString();
                        return(bs);
                    }
                    else
                    {
                        return(null);
                    }
                }
                catch {
                    return(null);
                }
            }
        }
示例#7
0
        public override bool calibER(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var)
        {
            try {
                bool _result = false;
                _testinfo.TUNINGERRESULT = Parameters.testStatus.Wait.ToString();
                _testinfo.SYSTEMLOG     += "--------------------------------------------------------------\r\n";
                _testinfo.SYSTEMLOG     += "STEP 2: TUNING ER\r\n";

                _var.Imod = ((_var.Pwr_temp + 3) / _var.Slope) + _var.Iav - _var.Ith - 1;

                for (int k = 0; k < 12; k++)
                {
                    _var.Imod_DAC     = (Math.Round(_var.Imod * 4096 / 90)).ToString();
                    _var.Imod_DAC_Hex = int.Parse(_var.Imod_DAC).ToString("X");
                    base.WriteLine("echo IMOD 0x" + _var.Imod_DAC_Hex + " >/proc/pon_phy/debug");
                    Thread.Sleep(Delay_modem);

                    try {
                        string _kq = GlobalData.erDevice.getER(Port).Replace("\r", "").Replace("\n", "");
                        _testinfo.SYSTEMLOG += string.Format("ER String read from instrument: {0}", _kq);
                        //_var.ER_temp = Convert.ToDouble(_kq);
                        _var.ER_temp = double.Parse(_kq);
                    }
                    catch (Exception ex) {
                        _testinfo.SYSTEMLOG += ex.ToString() + "\r\n";
                        _var.ER_temp         = double.MaxValue;
                    }

                    _testinfo.SYSTEMLOG += string.Format("ER_temp = {0}\r\n", _var.ER_temp);
                    _testinfo.SYSTEMLOG += string.Format("Imod = {0}\r\n", _var.Imod);

                    if (!_var.ER_temp.ToString().Contains("E+"))
                    {
                        if (_var.ER_temp < 12 || _var.ER_temp > 13)
                        {
                            double ER_err = _var.ER_temp - 12.5;
                            if (ER_err <= -5)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +12.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 12;
                            }
                            else if (ER_err > -5 && ER_err <= -4)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +10.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 10;
                            }
                            else if (ER_err > -4 && ER_err <= -3)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +7.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 7;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err > -3 && ER_err <= -2.5)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +5.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 5;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err > -2.5 && ER_err <= -2)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +3.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 3;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err > -2 && ER_err <= -1.5)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +2.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 2;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err > -1.5 && ER_err <= -1)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +1.5.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 1.5;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err > -1 && ER_err <= -0.5)
                            {
                                _testinfo.SYSTEMLOG += "Cần tăng Imod thêm +1.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod + 1;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            //else if (ER_err >= 0.5)
                            //{
                            //    SetText(Tx_rtbAll, "Cần tăng Imod.");
                            //    Imod = Imod + 0.5;
                            //    SetText(Tx_rtbAll, "Imod mới = " + Imod);
                            //}

                            //------------------------------------------
                            if (ER_err >= 5)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -4.5.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 4.5;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 4 && ER_err < 5)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -4.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 4;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 3 && ER_err < 4)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -3.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 3;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 2.5 && ER_err < 3)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -2.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 2;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 2 && ER_err < 2.5)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -1.5.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 1.5;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 1.5 && ER_err < 2)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -1.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 1;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 1 && ER_err < 1.5)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -1.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 1;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                            else if (ER_err >= 0.5 && ER_err < 1)
                            {
                                _testinfo.SYSTEMLOG += "Cần giảm Imod -0.5.\r\n";
                                _testinfo.SYSTEMLOG += "-----------------\r\n";
                                _var.Imod            = _var.Imod - 0.5;
                                //Hienthi.SetText(rtb, "Imod mới = " + Imod);
                            }
                        }
                        else if (_var.ER_temp >= 12 && _var.ER_temp <= 13)
                        {
                            base.WriteLine("echo set_flash_register 0x00060023 0x64 >/proc/pon_phy/debug"); //Bù ER ở nhiệt độ 45*C
                            Thread.Sleep(Delay_modem);
                            _result = true;
                            break;
                        }
                    }
                    else if (_var.ER_temp.ToString().Contains("E+"))
                    {
                        //_result = false;
                        //break;
                    }
                }

                if (_result == false)
                {
                    _testinfo.ERRORCODE = "(Mã Lỗi: COT-ER-0001)";
                }
                _testinfo.SYSTEMLOG     += _result == true ? "Tuning ER: PASS\r\n" : string.Format("Tuning ER: FAIL. {0}\r\n", _testinfo.ERRORCODE);
                _testinfo.TUNINGERRESULT = _result == true?Parameters.testStatus.PASS.ToString() : Parameters.testStatus.FAIL.ToString();

                return(_result);
            }
            catch (Exception ex) {
                _testinfo.ERRORCODE      = "(Mã Lỗi: COT-ER-0002)";
                _testinfo.SYSTEMLOG     += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
                _testinfo.TUNINGERRESULT = Parameters.testStatus.FAIL.ToString();
                return(false);
            }
        }
示例#8
0
        public override bool calibPower(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var)
        {
            try {
                bool _result = false;
                _testinfo.TUNINGPOWERRESULT = Parameters.testStatus.Wait.ToString();
                _testinfo.SYSTEMLOG        += "Bắt Đầu Thực Hiện Calib TX...\r\n";
                _testinfo.SYSTEMLOG        += string.Format("BOSA Serial Number: {0}\r\n", _testinfo.BOSASERIAL);
                _testinfo.SYSTEMLOG        += string.Format("Ith = {0}\r\n", _bosainfo.Ith);
                _testinfo.SYSTEMLOG        += "--------------------------------------------------------------\r\n";
                _testinfo.SYSTEMLOG        += "STEP 1: TUNING POWER\r\n";

                base.WriteLine("echo set_flash_register_default >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);
                base.WriteLine("echo flash_dump >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);
                base.WriteLine("echo GPON_Tx_cal_init >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);

                _var.Ith           = double.Parse(_bosainfo.Ith);
                _var.Iav_1         = _var.Ith + 10;
                _var.Iav_1_dac     = Math.Round(_var.Iav_1 * 4096 / 90);
                _var.Iav_1_dac_hex = int.Parse(_var.Iav_1_dac.ToString()).ToString("X");

                _testinfo.SYSTEMLOG += string.Format("echo IAV 0x{0} >/proc/pon_phy/debug\r\n", _var.Iav_1_dac_hex);
                base.WriteLine("echo IAV 0x" + _var.Iav_1_dac_hex + " >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);

                _var.Pwr_1           = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                _testinfo.SYSTEMLOG += string.Format("Pwr_1 = {0}\r\n", _var.Pwr_1);

                if (_var.Pwr_1 <= -8)
                {
                    _testinfo.ERRORCODE         = "(Mã Lỗi: COT-PW-0001)";
                    _testinfo.SYSTEMLOG        += string.Format("Tuning Power: FAIL. {0}\r\n", _testinfo.ERRORCODE);
                    _testinfo.TUNINGPOWERRESULT = Parameters.testStatus.FAIL.ToString();
                    return(false);
                }

                _var.Iav_2         = _var.Ith + 15;
                _var.Iav_2_dac     = Math.Round(_var.Iav_2 * 4096 / 90);
                _var.Iav_2_dac_hex = int.Parse(_var.Iav_2_dac.ToString()).ToString("X");

                _testinfo.SYSTEMLOG += string.Format("echo IAV 0x{0} >/proc/pon_phy/debug\r\n", _var.Iav_2_dac_hex);
                base.WriteLine("echo IAV 0x" + _var.Iav_2_dac_hex + " >/proc/pon_phy/debug");
                Thread.Sleep(Delay_modem);

                _var.Pwr_2           = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                _testinfo.SYSTEMLOG += string.Format("Pwr_2 = {0}\r\n", _var.Pwr_2);

                _var.Slope    = (_var.Pwr_2 - _var.Pwr_1) / (_var.Iav_2 - _var.Iav_1);
                _var.Pwr_temp = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                _var.Iav      = ((2.5 - _var.Pwr_1) / _var.Slope) + _var.Iav_1;

                for (int i = 0; i < 15; i++)
                {
                    _var.Iav_DAC     = (Math.Round(_var.Iav * 4096 / 90)).ToString();
                    _var.Iav_DAC_Hex = int.Parse(_var.Iav_DAC).ToString("X");

                    base.WriteLine("echo IAV 0x" + _var.Iav_DAC_Hex + " >/proc/pon_phy/debug");
                    Thread.Sleep(Delay_modem);
                    _var.Pwr_temp        = Convert.ToDouble(GlobalData.powerDevice.getPower_dBm(Port));
                    _testinfo.SYSTEMLOG += string.Format("Pwr_temp = {0}\r\n", _var.Pwr_temp.ToString());

                    if (_var.Pwr_temp >= 2.5 && _var.Pwr_temp <= 3)
                    {
                        _result = true;
                        break;
                    }
                    else
                    {
                        _var.Iav = ((2.8 - _var.Pwr_temp) / _var.Slope) + _var.Iav;
                    }
                }

                if (_result == false)
                {
                    _testinfo.ERRORCODE = "(Mã Lỗi: COT-PW-0001)";
                }
                _testinfo.SYSTEMLOG        += _result == true ? "Tuning Power: PASS.\r\n" : string.Format("Tuning Power: FAIL. {0}\r\n", _testinfo.ERRORCODE);
                _testinfo.TUNINGPOWERRESULT = _result == true?Parameters.testStatus.PASS.ToString() : Parameters.testStatus.FAIL.ToString();

                return(_result);
            }
            catch (Exception ex) {
                _testinfo.ERRORCODE         = "(Mã Lỗi: COT-PW-0002)";
                _testinfo.SYSTEMLOG        += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
                _testinfo.TUNINGPOWERRESULT = Parameters.testStatus.FAIL.ToString();
                return(false);
            }
        }
示例#9
0
 public abstract bool calibCrossing(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var);
        //----RUN ALL
        //****************************************************************************************************
        //****************************************************************************************************
        //****************************************************************************************************
        bool RunAll(testinginfo _testtemp, bosainfo _bosainfo, variables _vari)
        {
            System.Diagnostics.Stopwatch pt = new System.Diagnostics.Stopwatch();
            pt.Start();
            bool   _result  = false;
            string _message = "";

            GW      ontDevice  = null;
            FVA3150 instrument = null;

            switch (globalData.initSetting.ONTTYPE)
            {
            case "GW040H": {
                ontDevice = new GW040H(_testtemp.COMPORT);
                break;
            }

            case "GW020BoB": {
                ontDevice = new GW020BoB(_testtemp.COMPORT);
                break;
            }

            default: return(false);
            }

            //Connect to Instrument
            _testtemp.SYSTEMLOG += string.Format("Connect to FVA3150 {0}...\r\n", _testtemp.GPIB);
            instrument           = new FVA3150(_testtemp.GPIB);
            if (instrument.Open(out _message) == false)
            {
                _testtemp.SYSTEMLOG += "...FAIL" + "\r\n";
                _testtemp.SYSTEMLOG += _message + "\r\n";
                goto END;
            }
            _testtemp.SYSTEMLOG += "...PASS" + "\r\n";

            //login to ONT
            if (ontDevice.loginToONT(_testtemp) == false)
            {
                goto END;
            }


            //Get MAC Address
            _testtemp.MACADDRESS = ontDevice.getMACAddress(_testtemp);
            if (_testtemp.MACADDRESS == string.Empty)
            {
                _testtemp.ERRORCODE = "(Mã Lỗi: COT-GM-0001)"; goto END;
            }


            //Set Vapd + Slope
            if (globalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.setVapdAndSlope(_bosainfo, _testtemp, instrument, _vari) == false)
                {
                    goto END;
                }
                pt.Stop();
                _testtemp.SYSTEMLOG += string.Format("Set Vadp + Slope time = {0} ms\r\n", pt.ElapsedMilliseconds);
            }


            //Overload + Sensitivity
            if (globalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.overloadSensitivity(_bosainfo, _testtemp, instrument, _vari) == false)
                {
                    goto END;
                }
                pt.Stop();
                _testtemp.SYSTEMLOG += string.Format("Overload + Sensitivity time = {0} ms\r\n", pt.ElapsedMilliseconds);
            }


            //RX DDMI Calibration
            if (ontDevice.calibDDMI(_bosainfo, _testtemp, instrument, _vari) == false)
            {
                goto END;
            }
            pt.Stop();
            _testtemp.SYSTEMLOG += string.Format("RX DDMI Calibration time = {0} ms\r\n", pt.ElapsedMilliseconds);

            //RX DDMI Curve
            if (globalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.curveDDMI(_bosainfo, _testtemp, instrument, _vari) == false)
                {
                    goto END;
                }
                pt.Stop();
                _testtemp.SYSTEMLOG += string.Format("RX DDMI Curve time = {0} ms\r\n", pt.ElapsedMilliseconds);
            }

            //LOS Calibration
            bool _flag = false;

            if (ontDevice.calibLOS(_bosainfo, _testtemp, instrument, _vari, ref _flag) == false)
            {
                goto END;
            }
            pt.Stop();
            _testtemp.SYSTEMLOG += string.Format("LOS Calibration time = {0} ms\r\n", pt.ElapsedMilliseconds);

            //LOS Check
            if (globalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.checkLOS(_flag, _bosainfo, _testtemp, instrument, _vari) == false)
                {
                    goto END;
                }
                pt.Stop();
                _testtemp.SYSTEMLOG += string.Format("LOS check time = {0} ms\r\n", pt.ElapsedMilliseconds);
            }

            //Write Flash
            if (globalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.writeFlash(_bosainfo, _testtemp) == false)
                {
                    goto END;
                }
                pt.Stop();
                _testtemp.SYSTEMLOG += string.Format("Write flash time = {0} ms\r\n", pt.ElapsedMilliseconds);
            }

            _result = true;

END:
            try { ontDevice.Close(); } catch { }
            return(_result);
        }
示例#11
0
 public abstract bool writeAPD(bosainfo _bosainfo, testinginfo _testinfo);
示例#12
0
 public override bool calibCrossing(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var)
 {
     throw new NotImplementedException();
 }
示例#13
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button b          = sender as Button;
            string buttonName = b.Name;
            string _index     = buttonName.Substring(buttonName.Length - 1, 1);

            this._resetDisplay(_index); //manual

            if (GlobalData.initSetting.ONTTYPE == "GW040H" || (GlobalData.initSetting.ONTTYPE == "GW020BoB" && GlobalData.initSetting.ENABLEWRITEAPD == true))
            {
                this.Opacity = 0.3;
                wBosaSerialNumber wb = new wBosaSerialNumber(_index);
                wb.ShowDialog();
                this.Opacity = 1;
            }

            //Kiểm tra trạng thái calib của máy đo ER
            try {
                double _temp = 0, _hours;
                string _time;
                bool   ret;
                ret = Function.IO.CalibrationModuleTime.Read(out _time);
                //ret = GlobalData.erDevice.getTemperature(out _temp);
                ret = BaseFunctions.last_Time_Calibrate_Module_DCAX86100D_To_Hours(_time, out _hours);
                if (_hours > 5 || _temp > 5)
                {
                    CalibModuleWarning cm = new CalibModuleWarning(_time.ToString(), _temp.ToString());
                    cm.ShowDialog();
                }
            }
            catch { }

            //***BEGIN -----------------------------------------//
            System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(() => {
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
                //Start count time
                System.Diagnostics.Stopwatch st = new System.Diagnostics.Stopwatch();
                st.Start();

                string _name        = buttonName;
                testinginfo testtmp = null;
                BaseFunctions.get_Testing_Info_By_Name(_name, ref testtmp);
                variables vari = new variables();

                string _BosaSN = "";
                if (GlobalData.initSetting.ONTTYPE == "GW040H" || (GlobalData.initSetting.ONTTYPE == "GW020BoB" && GlobalData.initSetting.ENABLEWRITEAPD == true))
                {
                    testtmp.SYSTEMLOG += string.Format("Input Bosa Serial...\r\n...{0}\r\n", testtmp.BOSASERIAL);
                    _BosaSN            = testtmp.BOSASERIAL;
                    if (_BosaSN == "--")
                    {
                        return;
                    }
                }

                if (GlobalData.initSetting.ENABLEWRITEMAC)
                {
                    if (testtmp.MACADDRESS == "--")
                    {
                        return;
                    }
                }

                //Get Bosa Information from Bosa Serial
                bosainfo bosaInfo = new bosainfo();

                if (GlobalData.initSetting.ONTTYPE == "GW040H" || (GlobalData.initSetting.ONTTYPE == "GW020BoB" && GlobalData.initSetting.ENABLEWRITEAPD == true))
                {
                    testtmp.SYSTEMLOG += string.Format("Get Bosa information...\r\n");
                    bosaInfo           = this._getDataByBosaSN(_BosaSN);
                    if (bosaInfo == null)
                    {
                        testtmp.ERRORCODE   = "(Mã Lỗi: COT-BS-0001)";
                        testtmp.SYSTEMLOG  += string.Format("...FAIL. {0}. Bosa SN is not existed\r\n", testtmp.ERRORCODE);
                        testtmp.TOTALRESULT = Parameters.testStatus.FAIL.ToString();
                        goto END;
                    }
                    testtmp.SYSTEMLOG += string.Format("...Ith= {0}mA\r\n", bosaInfo.Ith);
                    testtmp.SYSTEMLOG += string.Format("...Vbr= {0}V\r\n", bosaInfo.Vbr);
                    testtmp.SYSTEMLOG += string.Format("...PASS\r\n");
                }

                //Calib
                testtmp.TOTALRESULT   = Parameters.testStatus.Wait.ToString();
                testtmp.BUTTONCONTENT = "STOP"; testtmp.BUTTONENABLE = false;
                bool _result          = RunAll(testtmp, bosaInfo, vari);

                testtmp.TOTALRESULT = _result == false ? Parameters.testStatus.FAIL.ToString() : Parameters.testStatus.PASS.ToString();

                END:
                testtmp.SYSTEMLOG    += string.Format("\r\n----------------------------\r\nTotal Judged={0}\r\n", testtmp.TOTALRESULT);
                testtmp.BUTTONCONTENT = "START"; testtmp.BUTTONENABLE = true;

                //Stop count time
                st.Stop();
                testtmp.SYSTEMLOG += string.Format("Total time = {0} seconds\r\n", st.ElapsedMilliseconds / 1000);
                testtmp.TOTALTIME += (st.ElapsedMilliseconds / 1000).ToString();

                //save log
                Function.IO.LogDetail.Save(testtmp);
                Function.IO.LogTest.Save(testtmp);
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
            }));
            t.IsBackground = true;
            t.Start();
            //***END -------------------------------------------//
        }
示例#14
0
        //****************************************************************************************************
        //****************************************************************************************************
        //****************************************************************************************************
        bool RunAll(testinginfo _testtemp, bosainfo _bosainfo, variables _vari)
        {
            System.Diagnostics.Stopwatch pt = new System.Diagnostics.Stopwatch();
            pt.Start();
            string _apdTime = "", _pwTime = "", _erTime = "", _ddmiTime = "";


            if (!(GlobalData.initSetting.ONTTYPE == "GW020BoB" && GlobalData.initSetting.ONTAPD == "Only Write APD LUT"))
            {
                //Kiem tra ket noi toi may do Power
                _testtemp.SYSTEMLOG += string.Format("Kiểm tra kết nối tới máy đo EXFO IQS610P {0}...\r\n", GlobalData.initSetting.EXFOIP);
                if (Network.PingNetwork(GlobalData.initSetting.EXFOIP) == false)
                {
                    _testtemp.SYSTEMLOG += "...Kết quả = FAIL\r\n";
                    GlobalData.connectionManagement.IQS1700STATUS  = false;
                    GlobalData.connectionManagement.IQS9100BSTATUS = false;
                    return(false);
                }
                _testtemp.SYSTEMLOG += "...Kết quả = PASS\r\n";
            }


            //login to ONT
            bool _result   = false;
            GW   ontDevice = null;

            switch (GlobalData.initSetting.ONTTYPE)
            {
            case "GW040H": {
                ontDevice = new GW040H(_testtemp.COMPORT);
                break;
            }

            case "GW020BoB": {
                ontDevice = new GW020BoB(_testtemp.COMPORT);
                break;
            }

            default: return(false);
            }
            if (ontDevice.loginToONT(_testtemp) == false)
            {
                goto END;
            }


            //Get MAC Address
            if (!GlobalData.initSetting.ENABLEWRITEMAC)
            {
                _testtemp.MACADDRESS = ontDevice.getMACAddress(_testtemp);
                if (_testtemp.MACADDRESS == string.Empty)
                {
                    _testtemp.ERRORCODE = "(Mã Lỗi: COT-GM-0001)"; goto END;
                }
            }

            //Write APD LUT
            if (GlobalData.initSetting.ENABLEWRITEAPD == true)
            {
                if (ontDevice.writeAPD(_bosainfo, _testtemp) == false)
                {
                    goto END;
                }
            }
            pt.Stop();
            _apdTime = string.Format("PW time = {0} ms\r\n", pt.ElapsedMilliseconds);
            pt.Reset(); pt.Restart();

            //Calib Power
            if (GlobalData.initSetting.ENABLETUNINGPOWER)
            {
                if (ontDevice.calibPower(int.Parse(_testtemp.ONTINDEX), _bosainfo, _testtemp, _vari) == false)
                {
                    goto END;
                }
            }

            pt.Stop();
            _pwTime = string.Format("PW time = {0} ms\r\n", pt.ElapsedMilliseconds);

            //Calib ER
            if (GlobalData.initSetting.ENABLETUNINGER || GlobalData.initSetting.ENABLETUNINGCROSSING)
            {
                pt.Reset();
                pt.Restart();

                //Đăng kí thứ tự Calib ER
                if (this._addToListSequenceTestER(_testtemp) == false)
                {
                    goto END;
                }

                //Chờ đến lượt timeout 90s
                if (this._waitForTurn(_testtemp) == false)
                {
                    goto END;
                }

                //Kiem tra ket noi toi may do DCA
                _testtemp.SYSTEMLOG += string.Format("Kiểm tra kết nối tới máy đo DCA X86100D {0}...\r\n", GlobalData.initSetting.ERINSTRGPIB);
                if (GlobalData.erDevice.isConnected() == false)
                {
                    _testtemp.SYSTEMLOG += "...Kết quả = FAIL\r\n";
                    GlobalData.connectionManagement.DCAX86100DSTATUS = false;
                    return(false);
                }
                _testtemp.SYSTEMLOG += "...Kết quả = PASS\r\n";

                //Calib Dark level
                _testtemp.SYSTEMLOG += string.Format("Switching port...{0} OFF\r\n", _testtemp.ONTINDEX);
                GlobalData.switchDevice.switchOff();
                Thread.Sleep(500);
                GlobalData.erDevice.Calibrate();
                Thread.Sleep(500);

                //Switch Port check ER
                _testtemp.SYSTEMLOG += string.Format("Switching port...{0} ON\r\n", _testtemp.ONTINDEX);
                if (GlobalData.switchDevice.switchToPort(int.Parse(_testtemp.ONTINDEX)) == false)
                {
                    goto END;
                }

                //Calib ER
                if (GlobalData.initSetting.ENABLETUNINGER)
                {
                    if (ontDevice.calibER(int.Parse(_testtemp.ONTINDEX), _bosainfo, _testtemp, _vari) == false)
                    {
                        goto END;
                    }
                }

                //Calib Crossing
                if (GlobalData.initSetting.ENABLETUNINGCROSSING && GlobalData.initSetting.ONTTYPE == "GW020BoB")
                {
                    if (ontDevice.calibCrossing(int.Parse(_testtemp.ONTINDEX), _bosainfo, _testtemp, _vari) == false)
                    {
                        goto END;
                    }
                }

                //Xóa thứ tự đăng kí Calib ER (để Thread # có thể sử dụng)
                this._removeFromListSequenceTestER(_testtemp);

                pt.Stop();
                _erTime = string.Format("ER time = {0} ms\r\n", pt.ElapsedMilliseconds);
            }

            //TX DDMI
            pt.Reset(); pt.Restart();
            if (GlobalData.initSetting.ENABLETXDDMI)
            {
                if (ontDevice.txDDMI(int.Parse(_testtemp.ONTINDEX), _bosainfo, _testtemp, _vari) == false)
                {
                    goto END;
                }
            }

            //Signal Off
            if (GlobalData.initSetting.ENABLESIGNALOFF && GlobalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.signalOff(int.Parse(_testtemp.ONTINDEX), _bosainfo, _testtemp, _vari) == false)
                {
                    goto END;
                }
            }

            //Write flash
            if (GlobalData.initSetting.ENABLEWRITEFLASH && GlobalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.writeFlash(_bosainfo, _testtemp) == false)
                {
                    goto END;
                }
            }

            //Verify Signal
            if (GlobalData.initSetting.ENABLEVERIFYSIGNAL && GlobalData.initSetting.ONTTYPE == "GW040H")
            {
                if (ontDevice.verifySignal(int.Parse(_testtemp.ONTINDEX), _bosainfo, _testtemp, _vari) == false)
                {
                    goto END;
                }
            }

            //Write MAC
            if (GlobalData.initSetting.ENABLEWRITEMAC)
            {
                if (ontDevice.writeMAC(_testtemp) == false)
                {
                    goto END;
                }
            }

            pt.Stop();
            _ddmiTime = string.Format("DDMI,SIGOFF,WRITE FLASH time = {0} ms\r\n", pt.ElapsedMilliseconds);

            _result = true;

END:
            _testtemp.SYSTEMLOG += _pwTime;
            _testtemp.SYSTEMLOG += _erTime;
            _testtemp.SYSTEMLOG += _ddmiTime;
            this._removeFromListSequenceTestER(_testtemp);
            try { ontDevice.Close(); } catch { }
            return(_result);
        }
示例#15
0
 public abstract bool verifySignal(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var);
示例#16
0
 public abstract bool writeFlash(bosainfo _bosainfo, testinginfo _testinfo);
示例#17
0
 public abstract bool signalOff(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var);
示例#18
0
 public abstract bool txDDMI(int Port, bosainfo _bosainfo, testinginfo _testinfo, variables _var);
示例#19
0
        public override bool writeFlash(bosainfo _bosainfo, testinginfo _testinfo)
        {
            bool _result = false;

            _testinfo.WRITEFLASHRESULT = Parameters.testStatus.Wait.ToString();
            _testinfo.SYSTEMLOG       += "--------------------------------------------------------------\r\n";
            _testinfo.SYSTEMLOG       += "STEP 5: WRITE INTO FLASH\r\n";
            string tempdata = "";

            try {
                //Luu FLASH
                bool _isOK = false;
                _isOK = base.WriteLineAndWaitComplete("echo set_flash_register_Tx_data >/proc/pon_phy/debug", ref tempdata);
                _testinfo.SYSTEMLOG += tempdata + "\r\n";
                if (_isOK == false)
                {
                    goto NG;
                }

                _isOK = base.WriteLineAndWaitComplete("echo set_flash_register 0x07050701 0x94 >/proc/pon_phy/debug", ref tempdata);
                _testinfo.SYSTEMLOG += tempdata + "\r\n";
                if (_isOK == false)
                {
                    goto NG;
                }

                _isOK = base.WriteLineAndWaitComplete("echo save_flash_matrix >/proc/pon_phy/debug", ref tempdata);
                _testinfo.SYSTEMLOG += tempdata + "\r\n";
                if (_isOK == false)
                {
                    goto NG;
                }

                _isOK = base.WriteLineAndWaitComplete("mtd writeflash /tmp/7570_bob.conf 160 656896 reservearea", ref tempdata);//dual band
                _testinfo.SYSTEMLOG += tempdata + "\r\n";
                if (_isOK == false)
                {
                    goto NG;
                }

                //Show gia tri thanh ghi quang TX
                int count = 0;
REPEAT:
                count++;
                base.WriteLineAndWaitComplete("echo flash_dump >/proc/pon_phy/debug", ref tempdata);
                _testinfo.SYSTEMLOG += tempdata + "\r\n";
                if (tempdata.Contains("0x07050701"))
                {
                    _result = true;
                }
                else
                {
                    _result = false;
                    if (count < 3)
                    {
                        goto REPEAT;
                    }
                }

                _testinfo.SYSTEMLOG += "Hoàn thành quá trình Calibration.\r\n";
                if (_result == false)
                {
                    _testinfo.ERRORCODE = "(Mã Lỗi: COT-WF-0001)";
                    goto NG;
                }

                goto OK;
            }
            catch (Exception ex) {
                _testinfo.ERRORCODE  = "(Mã Lỗi: COT-WF-0002)";
                _testinfo.SYSTEMLOG += string.Format("{0}, {1}\r\n", _testinfo.ERRORCODE, ex.ToString());
                goto NG;
            }

OK:
            _testinfo.SYSTEMLOG       += "Write flash thành công.\r\n";
            _testinfo.WRITEFLASHRESULT = Parameters.testStatus.PASS.ToString();
            return(true);

NG:
            _testinfo.SYSTEMLOG       += string.Format("Write flash thất bại. {0}\r\n", _testinfo.ERRORCODE);
            _testinfo.WRITEFLASHRESULT = Parameters.testStatus.FAIL.ToString();
            return(false);
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button b          = sender as Button;
            string buttonName = b.Name;
            string _index     = buttonName.Substring(buttonName.Length - 1, 1);

            this._resetDisplay(_index); //manual

            if (globalData.initSetting.ONTTYPE == "GW040H")
            {
                this.Opacity = 0.3;
                inputBosaWindow wb = new inputBosaWindow(_index);
                wb.ShowDialog();
                this.Opacity = 1;
            }


            //***BEGIN -----------------------------------------//
            System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(() => {
                //Start count time
                System.Diagnostics.Stopwatch st = new System.Diagnostics.Stopwatch();
                st.Start();

                string _name        = buttonName;
                testinginfo testtmp = null;
                baseFunction.get_Testing_Info_By_Name(_name, ref testtmp);

                //Get Bosa Information from Bosa Serial ??? GW040H // GW020BoB
                bosainfo bosaInfo = new bosainfo();
                //Variables ??? GW040H//GW020BoB
                variables vari = new variables();

                if (globalData.initSetting.ONTTYPE == "GW040H")
                {
                    string _BosaSN     = "";
                    testtmp.SYSTEMLOG += string.Format("Input Bosa Serial...\r\n...{0}\r\n", testtmp.BOSASERIAL);
                    _BosaSN            = testtmp.BOSASERIAL;
                    if (_BosaSN == "--")
                    {
                        return;
                    }

                    testtmp.SYSTEMLOG += string.Format("Get Bosa information...\r\n");
                    bosaInfo           = this._getDataByBosaSN(_BosaSN);
                    if (bosaInfo == null)
                    {
                        testtmp.ERRORCODE   = "(Mã Lỗi: COT-BS-0001)";
                        testtmp.SYSTEMLOG  += string.Format("...FAIL. {0}. Bosa SN is not existed\r\n", testtmp.ERRORCODE);
                        testtmp.TOTALRESULT = Parameters.testStatus.FAIL.ToString();
                        goto END;
                    }
                    testtmp.SYSTEMLOG += string.Format("...Ith = {0} mA\r\n", bosaInfo.Ith);
                    testtmp.SYSTEMLOG += string.Format("...Vbr = {0} V\r\n", bosaInfo.Vbr);
                    testtmp.SYSTEMLOG += string.Format("...PASS\r\n");

                    vari.Vbr = double.Parse(bosaInfo.Vbr);
                }

                vari.OLT_Power = _getOltPower(_index);

                //Calib RX
                testtmp.TOTALRESULT   = Parameters.testStatus.Wait.ToString();
                testtmp.BUTTONCONTENT = "STOP"; testtmp.BUTTONENABLE = false;
                bool _result          = RunAll(testtmp, bosaInfo, vari);
                testtmp.TOTALRESULT   = _result == false ? Parameters.testStatus.FAIL.ToString() : Parameters.testStatus.PASS.ToString();

                END:
                testtmp.SYSTEMLOG    += string.Format("\r\n----------------------------\r\nTotal Judged={0}\r\n", testtmp.TOTALRESULT);
                testtmp.BUTTONCONTENT = "START"; testtmp.BUTTONENABLE = true;

                //Stop count time
                st.Stop();
                testtmp.SYSTEMLOG += string.Format("Total time = {0} seconds\r\n", st.ElapsedMilliseconds / 1000);
                testtmp.TOTALTIME += (st.ElapsedMilliseconds / 1000).ToString();

                //save log
                LogFile.Savelogtest(testtmp);
                LogFile.Savelogdetail(testtmp);
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
            }));
            t.IsBackground = true;
            t.Start();
            //***END -------------------------------------------//
        }
示例#21
0
 public override bool writeAPD(bosainfo _bosainfo, testinginfo _testinfo)
 {
     throw new NotImplementedException();
 }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button b    = sender as Button;
            string _txt = b.Content.ToString();

            b.Content = "Please wait...";

            Thread t = new Thread(new ThreadStart(() => {
                //***************************************************SQL SERVER
                ////Load data from excel to dataGrid
                //DataTable dt = new DataTable();
                //importInfo.STATUS = "Loading data from excel to datagrid...";
                //dt = BosaReport.readData();

                ////Display data to dataGrid
                //Dispatcher.Invoke(new Action(() => {
                //    this.datagrid.ItemsSource = dt.DefaultView;
                //    importInfo.PROGRESSMAX = dt.Rows.Count - 1;
                //    b.Content = _txt;
                //}));

                ////Import data from dataGrid to Sql Server (using Sql Bulk)
                //importInfo.STATUS = "Importing data from datagrid to Sql Server...";
                //int counter = 0;
                //for (int i = 0; i < dt.Rows.Count; i++) {
                //    string _bosaSN = "", _Ith = "", _Vbr = "";
                //    _bosaSN = dt.Rows[i].ItemArray[0].ToString().Trim();
                //    if (_bosaSN.Length > 0 && BaseFunctions.bosa_SerialNumber_Is_Correct(_bosaSN) == true) {
                //        _Ith = dt.Rows[i].ItemArray[1].ToString().Trim();
                //        _Vbr = dt.Rows[i].ItemArray[18].ToString().Trim();

                //        bosainfo _bs = new bosainfo() { BosaSN = _bosaSN, Ith = _Ith, Vbr = _Vbr };
                //        if (GlobalData.sqlServer.insertData(_bs)) counter++;
                //        importInfo.PROGRESSVALUE += 1;
                //    }
                //}
                //importInfo.PROGRESSVALUE = importInfo.PROGRESSMAX;
                //importInfo.STATUS = string.Format("Finished.The Bosa SN already imported {0}/{1}.", counter, dt.Rows.Count);

                //***************************************************NO SQL SERVER

                //Load data from excel to dataGrid
                DataTable dt      = new DataTable();
                importInfo.STATUS = "Loading data from excel to datagrid...";
                dt = BosaReport.readData();

                //Display data to dataGrid
                Dispatcher.Invoke(new Action(() => {
                    this.datagrid.ItemsSource = dt.DefaultView;
                    importInfo.PROGRESSMAX    = dt.Rows.Count - 1;
                    b.Content = _txt;
                }));

                //Import data from dataGrid to Sql Server (using Sql Bulk)
                importInfo.STATUS       = "Importing data from datagrid to Sql Server...";
                int counter             = 0;
                GlobalData.listBosaInfo = new List <bosainfo>();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string _bosaSN = "", _Ith = "", _Vbr = "";
                    _bosaSN        = dt.Rows[i].ItemArray[0].ToString().Trim();
                    if (_bosaSN.Length > 0 && BaseFunctions.bosa_SerialNumber_Is_Correct(_bosaSN) == true)
                    {
                        _Ith = dt.Rows[i].ItemArray[1].ToString().Trim();
                        _Vbr = dt.Rows[i].ItemArray[5].ToString().Trim();

                        bosainfo _bs = new bosainfo()
                        {
                            BosaSN = _bosaSN, Ith = _Ith, Vbr = _Vbr
                        };
                        GlobalData.listBosaInfo.Add(_bs);
                        counter++;
                        importInfo.PROGRESSVALUE += 1;
                    }
                }
                importInfo.PROGRESSVALUE = importInfo.PROGRESSMAX;
                importInfo.STATUS        = string.Format("Finished.The Bosa SN already imported {0}/{1}.", counter, dt.Rows.Count - 1);
            }));

            t.IsBackground = true;
            t.Start();
        }