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; } } } }