B2019-072: Include psi in outside transition text

This commit is contained in:
Kathy Ruffing 2019-05-14 14:06:34 +00:00
parent 7a2966e75d
commit b7633a1f08
4 changed files with 63 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -600,6 +600,7 @@ namespace VEPROMS.CSLA.Library
public ItemInfo _RangeItem;
public bool _UsedRangeAncestor;
private string _Token;
public string _UnitProcSetString;
public bool SectNumWithStepNum;
private int _SectionNumberLength = 0;
public int SectionNumberLength
@ -847,6 +848,7 @@ namespace VEPROMS.CSLA.Library
tb._TranType = tranType;
tb._ToItem = toItem;
tb._RangeItem = rangeItem;
tb._UnitProcSetString = tb._FormatData.TransData.TransTypeList[tranType].UnitProcSetString;
return tb;
}
private static string BuildString(TransitionBuilder tb)
@ -938,9 +940,54 @@ namespace VEPROMS.CSLA.Library
unitnum = unitnum.Replace("-", @"\u8209?");
retstr = unitnum.Replace("#", retstr);
}
// B2019-072: use si & psi as a prefix to the transition
string outsideprefix = null;
if (tb._ToItem.MyDocVersion != tb._FromItem.MyDocVersion) // doc versions not equal means it is an outside transition
{
if (tb._FromItem.ActiveFormat.PlantFormat.FormatData.PrintData.OutSideTransSetName) // must have format flag to include prefix
{
bool foundnull = false;
if (tb._UnitProcSetString != null && tb._UnitProcSetString != "") // must have a string on transition to use as format
{
// get the type/token strings from the format so that can grab si or psi info. An example format
// as used by AEP is: UnitProcSetString ="{PSI:UNITCOM}-{SI:SETNAME}-{PSI:SETID}-"
string findMatch = "{.*?}";
MatchCollection ms = Regex.Matches(tb._UnitProcSetString,findMatch);
string txt = tb._UnitProcSetString;
FolderConfig fc = tb._ToItem.MyDocVersion.MyFolder.FolderConfig as FolderConfig;
ProcedureConfig pc = new ProcedureConfig(tb._ToItem.MyProcedure.MyContent.Config);
// Use a dictionary to get all of the tokens from the format string, then
// go through all dictionary entries to make the replacements.
Dictionary<string, string> repStr = new Dictionary<string, string>();
foreach (Match mtch in ms)
{
int offset = mtch.Index;
string str = tb._UnitProcSetString.Substring(mtch.Index, mtch.Length);
int indxcn = str.IndexOf(":");
string pt1 = str.Substring(1, indxcn - 1);
string pt2 = str.Substring(indxcn+1, str.Length - 2 - indxcn);
string add = null;
if (pt1.StartsWith("SI")) // SI fields go to the folder specific information
add = fc.GetValue(pt1, pt2);
else
add = pc.GetValue(pt1, pt2);
if (add == null || add == "") foundnull = true; // don't do prefix if any of the fields are null.
else repStr.Add(str, add);
}
if (!foundnull)
{
outsideprefix = tb._UnitProcSetString;
foreach (string key in repStr.Keys)
outsideprefix = outsideprefix.Replace(key, repStr[key]);
outsideprefix = outsideprefix.Replace("-", @"\u8209?"); // use unicode for dashes
}
}
}
}
// LATER: Format Flag TruncateProcNmAfter1stSpace (dropped plants)
// LATER: Format Flag HardSpTranProcNumb (active plants)
tb.AppendPrefix();
if (outsideprefix != null) retstr = outsideprefix + retstr;
if (tb._FormatData.TransData.HardSpTranProcNumb) retstr = retstr.Replace(" ", @"\u160?");
tb.ReplaceToken(retstr);
return (retstr != null && retstr != "");

View File

@ -1050,6 +1050,14 @@ namespace VEPROMS.CSLA.Library
return LazyLoad(ref _UnitNumber, "@UnitNumber");
}
}
private LazyLoad<bool> _OutSideTransSetName; //B2019-072: For AEP, use PSI & SI for outside transition text
public bool OutSideTransSetName
{
get
{
return LazyLoad(ref _OutSideTransSetName, "@OutSideTransSetName");
}
}
private LazyLoad<bool> _SpecialCaseCalvert;
public bool SpecialCaseCalvert
{
@ -6667,6 +6675,14 @@ namespace VEPROMS.CSLA.Library
return LazyLoad(ref _TransMenu, "@TransMenu");
}
}
private LazyLoad<string> _UnitProcSetString; //B2019-072: For AEP, use PSI & SI for outside transition text
public string UnitProcSetString // this is format of string to preface transition with
{
get
{
return LazyLoad(ref _UnitProcSetString, "@UnitProcSetString");
}
}
public override string GetPDDisplayName()
{ return string.Format("[{0}] - Type {1}", Index, Type); }
public override string GetPDCategory()