diff --git a/插件库/Lskj.PubProductSysMge/FrmMain.cs b/插件库/Lskj.PubProductSysMge/FrmMain.cs index 3700505..1a80977 100644 --- a/插件库/Lskj.PubProductSysMge/FrmMain.cs +++ b/插件库/Lskj.PubProductSysMge/FrmMain.cs @@ -549,8 +549,6 @@ namespace Lskj.PubProductSysMge if (treeNode != null && !string.IsNullOrEmpty(projectId)) { DataTable dataTable = new DataTable(); - string speciesid = treeNode.Name; - //string dataSourceSql = string.Format("select * from p_productsyssettab where speciesid = '{0}' and groupname = '{1}' and ban = 0 order by orderid", speciesid, groupname); string dataSourceSql = string.Format("select * from p_productsyssettab where groupid = '{0}' and ban = 0 order by orderid", projectId); dataTable = MainImpl.GetDataTableResult(dataSourceSql); int x = 10; @@ -1133,9 +1131,6 @@ namespace Lskj.PubProductSysMge if (model.OrderId.Equals(1) && this.NameBaseControl != null)//反写名称 { this.NameBaseControl.EditText = baseControl.EditText; - //string speciesid = this.treeLeftViewEx.TreeView.SelectedNode.Name; - //string whereSql = string.Format(" and speciesno = '{0}' ", speciesid); - //this.SetMainGridView(whereSql); } if (model.SpecDbName.Equals(1) && this.SpecBaseControl != null)//反写规格 { @@ -1303,11 +1298,19 @@ namespace Lskj.PubProductSysMge WaitForm.ShowForm("正在保存数据"); try { - if (this.treeLeftViewEx.TreeView.SelectedNode.Nodes.Count > 0) + // 获取特定路径的节点名称 + TreeNode[] nodes = treeLeftViewEx.TreeView.Nodes.Find(this.speciesNoEdit.Text, true); // 搜索所有层级 + if (nodes.Length == 0|| nodes[0].Nodes.Count>0) { MessageUtil.Show("请选择根节点"); return; } + + //if (this.treeLeftViewEx.TreeView.SelectedNode.Nodes.Count > 0) + //{ + // MessageUtil.Show("请选择根节点"); + // return; + //} if (this.VerifyNull(this.pl_Top)) { string Autogrowcolumn = BaseImpl.GetResult(string.Format("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME='{0}' AND COLUMNPROPERTY(OBJECT_ID('{0}'),COLUMN_NAME,'IsIdentity')=1", this.MainModuleObj.MenuTable)) + ""; @@ -1315,7 +1318,7 @@ namespace Lskj.PubProductSysMge string primaryValue = this.GetControlValue(primaryKey); DataTable tableColumns = BaseImpl.GetTableColumns(this.MainModuleObj.MenuTable); ControlModel model = this.MainControlObj._models.FirstOrDefault(x => x.FieldName == primaryKey); - string parentValue = this.treeLeftViewEx.TreeView.SelectedNode.Name; + string parentValue = this.speciesNoEdit.Text;//this.treeLeftViewEx.TreeView.SelectedNode.Name; //string newBillNo = BaseImpl.GetDefaultValue(model.Default, parentValue); //sqlBuilder.Append(string.Format("delete from bom_BillTab where productid = '{0}'\r\n", newBillNo)); //sqlBuilder.Append(string.Format("delete from bom_BillListTab where ParentProduct = '{0}'\r\n", newBillNo)); @@ -1403,9 +1406,9 @@ namespace Lskj.PubProductSysMge } MessageUtil.Show(ResourceKeys.SaveSuccess); this.MainControlObj.ResetControlValue(); - SetDynamicControl(this.treeLeftViewEx.TreeView.SelectedNode); + SetDynamicControl(nodes[0]); string where = null; - string nodeName = this.treeLeftViewEx.TreeView.SelectedNode.Name; + string nodeName = this.speciesNoEdit.Text; //this.treeLeftViewEx.TreeView.SelectedNode.Name; if (string.IsNullOrWhiteSpace(this.ParentUnionField)) { where = string.Format(" and {0} = N'{1}'", this.treeLeftViewEx.TreeNodeKeyField, nodeName); @@ -1454,7 +1457,7 @@ namespace Lskj.PubProductSysMge string newBillNo = focusRow["productid"] + ""; string primaryKey = BaseImpl.GetBasePrimaryKey(this.Model.ModuleCode); ControlModel model = this.MainControlObj._models.FirstOrDefault(x => x.FieldName == primaryKey); - string parentValue = focusRow["speciesNo"] + "";// this.treeLeftViewEx.TreeView.SelectedNode.Name; + string parentValue = focusRow["speciesNo"] + ""; //string newBillNo = BaseImpl.GetDefaultValue(model.Default, parentValue); List keyList = new List() { "speciesno", "operatorname", "operatedate", "smartbmfa" }; StringBuilder sqlBuilder = new StringBuilder(); @@ -1545,7 +1548,7 @@ namespace Lskj.PubProductSysMge } MessageUtil.Show(ResourceKeys.SaveSuccess); string where = null; - string nodeName = focusRow["speciesNo"] + ""; //this.treeLeftViewEx.TreeView.SelectedNode.Name; + string nodeName = focusRow["speciesNo"] + ""; if (string.IsNullOrWhiteSpace(this.ParentUnionField)) { where = string.Format(" and {0} = N'{1}'", this.treeLeftViewEx.TreeNodeKeyField, nodeName); @@ -1623,15 +1626,6 @@ namespace Lskj.PubProductSysMge this.btnSave.Enabled = true; return; } - this.speciesNoEdit.Text = speciesNo; - // 获取特定路径的节点名称 - TreeNode[] nodes = treeLeftViewEx.TreeView.Nodes.Find(speciesNo, true); // 搜索所有层级 - if (nodes.Length > 0) - { - string foundNodeName = nodes[0].Text; - this.speciesNameEdit.Text = foundNodeName; - } - //获取选中行对应的方案 @@ -1659,6 +1653,10 @@ namespace Lskj.PubProductSysMge if (foundNodes.Length > 0) { //this.treeLeftViewEx.TreeView.SelectedNode = foundNodes[0]; + this.speciesNoEdit.Text = speciesNo; + string foundNodeName = foundNodes[0].Text; + this.speciesNameEdit.Text = foundNodeName; + this.SetDynamicControl(foundNodes[0]); } //中间部分控件赋值