/* * * 从 xml 数据中 读取一个已经存在的工作组(N个工作流的组合) * * */ private void LoadXml() { personList = new List <hyPerson>();// 创建工作流列表 xmlDoc = new XmlDocument(); xmlDoc.Load("hyPerson.xml"); //加载xml文件 xroot = xmlDoc.SelectSingleNode("persongroup"); XmlNodeList xnl1 = xroot.ChildNodes; foreach (XmlNode xn1 in xnl1) {// Person // 每一个工作流,都包含关联一个工艺 // 每个工艺中,都包含了13个station(炉子,水槽)的参数.station para hyPerson Person = new hyPerson(); XmlElement xe1 = (XmlElement)xn1; Person.id = Convert.ToInt32(xe1.ChildNodes.Item(0).InnerText); // id Person.name = xe1.ChildNodes.Item(1).InnerText; // 姓名 Person.job_number = xe1.ChildNodes.Item(2).InnerText; // 工号 Person.position = xe1.ChildNodes.Item(3).InnerText; // 岗位 Person.password = Encript.Decode(xe1.ChildNodes.Item(4).InnerText); // 密码//加密 person_id_max_assigned = Math.Max(Person.id, person_id_max_assigned); personList.Add(Person); } }
/* * * 从 xml 数据中 读取一个已经存在的工作组(N个工作流的组合) * * */ private void LoadXml() { processList = new List <hyProcess>();// 创建工作流列表 xmlDoc = new XmlDocument(); xmlDoc.Load("hyProcess.xml"); //加载xml文件 xroot = xmlDoc.SelectSingleNode("processgroup"); XmlNodeList xnl1 = xroot.ChildNodes; foreach (XmlNode xn1 in xnl1) {// process // 每一个工作流,都包含关联一个工艺 // 每个工艺中,都包含了13个station(炉子,水槽)的参数.station para hyProcess process = new hyProcess(); XmlElement xe1 = (XmlElement)xn1; process.process_id = Convert.ToInt32(xe1.GetAttribute("process_id")); // 工艺ID process.process_name = xe1.GetAttribute("process_name"); // 工艺名称 process_id_max_assigned = Math.Max(process_id_max_assigned, process.process_id); // 已经分配的最大process_id XmlNodeList xnl2 = xe1.ChildNodes; int index = 0; foreach (XmlNode xn2 in xnl2) {//staion XmlElement xe2 = (XmlElement)xn2; index = Convert.ToInt32(xe2.GetAttribute("station_id")); process.stationParaList[index].workingTemp = Convert.ToInt32(Encript.Decode(xe2.ChildNodes.Item(0).InnerText)); // 工作温度// 加密 process.stationParaList[index].workingTime = Convert.ToInt32(Encript.Decode(xe2.ChildNodes.Item(1).InnerText)); // 工作时间// 加密 process.stationParaList[index].formula = Encript.Decode(xe2.ChildNodes.Item(2).InnerText); // 配方// 加密 } processList.Add(process); } }
/* * * 从 xml 数据中 读取一个已经存在的工作组(N个工作流的组合) * * */ private void LoadXml(string dfname) { xmlName = dfname; xmlDoc = new XmlDocument(); xmlDoc.Load(xmlName); //加载xml文件 xroot = xmlDoc.SelectSingleNode("workgroup"); XmlNodeList xnl1 = xroot.ChildNodes; XmlElement xre = (XmlElement)xroot; string strTime = xre.GetAttribute("created"); string[] strTime2 = strTime.Split('/'); createdTime = new DateTime(Convert.ToInt32(strTime2[0]), Convert.ToInt32(strTime2[1]), Convert.ToInt32(strTime2[2]), Convert.ToInt32(strTime2[3]), Convert.ToInt32(strTime2[4]), 0);//Convert.ToInt32();// 表格创建时间 foreach (XmlNode xn1 in xnl1) {// workflow // 每一个工作流,都包含关联一个工艺 // 每个工艺中,都包含了13个station(炉子,水槽)的参数.station para hyWorkFlow workFlow = currWorkFlow = new hyWorkFlow(this); XmlElement xe1 = (XmlElement)xn1; workFlow.workflow_id = Convert.ToInt32(xe1.GetAttribute("workflow_id")); // 工作流ID workFlow.process_id = Convert.ToInt32(xe1.GetAttribute("process_id")); // 工艺ID workFlow.person_id = Convert.ToInt32(xe1.GetAttribute("person_id")); // 创建人员ID workFlow.carrier_id = Convert.ToInt32(xe1.GetAttribute("carrier_id")); // 夹具ID workFlow.carrier.name = Convert.ToInt32(xe1.GetAttribute("carrier_name")); // 夹具名称 workFlow.carrier.status = (hyCarrier.STATUS)(Convert.ToInt32(xe1.GetAttribute("carrier_status"))); // 夹具状态 workFlow.carrier.pos = Convert.ToInt32(xe1.GetAttribute("carrier_pos")); // 夹具pos max_workflow_id_assigned = Math.Max(max_workflow_id_assigned, workFlow.workflow_id); // 已经分配的最大ID XmlNodeList xnl2 = xe1.ChildNodes; int index = 0; foreach (XmlNode xn2 in xnl2) {//staion XmlElement xe2 = (XmlElement)xn2; index = Convert.ToInt32(xe2.GetAttribute("station_id")); workFlow.process.stationParaList[index].workingTime = Convert.ToInt32(Encript.Decode(xe2.ChildNodes.Item(0).InnerText)); // 工作时间 加密 workFlow.process.stationParaList[index].workingTemp = Convert.ToInt32(Encript.Decode(xe2.ChildNodes.Item(1).InnerText)); // 工作温度 加密 workFlow.process.stationParaList[index].startingTime = Convert.ToInt32(Encript.Decode(xe2.ChildNodes.Item(2).InnerText)); // 起始时间 加密 workFlow.process.stationParaList[index].endingTime = Convert.ToInt32(Encript.Decode(xe2.ChildNodes.Item(3).InnerText)); //结束时间 加密 // if (workFlow.process.stationParaList[index].workingTemp > 0) { switch (index) { case 0: GenericOp.temperature1_1 = (workFlow.process.stationParaList[index].workingTemp); break; case 2: GenericOp.temperature2_1 = (workFlow.process.stationParaList[index].workingTemp); break; case 3: GenericOp.temperature4 = (workFlow.process.stationParaList[index].workingTemp); break; case 4: GenericOp.temperature5 = (workFlow.process.stationParaList[index].workingTemp); break; case 5: GenericOp.temperature6 = (workFlow.process.stationParaList[index].workingTemp); break; case 6: GenericOp.temperature7 = (workFlow.process.stationParaList[index].workingTemp); break; case 9: GenericOp.temperature3_1 = (workFlow.process.stationParaList[index].workingTemp); break; case 10: GenericOp.temperature11 = (workFlow.process.stationParaList[index].workingTemp); break; case 11: GenericOp.temperature12 = (workFlow.process.stationParaList[index].workingTemp); break; default: break; } } if (workFlow.process.stationParaList[index].workingTime != 0) { this.max_station_endingTime[index] = workFlow.process.stationParaList[index].endingTime; // 更新每一行的总结束时间 workFlow.max_workflow_endingtime = workFlow.process.stationParaList[index].endingTime; // 更新总结束时间 } } SerialTemp.commState = SerialTemp.COMM_STATE.IDLE; Thread.Sleep(100); SerialTemp.commState = SerialTemp.COMM_STATE.IDLE; Thread.Sleep(100); SerialTemp.commState = SerialTemp.COMM_STATE.IDLE; Thread.Sleep(100); SerialTemp.commState = SerialTemp.COMM_STATE.IDLE; if ((workFlow.carrier.pos >= hyWorkFlow.POS_FIRST_STATION) && (workFlow.carrier_pos <= hyWorkFlow.POS_LAST_STATION)) { // 从 POS_LOAD 到 POS_LAST_STATION 都是有endingTime的。 workFlow.carrier.endingTime = workFlow.process.stationParaList[workFlow.carrier.pos].endingTime; // 更新carrier结束时间 } if (workFlow.carrier.pos == hyWorkFlow.POS_LOAD) { workFlow.carrier.endingTime = workFlow.process.stationParaList[hyWorkFlow.POS_FIRST_STATION].startingTime; } workFlowList.Add(workFlow); } UpdateChangeOverTime(); // 更新 换型过度时间 }