Added code to support conversion to text of invalid referenced objects and invalid transitions
Added command line switch NOUPDATERO to prevent updating referenced objects Added code to support conversion to text of invalid transitions
This commit is contained in:
@@ -556,7 +556,9 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static int TranCheckCount = 0;
|
||||
public static int TranFixCount = 0;
|
||||
internal static void MyRefreshTransitions(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
|
||||
internal static TransitionInfoList TransitionsToDisconnected;
|
||||
internal static TransitionInfoList TransitionsToNonEditable;
|
||||
internal static void MyRefreshTransitions(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
|
||||
{
|
||||
//TransitionInfoList til = TransitionInfoList.GetByFromID(itemInfo.ItemID);
|
||||
//Console.WriteLine("Procedure: {0}, transitions: {1}", (itemInfo as ProcedureInfo).DisplayNumber, til.Count);
|
||||
@@ -582,6 +584,15 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
|
||||
{
|
||||
TranCheckCount++;
|
||||
if (IsTransitionToNonEditable(traninfo))
|
||||
{
|
||||
TranFixCount++;
|
||||
itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, true);
|
||||
Content content = Content.Get(itemInfo.MyContent.ContentID);
|
||||
content.FixTransitionText(traninfo, true);
|
||||
content.Save();
|
||||
return;
|
||||
}
|
||||
string oldText = itemInfo.MyContent.Text;
|
||||
itemInfo.MyContent.FixTransitionText(traninfo, itemInfo);
|
||||
string newText = itemInfo.MyContent.Text;
|
||||
@@ -595,7 +606,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void ResetROCounters()
|
||||
//private static bool IsTransitionToDisconnected(TransitionInfo ti)
|
||||
//{
|
||||
// foreach (TransitionInfo til in TransitionsToDisconnected)
|
||||
// {
|
||||
// if (ti.TransitionID == til.TransitionID)
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
//}
|
||||
private static bool IsTransitionToNonEditable(TransitionInfo ti)
|
||||
{
|
||||
foreach (TransitionInfo til in TransitionsToNonEditable)
|
||||
{
|
||||
if (ti.TransitionID == til.TransitionID)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static void ResetROCounters()
|
||||
{
|
||||
ROCheckCount = 0;
|
||||
ROFixCount = 0;
|
||||
@@ -614,6 +643,38 @@ namespace VEPROMS.CSLA.Library
|
||||
return _VolianCommentType;
|
||||
}
|
||||
}
|
||||
public void UpdateROText()
|
||||
{
|
||||
ROFstInfo rofstinfo = this.MyDocVersion.DocVersionAssociations[0].MyROFst;
|
||||
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(this.MyDocVersion);
|
||||
lookup.MyDocVersionInfo = this.MyDocVersion;
|
||||
if (this.MyContent.ContentRoUsageCount > 0)
|
||||
{
|
||||
foreach (RoUsageInfo rousage in this.MyContent.ContentRoUsages)
|
||||
{
|
||||
if (this.ActiveSection != null)
|
||||
{
|
||||
string oldText = this.MyContent.Text;
|
||||
string roval = lookup.GetTranslatedRoValue(rousage.ROID, this.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
|
||||
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
|
||||
this.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, this);
|
||||
string newText = this.MyContent.Text;
|
||||
if (newText != oldText)
|
||||
{
|
||||
Content content = Content.Get(this.MyContent.ContentID);
|
||||
if (roval == "?")
|
||||
{
|
||||
oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo);
|
||||
Annotation.MakeAnnotation(content.ContentItems[0].MyItem, VolianCommentType, "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldText)), null);
|
||||
}
|
||||
else
|
||||
content.FixContentText(rousage, roval, roch.type, rofstinfo);
|
||||
content.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
internal static void MyRefreshReferenceObjects(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, DocVersionInfo docVersionInfo)
|
||||
{
|
||||
if (itemInfo.MyContent.ContentPartCount > 0)
|
||||
@@ -642,7 +703,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (roval == "?")
|
||||
{
|
||||
oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo);
|
||||
//Annotation.MakeAnnotation(content.ContentItems[0].MyItem, VolianCommentType, "", string.Format("RO value ({0}) converted to text" + sameMsg, ItemInfo.ConvertToDisplayText(oldText)), null);
|
||||
Annotation.MakeAnnotation(content.ContentItems[0].MyItem, VolianCommentType, "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldText)), null);
|
||||
}
|
||||
else
|
||||
content.FixContentText(rousage, roval, roch.type, rofstinfo);
|
||||
@@ -5431,8 +5492,14 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
return (Procedure)(_Editable = Procedure.Get(ItemID));
|
||||
}
|
||||
public static void RefreshTransitions(ProcedureInfo tmp)
|
||||
public static void RefreshTransitions(ProcedureInfo tmp)
|
||||
{
|
||||
RefreshTransitions(tmp, null, null);
|
||||
}
|
||||
public static void RefreshTransitions(ProcedureInfo tmp, TransitionInfoList transitionToDisconnected, TransitionInfoList transitionsToNonEditable)
|
||||
{
|
||||
TransitionsToDisconnected = transitionToDisconnected;
|
||||
TransitionsToNonEditable = transitionsToNonEditable;
|
||||
TransitionLookup tranLookup = new TransitionLookup(0, tmp.ItemID, tmp.MyLookup);
|
||||
tranLookup.ApplicabilityUnit = tmp.MyDocVersion.DocVersionConfig.SelectedSlave;
|
||||
tranLookup.NewLookupNeeded += new TransitionLookupEvent(GetNewLookup);
|
||||
|
Reference in New Issue
Block a user