Exemplo n.º 1
0
     private void FixupJob(Job previousValue)
     {
         if (previousValue != null && previousValue.Blocks.Contains(this))
         {
             previousValue.Blocks.Remove(this);
         }
 
         if (Job != null)
         {
             if (!Job.Blocks.Contains(this))
             {
                 Job.Blocks.Add(this);
             }
         }
     }
Exemplo n.º 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;
		}