//��ӹ��� 0Ϊ��һ����-1������Ϊ���һ�� //����ڵ������λ�ã� //ԭ �£�index�� // 0 //0------- // 1 //1------- // 2 //2------- // 3 or -1 //-------- /// <summary> /// ��ӹ���ʱ���� /// </summary> /// <param name="index">0Ϊ��һ����-1������Ϊ���һ��</param> /// <param name="type">��ͨ���� �ȵ� ����չ</param> /// <param name="ProcessXML">����xml</param> /// <param name="TemplateXML">ģ��xml</param> public static void AddGongxu(int index,E_GongyiNodeType e_GongyiNodeType,string ProcessXML,string TemplateXML) { try { XmlDocument docForm = new XmlDocument(); XmlDocument docTo = new XmlDocument(); docForm.Load(TemplateXML); docTo.Load(ProcessXML); XmlNode rootNodel = docTo.SelectSingleNode("//Gongyi"); string path = "/Template/Gongxu[@Type='" + e_GongyiNodeType.ToString() + "']"; XmlNode fromNode = docForm.SelectSingleNode(path); XmlNode newNode = docTo.ImportNode(fromNode, true); string guid = Guid.NewGuid().ToString(); ((XmlElement)newNode).SetAttribute("GUID", guid); //�õ��������� XmlNodeList nodes = rootNodel.SelectNodes("Gongxu"); int count = nodes.Count; if (index < 0 || index > count - 1) { //������� rootNodel.AppendChild(newNode); } else { //����indexǰ rootNodel.InsertBefore(newNode, nodes[index]); } UpdateGongxuhao(docTo); docTo.Save(ProcessXML); } catch (System.Exception ex) { NXFun.MessageBox(ex.Message); } }
//添加工序节点的函数 //插入节点坐标的位置: //原 新(index) // 0 //0------- // 1 //1------- // 2 //2------- // 3 or -1 //-------- /// <summary> /// 添加工序节点 /// </summary> /// <param name="index">插入节点坐标的位置</param> private void AddGongxuFun(int index,E_GongyiNodeType e_GongxuTye) { XML3DPPM.AddGongxu(index, e_GongxuTye, XmlFile, TemplateXML); }