예제 #1
0
        /// <summary>
        /// 提交数据,写入csv档
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Register_btn_Click(object sender, EventArgs e)
        {
            //检查barcode是否已经检查
            if (Flag == false)
            {
                error_msg.Text       = "条码格式有误,请重新输入!";
                Output_lbl.ForeColor = Color.Red;
                barcode_txt.SelectAll();
                return;
            }
            else
            {
                error_msg.Text = "";
            }
            //检查是否有选中的NG CODE项
            string ngCode = sNgCode();

            if (ngCode == null)
            {
                error_msg.Text       = "请选择不良原因!";
                Output_lbl.ForeColor = Color.Red;
                panel1.Select();
                return;
            }
            else
            {
                error_msg.Text = "";
            }

            CsvFile csv  = new CsvFile();
            string  path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            #region
            csv.Model = "KK07";
            csv.Site  = "NSTD";

            string      fPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Setting.xml";
            XmlDocument xDoc  = new XmlDocument();
            xDoc.Load(fPath);
            XmlNode nod = xDoc.SelectSingleNode("root");

            XmlNode xNode   = nod.SelectSingleNode("factory");
            string  factory = xNode.Attributes["value"].Value;

            csv.Factory = factory;
            csv.Line    = line_cbx.SelectedItem.ToString();
            csv.Process = process_cbx.SelectedItem.ToString();
            csv.Module  = barcode_txt.Text.ToUpper();
            csv.Module2 = "";
            csv.x2      = "";
            DateTime t1 = System.DateTime.Now;
            csv.Year     = int.Parse(t1.Year.ToString().Substring(2, 2));
            csv.Month    = int.Parse(t1.Month.ToString());
            csv.Day      = int.Parse(t1.Day.ToString());
            csv.Hour     = int.Parse(t1.Hour.ToString());
            csv.Minute   = int.Parse(t1.Minute.ToString());
            csv.Second   = int.Parse(t1.Second.ToString());
            csv.Faci_num = 1;
            //csv.Faci = "PLC";
            csv.Faci        = ngCode;
            csv.faci_value  = 0;
            csv.Item_result = 1;
            csv.All_result  = 1;
            csv.Item_num    = 1;
            //csv.Op_user = _user.user;
            csv.Op_type  = "OPERATOR";
            csv.Op_value = this.user;
            #endregion
            csv.OutPutCsv(path);
            Output_lbl.ForeColor = Color.Lime;
            Output_lbl.Text      = "Output " + csv.Filename + " completed.";
            Flag            = false;
            barErr_lbl.Text = "";

            /*
             * panel1.Click -= new EventHandler(panel1_Click);
             * foreach (RadioButton rad in panel1.Controls)
             * {
             *  rad.Checked = false;
             * }
             * panel1.Click += new EventHandler(panel1_Click);
             */
            barcode_txt.SelectAll();
            barcode_txt.Focus();
            serials = new List <SnClass>();
            LoadserialsDGV();
            //后台ftp上传线程启动
            //ftpUpLoad();
        }
예제 #2
0
        private void UpLoadData()
        {
            //检查barcode是否已经检查
            if (Flag == false)
            {
                Output_lbl.Text      = "条码格式有误,请重新输入请重新输入FYH!";
                Output_lbl.ForeColor = Color.Red;
                barcode_txt.SelectAll();
                return;
            }
            //检查是否有选中的NG CODE项
            string ngCode = sNgCode();

            if (ngCode == null)
            {
                Output_lbl.Text      = "请选择不良原因!";
                Output_lbl.ForeColor = Color.Red;
                panel1.Select();
                return;
            }

            CsvFile csv  = new CsvFile();
            string  path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            #region
            csv.Model   = "KK07";
            csv.Site    = "NSTD";
            csv.Factory = "E-1";
            csv.Line    = line_cbx.SelectedItem.ToString();
            csv.Process = process_cbx.SelectedItem.ToString();
            csv.Module  = barcode_txt.Text.ToUpper();
            csv.Module2 = "";
            csv.x2      = "";
            DateTime t1 = System.DateTime.Now;
            csv.Year     = int.Parse(t1.Year.ToString().Substring(2, 2));
            csv.Month    = int.Parse(t1.Month.ToString());
            csv.Day      = int.Parse(t1.Day.ToString());
            csv.Hour     = int.Parse(t1.Hour.ToString());
            csv.Minute   = int.Parse(t1.Minute.ToString());
            csv.Second   = int.Parse(t1.Second.ToString());
            csv.Faci_num = 1;
            //csv.Faci = "PLC";
            csv.Faci        = ngCode;
            csv.faci_value  = 0;
            csv.Item_result = 1;
            csv.All_result  = 1;
            csv.Item_num    = 1;
            //csv.Op_user = _user.user;
            csv.Op_type  = "OPERATOR";
            csv.Op_value = this.user;
            #endregion
            csv.OutPutCsv(path);
            Output_lbl.ForeColor = Color.Lime;
            Output_lbl.Text      = "Output " + csv.Filename + " completed.";
            Flag            = false;
            barErr_lbl.Text = "";
            panel1.Click   -= new EventHandler(panel1_Click);
            foreach (RadioButton rad in panel1.Controls)
            {
                rad.Checked = false;
            }
            panel1.Click    += new EventHandler(panel1_Click);
            barcode_txt.Text = "";
            barcode_txt.SelectAll();
            barcode_txt.Focus();
            //后台ftp上传线程启动
            //ftpUpLoad();
        }