From b44736041cecbd29034d2f086dd2b6b588bf7f23 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 30 Oct 2012 18:43:19 +0000 Subject: [PATCH] =?UTF-8?q?B2012-273=20=20&=20C2012-033=E2=80=93=20The=20s?= =?UTF-8?q?tep=20numbering=20is=20not=20accurate=20on=20the=20RO=20Search?= =?UTF-8?q?=20Results=20Report=20in=20that=20numbers=20are=20used=20for=20?= =?UTF-8?q?lettered=20substeps.=20C2012-031=20=E2=80=93=20On=20the=20RO=20?= =?UTF-8?q?Usage=20Report=20sorted=20by=20RO,=20a=20space=20is=20needed=20?= =?UTF-8?q?between=20the=20procedure=20number=20and=20procedure=20title,?= =?UTF-8?q?=20also=20when=20there=20are=20more=20than=20one=20result=20for?= =?UTF-8?q?=20the=20same=20procedure,=20=20the=20listing=20of=20the=20step?= =?UTF-8?q?s=20are=20not=20always=20in=20chronological=20order.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PROMS/Volian.Print.Library/PDFReport.cs | 89 +++++++++++++++++++------ 1 file changed, 67 insertions(+), 22 deletions(-) diff --git a/PROMS/Volian.Print.Library/PDFReport.cs b/PROMS/Volian.Print.Library/PDFReport.cs index 24eca394..00f24298 100644 --- a/PROMS/Volian.Print.Library/PDFReport.cs +++ b/PROMS/Volian.Print.Library/PDFReport.cs @@ -281,7 +281,10 @@ namespace Volian.Print.Library private string GetCurProcNum(string path) { 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) //{ @@ -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); lastPath = item.SearchPath ?? item.ShortPath; //AddCell(datatable, stepPath, f2, (item.IsSection ? SectColor : TextColor)); + stepPath = BuildStepTab(item); AddCell(subTable, stepPath, f2, (item.IsSection ? SectColor : TextColor)); // 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. @@ -848,14 +852,24 @@ namespace Volian.Print.Library ItemInfo pitem = item; bool hasDelim = item.ActiveFormat.PlantFormat.FormatData.TransData.StepSubstepDelimeter != null; List DelimList = null; + DelimList = new List(); if (!hasDelim) { - DelimList = new List(); SeqTabFmtList seqtabs = item.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList; foreach (SeqTabFmt seqtab in seqtabs) { 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 typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.ToString(); // 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: 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" // then reset the tab an empty string so that the type name along with the count of that type // (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 = ""; if (pitem.IsRNOPart) { if (thisTab == "") - sret = " RNO" + sret; //"RNO." + sret; + sret = "RNO." + sret; //"RNO." + sret; else { 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) { // add the Caution or Note count to the tab (ex "Caution 1", "Note 2") if (thisTab == "") - sret = ".{" + typeName + " " + pitem.Ordinal.ToString() + "}"; + sret = "{" + typeName + " " + pitem.Ordinal.ToString() + "}"; else { thisTab = thisTab.Trim(" ".ToCharArray()); - sret = "." + thisTab + " " + pitem.Ordinal.ToString() + sret; + //sret = "." + thisTab + " " + pitem.Ordinal.ToString() + sret; + sret = thisTab + " " + pitem.Ordinal.ToString() + sret; } } else @@ -904,11 +921,13 @@ namespace Volian.Print.Library if (thisTab != "") { 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 - thisTab = "{" + typeName + " " + pitem.Ordinal.ToString() + "}"; - sret = "." + thisTab + sret; + thisTab = "{" + typeName + " " + pitem.Ordinal.ToString() + "}."; + //sret = "." + thisTab + sret; + sret = thisTab + sret; } pitem = pitem.ActiveParent as ItemInfo; if (pitem == null) break; @@ -922,13 +941,14 @@ namespace Volian.Print.Library //string thisTab = stpinfo.MyTab.CleanText; //StepInfo.Get(pitem.ItemID).MyTab.CleanText; string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;//stpinfo.FormatStepData.GetPDDisplayName(); //.ToString(); if (hlsTab == null || hlsTab == "") - hlsTab = "{" + typeName + " "+ pitem.Ordinal.ToString()+"}"; + hlsTab = "{" + typeName + " "+ pitem.Ordinal.ToString()+"}."; else if (!sret.StartsWith(hlsTab.Trim(" ".ToCharArray()))) { - if (!hasDelim) + //if (!hasDelim) foreach (string rmvDelim in DelimList) hlsTab = hlsTab.Replace(rmvDelim, ""); 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; } @@ -1017,7 +1037,7 @@ namespace Volian.Print.Library document.Add(datatable); } - private void AddProcROUse(ItemInfo item, Dictionary> procRoUse) + private void AddProcROUse(ItemInfo item, SortedDictionary> procRoUse) { string dictKey = GetCurProcNum(item.SearchPath) + " " + GetCurSectionNumTitle(item); if (dictKey != null && dictKey != "") @@ -1032,11 +1052,25 @@ namespace Volian.Print.Library } } } - private void PutROusageForROID(PdfPTable curTable, Dictionary> procRoUse, float[] headerwidths) + + private void PutStepListForProcedure(PdfPTable rotable, SortedDictionary 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> procRoUse, float[] headerwidths) + { + SortedDictionary sortedStepList = new SortedDictionary(); //if (rosused.Count == 0) return; // nothing to process iTextSharp.text.Font f2 = pdf.GetFont("Arial Unicode MS", 10, 0, Color.BLACK); string lastProcKey = ""; + string lastProcNumTitle = ""; + string curProcNumTitle = ""; foreach (string procKey in procRoUse.Keys) { PdfPTable rotable = new PdfPTable(headerwidths); @@ -1044,7 +1078,16 @@ namespace Volian.Print.Library { 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(@"\u160?", " "); // replace Hard Space with normal Space PdfPCell ProcTitleCell = new PdfPCell(new Phrase(procNumTitleSect, f2)); @@ -1060,9 +1103,11 @@ namespace Volian.Print.Library stepnum = itm.MyActiveSection.DisplayNumber; else stepnum = BuildStepTab(itm);//GetStepNumberFromSearchPath(itm.SearchPath);//stepnum.Substring(itm.SearchPath.LastIndexOf(sectitle) + sectitle.Length +1); - AddCell(rotable, stepnum, f2, Color.WHITE); - AddCell(rotable, itm.DisplayText, f2, Color.WHITE); + sortedStepList.Add(stepnum, itm.DisplayText); + //AddCell(rotable, stepnum, f2, Color.WHITE); + //AddCell(rotable, itm.DisplayText, f2, Color.WHITE); } + if (sortedStepList.Count > 0) PutStepListForProcedure(rotable, sortedStepList); curTable.AddCell(rotable); } } @@ -1097,7 +1142,7 @@ namespace Volian.Print.Library private void BuildROUsageTableByRO(iTextSharp.text.Document document) { - Dictionary> procRoUse = new Dictionary>(); + SortedDictionary> procRoUse = new SortedDictionary>(); float[] headerwidths = { 20, 80 }; PdfPTable datatable = new PdfPTable(1); PdfPTable colHeader = new PdfPTable(headerwidths); @@ -1145,7 +1190,7 @@ namespace Volian.Print.Library // Chec for different ROID string curROID = item.FoundROID; - if (curROID != lastROID) + if (lastROID == "" || curROID.Substring(0,12) != lastROID.Substring(0,12)) { if (lastROID != "" && procRoUse.Count > 0) {