private int ComparePath(Mozart.SeePlan.DataModel.Transition a, Mozart.SeePlan.DataModel.Transition b) { if (object.ReferenceEquals(a, b)) { return(0); } PrpPath x = (PrpPath)a; PrpPath y = (PrpPath)b; int cmp = x.Type.CompareTo(y.Type); if (cmp == 0) { LcdStep xStep = x.Step as LcdStep; LcdStep yStep = y.Step as LcdStep; cmp = this.ComparePrevSteps(xStep, yStep); } return(cmp); }
private void LinkRoute(Process proc, Dictionary <string, LcdStep> steps, Dictionary <string, PrpInfo> prps) { List <PrpPath> list = new List <PrpPath>(); LcdStep from; LcdStep to; foreach (PrpInfo prp in prps.Values) { from = FindStep(proc, steps, prps, prp.StepId, true); foreach (PrpInfo.PrpTo pto in prp.ToList) { if (pto.StepID == "-" || string.IsNullOrEmpty(pto.StepID)) { continue; } to = FindStep(proc, steps, prps, pto.StepID, false); if (to != null) { if (from == null) { Logger.MonitorInfo(string.Format("{0} -> {1} : ({0}) not found", prp.StepId, to.StepID)); steps[prp.StepId] = to; break; } //recursive case check if (to.NextStep != null && to.NextStep == from) { Logger.MonitorInfo(string.Format("recursive prp info at {0}", from.StepID)); continue; } if (from != to) { PrpPath path = new PrpPath(from, to, pto.Type, pto.Rate); //Logger.MonitorInfo(string.Format("{0} -> {1}", from.StepID, to.StepID)); list.Add(path); } } else { if (from == null) { Logger.MonitorInfo(string.Format("{0} -> {1} : not found", prp.StepId, pto.StepID)); } if (to == null) { Logger.MonitorInfo(string.Format("{0} -> {1} : ({1}) not found", prp.StepId, pto.StepID)); } } } } List <LcdStep> startingSteps = FindFirstSteps(proc, steps); AddSteps(proc, startingSteps); InitRoute(proc, steps); if (proc.FirstStep == null) { Logger.Warn(proc.ProcessID + ": First Step is NULL "); } }