private static void AddDataFromJobDB(JobDB jobDB, JobPlan jobFromMazak) { var jobFromDb = jobDB.LoadJob(jobFromMazak.UniqueStr); if (jobFromDb == null) { return; } jobFromMazak.RouteStartingTimeUTC = jobFromDb.RouteStartingTimeUTC; jobFromMazak.RouteEndingTimeUTC = jobFromDb.RouteEndingTimeUTC; jobFromMazak.ScheduleId = jobFromDb.ScheduleId; jobFromMazak.AddInspections(jobFromDb.GetInspections()); jobFromMazak.HoldEntireJob = jobFromDb.HoldEntireJob; foreach (var b in jobFromDb.ScheduledBookingIds) { jobFromMazak.ScheduledBookingIds.Add(b); } for (int proc = 1; proc <= jobFromMazak.NumProcesses; proc++) { for (int path = 1; path <= jobFromMazak.GetNumPaths(proc); path++) { if (proc > jobFromDb.NumProcesses || path > jobFromDb.GetNumPaths(proc)) { continue; } jobFromMazak.SetSimulatedStartingTimeUTC(proc, path, jobFromDb.GetSimulatedStartingTimeUTC(proc, path)); jobFromMazak.SetSimulatedAverageFlowTime(proc, path, jobFromDb.GetSimulatedAverageFlowTime(proc, path)); jobFromMazak.SetSimulatedProduction(proc, path, jobFromDb.GetSimulatedProduction(proc, path)); jobFromMazak.SetExpectedLoadTime(proc, path, jobFromDb.GetExpectedLoadTime(proc, path)); jobFromMazak.SetExpectedUnloadTime(proc, path, jobFromDb.GetExpectedUnloadTime(proc, path)); jobFromMazak.SetInputQueue(proc, path, jobFromDb.GetInputQueue(proc, path)); jobFromMazak.SetOutputQueue(proc, path, jobFromDb.GetOutputQueue(proc, path)); var mazakStops = jobFromMazak.GetMachiningStop(proc, path).ToList(); var dbStops = jobFromDb.GetMachiningStop(proc, path).ToList(); for (int i = 0; i < Math.Min(mazakStops.Count, dbStops.Count); i++) { mazakStops[i].StationGroup = dbStops[i].StationGroup; mazakStops[i].ExpectedCycleTime = dbStops[i].ExpectedCycleTime; } } } }
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 }