コード例 #1
0
ファイル: SmartStep.cs プロジェクト: T1Easyware/Soheil
		/// <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);
		}
コード例 #2
0
ファイル: Connector.cs プロジェクト: T1Easyware/Soheil
     private void FixupStartState(State previousValue)
     {
         if (previousValue != null && previousValue.OutConnectors.Contains(this))
         {
             previousValue.OutConnectors.Remove(this);
         }
 
         if (StartState != null)
         {
             if (!StartState.OutConnectors.Contains(this))
             {
                 StartState.OutConnectors.Add(this);
             }
         }
     }
コード例 #3
0
ファイル: StateStation.cs プロジェクト: T1Easyware/Soheil
     private void FixupState(State previousValue)
     {
         if (previousValue != null && previousValue.StateStations.Contains(this))
         {
             previousValue.StateStations.Remove(this);
         }
 
         if (State != null)
         {
             if (!State.StateStations.Contains(this))
             {
                 State.StateStations.Add(this);
             }
         }
     }
コード例 #4
0
ファイル: SmartJob.cs プロジェクト: T1Easyware/Soheil
		bool makeNextLayer(SmartLayer currentLayer, State veryStartState)
		{
			SmartLayer nextLayer = new SmartLayer();
			foreach (var step in currentLayer)
			{
				//Find destination states from current step's state
				var endStates = _fpcDs.GetDestinationStates(step.State.Id);
				//add them to nextLayer (after converting them to SmartSteps)
				nextLayer.AddRange(endStates.Select(state => new SmartStep(this, state, step)));
			}
			if (nextLayer.Count == 0)
			{
				if (currentLayer.Count == 1)
					if (currentLayer.Single().State.StateType == Common.StateType.Final)
					{
						Layers.Remove(currentLayer);
						return true;
					}

				if (veryStartState.OnProductRework == null
					|| veryStartState.OnProductRework.Rework == null)
				{
					throw new SoheilExceptionBase(
						string.Format("FPC {0} در مسیر تولید اصلی به مرحله نهایی ختم نمی شود", _fpcModel.Product.Name),
						ExceptionLevel.Warning, "مسیریابی خودکار FPC");
				}
				else if (veryStartState.OutConnectors.Any())
				{
					throw new SoheilExceptionBase(
						string.Format(
							"FPC {0} پس از گذر از {1} به مرحله نهایی ختم نمی شود",
							_fpcModel.Product.Name,
							veryStartState.OnProductRework.Name),
						ExceptionLevel.Warning, "مسیریابی خودکار FPC");
				}
				return true;
			}

			//Remove duplicate steps (present in nextLayer) from nextLayer
			nextLayer.RemoveDuplicateSteps();
			//Remove duplicate steps (present in nextLayer) from all previous layers
			nextLayer.RemoveDuplicateStepsFrom(Layers);
			//Add nextLayer to Layers
			Layers.Add(nextLayer);
			//preform the next layer search
			currentLayerIndex++;
			if (currentLayerIndex == LIMIT_numberOfLayers) return false;
			return makeNextLayer(nextLayer, veryStartState);
		}
コード例 #5
0
ファイル: SmartJob.cs プロジェクト: T1Easyware/Soheil
		/// <summary>
		/// 
		/// </summary>
		/// <param name="startState">Must fill OnProductRework</param>
		/// <returns></returns>
		bool buildLayers(State startState)
		{
			var currentLayer = new SmartLayer(new SmartStep(this, startState, null));
			currentLayerIndex = 0;
			return makeNextLayer(currentLayer, startState);
		}
コード例 #6
0
ファイル: Connector.cs プロジェクト: T1Easyware/Soheil
     private void FixupEndState(State previousValue)
     {
         if (previousValue != null && previousValue.InConnectors.Contains(this))
         {
             previousValue.InConnectors.Remove(this);
         }
 
         if (EndState != null)
         {
             if (!EndState.InConnectors.Contains(this))
             {
                 EndState.InConnectors.Add(this);
             }
         }
     }
コード例 #7
0
		private void addStateToList(State state, int stationId, List<State> destination)
		{
			foreach (var conn in state.OutConnectors.Where(x =>
				x.EndState.StateType == StateType.Mid &&
				x.EndState.StateStations.Any(y => y.Station.Id == stationId)))
			{
				if (destination.Any(x => x.Id == conn.EndState.Id)) continue;
				destination.Add(conn.EndState);
				addStateToList(conn.EndState, stationId, destination);
			}
		}