/// <summary> /// /// 初始化整个表格 /// </summary> private void initdgv() { this.del_list.Clear(); Maticsoft.BLL.measures use1 = new Maticsoft.BLL.measures(); string aa = string.Format("componentId = '{0}'ORDER BY step", LjHao);//ORDER BY step DataSet ds = use1.GetListByPage3(aa, "", 0, 100); dgv.DataSource = ds.Tables[0]; foreach (DataGridViewRow row in dgv.Rows) { row.Cells["step"].Value = row.Index + 1; } Maticsoft.BLL.component mea_bll = new Maticsoft.BLL.component(); Maticsoft.Model.component comp_mode = mea_bll.GetModel(Convert.ToInt32(LjHao)); if (comp_mode != null) { Task a_task = new Task(new Action(() => { Thread.Sleep(1000); renderView.Invoke(new Action(() => { string base_dir = Environment.CurrentDirectory; base_dir += "\\shumo\\"; base_dir += comp_mode.sm; IgesReader reader = new IgesReader(); bool ret = reader.Read(base_dir, new CadView(this.renderView)); Console.WriteLine("ret ====== " + ret); renderView.FitAll(); renderView.RequestDraw(); })); })); a_task.Start(); } }
private void button1_Click(object sender, EventArgs e) { string componentId = dataGridView1.CurrentRow.Cells["componentId"].Value.ToString(); Maticsoft.BLL.component comp_bll = new Maticsoft.BLL.component(); DataSet ds = comp_bll.GetList(string.Format(" componentId = '{0}'", componentId)); DataTable dt = ds.Tables[0]; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string fName = saveFileDialog1.FileName; //this.DataToExcel(dt, fName); Maticsoft.BLL.measures mea_bll = new Maticsoft.BLL.measures(); DataSet ds2 = mea_bll.GetList(string.Format(" componentId = '{0}'", componentId)); DataTable dt2 = ds2.Tables[0]; for (int i = 0; i < dt2.Rows.Count; i++) { for (int j = 0; j < dt2.Columns.Count; j++) { Console.WriteLine(dt2.Rows[i][j].ToString()); } } this.TableToExcelForXLSX2003(dt, dt2, fName, "s1"); // this.TableToExcelForXLSX2003(dt2, fName, "s2"); //string file_name = Path.GetFileNameWithoutExtension(fName) + "详情"+ Path.GetExtension(fName); //file_name = Path.GetDirectoryName(fName)+ "\\" + file_name; //this.DataToExcel(dt2, file_name); //this.TableToExcelForXLSX2003(dt2, file_name, "s2"); } }
private void allupdate() { for (int i = 0; i < dgv.Rows.Count; i++) { string to = dgv.Rows[i].Cells["Tools"].Value.ToString(); string tl = dgv.Rows[i].Cells["position"].Value.ToString(); string bz = dgv.Rows[i].Cells["standardv"].Value.ToString(); string sg = dgv.Rows[i].Cells["up"].Value.ToString(); string xg = dgv.Rows[i].Cells["down"].Value.ToString(); string cun = dgv.Rows[i].Cells["CC"].Value.ToString(); int componentid = Convert.ToInt32(dgv.Rows[i].Cells["componentid"].Value); int XH = Convert.ToInt32(dgv.Rows[i].Cells["id"].Value); int st = Convert.ToInt32(dgv.Rows[i].Cells["step"].Value); int device_type = Convert.ToInt32(dgv.Rows[i].Cells["devicetype"].Value == null ? "0" : dgv.Rows[i].Cells["devicetype"].Value); int port_id = Convert.ToInt32(dgv.Rows[i].Cells["portid"].Value); Maticsoft.BLL.measures use = new Maticsoft.BLL.measures(); Maticsoft.Model.measures us = new measures() { id = XH, step = st, Tools = to, position = tl, standardv = bz, up = sg, down = xg, componentId = componentid, CC = cun, devicetype = device_type, portid = port_id, }; use.Update(us); } }
private void button2_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { DataTable dt = ExcelToDataTable(openFileDialog1.FileName, "s1", true); //for (int i = 0; i < dt.Rows.Count; i++) //{ // for (int j = 0; j < dt.Columns.Count; j++) // { // Console.WriteLine(dt.Rows[i][j].ToString()); // } //} Maticsoft.BLL.component comp_bll = new Maticsoft.BLL.component(); for (int i = 0; i < dt.Rows.Count; i++) { if (!comp_bll.Exists(Convert.ToInt32(dt.Rows[i]["componentId"]))) { Maticsoft.Model.component comp_mode = new Maticsoft.Model.component() { componentId = Convert.ToInt32(dt.Rows[i]["componentId"]), ARef = Convert.ToString(dt.Rows[i]["ARef"]), jobnum = Convert.ToString(dt.Rows[i]["jobnum"]), name = Convert.ToString(dt.Rows[i]["name"]), size = Convert.ToString(dt.Rows[i]["size"]), photo = Convert.ToString(dt.Rows[i]["photo"]), sm = Convert.ToString(dt.Rows[i]["sm"]), remark = Convert.ToString(dt.Rows[i]["remark"]) }; comp_bll.Add(comp_mode); } } DataTable dt2 = ExcelToDataTable(openFileDialog1.FileName, "s2", true); Maticsoft.BLL.measures mea_bll = new Maticsoft.BLL.measures(); for (int i = 0; i < dt2.Rows.Count; i++) { if (!mea_bll.Exists(Convert.ToInt32(dt2.Rows[i]["id"]))) { Maticsoft.Model.measures mea_obj = new Maticsoft.Model.measures() { id = Convert.ToInt32(dt2.Rows[i]["id"]), componentId = Convert.ToInt32(dt2.Rows[i]["componentId"]), standardv = Convert.ToString(dt2.Rows[i]["standardv"]), step = Convert.ToInt32(dt2.Rows[i]["step"]), down = Convert.ToString(dt2.Rows[i]["down"]), up = Convert.ToString(dt2.Rows[i]["up"]), devicetype = Convert.ToInt32(dt2.Rows[i]["devicetype"]), position = Convert.ToString(dt2.Rows[i]["position"]), Tools = Convert.ToString(dt2.Rows[i]["Tools"]), CC = Convert.ToString(dt2.Rows[i]["CC"]), }; mea_bll.Add(mea_obj); } } } }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtstep.Text.Trim().Length == 0) { strErr += "step不能为空!\\n"; } if (this.txt Tools.Text.Trim().Length == 0) { strErr += " Tools不能为空!\\n"; } if (this.txtposition.Text.Trim().Length == 0) { strErr += "position不能为空!\\n"; } if (this.txtstandardv.Text.Trim().Length == 0) { strErr += "standardv不能为空!\\n"; } if (this.txtup.Text.Trim().Length == 0) { strErr += "up不能为空!\\n"; } if (this.txtdown.Text.Trim().Length == 0) { strErr += "down不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int id = int.Parse(this.lblid.Text); string step = this.txtstep.Text; string Tools = this.txt Tools.Text; string position = this.txtposition.Text; string standardv = this.txtstandardv.Text; string up = this.txtup.Text; string down = this.txtdown.Text; Maticsoft.Model.measures model = new Maticsoft.Model.measures(); model.id = id; model.step = step; model.Tools = Tools; model.position = position; model.standardv = standardv; model.up = up; model.down = down; Maticsoft.BLL.measures bll = new Maticsoft.BLL.measures(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
private void send_bt_Click(object sender, EventArgs e) { allupdate(); groupBox1.Enabled = true; Maticsoft.BLL.measures use = new Maticsoft.BLL.measures(); foreach (int del_id in del_list) { use.Delete(del_id); } MessageBox.Show("数据已经提交"); }
private void ShowInfo(int id) { Maticsoft.BLL.measures bll = new Maticsoft.BLL.measures(); Maticsoft.Model.measures model = bll.GetModel(id); this.lblid.Text = model.id.ToString(); this.lblstep.Text = model.step; this.lbl Tools.Text = model.Tools; this.lblposition.Text = model.position; this.lblstandardv.Text = model.standardv; this.lblup.Text = model.up; this.lbldown.Text = model.down; }
private void reQuery(bool all = false, string order = "") { string where_string = this.query_wherestring(); // 同步处理好 零件的基础信息的事情 string lijianhao = textBox_ljhao.Text; if (lijianhao != null && lijianhao != "") { this.dealwithcomp(Convert.ToInt32(lijianhao)); } else { return; } #region 构建基本的表形状 DataTable mea_dt = new DataTable(); Maticsoft.BLL.measures mea_bll = new Maticsoft.BLL.measures(); List <Maticsoft.Model.measures> mea_modes = mea_bll.GetModelList(string.Format(" componentId={0} order by step", this.comp_type)); mea_dt.Columns.Add("零件号"); mea_dt.Columns.Add("测量编号"); mea_modes = mea_modes.OrderBy(obj => obj.step).ToList(); foreach (Maticsoft.Model.measures mea_obj in mea_modes) { //string sg = "步骤" + mea_dt.Tables[0].Rows[i]["step"].ToString();// comboBox1.Items.Add() // comboBox1.Text = sg; string sg = mea_obj.CC.ToString(); mea_dt.Columns.Add(sg.ToString()); } mea_dt.Columns.Add("结果"); mea_dt.Columns.Add("测量时间"); if (all == false) { dgv.DataSource = null; dgv.DataSource = mea_dt; for (int i = 0; i < this.dgv.Columns.Count; i++) { this.dgv.Columns[i].SortMode = DataGridViewColumnSortMode.Programmatic; } } dgv.Columns["测量编号"].Width = 140; dgv.Columns["测量时间"].Width = 140; // dgv.AutoGenerateColumns = false; dataGridView1.DataSource = mea_dt.Copy(); #endregion // 查询出来test 数据 Maticsoft.BLL.test test_bll = new Maticsoft.BLL.test(); // List<Maticsoft.Model.test> test_lists = test_bll.GetModelList(where_str); DataSet ds = new DataSet(); DataTable dest_table = null; //DataTable dest_table2 = null; if (all == false) { ds = test_bll.GetListByPage2(where_string, order, cur_page_lenb * cur_page_num, cur_page_lenb); dest_table = dgv.DataSource as DataTable; } else { ds = test_bll.GetListByPage2(where_string, order, 0, 10000); dest_table = dataGridView1.DataSource as DataTable; } DataTable dt = ds.Tables[0]; #region 根据数据 更新表结构 ==== 惰性加入数据 // 放入基础信息 Task <string[]> parent = new Task <string[]>((aa) => { DataTable local_dt = aa as DataTable; int count = local_dt.Rows.Count; string[] ret = new string[count]; dgv.Columns["零件号"].Tag = "PN"; dgv.Columns["测量编号"].Tag = "measureb"; dgv.Columns["测量时间"].Tag = "time"; dgv.Columns["结果"].Tag = "OKorNG"; for (int i = 0; i < count; i++) { DataRow xin_dr = dest_table.NewRow(); xin_dr["零件号"] = local_dt.Rows[i]["PN"]; xin_dr["测量编号"] = local_dt.Rows[i]["measureb"]; xin_dr["测量时间"] = local_dt.Rows[i]["time"]; xin_dr["结果"] = local_dt.Rows[i]["OKorNG"]; dest_table.Rows.Add(xin_dr); //xin_dr.Rows[][] = local_dt.Rows[i][0] new Task((index) => { int ret_i = Convert.ToInt32(index); // Console.WriteLine("试试 " + index); ret[ret_i] = local_dt.Rows[ret_i]["step1"].ToString(); }, i, TaskCreationOptions.AttachedToParent).Start(); } return(ret); }, dt); parent.ContinueWith((t) => { for (int i = 0; i < t.Result.Length; i++) { string[] sp_l = t.Result[i].Split('/'); foreach (Maticsoft.Model.measures mea_obj in mea_modes) { int ret_col_num = 1; bool col_if = int.TryParse(mea_obj.step.ToString(), out ret_col_num); // string sg = "步骤" + mea_obj.CC.ToString(); string sg = mea_obj.CC.ToString(); dgv.Columns[sg].Tag = "step1"; //mea_modes if (col_if && ret_col_num < sp_l.Length + 1) { double stand_info = Convert.ToDouble(mea_obj.standardv); string test_str = sp_l[ret_col_num - 1]; if (test_str == "") { continue; } double test_info = Convert.ToDouble(test_str); dest_table.Rows[i][sg] = sp_l[ret_col_num - 1]; if (all == false) { if (stand_info + Convert.ToDouble(mea_obj.down) > test_info) { dgv.Rows[i].Cells[sg].Style.BackColor = Color.Cyan; } else if (stand_info + Convert.ToDouble(mea_obj.up) < test_info) { dgv.Rows[i].Cells[sg].Style.BackColor = Color.LightSalmon; } else { dgv.Rows[i].Cells[sg].Style.BackColor = Color.Lime; } } else { if (stand_info + Convert.ToDouble(mea_obj.down) > test_info) { dataGridView1.Rows[i].Cells[sg].Style.BackColor = Color.Cyan; } else if (stand_info + Convert.ToDouble(mea_obj.up) < test_info) { dataGridView1.Rows[i].Cells[sg].Style.BackColor = Color.LightSalmon; } else { dataGridView1.Rows[i].Cells[sg].Style.BackColor = Color.Lime; } } } } } // 计算 jisuan(all); }); parent.Start(); #endregion #endregion return; }
private void jisuan(bool all = false) { DataTable dt2 = NewMethod(); //构建一个计算用的表格 Maticsoft.BLL.measures mea_bll = new Maticsoft.BLL.measures(); List <Maticsoft.Model.measures> mea_list = mea_bll.GetModelList(string.Format(" componentId = '{0}' order by step ", this.comp_type)); foreach (Maticsoft.Model.measures mea_obj in mea_list) { // dt2.Columns.Add(new DataColumn("s" + mea_obj.step.ToString(), typeof(Double))); dt2.Columns.Add(new DataColumn(mea_obj.CC.ToString(), typeof(Double))); } // 取得数据。 分解数据。 填充数据 Maticsoft.BLL.test test_bll = new Maticsoft.BLL.test(); string where_string1 = this.query_wherestring(); // radioGroup1.SelectedIndex = 2; DataSet ds = test_bll.GetList3(where_string1); //DataTable dt = this.dgv.DataSource as DataTable; DataTable dt = ds.Tables[0]; List <double[]> bbb = new List <double[]>(); foreach (DataRow dr in dt.Rows) { string step = dr["step1"].ToString(); string[] temp_step = step.Split('/'); if (temp_step.Length == dt2.Columns.Count) { DataRow dr_temp = dt2.NewRow(); for (int i = 0; i < temp_step.Length; i++) { double temp_d = 0; Double.TryParse(temp_step[i], out temp_d); // dr_temp["s" + (i + 1).ToString()] = temp_d; dr_temp[i] = temp_d; Console.WriteLine("temp_step[i] == " + temp_step[i] + " === " + i); } dt2.Rows.Add(dr_temp); //Console.WriteLine(Environment.NewLine); } } /* * CPK=Cp*(1-|Ca|) * Ca (Capability of Accuracy):制程准确度;在衡量「实际平均值」与「规格中心值」之一致性。对於单边规格,因不存在规格中心,因此不存在Ca;对於双边规格,Ca=(ˉx-U)/(T/2)。 * Cp (Capability of Precision):制程精密度;在衡量「规格公差宽度」与「制程变异宽度」之比例。对於单边规格,只有上限和中心值,Cpu = | USL-ˉx | / 3σ 或 只有下限和中心值,Cpl = | ˉx -LSL | / 3σ;对於双边规格:Cp=(USL-LSL) / 6σ=T/6σ * 注意: 计算Cpk时,取样数据至少应有20组数据,而且数据要具有一定代表性。 * * 某零件质量要求为20±0.15,抽样100件,测得:-x =20.05mm;s=0.05mm,求过程能力指数。根据零件的规格要求,Tu=20.15,Tl=19.85 * M=Tu+Tl/2=(20.15+19.85)/2=20.00 * ε=|M- 20.05|=0.05 * T = USL - LSL = 20.15 - 19.85 = 0.3 * CPK = CP*(|1-CA|) * = (T-2ε)/6s = (0.3-2*0.05)/(6*0.05)=(0.3-0.1)/(6*0.05)≈0.67 */ // 分析数据 // mea_list string all_cpk = ""; Dictionary <int, double> cpk_dic = new Dictionary <int, double>(); foreach (DataColumn aa in dt2.Columns) { int step = dt2.Columns.IndexOf(aa); string col_name = aa.ColumnName.Replace("s", ""); //dt2.Columns[1]. // List<Maticsoft.Model.measures> mea_obj = mea_list.Where(x => x.step == Convert.ToInt32(col_name)).Select(x => x).ToList<Maticsoft.Model.measures>(); List <Maticsoft.Model.measures> mea_obj = mea_list.Where(x => x.step == step + 1).Select(x => x).ToList <Maticsoft.Model.measures>(); //string rr = dt2.Select("", aa.ColumnName + " DESC")[0][aa.ColumnName].ToString(); object max = dt2.Compute(string.Format("Max([{0}])", aa.ColumnName), "true"); // MessageBox.Show(max.ToString()); object min = dt2.Compute(string.Format("Min([{0}])", aa.ColumnName), "true"); double sta = Convert.ToDouble(mea_obj[0].standardv); double va_x1 = Convert.ToDouble(max is DBNull ? 0 : max); double va_x2 = Convert.ToDouble(min is DBNull ? 0 : min); double va_x = va_x1 - sta > sta - va_x2 ? va_x1 : va_x2; double va_s = sta - va_x; double tu = sta + Convert.ToDouble(mea_obj[0].up); double ti = sta - Convert.ToDouble(mea_obj[0].down); double v_m = (tu + ti) / 2; double sgm = Math.Abs(sta - va_x); double v_t = tu - ti; double cpk = (v_t - 2 * sgm) / (6 * va_s); Console.WriteLine(string.Format("max == {0} --- min {1}----- {2}::{3}", max, min, mea_obj[0].up, mea_obj[0].down)); Console.WriteLine(Environment.NewLine); Console.WriteLine(string.Format("cpk == {0}", cpk)); all_cpk += " " + aa.ColumnName + "= " + cpk; //cpk_dic.Add(aa.ColumnName, cpk); cpk_dic.Add(step + 1, cpk); } string op = "\t" + get_okpara(); //MessageBox.Show("all_cpk" + all_cpk + " op" + op); label_result.Invoke(new Action(() => { label_result.Text = string.Format("all_cpk" + all_cpk + " op" + op); })); if (all == true) { dataGridView1.Invoke(new Action(() => { #region 添加一行总结 DataTable temp_table = dataGridView1.DataSource as DataTable; int last_row = temp_table.Rows.Count; if (temp_table.Rows[last_row - 1]["零件号"].ToString() == "结果与CPK") { return; } DataRow temp_dr = temp_table.NewRow(); temp_dr["零件号"] = "结果与CPK"; foreach (KeyValuePair <int, double> par in cpk_dic) { // string key_name = par.Key.Replace("s", "步骤"); // string key_name = par.Key; temp_dr[par.Key + 1] = par.Value.ToString("0.00"); } temp_dr["结果"] = op.Replace("\t", ""); temp_table.Rows.Add(temp_dr); dataGridView1.Refresh(); jisuan_f = true; })); } else { } dgv.Invoke(new Action(() => { #region 添加一行总结 DataTable temp_table = dgv.DataSource as DataTable; int last_row = temp_table.Rows.Count; if (last_row >= 1) { if (temp_table.Rows[last_row - 1]["零件号"].ToString() == "结果与CPK") { return; } DataRow temp_dr = temp_table.NewRow(); temp_dr["零件号"] = "结果与CPK"; foreach (KeyValuePair <int, double> par in cpk_dic) { // string key_name = par.Key.Replace("s", "步骤"); temp_dr[par.Key + 1] = par.Value.ToString("0.00"); } temp_dr["结果"] = op.Replace("\t", ""); temp_table.Rows.Add(temp_dr); dgv.Refresh(); } })); #endregion }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mdf_bt_Click(object sender, EventArgs e) { //for (int i=0; i<dgv.Rows.Count;i++) { //bomname_tb.Text = dgv.Rows[0].Cells["tool"].Value.ToString(); //gdno_tb.Text = dgv.Rows[0].Cells["testlocal"].Value.ToString(); //scbh_tb.Text = dgv.Rows[0].Cells["bzz"].Value.ToString(); //sandsm_tb.Text = dgv.Rows[0].Cells["sgc"].Value.ToString(); //tm_tb.Text = dgv.Rows[0].Cells["xgc"].Value.ToString(); //cicun_tb.Text = dgv.Rows[0].Cells["cicun"].Value.ToString(); #region 判断条件 if (gdno_tb.Text == "") { MessageBox.Show("请填写位置"); return; } if (scbh_tb.Text == "") { MessageBox.Show("请填写标准值"); return; } if (sandsm_tb.Text == "") { MessageBox.Show("请填上公差"); return; } if (tm_tb.Text == "") { MessageBox.Show("请填下公差"); return; } if (cicun_tb.Text == "") { MessageBox.Show("请填写尺寸"); return; } if (comboBox_devs.Text == "") { MessageBox.Show("请选择工具"); return; } #endregion int step_index = dgv.CurrentCell.RowIndex; int XH = Convert.ToInt32(dgv.Rows[step_index].Cells["id"].Value); //String TO = bomname_tb.Text; string PO = gdno_tb.Text; string ST = scbh_tb.Text; string SG = sandsm_tb.Text; string XG = tm_tb.Text; string CI = cicun_tb.Text; // string LJH = textbox_ljh.Text; Maticsoft.BLL.measures use = new Maticsoft.BLL.measures(); Maticsoft.Model.measures us = new measures() { id = XH, Tools = 1.ToString(), position = PO, standardv = ST, up = SG, down = XG, CC = CI, componentId = Convert.ToInt32(this.LjHao), step = Convert.ToInt32(dgv.Rows[step_index].Cells["step"].Value), //devicetype = this.td_lists[comboBox_devs.SelectedIndex].devicetype devicetype = port_list[comboBox_devs.SelectedIndex].devicetype, portid = port_list[comboBox_devs.SelectedIndex].id, }; use.Update(us); // } MessageBox.Show("修改成功"); //Ctrol.Text = ""; //bomname_tb.Text = ""; gdno_tb.Text = ""; scbh_tb.Text = ""; sandsm_tb.Text = ""; tm_tb.Text = ""; cicun_tb.Text = ""; textbox_ljh.Text = ""; Maticsoft.BLL.measures use1 = new Maticsoft.BLL.measures(); string aa = string.Format("componentId = '{0}'ORDER BY step", LjHao); DataSet ds = use1.GetListByPage3(aa, "", 0, 100); dgv.DataSource = ds.Tables[0]; foreach (DataGridViewRow row in dgv.Rows) { row.Cells["step"].Value = row.Index + 1; } // 选中下一行 dgv.ClearSelection(); step_index += 1; int last_line = dgv.Rows.Count; if (step_index >= last_line - 1) { step_index = last_line - 1; } dgv.Rows[step_index].Selected = true; dgv.Rows[step_index].Cells[0].Selected = true; dgv.CurrentCell = dgv.Rows[step_index].Cells["step"]; }
/// <summary> /// /// 新建规矩 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void new_bt_Click(object sender, EventArgs e) { try { #region 判断条件 if (gdno_tb.Text == "") { MessageBox.Show("请填写位置"); return; } if (scbh_tb.Text == "") { MessageBox.Show("请填写标准值"); return; } if (sandsm_tb.Text == "") { MessageBox.Show("请填上公差"); return; } if (tm_tb.Text == "") { MessageBox.Show("请填下公差"); return; } if (cicun_tb.Text == "") { MessageBox.Show("请填写尺寸"); return; } if (comboBox_devs.Text == "") { MessageBox.Show("请选择工具"); return; } else { int index = comboBox_devs.SelectedIndex; } #endregion int max_step = dgv.Rows.Count; Maticsoft.BLL.measures use = new Maticsoft.BLL.measures(); Maticsoft.Model.measures us = new measures() { // step=Convert.ToInt32( bz.Text), // S Tools = bomname_tb.Text, position = gdno_tb.Text, standardv = scbh_tb.Text, up = sandsm_tb.Text, down = tm_tb.Text, CC = cicun_tb.Text, componentId = Convert.ToInt32(this.LjHao), devicetype = port_list[comboBox_devs.SelectedIndex].devicetype, portid = port_list[comboBox_devs.SelectedIndex].id, step = max_step + 1, Tools = comboBox_devs.Text, }; // MessageBox.Show(this.comboBox_devs.SelectedIndex.ToString()); use.Add(us); MessageBox.Show("已经提交保存"); gdno_tb.Text = ""; scbh_tb.Text = ""; sandsm_tb.Text = ""; tm_tb.Text = ""; cicun_tb.Text = ""; this.initdgv(); } catch (Exception err) { Console.WriteLine(err.Message); } }