Exemple #1
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="job"></param>
		/// <param name="currentState">Required some of its Relations loaded</param>
		/// <param name="parentStep"></param>
		internal SmartStep(SmartJob job, State currentState, SmartStep parentStep)
		{
			_job = job;
			State = currentState;
			ParentSteps = new List<SmartStep>();
			if (parentStep != null)
				if (parentStep.State.StateType == Common.StateType.Mid)
					ParentSteps.Add(parentStep);
		}
Exemple #2
0
		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;
		}