Esempio n. 1
0
		/// <summary>
		/// Creates an instance of this view model with given parameteres
		/// </summary>
		/// <param name="parent">parent FpcWindowVm instance</param>
		/// <param name="container">(sub)item in fpc state in which this vm desires to go</param>
		/// <param name="containment">toolbox item that contains the data which is being dragged onto the state</param>
		public DropIndicatorVm(FpcWindowVm parent, TreeItemVm container, IToolboxData containment)
			: base(parent)
		{
			Container = container;
			Containment = containment;
			IsDropIndicator = true;
		}
		/// <summary>
		/// Creates a new instance of StateStationActivityMachineVm with given model and parent window
		/// </summary>
		/// <param name="parentWindowVm"></param>
		/// <param name="model">Can't be null</param>
		public StateStationActivityMachineVm(FpcWindowVm parentWindowVm, Model.StateStationActivityMachine model)
			: base(parentWindowVm)
		{
			TreeLevel = 3;
			Model = model;
			IsFixed = model.SelectedMachines.Any();
		}
Esempio n. 3
0
		/// <summary>
		/// Creates a new instance of StateStationVm with given model and parent window
		/// </summary>
		/// <param name="parentWindowVm"></param>
		/// <param name="model">Can't be null</param>
		public StateStationVm(FpcWindowVm parentWindowVm, Model.StateStation model)
			: base(parentWindowVm)
		{
			TreeLevel = 1;
			Model = model;
			IsFixed = model.Blocks.Any();
			ContentsList.CollectionChanged += ContentsList_CollectionChanged;
		}
		/// <summary>
		/// Creates a new instance of StateStationActivityVm with given model and parent window
		/// </summary>
		/// <param name="parentWindowVm"></param>
		/// <param name="model">Can't be null</param>
		public StateStationActivityVm(FpcWindowVm parentWindowVm, Model.StateStationActivity model)
			: base(parentWindowVm)
		{
			TreeLevel = 2;
			Model = model;
			IsFixed = model.Processes.Any();
			ContentsList.CollectionChanged += ContentsList_CollectionChanged;
		}
Esempio n. 5
0
		/// <summary>
		/// Create a temporary state just for drag and drop
		/// </summary>
		/// <param name="x"></param>
		/// <param name="y"></param>
		/// <param name="parentWindowVm"></param>
		/// <returns></returns>
		public static StateVm CreateTemp(double x, double y, FpcWindowVm parentWindowVm)
		{
			var vm = new StateVm
			{
				InitializingPhase = true,
				ParentWindowVm = parentWindowVm,
				Width = 1,
				Height = 1,
				Location = new Vector(x, y),
				//since model is null, StateType will be Temp
			};
			return vm;
		}
Esempio n. 6
0
		/// <summary>
		/// Initializes this vm (sets parent)
		/// </summary>
		/// <param name="parentWindowVm"></param>
		public TreeItemVm(FpcWindowVm parentWindowVm)
		{
			Parent = parentWindowVm;
		}
Esempio n. 7
0
		/// <summary>
		/// Adds the specified station to this State
		/// </summary>
		/// <param name="fpc"></param>
		/// <param name="station"></param>
		public void AddNewStateStation(FpcWindowVm fpc, StationVm station)
		{
			//if no station is already there and no name or code is set, set them to station's
			if (!ContentsList.Any(x => !x.IsDropIndicator) && State.Name == "*" && State.Code == "*")
			{
				State.Name = station.Name;
				State.Code = station.Code;
			}

			//create model for StateStation
			var ss = new Soheil.Model.StateStation
			{
				State = this.State.Model,
				Station = station.Model,
			};

			//create vm for StateStation and add it
			ContentsList.Add(new StateStationVm(fpc, ss)
			{
				Container = this,
				Containment = station,
				IsExpanded = true,
			});
		}
Esempio n. 8
0
		public ToolboxItemVm(FpcWindowVm parentWindowVm)
		{
			_parentWindowVm = parentWindowVm;
		}
Esempio n. 9
0
		public FpcWindow()
		{
			InitializeComponent();
			VM = new FpcWindowVm();
		}
Esempio n. 10
0
		/// <summary>
		/// Creates an instance of StateVm from the given model
		/// </summary>
		/// <param name="model">Must be full of data</param>
		/// <param name="parentWindowVm">parent window vm</param>
		/// <param name="isPlaced">a value that indicates whether this state is officially a part of its fpc</param>
		public StateVm(Model.State model, FpcWindowVm parentWindowVm, bool isPlaced = true)
		{
			InitializingPhase = true;
			ParentWindowVm = parentWindowVm;
			IsPlaced = isPlaced;
			if (isPlaced) { IsFixed = model.StateStations.Any(ss => ss.Blocks.Any()); }

			initCommands();

			//fetch from db and update state basics
			Model = model;
			Name = Model.Name;
			Code = Model.Code;
			if (StateType == Common.StateType.Mid || StateType == Common.StateType.Rework)
				if (Model.OnProductRework != null)
					ProductRework = ParentWindowVm.ProductReworks.FirstOrDefault(x => x.Id == Model.OnProductRework.Id);
			Location = new Vector(model.X, model.Y);


			//fetch from db and update state config
			Config = new StateConfigVm(this);
			foreach (var ss in Model.StateStations)
			{
				var stateStation = new StateStationVm(ParentWindowVm, ss)
				{
					Container = Config,
					Containment = new StationVm(ss.Station),
				};
				foreach (var ssa in ss.StateStationActivities)
				{
					var stateStationActivity = new StateStationActivityVm(ParentWindowVm, ssa)
					{
						Container = stateStation,
						ManHour = ssa.ManHour,
						CycleTime = ssa.CycleTime,
						IsMany = ssa.IsMany,
						Containment = new ActivityVm(ssa.Activity, null),
						//CreatedDate
						//ModifiedBy
						//ModifiedDate
						//Status
					};
					foreach (var ssam in ssa.StateStationActivityMachines)
					{
						stateStationActivity.ContentsList.Add(new StateStationActivityMachineVm(ParentWindowVm, ssam)
						{
							Container = stateStationActivity,
							Containment = new MachineVm(ssam.Machine, null),
							IsDefault = ssam.IsFixed,
						});
					}
					stateStation.ContentsList.Add(stateStationActivity);
				}
				Config.ContentsList.Add(stateStation);
			}
		}
Esempio n. 11
0
		/// <summary>
		/// Adds the specified activity to this StateStation
		/// </summary>
		/// <param name="fpc"></param>
		/// <param name="activity"></param>
		public void AddNewStateStationActivity(FpcWindowVm fpc, ActivityVm activity)
		{
			//create model for StateStationActivity
			var ssa = new Soheil.Model.StateStationActivity
			{
				StateStation = this.Model,
				Activity = activity.Model,
				ManHour = 1,
				CycleTime = 60,
			};

			//create vm for StateStationActivity and add it
			ContentsList.Add(new StateStationActivityVm(fpc, ssa)
			{
				Container = this,
				Containment = activity,
				IsExpanded = true,
			});
		}
Esempio n. 12
0
		/// <summary>
		/// Adds the specified machine to this StateStationActivity
		/// </summary>
		/// <param name="fpc"></param>
		/// <param name="machine"></param>
		public void AddNewStateStationActivityMachine(FpcWindowVm fpc, MachineVm machine)
		{
			//create model for StateStationActivityMachine
			var ssam = new Soheil.Model.StateStationActivityMachine
			{
				StateStationActivity = this.Model,
				Machine = /*machine.Model???*/ Parent.fpcDataService.machineFamilyDataService.GetMachine__(machine.Id),
				IsFixed = true,
			};

			//create vm for StateStationActivityMachine and add it
			ContentsList.Add(new StateStationActivityMachineVm(fpc, ssam)
			{
				Container = this,
				Containment = machine,
				IsExpanded = true,
			});
		}