示例#1
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;
		}
示例#2
0
文件: Task.cs 项目: T1Easyware/Soheil
     private void FixupBlock(Block previousValue)
     {
         if (previousValue != null && previousValue.Tasks.Contains(this))
         {
             previousValue.Tasks.Remove(this);
         }
 
         if (Block != null)
         {
             if (!Block.Tasks.Contains(this))
             {
                 Block.Tasks.Add(this);
             }
         }
     }