B2012-273 & C2012-033– The step numbering is not accurate on the RO Search Results Report in that numbers are used for lettered substeps.

C2012-031 – On the RO Usage Report sorted by RO, a space is needed between the procedure number and procedure title, also when there are more than one result for the same procedure,  the listing of the steps are not always in chronological order.
This commit is contained in:
John Jenko 2012-10-30 18:43:19 +00:00
parent a55f097391
commit b44736041c

View File

@ -281,7 +281,10 @@ namespace Volian.Print.Library
private string GetCurProcNum(string path) private string GetCurProcNum(string path)
{ {
string[] NewPath = path.Split("\x7".ToCharArray()); string[] NewPath = path.Split("\x7".ToCharArray());
return NewPath[1]; string pnumtitle = NewPath[1];
pnumtitle = pnumtitle.Replace('\x11', ' ');
//return NewPath[1].Replace("\x11:"," ");
return pnumtitle;
} }
//private string GetCurSectionNumTitle(string path) //private string GetCurSectionNumTitle(string path)
//{ //{
@ -580,6 +583,7 @@ namespace Volian.Print.Library
string stepPath = AddGroup(subTable, item.SearchPath ?? item.ShortPath, lastPath, f2, true, new Color(0xC0, 0xFF, 0xC0), true); string stepPath = AddGroup(subTable, item.SearchPath ?? item.ShortPath, lastPath, f2, true, new Color(0xC0, 0xFF, 0xC0), true);
lastPath = item.SearchPath ?? item.ShortPath; lastPath = item.SearchPath ?? item.ShortPath;
//AddCell(datatable, stepPath, f2, (item.IsSection ? SectColor : TextColor)); //AddCell(datatable, stepPath, f2, (item.IsSection ? SectColor : TextColor));
stepPath = BuildStepTab(item);
AddCell(subTable, stepPath, f2, (item.IsSection ? SectColor : TextColor)); AddCell(subTable, stepPath, f2, (item.IsSection ? SectColor : TextColor));
// This was for the old 16-bit style of table - jsj 7/7/2011 // This was for the old 16-bit style of table - jsj 7/7/2011
//if (item.DisplayText.Contains("|")) // Need a better way to determine if it is a table. //if (item.DisplayText.Contains("|")) // Need a better way to determine if it is a table.
@ -848,14 +852,24 @@ namespace Volian.Print.Library
ItemInfo pitem = item; ItemInfo pitem = item;
bool hasDelim = item.ActiveFormat.PlantFormat.FormatData.TransData.StepSubstepDelimeter != null; bool hasDelim = item.ActiveFormat.PlantFormat.FormatData.TransData.StepSubstepDelimeter != null;
List<string> DelimList = null; List<string> DelimList = null;
DelimList = new List<string>();
if (!hasDelim) if (!hasDelim)
{ {
DelimList = new List<string>();
SeqTabFmtList seqtabs = item.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList; SeqTabFmtList seqtabs = item.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList;
foreach (SeqTabFmt seqtab in seqtabs) foreach (SeqTabFmt seqtab in seqtabs)
{ {
string delim = seqtab.PrintTabFormat.Replace("{seq}", ""); string delim = seqtab.PrintTabFormat.Replace("{seq}", "");
DelimList.Add(delim.Trim()); if (!DelimList.Contains(delim))
DelimList.Add(delim.Trim());
}
}
else
{
string stpdelms = item.ActiveFormat.PlantFormat.FormatData.TransData.StepSubstepDelimeter;
foreach (char c in stpdelms)
{
if (!DelimList.Contains(c.ToString()))
DelimList.Add(c.ToString());
} }
} }
@ -865,7 +879,8 @@ namespace Volian.Print.Library
string thisTab = stpinfo.MyTab.CleanText; //StepInfo.Get(pitem.ItemID).MyTab.CleanText; string thisTab = stpinfo.MyTab.CleanText; //StepInfo.Get(pitem.ItemID).MyTab.CleanText;
string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.ToString(); string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.ToString();
// remove delimiters of '.' and ')' in tab. // remove delimiters of '.' and ')' in tab.
if (thisTab != null && !hasDelim) //if (thisTab != null && !hasDelim)
if (thisTab != null)
{ {
// get list of delimiters to remove from the format: // get list of delimiters to remove from the format:
foreach (string rmvDelim in DelimList) thisTab = thisTab.Replace(rmvDelim, ""); foreach (string rmvDelim in DelimList) thisTab = thisTab.Replace(rmvDelim, "");
@ -876,27 +891,29 @@ namespace Volian.Print.Library
// the tab is an AND or OR type and is the letter "o" // the tab is an AND or OR type and is the letter "o"
// then reset the tab an empty string so that the type name along with the count of that type // then reset the tab an empty string so that the type name along with the count of that type
// (ex. "AND 2", "OR 3") // (ex. "AND 2", "OR 3")
if (thisTab == null || (thisTab != "" && (!(char.IsLetterOrDigit(thisTab[0])) || ((pitem.IsAnd || pitem.IsOr) && thisTab.Contains("o"))))) if (thisTab == null || (thisTab != "" && (!(char.IsLetterOrDigit(thisTab[0])) || ((pitem.IsAnd || pitem.IsOr || pitem.IsCaution || pitem.IsNote) && thisTab.Contains("o")))))
thisTab = ""; thisTab = "";
if (pitem.IsRNOPart) if (pitem.IsRNOPart)
{ {
if (thisTab == "") if (thisTab == "")
sret = " RNO" + sret; //"RNO." + sret; sret = "RNO." + sret; //"RNO." + sret;
else else
{ {
thisTab = thisTab.Trim(" ".ToCharArray()); thisTab = thisTab.Trim(" ".ToCharArray());
sret = " RNO." + thisTab + sret; //"RNO." + thisTab + sret; if (!thisTab.EndsWith(".") && !thisTab.EndsWith(")")) thisTab = thisTab + ".";
sret = "RNO." + thisTab + sret; //"RNO." + thisTab + sret;
} }
} }
else if (pitem.IsCaution || pitem.IsNote) else if (pitem.IsCaution || pitem.IsNote)
{ {
// add the Caution or Note count to the tab (ex "Caution 1", "Note 2") // add the Caution or Note count to the tab (ex "Caution 1", "Note 2")
if (thisTab == "") if (thisTab == "")
sret = ".{" + typeName + " " + pitem.Ordinal.ToString() + "}"; sret = "{" + typeName + " " + pitem.Ordinal.ToString() + "}";
else else
{ {
thisTab = thisTab.Trim(" ".ToCharArray()); thisTab = thisTab.Trim(" ".ToCharArray());
sret = "." + thisTab + " " + pitem.Ordinal.ToString() + sret; //sret = "." + thisTab + " " + pitem.Ordinal.ToString() + sret;
sret = thisTab + " " + pitem.Ordinal.ToString() + sret;
} }
} }
else else
@ -904,11 +921,13 @@ namespace Volian.Print.Library
if (thisTab != "") if (thisTab != "")
{ {
thisTab = thisTab.Trim(" ".ToCharArray()); thisTab = thisTab.Trim(" ".ToCharArray());
if (hasDelim && !thisTab.EndsWith(".") && !thisTab.EndsWith(")")) thisTab = thisTab + "."; //if (hasDelim && !thisTab.EndsWith(".") && !thisTab.EndsWith(")")) thisTab = thisTab + ".";
if (!thisTab.EndsWith(".") && !thisTab.EndsWith(")")) thisTab = thisTab + ".";
} }
else else
thisTab = "{" + typeName + " " + pitem.Ordinal.ToString() + "}"; thisTab = "{" + typeName + " " + pitem.Ordinal.ToString() + "}.";
sret = "." + thisTab + sret; //sret = "." + thisTab + sret;
sret = thisTab + sret;
} }
pitem = pitem.ActiveParent as ItemInfo; pitem = pitem.ActiveParent as ItemInfo;
if (pitem == null) break; if (pitem == null) break;
@ -922,13 +941,14 @@ namespace Volian.Print.Library
//string thisTab = stpinfo.MyTab.CleanText; //StepInfo.Get(pitem.ItemID).MyTab.CleanText; //string thisTab = stpinfo.MyTab.CleanText; //StepInfo.Get(pitem.ItemID).MyTab.CleanText;
string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.GetPDDisplayName(); //.ToString(); string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.GetPDDisplayName(); //.ToString();
if (hlsTab == null || hlsTab == "") if (hlsTab == null || hlsTab == "")
hlsTab = "{" + typeName + " "+ pitem.Ordinal.ToString()+"}"; hlsTab = "{" + typeName + " "+ pitem.Ordinal.ToString()+"}.";
else if (!sret.StartsWith(hlsTab.Trim(" ".ToCharArray()))) else if (!sret.StartsWith(hlsTab.Trim(" ".ToCharArray())))
{ {
if (!hasDelim) //if (!hasDelim)
foreach (string rmvDelim in DelimList) hlsTab = hlsTab.Replace(rmvDelim, ""); foreach (string rmvDelim in DelimList) hlsTab = hlsTab.Replace(rmvDelim, "");
hlsTab = hlsTab.Trim(" ".ToCharArray()); hlsTab = hlsTab.Trim(" ".ToCharArray());
if (hasDelim && !hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + "."; //if (hasDelim && !hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + ".";
if (!hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + ".";
} }
sret = hlsTab + sret; sret = hlsTab + sret;
} }
@ -1017,7 +1037,7 @@ namespace Volian.Print.Library
document.Add(datatable); document.Add(datatable);
} }
private void AddProcROUse(ItemInfo item, Dictionary<string, List<ItemInfo>> procRoUse) private void AddProcROUse(ItemInfo item, SortedDictionary<string, List<ItemInfo>> procRoUse)
{ {
string dictKey = GetCurProcNum(item.SearchPath) + " " + GetCurSectionNumTitle(item); string dictKey = GetCurProcNum(item.SearchPath) + " " + GetCurSectionNumTitle(item);
if (dictKey != null && dictKey != "") if (dictKey != null && dictKey != "")
@ -1032,11 +1052,25 @@ namespace Volian.Print.Library
} }
} }
} }
private void PutROusageForROID(PdfPTable curTable, Dictionary<string, List<ItemInfo>> procRoUse, float[] headerwidths)
private void PutStepListForProcedure(PdfPTable rotable, SortedDictionary<string, string> sortedStepList)
{ {
iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK);
foreach (string stepnum in sortedStepList.Keys)
{
AddCell(rotable, stepnum, f2, Color.WHITE);
AddCell(rotable, sortedStepList[stepnum], f2, Color.WHITE);
}
sortedStepList.Clear();
}
private void PutROusageForROID(PdfPTable curTable, SortedDictionary<string, List<ItemInfo>> procRoUse, float[] headerwidths)
{
SortedDictionary<string, string> sortedStepList = new SortedDictionary<string, string>();
//if (rosused.Count == 0) return; // nothing to process //if (rosused.Count == 0) return; // nothing to process
iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK); iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK);
string lastProcKey = ""; string lastProcKey = "";
string lastProcNumTitle = "";
string curProcNumTitle = "";
foreach (string procKey in procRoUse.Keys) foreach (string procKey in procRoUse.Keys)
{ {
PdfPTable rotable = new PdfPTable(headerwidths); PdfPTable rotable = new PdfPTable(headerwidths);
@ -1044,7 +1078,16 @@ namespace Volian.Print.Library
{ {
if (procKey != lastProcKey) if (procKey != lastProcKey)
{ {
string procNumTitleSect = GetCurProcNum(itm.SearchPath) + "\r\n " + GetCurSectionNumTitle(itm); if (sortedStepList.Count > 0) PutStepListForProcedure(rotable, sortedStepList);
//string procNumTitleSect = GetCurProcNum(itm.SearchPath) + "\r\n " + GetCurSectionNumTitle(itm);
string procNumTitleSect = "";
curProcNumTitle = GetCurProcNum(itm.SearchPath);
if (lastProcNumTitle == "" || lastProcNumTitle != curProcNumTitle)
{
procNumTitleSect = curProcNumTitle + "\r\n";
lastProcNumTitle = curProcNumTitle;
}
procNumTitleSect += " " + GetCurSectionNumTitle(itm);
procNumTitleSect = procNumTitleSect.Replace(@"\u8209?", "-"); // repace unicode with dash char procNumTitleSect = procNumTitleSect.Replace(@"\u8209?", "-"); // repace unicode with dash char
procNumTitleSect = procNumTitleSect.Replace(@"\u160?", " "); // replace Hard Space with normal Space procNumTitleSect = procNumTitleSect.Replace(@"\u160?", " "); // replace Hard Space with normal Space
PdfPCell ProcTitleCell = new PdfPCell(new Phrase(procNumTitleSect, f2)); PdfPCell ProcTitleCell = new PdfPCell(new Phrase(procNumTitleSect, f2));
@ -1060,9 +1103,11 @@ namespace Volian.Print.Library
stepnum = itm.MyActiveSection.DisplayNumber; stepnum = itm.MyActiveSection.DisplayNumber;
else else
stepnum = BuildStepTab(itm);//GetStepNumberFromSearchPath(itm.SearchPath);//stepnum.Substring(itm.SearchPath.LastIndexOf(sectitle) + sectitle.Length +1); stepnum = BuildStepTab(itm);//GetStepNumberFromSearchPath(itm.SearchPath);//stepnum.Substring(itm.SearchPath.LastIndexOf(sectitle) + sectitle.Length +1);
AddCell(rotable, stepnum, f2, Color.WHITE); sortedStepList.Add(stepnum, itm.DisplayText);
AddCell(rotable, itm.DisplayText, f2, Color.WHITE); //AddCell(rotable, stepnum, f2, Color.WHITE);
//AddCell(rotable, itm.DisplayText, f2, Color.WHITE);
} }
if (sortedStepList.Count > 0) PutStepListForProcedure(rotable, sortedStepList);
curTable.AddCell(rotable); curTable.AddCell(rotable);
} }
} }
@ -1097,7 +1142,7 @@ namespace Volian.Print.Library
private void BuildROUsageTableByRO(iTextSharp.text.Document document) private void BuildROUsageTableByRO(iTextSharp.text.Document document)
{ {
Dictionary<string, List<ItemInfo>> procRoUse = new Dictionary<string, List<ItemInfo>>(); SortedDictionary<string, List<ItemInfo>> procRoUse = new SortedDictionary<string, List<ItemInfo>>();
float[] headerwidths = { 20, 80 }; float[] headerwidths = { 20, 80 };
PdfPTable datatable = new PdfPTable(1); PdfPTable datatable = new PdfPTable(1);
PdfPTable colHeader = new PdfPTable(headerwidths); PdfPTable colHeader = new PdfPTable(headerwidths);
@ -1145,7 +1190,7 @@ namespace Volian.Print.Library
// Chec for different ROID // Chec for different ROID
string curROID = item.FoundROID; string curROID = item.FoundROID;
if (curROID != lastROID) if (lastROID == "" || curROID.Substring(0,12) != lastROID.Substring(0,12))
{ {
if (lastROID != "" && procRoUse.Count > 0) if (lastROID != "" && procRoUse.Count > 0)
{ {