示例#1
0
        private static void WritePart(XmlTextWriter xml, JobPlan j)
        {
            xml.WriteStartElement("Part");
            xml.WriteAttributeString("action", "ADD");
            xml.WriteAttributeString("name", j.UniqueStr);
            xml.WriteAttributeString("revision", "SAIL");

            xml.WriteElementString("Comment", j.PartName);

            xml.WriteStartElement("Processes");

            for (int proc = 1; proc <= j.NumProcesses; proc++)
            {
                xml.WriteStartElement("Process");
                xml.WriteAttributeString("number", proc.ToString());

                xml.WriteElementString("Name", j.UniqueStr + "-" + proc.ToString());
                xml.WriteElementString("Comment", j.UniqueStr);

                xml.WriteStartElement("Operations");
                xml.WriteStartElement("Operation");
                xml.WriteAttributeString("number", "1");
                xml.WriteAttributeString("clampQuantity", j.PartsPerPallet(proc, 1).ToString());
                xml.WriteAttributeString("unclampMultiplier", j.PartsPerPallet(proc, 1).ToString());
                xml.WriteEndElement(); //Operation
                xml.WriteEndElement(); //Operations

                xml.WriteStartElement("Jobs");

                xml.WriteStartElement("Job");
                xml.WriteAttributeString("number", "1");
                xml.WriteAttributeString("type", "WSS");
                xml.WriteElementString("FeasibleDevice", Join(",", j.LoadStations(proc, 1)));
                xml.WriteEndElement(); //Job

                int jobNum = 2;

                foreach (var stop in j.GetMachiningStop(proc, 1))
                {
                    xml.WriteStartElement("Job");
                    xml.WriteAttributeString("number", jobNum.ToString());
                    xml.WriteAttributeString("type", "MCW");
                    xml.WriteElementString("FeasibleDevice", Join(",", stop.Stations));
                    xml.WriteElementString("NCProgram", stop.ProgramName);
                    xml.WriteEndElement(); //Job

                    jobNum += 1;
                }

                xml.WriteStartElement("Job");
                xml.WriteAttributeString("number", jobNum.ToString());
                xml.WriteAttributeString("type", "WSS");
                xml.WriteElementString("FeasibleDevice", Join(",", j.UnloadStations(proc, 1)));
                xml.WriteEndElement(); //Job

                xml.WriteEndElement(); //Jobs
                xml.WriteEndElement(); //Process
            }

            xml.WriteEndElement(); //Processes
            xml.WriteEndElement(); //Part
        }