private void FixupProcess(Process previousValue) { if (previousValue != null && previousValue.SelectedMachines.Contains(this)) { previousValue.SelectedMachines.Remove(this); } if (Process != null) { if (!Process.SelectedMachines.Contains(this)) { Process.SelectedMachines.Add(this); } } }
private void FixupProcess(Process previousValue) { if (previousValue != null && previousValue.ProcessOperators.Contains(this)) { previousValue.ProcessOperators.Remove(this); } if (Process != null) { if (!Process.ProcessOperators.Contains(this)) { Process.ProcessOperators.Add(this); } } }
internal Block MakeBlockFrom(SmartStep step, Job jobModel) { if (!step.HasStateStation) throw new Exception("FPC is incomplete. Some states do not have stations.");//??? int durationSeconds = (int)Math.Ceiling(step.BestStateStation.StateStationActivities .Max(x => x.CycleTime * Quantity)); var block = new Block { Job = jobModel, Code = jobModel.Code + step.State.Code, StartDateTime = step.ActualReleaseTime, StateStation = step.BestStateStation, DurationSeconds = durationSeconds, EndDateTime = step.ActualReleaseTime.AddSeconds(durationSeconds), BlockTargetPoint = jobModel.Quantity }; var task = new Task { Block = block, DurationSeconds = block.DurationSeconds, EndDateTime = block.EndDateTime, StartDateTime = block.StartDateTime, TaskTargetPoint = block.BlockTargetPoint, }; foreach (var ssa in step.BestStateStation.StateStationActivities) { var process = new Process { Task = task, Code = block.Code + ssa.Activity.Code, TargetCount = Quantity, StateStationActivity = ssa, }; foreach (var ssam in ssa.StateStationActivityMachines) { if (ssam.IsFixed) process.SelectedMachines.Add(new SelectedMachine { Process = process, StateStationActivityMachine = ssam }); } task.Processes.Add(process); } return block; }