private void but_item_Click(object sender, EventArgs e) { if (dgv_01.SelectedRows.Count > 0) { SortedList slindata = new SortedList(); slindata.Add("ca_name", dgv_01.SelectedRows[0].Cells["ca_name"].Value.ToString()); slindata.Add("id", dgv_01.SelectedRows[0].Cells["id"].Value.ToString()); slindata.Add("ca_type", Sl_type_04.GetKey(Sl_type_04.IndexOfValue(dgv_01.SelectedRows[0].Cells["ca_type"].Value.ToString())).ToString()); slindata.Add("cost_center", Sl_type_01[dgv_01.SelectedRows[0].Cells["cost_center"].Value.ToString()].ToString()); slindata.Add("customer_code", Sl_type_05_01.GetKey(Sl_type_05_01.IndexOfValue(Sl_type_05[dgv_01.SelectedRows[0].Cells["customer_code"].Value.ToString()])).ToString()); //string selectname = dgv_01.SelectedRows[0].Cells["ca_name"].Value.ToString(); //string srtid = dgv_01.SelectedRows[0].Cells["id"].Value.ToString(); //string strtype = Sl_type_04.GetKey(Sl_type_04.IndexOfValue(dgv_01.SelectedRows[0].Cells["ca_type"].Value.ToString())).ToString(); //string strcc = Sl_type_01.GetKey(Sl_type_01.IndexOfValue(dgv_01.SelectedRows[0].Cells["cost_center"].Value.ToString())).ToString(); bool Vbutton = false; HCSCM_set_manager_item hcsm = new HCSCM_set_manager_item(slindata, Vbutton); //获取一个值,指是否在Windows任务栏中显示窗体。 hcsm.ShowInTaskbar = false; hcsm.ShowDialog(); } else { MessageBox.Show("请选择一行。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void but_ok_Click(object sender, EventArgs e) { if (this.tb_name.Text.Trim() == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillname", EnumPromptMessage.warning, new string[] { "" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_customer.Text == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillcustomer", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_cost_center.Text == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillcostcenter", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_material.Text == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillmaterial", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.tb_price.Text.Trim() == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillprice", EnumPromptMessage.warning, new string[] { "处理" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_put.Text == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillput", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.tb_weight.Text.Trim() == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillweight", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.tb_stu.Text.Trim() == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillsize", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_washing.Text == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillwastype", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_sterilizer.Text == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("fillstrtype", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_complexity.Text == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("filldifficulty", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_type.Text == "") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("filltype", EnumPromptMessage.warning, new string[] { "包的" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (tb_times.Text.Trim() == "") { tb_times.Text = ""; } if (tb_minimum_set.Text.Trim() == "") { tb_minimum_set.Text = ""; } try { if (Selectid == "") { CnasRemotCall reCnasRemotCall = new CnasRemotCall(); #region 判断名字是否存在 if (order_set == "1")//判断是否是订单包 { SortedList sttemp01 = new SortedList(); sttemp01.Add(1, CnasBaseData.SystemID); sttemp01.Add(2, sl_type_03.GetKey(sl_type_03.IndexOfValue(cb_customer.Text.Trim()))); sttemp01.Add(3, "1"); DataTable getdt = reCnasRemotCall.RemotInterface.SelectData("HCS-set-base-sec050", sttemp01);//503 if (getdt != null) { DataRow[] getdt_01 = getdt.Select(); foreach (DataRow dr in getdt_01) { if (tb_name.Text.Trim().ToString() == dr["ca_name"].ToString().Trim()) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("namerepetition", EnumPromptMessage.warning, new string[] { "基本包" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } else { SortedList sttemp01 = new SortedList(); sttemp01.Add(1, CnasBaseData.SystemID); sttemp01.Add(2, sl_type_03.GetKey(sl_type_03.IndexOfValue(cb_customer.Text.Trim()))); sttemp01.Add(3, "0"); string sql = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-set-base-sec050", sttemp01); DataTable getdt = reCnasRemotCall.RemotInterface.SelectData("HCS-set-base-sec050", sttemp01);//503 if (getdt != null) { DataRow[] getdt_01 = getdt.Select(); foreach (DataRow dr in getdt_01) { if (tb_name.Text.Trim().ToString() == dr["ca_name"].ToString().Trim()) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("namerepetition", EnumPromptMessage.warning, new string[] { "基本包" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp.Add(1, tb_name.Text.Trim()); //名字 sltmp.Add(2, tb_barcode.Text.Trim()); //条码 sltmp.Add(3, tb_expiration.Text.Trim()); //保质期 sltmp.Add(4, tb_price.Text.Trim()); //价格 sltmp.Add(5, tb_remarks.Text.Trim()); //备注 sltmp.Add(6, tb_size.Text.Trim()); //大小 if (tb_times.Text.Trim() == "") { sltmp.Add(7, "NULL");//使用次数 } else { sltmp.Add(7, tb_times.Text.Trim());//使用次数 } sltmp.Add(8, tb_weight.Text.Trim()); //重量 sltmp.Add(9, cb_complexity.Text.Trim().Substring(0, 1)); //清洗难度 sltmp.Add(10, cb_type.Text.Trim().Substring(0, 1)); //包的类型 sltmp.Add(11, sl_type_04.GetKey(sl_type_04.IndexOfValue(cb_cost_center.Text.Trim()))); //成本中心 sltmp.Add(12, sl_type_03.GetKey(sl_type_03.IndexOfValue(cb_customer.Text.Trim()))); //顾客 sltmp.Add(13, sl_type_02.GetKey(sl_type_02.IndexOfValue(cb_material.Text.Trim()))); //打包材料 sltmp.Add(14, cb_put.Text.Trim().Substring(0, 1)); //摆放方式 sltmp.Add(15, sl_type_06.GetKey(sl_type_06.IndexOfValue(cb_sterilizer.Text.Trim()))); //灭菌类型 sltmp.Add(16, sl_type_01.GetKey(sl_type_01.IndexOfValue(cb_washing.Text.Trim()))); //清洗类型 if (this.rb_normal.Checked) { sltmp.Add(17, 1);//为正常包 } else if (this.rb_urgent.Checked) { sltmp.Add(17, 2);//为紧急包 } else { sltmp.Add(17, 3);//为非常紧急包 } sltmp.Add(18, CnasBaseData.SystemID); sltmp.Add(19, CnasBaseData.UserName); //创建人 if (this.cb_if.Checked) //是否为院内特殊包 { sltmp.Add(20, 1); } else { sltmp.Add(20, 0); } sltmp.Add(21, order_set); if (tb_minimum_set.Text == "") { sltmp.Add(22, "NULL"); } else { sltmp.Add(22, tb_minimum_set.Text); } if (this.cb_RFID.Checked)//是否须要RFID追溯 { sltmp.Add(23, 1); } else { sltmp.Add(23, 0); } sltmp01.Add(1, sltmp); // string strtmp = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-set-base-add001", sltmp01, null); int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-set-base-add001", sltmp01, null); if (recint > -1) { if (order_set == "1") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("addsuccessful", EnumPromptMessage.warning, new string[] { "订单包" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("addsuccessful", EnumPromptMessage.warning, new string[] { "基本包" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { MessageBox.Show("对不起,系统增加出错,请联系管理员。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } if (order_set == "0") { string sql = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-set-base-sec003", null); DataTable getdt2 = reCnasRemotCall.RemotInterface.SelectData("HCS-set-base-sec003", null);//查询基本包最后创建的信息,取id121 string strid = ""; if (getdt2 != null) { DataRow arrayDR = getdt2.Select()[0]; strid = arrayDR["id"].ToString().Trim(); SortedList slindata = new SortedList(); slindata.Add("ca_name", tb_name.Text.Trim()); slindata.Add("id", arrayDR["id"].ToString().Trim()); slindata.Add("ca_type", cb_type.Text.Trim().Substring(0, 1)); slindata.Add("cost_center", sl_type_04.GetKey(sl_type_04.IndexOfValue(cb_cost_center.Text)).ToString()); slindata.Add("customer_code", sl_type_03_01.GetKey(sl_type_03_01.IndexOfValue(cb_customer.Text)).ToString()); //string strname = tb_name.Text.Trim(); //string strtype = cb_type.Text.Trim().Substring(0, 1); //string strcc = sl_type_04.GetKey(sl_type_04.IndexOfValue(cb_cost_center.Text)).ToString(); HCSCM_set_manager_item hcsm = new HCSCM_set_manager_item(slindata, true); hcsm.ShowDialog(); this.Close(); } } else { string sql = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-set-base-sec003", null); DataTable getdt2 = reCnasRemotCall.RemotInterface.SelectData("HCS-set-base-sec003", null);//查询基本包最后创建的信息,取id121 string strid = ""; if (getdt2 != null) { DataRow arrayDR = getdt2.Select()[0]; strid = arrayDR["id"].ToString().Trim(); SortedList aa = new SortedList(); aa.Add("name", tb_name.Text.Trim()); aa.Add("id", arrayDR["id"].ToString().Trim()); aa.Add("type", cb_type.Text.Trim().Substring(0, 1)); aa.Add("customer", sl_type_03.GetKey(sl_type_03.IndexOfValue(cb_customer.Text))); aa.Add("customerid", sl_type_03_01.GetKey(sl_type_03_01.IndexOfValue(cb_customer.Text))); aa.Add("costcentername", sl_type_04.GetKey(sl_type_04.IndexOfValue(cb_cost_center.Text))); aa.Add("costcenter", cb_cost_center.Text); bool iswindows = false; HCSCM_specialset_item_add HCSR = new HCSCM_specialset_item_add(aa, iswindows); HCSR.ShowDialog(); this.Close(); } } } else { #region 判断名字是否存在 CnasRemotCall reCnasRemotCall = new CnasRemotCall(); if (this.tb_name.Text.Trim() != Strselectname) { if (order_set == "1")//判断是否是订单包 { SortedList sttemp01 = new SortedList(); sttemp01.Add(1, CnasBaseData.SystemID); sttemp01.Add(2, sl_type_03.GetKey(sl_type_03.IndexOfValue(cb_customer.Text.Trim()))); sttemp01.Add(3, "1"); DataTable getdt = reCnasRemotCall.RemotInterface.SelectData("HCS-set-base-sec050", sttemp01);//503 if (getdt != null) { DataRow[] getdt_01 = getdt.Select(); foreach (DataRow dr in getdt_01) { if (tb_name.Text.Trim().ToString() == dr["ca_name"].ToString().Trim()) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("namerepetition", EnumPromptMessage.warning, new string[] { "基本包" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } else { SortedList sttemp01 = new SortedList(); sttemp01.Add(1, CnasBaseData.SystemID); sttemp01.Add(2, sl_type_03.GetKey(sl_type_03.IndexOfValue(cb_customer.Text.Trim()))); sttemp01.Add(3, "0"); DataTable getdt = reCnasRemotCall.RemotInterface.SelectData("HCS-set-base-sec050", sttemp01);//503 if (getdt != null) { DataRow[] getdt_01 = getdt.Select(); foreach (DataRow dr in getdt_01) { if (tb_name.Text.Trim().ToString() == dr["ca_name"].ToString().Trim()) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("namerepetition", EnumPromptMessage.warning, new string[] { "基本包" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } } } #endregion SortedList sltmp = new SortedList(); SortedList sltmp01 = new SortedList(); sltmp.Add(1, tb_name.Text.Trim()); //名字 sltmp.Add(2, tb_expiration.Text.Trim()); //保质期 sltmp.Add(3, tb_price.Text.Trim()); //价格 sltmp.Add(4, tb_remarks.Text.Trim()); //备注 sltmp.Add(5, tb_size.Text.Trim()); //大小 if (tb_times.Text.Trim() == "") { sltmp.Add(6, "NULL");//使用次数 } else { sltmp.Add(6, tb_times.Text.Trim());//使用次数 } sltmp.Add(7, tb_weight.Text.Trim()); //重量 sltmp.Add(8, cb_complexity.Text.Trim().Substring(0, 1)); //清洗难度 sltmp.Add(9, cb_type.Text.Trim().Substring(0, 1)); //包的类型 sltmp.Add(10, sl_type_04.GetKey(sl_type_04.IndexOfValue(cb_cost_center.Text.Trim()))); //成本中心 sltmp.Add(11, sl_type_03.GetKey(sl_type_03.IndexOfValue(cb_customer.Text.Trim()))); //顾客 sltmp.Add(12, sl_type_02.GetKey(sl_type_02.IndexOfValue(cb_material.Text.Trim()))); //打包材料 sltmp.Add(13, cb_put.Text.Trim().Substring(0, 1)); //摆放方式 sltmp.Add(14, sl_type_06.GetKey(sl_type_06.IndexOfValue(cb_sterilizer.Text.Trim()))); //灭菌类型 sltmp.Add(15, sl_type_01.GetKey(sl_type_01.IndexOfValue(cb_washing.Text.Trim()))); //清洗类型 if (this.rb_normal.Checked) { sltmp.Add(16, 1);//为正常包 } else if (this.rb_urgent.Checked) { sltmp.Add(16, 2);//为紧急包 } else { sltmp.Add(16, 3);//为非常紧急包 } sltmp.Add(17, CnasBaseData.UserName); if (this.cb_if.Checked) { sltmp.Add(18, 1); } else { sltmp.Add(18, 0); } sltmp.Add(19, order_set); if (tb_minimum_set.Text == "") { sltmp.Add(20, "NULL"); } else { sltmp.Add(20, tb_minimum_set.Text); } if (this.cb_RFID.Checked)//是否须要RFID追溯 { sltmp.Add(21, 1); } else { sltmp.Add(21, 0); } sltmp.Add(22, Selectid); sltmp01.Add(1, sltmp); // string strtmp = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS-set-base-up001", sltmp01, null); int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS-set-base-up001", sltmp01, null); if (recint > -1) { if (order_set == "1") { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("updatesuccessful", EnumPromptMessage.warning, new string[] { "订单包" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("updatesuccessful", EnumPromptMessage.warning, new string[] { "基本包" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { MessageBox.Show("对不起,系统修改出错,请联系管理员。", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } catch (Exception ex) { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("unknowerror", EnumPromptMessage.error, new string[] { ex.Message }), "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }