private static string AddBOM_Module(TreeNode bomtypenode, string addbom_type) { DialogResult dr; dr = MessageBox.Show(string.Format("你确定要{0}吗?", addbom_type), "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.No) { return(""); } AddBomForm frm = new AddBomForm(addbom_type, "添加"); frm.ShowDialog(); if (string.IsNullOrEmpty(Constant.Add_Bom)) { UIHelper.DesktopNotify(true, string.Format("取消{0}", addbom_type)); return(""); } foreach (TreeNode node in bomtypenode.Nodes) { if (node.Text == Constant.Add_Bom) { UIHelper.DesktopNotify(false, string.Format("{0}已存在,不要重复添加!", addbom_type)); return(""); } } if (addbom_type == "添加产品容量") { TreeNode assemblynode = new TreeNode(); assemblynode.Tag = "产品容量"; assemblynode.Text = Constant.Add_Bom; assemblynode.ImageIndex = 3; bomtypenode.Nodes.Add(assemblynode); TreeNode ElasticNode = new TreeNode(); ElasticNode.Text = Constant.Elastic_dt.TableName; ElasticNode.ImageIndex = 1; assemblynode.Nodes.Add(ElasticNode); return(Constant.Add_Bom); } TreeNode bomnode = new TreeNode(); bomnode.Text = Constant.Add_Bom; bomnode.ImageIndex = 4; bomtypenode.Nodes.Add(bomnode); return(Constant.Add_Bom); }
private static string ModityBOM_Module(TabControl tabcontrol, TreeNode bomnode, string Modifybom_type) { DialogResult dr; dr = MessageBox.Show(string.Format("你确定要{0}:{1}?", Modifybom_type, bomnode.Text), "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.No) { return(""); } foreach (TabPage tp in tabcontrol.TabPages) { if (tp.Text == bomnode.Parent.Text + "-" + bomnode.Text) { MessageBox.Show(string.Format("请选关闭当前打开的BOM选项界面:{0}", tp.Text)); return(""); } } AddBomForm frm = new AddBomForm(Modifybom_type, "修改"); frm.ShowDialog(); if (string.IsNullOrEmpty(Constant.Add_Bom)) { UIHelper.DesktopNotify(true, string.Format("取消{0}", Modifybom_type)); return(""); } foreach (TreeNode node in bomnode.Parent.Nodes) { if (node.Text == Constant.Add_Bom) { UIHelper.DesktopNotify(false, string.Format("{0}已存在,请重新检查!", Modifybom_type)); return(""); } } bomnode.Text = Constant.Add_Bom; return(Constant.Add_Bom); }
private static string AddBOM_Module(TreeNode bomtypenode, string addbom_type, string ID) { DialogResult dr; dr = MessageBox.Show(string.Format("你确定要{0}吗?", addbom_type), "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.No) { return(""); } AddBomForm frm = new AddBomForm(addbom_type, "添加"); frm.ShowDialog(); if (string.IsNullOrEmpty(Constant.Add_Bom)) { UIHelper.DesktopNotify(true, string.Format("取消{0}", addbom_type)); return(""); } //遍历该产品下的节点,是否已经存在; foreach (TreeNode node in bomtypenode.Nodes) { if (node.Text == Constant.Add_Bom) { UIHelper.DesktopNotify(false, string.Format("{0}已存在,不要重复添加!", addbom_type)); return(""); } } TreeNode BOMnode = new TreeNode(); BOMnode.Text = Constant.Add_Bom; //传感器物料号的值 BOMnode.Name = Constant.Maingage_dt.TableName; BOMnode.Tag = ID; //唯一识别号 BOMnode.ImageIndex = 4; bomtypenode.Nodes.Add(BOMnode); CreateBomNode(BOMnode); return(Constant.Add_Bom); }