B2017-079, B2017-053, B2017-049, improved the speed and logic of updating ROs. The Refresh ROs logic is now merged into the Update ROs logic. Also annotations are added when ROs are updated. The Refresh ROs options were removed from the tool list.
Better feedback when updating RO values, also save list of updated ROs in text file in Documents\VEPROMS Save the date/time of the last successfully completed RO Values Update Add annotations for updated RO values, better logic in updating RO figures so they are needlessly updated, better logic in determining if an RO needs to be updated Logic to save the date/time of the last successfully completed RO Update Better logic to determine if an RO value needs updated.
This commit is contained in:
@@ -544,12 +544,26 @@ namespace VEPROMS.CSLA.Library
|
||||
data = part1 + part2 + part3 + part4 + part5;
|
||||
return data;
|
||||
}
|
||||
public string FixContentText(RoUsageInfo rousg, string value, int rotype, ROFstInfo origROFstInfo, bool saveAnnotation)
|
||||
{
|
||||
return FixContentText(rousg, value, rotype, origROFstInfo, null, "", saveAnnotation);
|
||||
}
|
||||
public string FixContentText(RoUsageInfo rousg, string value, int rotype, ROFstInfo origROFstInfo)
|
||||
{
|
||||
return FixContentText(rousg, value, rotype, origROFstInfo, null, "");
|
||||
string filenameonly = null;
|
||||
if (Text != null && Text.Length > 0)
|
||||
{
|
||||
if (ContentItems[0].MyItem.MyItemInfo.IsFigure)
|
||||
filenameonly = value.Substring(0, value.IndexOf("\n"));
|
||||
}
|
||||
return FixContentText(rousg, value, rotype, origROFstInfo, filenameonly, "", false);
|
||||
}
|
||||
// B2017-060 added roidFrmImportStep to pass in a ROID to use when rousg is null (import procedure uses this)
|
||||
public string FixContentText(RoUsageInfo rousg, string value, int rotype, ROFstInfo origROFstInfo, string fileNameOnly, string roidFrmImportStep)
|
||||
{
|
||||
return FixContentText(rousg, value, rotype, origROFstInfo, fileNameOnly, roidFrmImportStep, false);
|
||||
}
|
||||
public string FixContentText(RoUsageInfo rousg, string value, int rotype, ROFstInfo origROFstInfo, string fileNameOnly, string roidFrmImportStep, bool saveAnnotation)
|
||||
{
|
||||
string retval = null;
|
||||
if (value == "?")
|
||||
@@ -584,10 +598,20 @@ namespace VEPROMS.CSLA.Library
|
||||
myLength += m.Groups[3].Length;
|
||||
}
|
||||
string gg = Text.Substring(myIndex,myLength);
|
||||
if ((gg.Replace(@"\'b0", @"\'B0") != newvalue.Replace(@"\'b0", @"\'B0")) && ((fileNameOnly == null) || (gg != fileNameOnly)))
|
||||
if (((fileNameOnly == null) && (MakeConsistentFormat(gg) != MakeConsistentFormat(newvalue))) || ((fileNameOnly != null) && !(gg.Replace(@"\u8209?", "-").StartsWith(fileNameOnly) && newvalue.Replace(@"\u8209?", "-").StartsWith(fileNameOnly))))
|
||||
{
|
||||
retval = gg;
|
||||
Text = Text.Substring(0, myIndex) + newvalue + Text.Substring(myIndex + myLength);
|
||||
if (!saveAnnotation)
|
||||
{
|
||||
using (Item myitem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
|
||||
{
|
||||
myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060
|
||||
// B2016-225 (follow through) added more descriptive Annotation Type when RO is converted to text
|
||||
Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Verification Required"), "",
|
||||
string.Format("Referenced Object (Change in RO Values: Old value = {0}, New value = {1}) Changed", FixValue(gg), FixValue(newvalue)), null);
|
||||
}
|
||||
}
|
||||
break; // Text has been processed
|
||||
}
|
||||
}
|
||||
@@ -665,6 +689,16 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
public static string MakeConsistentFormat(string gg)
|
||||
{
|
||||
// replace degree, bullet dash, hardspace
|
||||
return ROFSTLookup.ConvertFortranFormatToScienctificNotation(gg).Replace("`", @"\'B0").Replace(@"\'b0", @"\'B0").Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ").Replace(@"\'a0", " ").Replace(@"\'A0", " ");
|
||||
}
|
||||
private string FixValue(string str)
|
||||
{
|
||||
return str.Replace(@"\u8209?", "-").Replace(@"\u160?", " "); //dash and hard space
|
||||
}
|
||||
}
|
||||
public delegate void StaticContentInfoEvent(object sender, StaticContentInfoEventArgs args);
|
||||
public class StaticContentInfoEventArgs
|
||||
@@ -894,6 +928,9 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public void FixContentText(RoUsageInfo rousg, string value, int rotype, ROFstInfo origROFstInfo, ItemInfo ii) // string newvalue)
|
||||
{
|
||||
string fileNameOnly = null;
|
||||
if (ii.IsFigure && Text != null && Text.Length > 0)
|
||||
fileNameOnly = value.Substring(0,value.IndexOf("\n")).Replace(@"\u8209?","-"); // check only the file name of the RO figure
|
||||
string newvalue = value;
|
||||
newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}");
|
||||
string findLink = @"<START\].*?\[END>";
|
||||
@@ -914,9 +951,12 @@ namespace VEPROMS.CSLA.Library
|
||||
myLength += m.Groups[3].Length;
|
||||
}
|
||||
string gg = Text.Substring(myIndex, myLength);
|
||||
if ((gg.Replace(@"\'b0", @"\'B0") != newvalue.Replace(@"\'b0", @"\'B0")))
|
||||
{
|
||||
_Text = Text.Substring(0, myIndex) + newvalue + _Text.Substring(myIndex + myLength);
|
||||
if (((fileNameOnly == null) && (Content.MakeConsistentFormat(gg) != Content.MakeConsistentFormat(newvalue))) || ((fileNameOnly != null) && !(gg.Replace(@"\u8209?", "-").StartsWith(fileNameOnly) && newvalue.Replace(@"\u8209?", "-").StartsWith(fileNameOnly))))
|
||||
{
|
||||
// Debug - jsj 5-19-2017 - left in for initial check-in
|
||||
//string gg_org = gg;
|
||||
//string newval_org = newvalue;
|
||||
_Text = Text.Substring(0, myIndex) + newvalue + _Text.Substring(myIndex + myLength);
|
||||
if (newvalue == "?")
|
||||
{
|
||||
gg = ItemInfo.ConvertToDisplayText(gg);
|
||||
@@ -932,6 +972,10 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
gg = ItemInfo.ConvertToDisplayText(gg);
|
||||
newvalue = ItemInfo.ConvertToDisplayText(newvalue);
|
||||
// Debug - jsj 5-19-2017 - left in for initial check-in
|
||||
//string xx_gg = gg_org.Replace(@"\'b0", @"\'B0").Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
|
||||
//string xx_nv = newval_org.Replace(@"\'b0", @"\'B0").Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
|
||||
//Console.WriteLine(xx_gg.CompareTo(xx_nv));
|
||||
OnStaticContentInfoChange(ii, new StaticContentInfoEventArgs(gg, newvalue, "RO"));
|
||||
break; // Text has been processed
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ using Csla.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
//using VEPROMS.Properties;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
@@ -65,6 +66,27 @@ namespace VEPROMS.CSLA.Library
|
||||
return ROFstInfoList.ROFstDiffBySize(rofstPath, rdi.RODbID, (int)fiRofst.Length);
|
||||
}
|
||||
}
|
||||
public bool ROfstLastCompleted
|
||||
{
|
||||
get
|
||||
{
|
||||
if (DocVersionAssociations == null || DocVersionAssociationCount == 0) return true; // no ROs associated this will turn off the update ROs button
|
||||
if (LastCompleted(DocVersionAssociations[0]) == string.Empty) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// return the date/time of the last time the RO Update was done and ran all the way through completion
|
||||
private string LastCompleted(DocVersionAssociation dva)
|
||||
{
|
||||
XmlDocument xd = new XmlDocument();
|
||||
if (dva.Config == null || dva.Config.Length == 0) return string.Empty;
|
||||
xd.LoadXml(dva.Config);
|
||||
XmlNode xn = xd.DocumentElement.SelectSingleNode("//ROUpdate");
|
||||
if (xn == null) return string.Empty;
|
||||
XmlAttribute att = xn.Attributes["LastCompleted"];
|
||||
if (att == null) return string.Empty;
|
||||
return att.InnerText;
|
||||
}
|
||||
#region VersionType
|
||||
public VersionTypeEnum eVersionType
|
||||
{
|
||||
@@ -233,7 +255,21 @@ namespace VEPROMS.CSLA.Library
|
||||
return AddToRoFstLookup(key, ROFstInfoList.ROFstDiffBySize(rofstPath, rdi.RODbID, (int)fiRofst.Length));
|
||||
}
|
||||
}
|
||||
|
||||
public bool ROfstLastCompleted
|
||||
{
|
||||
get
|
||||
{
|
||||
if (DocVersionAssociations == null || DocVersionAssociationCount == 0) return true; // no ROs associated this will turn off the update ROs button
|
||||
if (LastCompleted(DocVersionAssociations[0]) == string.Empty) return false; // the AssociatinoConfig does not have completed date for update ROs - this will turn on the update ROs button
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// return the date/time of the last time the RO Update was done and ran all the way through completion
|
||||
private string LastCompleted(AssociationInfo associationInfo)
|
||||
{
|
||||
AssociationConfig ac = new AssociationConfig(associationInfo);
|
||||
return ac.ROUpdate_LastCompleted;
|
||||
}
|
||||
#region SearchPaths
|
||||
public string _SearchDVPath;
|
||||
public string SearchDVPath
|
||||
|
@@ -792,8 +792,9 @@ namespace VEPROMS.CSLA.Library
|
||||
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
|
||||
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo);
|
||||
string newText = itemInfo.MyContent.Text;
|
||||
if (newText != oldText)
|
||||
if (DifferentROtext(newText,oldText))
|
||||
{
|
||||
//ShowDifference(oldText, newText); // debug - display in Visual Studio Output window
|
||||
ROFixCount++;
|
||||
Content content = Content.Get(itemInfo.MyContent.ContentID);
|
||||
if (roval == "?")
|
||||
@@ -807,13 +808,48 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
content.FixContentText(rousage, roval, roch.type, rofstinfo);
|
||||
}
|
||||
content.UserID = Volian.Base.Library.VlnSettings.UserID;
|
||||
content.DTS = DateTime.Now;
|
||||
content.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool DifferentROtext(string newText, string oldText)
|
||||
{
|
||||
string nt = newText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
|
||||
string ot = oldText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
|
||||
if (nt.Equals(ot))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
#region debug
|
||||
//private static void ShowDifference(string oldText, string newText)
|
||||
//{
|
||||
// string nt = newText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
|
||||
// string ot = oldText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
|
||||
// ShowText("OldText", ot);
|
||||
// ShowText("NewText", nt);
|
||||
//}
|
||||
//private static void ShowText(string title, string newText)
|
||||
//{
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// foreach (char c in newText)
|
||||
// {
|
||||
// if(c<' ' || c> '\x7F')
|
||||
// sb.Append(string.Format("\\x{0:X2}",((int) c)));
|
||||
// else
|
||||
// sb.Append(c);
|
||||
// }
|
||||
// Console.WriteLine("{0}='{1}'",title,sb.ToString());
|
||||
//}
|
||||
#endregion // debug
|
||||
internal static void SetParentSectionAndDocVersionPageNum(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
|
||||
{
|
||||
if (itemInfo.MyContent.ContentPartCount > 0)
|
||||
|
Reference in New Issue
Block a user