Esempio n. 1
0
        /// <summary>
        /// get rfid constants from config file
        /// </summary>
        private void InitRFIDConstants()
        {
            try
            {
                dic_customer_RFID_constants.Clear();

                string valid_cusomers = DealINI.IniReadValue("CUSTOMERS", "valid_customer");

                string[] customers = valid_cusomers.Split('|');

                foreach (string item in customers)
                {
                    string mfg_country = DealINI.IniReadValue(item, "mfg_country");
                    string mfg_name    = DealINI.IniReadValue(item, "mfg_name");
                    string iec_date    = DealINI.IniReadValue(item, "iec_date");
                    string iec_verfy   = DealINI.IniReadValue(item, "iec_verfy");
                    string iso         = DealINI.IniReadValue(item, "iso");
                    string producttype = DealINI.IniReadValue(item, "producttype");

                    RFIDConstants rfidConstant = new RFIDConstants(mfg_country, mfg_name, iec_date, iec_verfy, iso, producttype);

                    dic_customer_RFID_constants.Add(item, rfidConstant);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("解析配置文件出错,请检查配置文件!!!");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// set rfid's constants by customer
        /// </summary>
        private void SetRFIDConstants(string customer)
        {
            if (ReaderConfig._dic_rfidConstants.ContainsKey(customer))
            {
                RFIDConstants rc = ReaderConfig._dic_rfidConstants[customer];

                m_objModuleInfo.mfg_name = rc.mfg_name;
                m_objModuleInfo.cell_supplier_country = rc.mfg_country;
                m_objModuleInfo.iec_date    = rc.iec_date;
                m_objModuleInfo.iec_verfy   = rc.iec_verfy;
                m_objModuleInfo.iso         = rc.iso_desc;
                m_objModuleInfo.ProductType = rc.product_type;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// set rfid's constants by customer
        /// </summary>
        private void SetRFIDConstants(string customer)
        {
            ms_cfg_mfg_name    = "";
            ms_cfg_mfg_country = "";
            ms_iec_date        = "";
            ms_iec_verfy       = "";
            ms_iso             = "";
            ms_producttype     = "";

            if (dic_customer_RFID_constants.ContainsKey(customer))
            {
                RFIDConstants rc = dic_customer_RFID_constants[customer];

                ms_cfg_mfg_name    = rc.mfg_name;
                ms_cfg_mfg_country = rc.mfg_country;
                ms_iec_date        = rc.iec_date;
                ms_iec_verfy       = rc.iec_verfy;
                ms_iso             = rc.iso_desc;
                ms_producttype     = rc.product_type;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// get rfid constants from config file
        /// </summary>
        private void InitRFIDConstants()
        {
            try
            {
                dic_customer_RFID_constants.Clear();

                string valid_cusomers = DealINI.IniReadValue("CUSTOMERS", "valid_customer");

                string[] customers = valid_cusomers.Split('|');

                foreach (string item in customers)
                {
                    string mfg_country          = DealINI.IniReadValue(item, "mfg_country");
                    string mfg_name             = DealINI.IniReadValue(item, "mfg_name");
                    string iec_date             = DealINI.IniReadValue(item, "iec_date");
                    string iec_verfy            = DealINI.IniReadValue(item, "iec_verfy");
                    string iso                  = DealINI.IniReadValue(item, "iso");
                    string producttype          = DealINI.IniReadValue(item, "producttype");
                    string cell_mfg             = DealINI.IniReadValue(item, "cell_mfg");
                    string cellsource_country   = DealINI.IniReadValue(item, "cellsource_country");
                    string polarity_of_terminal = DealINI.IniReadValue(item, "polarity_of_terminal");
                    string iso9000_date         = DealINI.IniReadValue(item, "iso9000_date");
                    string iso9000_name         = DealINI.IniReadValue(item, "iso9000_name");
                    string iso14000_date        = DealINI.IniReadValue(item, "iso14000_date");
                    string iso14000_name        = DealINI.IniReadValue(item, "iso14000_name");
                    string max_sys_vol          = DealINI.IniReadValue(item, "max_sys_vol");
                    string cell_mfg_date        = DealINI.IniReadValue(item, "cell_mfg_date");

                    RFIDConstants rfidConstant = new RFIDConstants(mfg_country, mfg_name, iec_date, iec_verfy, iso, producttype, iso9000_name,
                                                                   iso9000_date, iso14000_name, iso14000_date, cellsource_country, polarity_of_terminal, max_sys_vol, cell_mfg,
                                                                   cell_mfg_date);

                    dic_customer_RFID_constants.Add(item, rfidConstant);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("解析配置文件出错,请检查配置文件!!!");
            }
        }
Esempio n. 5
0
        //access
        public byte[] QueryAccess(RFIDConstants configData, string lot)
        {
            ModuleInfo objModule = new ModuleInfo();
            //读取配置文件
            string path = new Jsonhelp().readjson("AccessFilePath", AppDomain.CurrentDomain.BaseDirectory + "config.json");

            if (!System.IO.File.Exists(path))
            {
                MessageBox.Show("没有找到Access文件");
                paintBackgroundColor(statusType.FAIL);
                return(null);
            }

            string conn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Persist Security Info=False;";
            //DbUtility sqlhelp = new DbUtility(conn, DbProviderType.OleDb);
            string sql = new Jsonhelp().readjson("AccessSql", AppDomain.CurrentDomain.BaseDirectory + "config.json");

            sql = string.Format(sql, lot);

            OleDbConnection oConn = new OleDbConnection();
            OleDbCommand    oCom  = new OleDbCommand();

            oConn.ConnectionString = conn;
            oConn.Open();
            oCom.Connection  = oConn;
            oCom.CommandText = sql;
            IDataReader dataReader = oCom.ExecuteReader();


            //IDataReader dataReader= sqlhelp.ExecuteReader(sql, null);
            string moduletime = string.Empty;

            if (dataReader.Read())
            {
                moduletime           = DateTime.Parse(dataReader["testtime"].ToString()).ToString("yyyy-MM-dd");//+ " " + DateTime.Parse(dataReader["Time"].ToString()).ToString("HH:mm:ss");
                objModule.PackedDate = moduletime;
                //电池生产时间从配置文件获取 modify by xue lei on 2018-9-28
                objModule.CellDate    = configData.cell_mfg_date;//new Jsonhelp().readjson("CellProductionDate", AppDomain.CurrentDomain.BaseDirectory + "config.json");  //moduletime;
                objModule.Pmax        = dataReader["Pmax"].ToString();
                objModule.Voc         = dataReader["Voc"].ToString();
                objModule.Vpm         = dataReader["Vpm"].ToString();
                objModule.Ipm         = dataReader["Ipm"].ToString();
                objModule.Isc         = dataReader["Isc"].ToString();
                objModule.FF          = dataReader["FF"].ToString();
                objModule.Module_ID   = lot;
                objModule.ProductType = configData.product_type;
            }
            else
            {
                DoFailStuff(m_sSerialNumber + " " + "未找到组件记录!");
                oConn.Close();
                return(null);
            }
            //dataReader.Close();
            ShowIVCurves(double.Parse(objModule.Isc), double.Parse(objModule.Ipm), double.Parse(objModule.Vpm), double.Parse(objModule.Voc));
            byte[] btData = TagDataFormat.CreateByteArray(objModule, configData);
            oModuleInfo = objModule;
            ShowModuleInfo(true, configData);
            paintBackgroundColor(statusType.PASS);
            oConn.Close();
            return(btData);
        }
Esempio n. 6
0
        private void ShowModuleInfo(bool bSuccess, RFIDConstants constParameters)
        {
            if (this.InvokeRequired)
            {
                ShowModuleInfoDlgt InvokeShowModuleInfo = new ShowModuleInfoDlgt(ShowModuleInfo);
                this.Invoke(InvokeShowModuleInfo, new object[] { bSuccess, constParameters });
            }
            else
            {
                if (!bSuccess)
                {
                    //tbx_SerialWrite.Text = "";
                    tbx_celldate.Text = "";
                    tbx_ipm.Text      = "";
                    tbx_isc.Text      = "";
                    tbx_packdate.Text = "";
                    tbx_pmax.Text     = "";
                    tbx_prodtype.Text = "";
                    tbx_voc.Text      = "";
                    tbx_vpm.Text      = "";
                    tbx_ff.Text       = "";

                    textBox5.Text    = "";
                    textBox1.Text    = "";
                    textBox3.Text    = "";
                    txtCellName.Text = "";
                    txtMFGName.Text  = "";
                }
                else
                {
                    //modify by xue lei on 2018-9-28 测试参数显示小数点后两位

                    //tbx_SerialWrite.Text = "";
                    tbx_celldate.Text = oModuleInfo.CellDate;
                    tbx_ipm.Text      = ((int)(Convert.ToDouble(oModuleInfo.Ipm) * 100) / 100.00).ToString();
                    tbx_isc.Text      = ((int)(Convert.ToDouble(oModuleInfo.Isc) * 100) / 100.00).ToString();  //oModuleInfo.Isc;
                    tbx_packdate.Text = oModuleInfo.PackedDate;
                    tbx_pmax.Text     = ((int)(Convert.ToDouble(oModuleInfo.Pmax) * 100) / 100.00).ToString(); //oModuleInfo.Pmax;
                    tbx_prodtype.Text = oModuleInfo.ProductType;
                    tbx_voc.Text      = ((int)(Convert.ToDouble(oModuleInfo.Voc) * 100) / 100.00).ToString();  //oModuleInfo.Voc;
                    //tbx_vpm.Text = (Convert.ToDecimal(Convert.ToInt32(Decimal.Parse(oModuleInfo.Vpm) * 100M)) / 100M).ToString(); ;//oModuleInfo.Vpm;
                    tbx_vpm.Text = ((int)(Convert.ToDouble(oModuleInfo.Vpm) * 100) / 100.00).ToString();
                    //string stemp = oModuleInfo.Pivf;
                    tbx_ff.Text     = ((int)(Convert.ToDouble(oModuleInfo.FF) * 100) / 100.00).ToString();//oModuleInfo.FF;
                    txtMFGName.Text = constParameters.mfg_name;
                    //textBox5.Text = oModuleInfo.cell_supplier_country;
                    //textBox1.Text = oModuleInfo.iec_date;
                    //textBox3.Text = oModuleInfo.iec_verfy;
                    //textBox4.Text = oModuleInfo.iso;
                    //textBox2.Text = constParameters.mfg_name;                          //oModuleInfo.mfg_name;
                    textBox5.Text = constParameters.mfg_country;                       //oModuleInfo.cell_supplier_country;
                    textBox1.Text = constParameters.iec_date;                          //oModuleInfo.iec_date;
                    textBox3.Text = constParameters.iec_verfy;                         //oModuleInfo.iec_verfy;
                    //txt_iso9000_name.Text = constParameters.iso_9000_name;
                    //txt_iso9000_date.Text = constParameters.iso_9000_date;
                    //txt_iso14000_name.Text = constParameters.iso_14000_name;
                    //txt_iso14000_date.Text = constParameters.iso_14000_date;
                    //txt_polarity.Text = constParameters.polarity_of_terminal;
                    //txt_max_sys_voltage.Text = constParameters.max_sys_vol;
                    //txt_cell_source.Text = constParameters.cellsource_country;
                    txtCellName.Text = constParameters.cell_mfg;
                }
            }
        }
Esempio n. 7
0
        private void tbx_SerialWrite_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (chkbox_burningTag.Checked && cbx_customer.SelectedValue == null)
                {
                    MessageBox.Show("请选择客户!!!");
                    return;
                }

                string        customer         = cbx_customer.SelectedValue.ToString();
                RFIDConstants const_parameters = null;
                if (dic_customer_RFID_constants.ContainsKey(customer))
                {
                    const_parameters = dic_customer_RFID_constants[customer];
                    //ms_cfg_mfg_name = const_parameters.mfg_name;
                    //ms_cfg_mfg_country = const_parameters.mfg_country;
                    //ms_iec_date = const_parameters.iec_date;
                    //ms_iec_verfy = const_parameters.iec_verfy;
                    //ms_iso = const_parameters.iso_desc;
                    //ms_producttype = const_parameters.product_type;
                    //ms_cell_mfg = const_parameters.cell_mfg;
                    //ms_cellsource_country = const_parameters.cellsource_country;
                    //ms_iso9000_date = const_parameters.iso_9000_date;
                    //ms_iso9000_name = const_parameters.iso_9000_name;
                    //ms_iso14000_date = const_parameters.iso_14000_date;
                    //ms_iso14000_name = const_parameters.iso_14000_name;
                    //ms_polarity_of_terminal = const_parameters.polarity_of_terminal;
                    //ms_max_sys_vol = const_parameters.max_sys_vol;
                    //ms_cell_mfg_date = const_parameters.cell_mfg_date;
                }

                CleanIVCurves();
                ShowModuleInfo(false, null);
                string ser = tbx_SerialWrite.Text.Trim().ToUpper();
                //tbx_SerialWrite.Text = "";

                if (ser.Length > 0)
                {
                    paintBackgroundColor(statusType.START);
                    tbx_SerialWrite.Enabled = false;

                    SetLabelStatus(statusType.START);

                    m_sSerialNumber = ser;
                    //add by xue lei on 2019-1-6 数据源配置
                    var datatype = new Jsonhelp().readjson("DataType", AppDomain.CurrentDomain.BaseDirectory + "config.json");
                    if (datatype == "")
                    {
                        MessageBox.Show("请先配置数据源");
                        return;
                    }
                    if (chkbox_burningTag.Checked)
                    {
                        if (!GetTagUID())
                        {
                            WriteLog(lrtxtLog, "没有发现标签!", 1);
                            common.rf_beep(ReaderInfo.icdev, 20);
                            paintBackgroundColor(statusType.FAIL);
                            List <string> csvValueList = new List <string> {
                                System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), m_sSerialNumber, "Fail", ""
                            };
                            WriteCSVLog.WriteCSV(csvValueList);
                            SetSerialTxtFocus();
                            Speech("烧录失败");
                        }
                        else
                        {
                            if (datatype == "csv")
                            {
                                WriteRfid(QueryCSVToOdbc(const_parameters, ser));
                            }
                            else if (datatype == "Access")
                            {
                                WriteRfid(QueryAccess(const_parameters, ser));
                            }
                            else
                            {
                                #region query data from database
                                WcfCaller.querySerialInfo((o, ex) =>
                                {
                                    if (ex == null)
                                    {
                                        if (o == null)
                                        {
                                            DoFailStuff(m_sSerialNumber + " " + "未找到组件记录!");
                                            return;
                                        }

                                        #region chech region state



                                        if (string.IsNullOrEmpty(o.ProductType))
                                        {
                                            o.ProductType = const_parameters.product_type;
                                            //DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt01);
                                            //return;
                                        }
                                        if (string.IsNullOrEmpty(o.CellDate))
                                        {
                                            o.CellDate = const_parameters.cell_mfg_date;
                                            //DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt02);
                                            //return;
                                        }
                                        if (string.IsNullOrEmpty(o.PackedDate))
                                        {
                                            DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt03);
                                            return;
                                        }
                                        if (string.IsNullOrEmpty(o.Pmax))
                                        {
                                            DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt04);
                                            return;
                                        }
                                        if (string.IsNullOrEmpty(o.Voc))
                                        {
                                            DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt05);
                                            return;
                                        }
                                        if (string.IsNullOrEmpty(o.Vpm))
                                        {
                                            DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt06);
                                            return;
                                        }
                                        if (string.IsNullOrEmpty(o.Ipm))
                                        {
                                            DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt07);
                                            return;
                                        }
                                        if (string.IsNullOrEmpty(o.Isc))
                                        {
                                            DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt08);
                                            return;
                                        }
                                        #endregion

                                        ShowIVCurves(double.Parse(o.Isc), double.Parse(o.Ipm), double.Parse(o.Vpm), double.Parse(o.Voc));

                                        o.customer = cbx_customer.SelectedValue.ToString();
                                        //SetRFIDConstants(o.customer);


                                        byte[] btData = TagDataFormat.CreateByteArray(o, const_parameters);

                                        oModuleInfo = o;

                                        m_sBasicInfo = o.ProductType + "|" + o.PackedDate.Replace("-", ".") + "|"
                                                       + o.Pivf + "|" + o.Module_ID + "|" + o.CellDate.Replace("-", ".") + "|3";

                                        if (WriteData(btData))
                                        {
                                            //WriteLog2DB();

                                            paintBackgroundColor(statusType.PASS);
                                            WriteLog(lrtxtLog, m_sSerialNumber + " " + "烧录成功!", 0);
                                            common.rf_beep(ReaderInfo.icdev, 10);
                                            List <string> csvValueList = new List <string> {
                                                System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), m_sSerialNumber, "Pass", m_sTagUIDstring, m_sBasicInfo
                                            };
                                            WriteCSVLog.WriteCSV(csvValueList);
                                            ShowModuleInfo(true, const_parameters);
                                            Speech("烧录成功");
                                        }
                                        else
                                        {
                                            DoFailStuff(m_sSerialNumber + " " + "烧录失败!");
                                        }
                                    }
                                    else
                                    {
                                        DoFailStuff("与服务器通讯发生异常" + ex.Message);
                                    }
                                    SetSerialTxtFocus();
                                }, new string[] { m_sSerialNumber, m_sTagUIDstring });
                                #endregion
                            }
                        }
                    }
                    else
                    {
                        if (datatype == "csv")
                        {
                            QueryCSVToOdbc(const_parameters, ser);
                        }
                        else if (datatype == "Access")
                        {
                            QueryAccess(const_parameters, ser);
                        }
                        else
                        {
                            #region query data from database
                            WcfCaller.querySerialInfo((o, ex) =>
                            {
                                if (ex == null)
                                {
                                    if (o == null)
                                    {
                                        DoFailStuff(m_sSerialNumber + " " + "未找到组件记录!");
                                        return;
                                    }

                                    #region chech region state

                                    if (string.IsNullOrEmpty(o.ProductType))
                                    {
                                        o.ProductType = const_parameters.product_type;
                                        //DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt01);
                                        //return;
                                    }
                                    if (string.IsNullOrEmpty(o.CellDate))
                                    {
                                        o.CellDate = const_parameters.cell_mfg_date;
                                        //DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt02);
                                        //return;
                                    }
                                    if (string.IsNullOrEmpty(o.PackedDate))
                                    {
                                        DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt03);
                                        return;
                                    }
                                    if (string.IsNullOrEmpty(o.Pmax))
                                    {
                                        DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt04);
                                        return;
                                    }
                                    if (string.IsNullOrEmpty(o.Voc))
                                    {
                                        DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt05);
                                        return;
                                    }
                                    if (string.IsNullOrEmpty(o.Vpm))
                                    {
                                        DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt06);
                                        return;
                                    }
                                    if (string.IsNullOrEmpty(o.Ipm))
                                    {
                                        DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt07);
                                        return;
                                    }
                                    if (string.IsNullOrEmpty(o.Isc))
                                    {
                                        DoFailStuff(m_sSerialNumber + " " + Resources.strPrompt08);
                                        return;
                                    }
                                    #endregion

                                    ShowIVCurves(double.Parse(o.Isc), double.Parse(o.Ipm), double.Parse(o.Vpm), double.Parse(o.Voc));

                                    o.customer = cbx_customer.SelectedValue.ToString();
                                    //SetRFIDConstants(o.customer);

                                    oModuleInfo = o;

                                    paintBackgroundColor(statusType.PASS);

                                    ShowModuleInfo(true, const_parameters);

                                    WriteLog(lrtxtLog, m_sSerialNumber + " " + "获取功率信息成功!", 0);

                                    SetSerialTxtFocus();
                                }
                                else
                                {
                                    DoFailStuff("与服务器通讯发生异常" + ex.Message);
                                    //WriteLog(lrtxtLog, "与服务器通讯发生异常"+ex.Message, 1);
                                    //common.rf_beep(ReaderInfo.icdev, 20);
                                    //paintBackgroundColor(statusType.FAIL);
                                    //List<string> csvValueList = new List<string> { System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), m_sSerialNumber, "Fail", "" };
                                    //WriteCSVLog.WriteCSV(csvValueList);
                                    //SetSerialTxtFocus();
                                    //Speech("烧录失败");
                                }
                            }, new string[] { m_sSerialNumber, m_sTagUIDstring });
                            #endregion }
                        }
                    }
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// get rfid constants from config file
        /// </summary>
        private void InitRFIDConstants()
        {
            try
            {
                dic_customer_RFID_constants.Clear();

                string valid_cusomers            = DealINI.IniReadValue("CUSTOMERS", "valid_customer");
                string valid_cusomer_displayname = DealINI.IniReadValue("CUSTOMERS", "customer_displayname");

                string[] customers            = valid_cusomers.Split('|');
                string[] customer_displayname = valid_cusomer_displayname.Split('|');

                IList <CustomerInfo> infoList = new List <CustomerInfo>();

                //if (customers.Count()>0)
                //{
                //    cbx_customer.DataSource =
                //}

                for (int i = 0; i < customers.Length; i++)
                {
                    CustomerInfo customerinfo = new CustomerInfo()
                    {
                        Id = customers[i], Name = customer_displayname[i]
                    };
                    infoList.Add(customerinfo);

                    string mfg_country          = DealINI.IniReadValue(customers[i], "mfg_country");
                    string mfg_name             = DealINI.IniReadValue(customers[i], "mfg_name");
                    string iec_date             = DealINI.IniReadValue(customers[i], "iec_date");
                    string iec_verfy            = DealINI.IniReadValue(customers[i], "iec_verfy");
                    string iso                  = DealINI.IniReadValue(customers[i], "iso");
                    string producttype          = DealINI.IniReadValue(customers[i], "producttype");
                    string cell_mfg             = DealINI.IniReadValue(customers[i], "cell_mfg");
                    string cellsource_country   = DealINI.IniReadValue(customers[i], "cellsource_country");
                    string polarity_of_terminal = DealINI.IniReadValue(customers[i], "polarity_of_terminal");
                    string iso9000_date         = DealINI.IniReadValue(customers[i], "iso9000_date");
                    string iso9000_name         = DealINI.IniReadValue(customers[i], "iso9000_name");
                    string iso14000_date        = DealINI.IniReadValue(customers[i], "iso14000_date");
                    string iso14000_name        = DealINI.IniReadValue(customers[i], "iso14000_name");
                    string max_sys_vol          = DealINI.IniReadValue(customers[i], "max_sys_vol");
                    string cell_mfg_date        = DealINI.IniReadValue(customers[i], "cell_mfg_date");

                    RFIDConstants rfidConstant = new RFIDConstants(mfg_country, mfg_name, iec_date, iec_verfy, iso, producttype, iso9000_name,
                                                                   iso9000_date, iso14000_name, iso14000_date, cellsource_country, polarity_of_terminal, max_sys_vol, cell_mfg,
                                                                   cell_mfg_date);

                    dic_customer_RFID_constants.Add(customers[i], rfidConstant);
                }

                if (infoList.Count > 0)
                {
                    cbx_customer.DataSource    = infoList;
                    cbx_customer.ValueMember   = "Id";
                    cbx_customer.DisplayMember = "Name";
                }
            }
            catch (Exception)
            {
                MessageBox.Show("解析配置文件出错,请检查配置文件!!!");
            }
        }
Esempio n. 9
0
        //读取csv
        /// <summary>
        /// Odbc查询CSV
        /// </summary>
        public byte[] QueryCSVToOdbc(RFIDConstants configData, string lot)
        {
            ModuleInfo objModule = new ModuleInfo();

            //读取配置文件
            string path = new Jsonhelp().readjson("CSVFilePath", AppDomain.CurrentDomain.BaseDirectory + "config.json");

            //path = path.Replace("\\\\", "\\");
            if (!System.IO.File.Exists(path))
            {
                MessageBox.Show("没有找到CSV文件");
                paintBackgroundColor(statusType.FAIL);
                return(null);
            }
            string newfilename = System.DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv";
            string newfilepath = AppDomain.CurrentDomain.BaseDirectory + newfilename;

            System.IO.File.Copy(path, newfilepath);

            //文件路径
            string tableName = newfilepath.Substring(newfilepath.LastIndexOf('\\') + 1);
            string filePath  = newfilepath.Substring(0, newfilepath.LastIndexOf('\\') + 1);//AppDomain.CurrentDomain.BaseDirectory;

            string pContent = string.Empty;

            OdbcConnection odbcConn = new OdbcConnection();
            OdbcCommand    odbcCmd  = new OdbcCommand();
            OdbcDataReader dataReader;

            try
            {
                string strConnOledb = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=";
                strConnOledb += filePath;
                strConnOledb += ";Extensions=csv,txt;";

                odbcConn.ConnectionString = strConnOledb;
                odbcConn.Open();
                StringBuilder commandText = new StringBuilder("SELECT  ");
                commandText.AppendFormat("Date,Time,Snr,Voc,Isc,Pmax,Vpmax,Ipmax,FF From {0} where Snr ='" + lot + "' ", tableName);
                odbcCmd.Connection  = odbcConn;
                odbcCmd.CommandText = commandText.ToString();
                dataReader          = odbcCmd.ExecuteReader(CommandBehavior.CloseConnection);
                string moduletime = string.Empty;
                if (dataReader.Read())
                {
                    moduletime           = DateTime.Parse(dataReader["Date"].ToString()).ToString("yyyy-MM-dd");//+ " " + DateTime.Parse(dataReader["Time"].ToString()).ToString("HH:mm:ss");
                    objModule.PackedDate = moduletime;
                    //电池生产时间从配置文件获取 modify by xue lei on 2018-9-28
                    objModule.CellDate    = configData.cell_mfg_date;//new Jsonhelp().readjson("CellProductionDate", AppDomain.CurrentDomain.BaseDirectory + "config.json");  //moduletime;
                    objModule.Pmax        = dataReader["Pmax"].ToString();
                    objModule.Voc         = dataReader["Voc"].ToString();
                    objModule.Vpm         = dataReader["Vpmax"].ToString();
                    objModule.Ipm         = dataReader["Ipmax"].ToString();
                    objModule.Isc         = dataReader["Isc"].ToString();
                    objModule.FF          = dataReader["FF"].ToString();
                    objModule.Module_ID   = lot;
                    objModule.ProductType = configData.product_type;
                }
                else
                {
                    DoFailStuff(m_sSerialNumber + " " + "未找到组件记录!");
                }
                //dataReader.Close();
                ShowIVCurves(double.Parse(objModule.Isc), double.Parse(objModule.Ipm), double.Parse(objModule.Vpm), double.Parse(objModule.Voc));
                byte[] btData = TagDataFormat.CreateByteArray(objModule, configData);
                oModuleInfo = objModule;
                ShowModuleInfo(true, configData);
                paintBackgroundColor(statusType.PASS);
                return(btData);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                odbcConn.Close();
                byte[] data = null;
                return(data);
            }
            finally
            {
                odbcConn.Close();
            }
        }
Esempio n. 10
0
        /// <summary>
        /// get rfid constants from config file
        /// </summary>
        private void InitRFIDConstants()
        {
            try
            {
                //判断是否读取 add by xue lei on 2018-9-11
                string isRead = DealINI.IniReadValue("Read", "read");
                cbxisRead.Checked = isRead == "true"?true:false;
                //获取间隔时间
                List <string> TimeList = new List <string>();
                string[]      aryTime  = DealINI.IniReadValue("READTIME", "time").ToString().Split('|');
                foreach (var a in aryTime)
                {
                    TimeList.Add(a);
                }
                ddlinternalTime.DataSource = TimeList;



                dic_customer_RFID_constants.Clear();

                string valid_cusomers            = DealINI.IniReadValue("CUSTOMERS", "valid_customer");
                string valid_cusomer_displayname = DealINI.IniReadValue("CUSTOMERS", "customer_displayname");

                string[] customers            = valid_cusomers.Split('|');
                string[] customer_displayname = valid_cusomer_displayname.Split('|');

                IList <CustomerInfo> infoList = new List <CustomerInfo>();

                //if (customers.Count()>0)
                //{
                //    cbx_customer.DataSource =
                //}

                for (int i = 0; i < customers.Length; i++)
                {
                    CustomerInfo customerinfo = new CustomerInfo()
                    {
                        Id = customers[i], Name = customer_displayname[i]
                    };
                    infoList.Add(customerinfo);

                    string mfg_country = DealINI.IniReadValue(customers[i], "mfg_country");
                    string mfg_name    = DealINI.IniReadValue(customers[i], "mfg_name");
                    string iec_date    = DealINI.IniReadValue(customers[i], "iec_date");
                    string iec_verfy   = DealINI.IniReadValue(customers[i], "iec_verfy");
                    string iso         = DealINI.IniReadValue(customers[i], "iso");
                    string producttype = DealINI.IniReadValue(customers[i], "producttype");

                    RFIDConstants rfidConstant = new RFIDConstants(mfg_country, mfg_name, iec_date, iec_verfy, iso, producttype);

                    dic_customer_RFID_constants.Add(customers[i], rfidConstant);
                }

                if (infoList.Count > 0)
                {
                    cbx_customer.DataSource    = infoList;
                    cbx_customer.ValueMember   = "Id";
                    cbx_customer.DisplayMember = "Name";
                }
            }
            catch (Exception)
            {
                MessageBox.Show("解析配置文件出错,请检查配置文件!!!");
            }
        }
Esempio n. 11
0
        private void ShowModuleInfo(bool bSuccess, RFIDConstants constParameters)
        {
            if (this.InvokeRequired)
            {
                ShowModuleInfoDlgt InvokeShowModuleInfo = new ShowModuleInfoDlgt(ShowModuleInfo);
                this.Invoke(InvokeShowModuleInfo, new object[] { bSuccess, constParameters });
            }
            else
            {
                if (!bSuccess)
                {
                    //tbx_SerialWrite.Text = "";
                    tbx_celldate.Text        = "";
                    tbx_ipm.Text             = "";
                    tbx_isc.Text             = "";
                    tbx_packdate.Text        = "";
                    tbx_pmax.Text            = "";
                    tbx_prodtype.Text        = "";
                    tbx_voc.Text             = "";
                    tbx_vpm.Text             = "";
                    tbx_ff.Text              = "";
                    textBox2.Text            = "";
                    textBox5.Text            = "";
                    textBox1.Text            = "";
                    textBox3.Text            = "";
                    txt_iso9000_name.Text    = "";
                    txt_iso9000_date.Text    = "";
                    txt_iso14000_name.Text   = "";
                    txt_iso14000_date.Text   = "";
                    txt_polarity.Text        = "";
                    txt_max_sys_voltage.Text = "";
                    txt_cell_source.Text     = "";
                    txt_cell_mfg.Text        = "";
                }
                else
                {
                    //tbx_SerialWrite.Text = "";
                    tbx_celldate.Text = oModuleInfo.CellDate;
                    tbx_ipm.Text      = oModuleInfo.Ipm;
                    tbx_isc.Text      = oModuleInfo.Isc;
                    tbx_packdate.Text = oModuleInfo.PackedDate;
                    tbx_pmax.Text     = oModuleInfo.Pmax;
                    tbx_prodtype.Text = oModuleInfo.ProductType;
                    tbx_voc.Text      = oModuleInfo.Voc;
                    tbx_vpm.Text      = oModuleInfo.Vpm;

                    //string stemp = oModuleInfo.Pivf;


                    tbx_ff.Text = oModuleInfo.FF;

                    //textBox2.Text = oModuleInfo.mfg_name;
                    //textBox5.Text = oModuleInfo.cell_supplier_country;
                    //textBox1.Text = oModuleInfo.iec_date;
                    //textBox3.Text = oModuleInfo.iec_verfy;
                    //textBox4.Text = oModuleInfo.iso;

                    textBox2.Text            = constParameters.mfg_name;               //oModuleInfo.mfg_name;
                    textBox5.Text            = constParameters.mfg_country;            //oModuleInfo.cell_supplier_country;
                    textBox1.Text            = constParameters.iec_date;               //oModuleInfo.iec_date;
                    textBox3.Text            = constParameters.iec_verfy;              //oModuleInfo.iec_verfy;
                    txt_iso9000_name.Text    = constParameters.iso_9000_name;
                    txt_iso9000_date.Text    = constParameters.iso_9000_date;
                    txt_iso14000_name.Text   = constParameters.iso_14000_name;
                    txt_iso14000_date.Text   = constParameters.iso_14000_date;
                    txt_polarity.Text        = constParameters.polarity_of_terminal;
                    txt_max_sys_voltage.Text = constParameters.max_sys_vol;
                    txt_cell_source.Text     = constParameters.cellsource_country;
                    txt_cell_mfg.Text        = constParameters.cell_mfg;
                }
            }
        }