Handle transitions to Dummy Steps (Created when errors are found during migration.)

Added ErrorLog output for invalid transitions when printing.
Invalid transitions include transitions from generic steps (Applicable to All) with a destination step which is not applicable to all.  Invalid transitions also include transitions from steps with one applicability to destination step with different applicability.
Valid transitions include generic to generic or between steps with the same applicabilty, or from a specific applicability to a generic step.
This commit is contained in:
Rich 2013-11-15 14:09:45 +00:00
parent 99792ab13e
commit 925f18d7fb
2 changed files with 11 additions and 4 deletions

View File

@ -4541,6 +4541,12 @@ namespace VEPROMS.CSLA.Library
public static ProcedureInfo GetNewLookup(object sender, TransitionLookupEventArgs args)
{
ProcedureInfo tmp = DataPortal.Fetch<ProcedureInfo>(new ItemAndChildrenByUnitCriteria(args.ProcID, 0, args.UnitID));
if (tmp.MyDocVersion != null)
{
tmp.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitID;
(tmp.MyConfig as ProcedureConfig).SelectedSlave = args.UnitID;
ItemInfo.SetParentSectionAndDocVersion(tmp, tmp.MyDocVersion, null, tmp, tmp.MyDocVersion);
}
return tmp;
}
// Criteria to get Item and children by unit

View File

@ -71,8 +71,8 @@ namespace VEPROMS.CSLA.Library
tranLookup.AddProcLookup(myItemToID.MyProcedure.ItemID, ProcedureInfo.GetNewLookup(tranLookup, new TransitionLookupEventArgs(myItemToID.MyProcedure.ItemID, tranLookup.ApplicabilityUnit, MyItemToID.MyDocVersion, tranLookup)).MyLookup);
if (tranLookup.ContainsKey(ToID))
myItemToID = tranLookup[ToID];
//else
// Console.WriteLine("Transition May Not Be Correct at Location");
else
_MyLog.WarnFormat("Invalid Unit Transition: from,to '{0}','{1}'", MyContent.ContentItems[0].ShortPath, myItemToID.ShortPath);
}
ItemInfo myItemRangeID = MyItemRangeID;
if (tranLookup.ContainsKey(RangeID))
@ -85,8 +85,9 @@ namespace VEPROMS.CSLA.Library
tranLookup.AddProcLookup(MyItemRangeID.MyProcedure.ItemID, ProcedureInfo.GetNewLookup(tranLookup, new TransitionLookupEventArgs(MyItemRangeID.MyProcedure.ItemID, tranLookup.ApplicabilityUnit, MyItemRangeID.MyDocVersion, tranLookup)).MyLookup);
if (tranLookup.ContainsKey(RangeID))
myItemRangeID = tranLookup[RangeID];
//else
// Console.WriteLine("Transition May Not Be Correct at Location");
else
if (myItemRangeID.ItemID != myItemToID.ItemID)
_MyLog.WarnFormat("Invalid Unit Range Transition: from,to '{0}','{1}'", MyContent.ContentItems[0].ShortPath, myItemRangeID.ShortPath);
//Console.WriteLine("Format = {0}", item.ActiveFormat);
//Console.WriteLine("item = {0}", item.ItemID);
//Console.WriteLine("TranType = {0}", TranType);