Ejemplo n.º 1
0
		/// <summary>
		/// Creates a report for the given block, fills all process reports
		/// </summary>
		/// <param name="block"></param>
		public BlockReportVm(BlockVm vm)
		{
			_parent = vm;
			UOW = new Dal.SoheilEdmContext();
			TaskDataService = new DataServices.TaskDataService(UOW);
			ProcessReportDataService = new DataServices.ProcessReportDataService(UOW);
			entity = new DataServices.BlockDataService(UOW).GetSingle(vm.Id);

			ReloadReports();
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Creates a ViewModel for the given ProcessReport with given row and column
		/// </summary>
		/// <param name="model">if null, it automatically assign unreported process space</param>
		public ProcessReportVm(Model.ProcessReport model, Dal.SoheilEdmContext uow)
		{
			Model = model;
			Message = new EmbeddedException();
			try
			{
				ActivityName = model.Process.StateStationActivity.Activity.Name;
				ProductName = model.Process.StateStationActivity.StateStation.State.FPC.Product.Name;
				ProductColor = model.Process.StateStationActivity.StateStation.State.FPC.Product.Color;
			}
			catch { }

			//uow
			UOW = uow;
			_processReportDataService = new DataServices.ProcessReportDataService(UOW);
			_taskReportDataService = new DataServices.TaskReportDataService(UOW);

			//properties
			//Model.ProducedG1 = Model.OperatorProcessReports.Sum(x => x.OperatorProducedG1);//??? can be different than sum
			ProducedG1 = Model.ProducedG1;
			Timing = new TimingSet(this);
			Timing.Saved += () => Save();
			Timing.DurationChanged += v => Model.DurationSeconds = v;
			Timing.StartChanged += v => Model.StartDateTime = v;
			Timing.EndChanged += v => Model.EndDateTime = v;
			Timing.TargetPointChanged += tp =>
			{
				TargetPointForOperator = Model.OperatorProcessReports.Any() ?
					string.Format("{0:F2}", (float)tp / Model.OperatorProcessReports.Count) :
					"---";
				Model.ProcessReportTargetPoint = tp;
				updateEmptyCount(tp: tp);
			};
			TargetPointForOperator = Model.OperatorProcessReports.Any() ?
				string.Format("{0:F2}", (float)Model.ProcessReportTargetPoint / Model.OperatorProcessReports.Count) :
				"---";
			//reports
			OperatorReports = new OperatorReportCollection(this);
			DefectionReports = new DefectionReportCollection(this);
			DefectionCount = (int)Model.DefectionReports.Sum(x => x.CountEquivalence);
			StoppageReports = new StoppageReportCollection(this);
			StoppageCount = (int)Model.StoppageReports.Sum(x => x.CountEquivalence);

			IsUserDrag = false;
			_isInInitializingPhase = false;
			initializeCommands();
		}