Added code to handle non-date formatted revision dates (eg: DRAFT)

Utilized newly created procedure config property ChangeBarDate
Modified method to populate ContentAuditInfoList used in summary report
Modified method to populate AnnotationAuditInfoList used in summary report
Fixed code to store correct date in History StartDate
Cleaned up code used to print procedure
Developed method to store ChangeBarDate in procedure config
Fixed code to assure rev and revdate were displayed when printing multi unit procedure
This commit is contained in:
Rich 2013-04-08 14:39:08 +00:00
parent 268df16b6e
commit 0979a8b178
2 changed files with 54 additions and 22 deletions

View File

@ -278,6 +278,7 @@ namespace VEPROMS
if (txbPDFName.Text.StartsWith("*")) if (txbPDFName.Text.StartsWith("*"))
txbPDFName.Text = txbPDFName.Text.Replace("*", this.UnitNumber); txbPDFName.Text = txbPDFName.Text.Replace("*", this.UnitNumber);
ProcedureConfig pc = _MyProcedure.MyConfig as ProcedureConfig; ProcedureConfig pc = _MyProcedure.MyConfig as ProcedureConfig;
if(SelectedSlave > 0) pc.SelectedSlave = SelectedSlave;
if (pc != null) if (pc != null)
{ {
RevNum = pc.Print_Rev; RevNum = pc.Print_Rev;
@ -446,6 +447,8 @@ namespace VEPROMS
_DocVersionConfig.SaveChangesToDocVersionConfig = true; _DocVersionConfig.SaveChangesToDocVersionConfig = true;
//_DocVersionConfig.ParentLookup = true; //_DocVersionConfig.ParentLookup = true;
ProcedureConfig pc = _MyProcedure.MyConfig as ProcedureConfig;
if (SelectedSlave > 0) pc.SelectedSlave = 0;
} }
private ProcedureInfo _MyProcedure; private ProcedureInfo _MyProcedure;
@ -533,6 +536,7 @@ namespace VEPROMS
pbPDFsStatus.Value = i; pbPDFsStatus.Value = i;
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n); // this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered. // RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50)); frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50));
frmStatus.CloseWhenDone = true; frmStatus.CloseWhenDone = true;
Application.DoEvents(); Application.DoEvents();
@ -590,6 +594,8 @@ namespace VEPROMS
ChangeBarDefinition cbd = DetermineChangeBarSettings(); ChangeBarDefinition cbd = DetermineChangeBarSettings();
if (MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave > 0) if (MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave); MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
else
MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered. // RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50)); frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50));
frmStatus.ShowDialog(); frmStatus.ShowDialog();

View File

@ -669,7 +669,10 @@ namespace VEPROMS
string sRevDate = proc.ProcedureConfig.Print_RevDate; string sRevDate = proc.ProcedureConfig.Print_RevDate;
if (sRevDate == string.Empty) if (sRevDate == string.Empty)
sRevDate = DateTime.Now.ToString("M/d/y"); sRevDate = DateTime.Now.ToString("M/d/y");
RevDate = DateTime.Parse(sRevDate); DateTime revDate;
if (!DateTime.TryParse(sRevDate, out revDate)) revDate = DateTime.Now;
RevDate = revDate;
//RevDate = DateTime.Parse(sRevDate);
//RevDate = DateTime.Parse(proc.ProcedureConfig.Print_RevDate); //RevDate = DateTime.Parse(proc.ProcedureConfig.Print_RevDate);
//if (print_revdate == string.Empty && DateTime.TryParse(RevNumber, out revdate)) //if (print_revdate == string.Empty && DateTime.TryParse(RevNumber, out revdate))
// ; // ;
@ -979,6 +982,9 @@ namespace VEPROMS
RevisionInfo ric = pi.MyDocVersion.DocVersionConfig.SelectedSlave > 0 ? RevisionInfo.GetCurrentByItemIDandUnitID(pi.ItemID,pi.MyDocVersion.DocVersionConfig.SelectedSlave) : RevisionInfo.GetCurrentByItemID(pi.ItemID); RevisionInfo ric = pi.MyDocVersion.DocVersionConfig.SelectedSlave > 0 ? RevisionInfo.GetCurrentByItemIDandUnitID(pi.ItemID,pi.MyDocVersion.DocVersionConfig.SelectedSlave) : RevisionInfo.GetCurrentByItemID(pi.ItemID);
// RevisionInfo rip = RevisionInfo.GetPreviousByItemID(pi.ItemID); // RevisionInfo rip = RevisionInfo.GetPreviousByItemID(pi.ItemID);
DateTime myDTS = pi.DTS; DateTime myDTS = pi.DTS;
string cbDTS = (pi.MyConfig as ProcedureConfig).Print_ChangeBarDate;
if ((cbDTS ?? "") != "")
myDTS = DateTime.Parse(cbDTS);
if (ric != null && ap.RevNumber == ric.RevisionNumber && ric.LatestVersion.MyStage.IsApproved == 1) if (ric != null && ap.RevNumber == ric.RevisionNumber && ric.LatestVersion.MyStage.IsApproved == 1)
{ {
myDTS = ric.MyConfig.History_StartDate; myDTS = ric.MyConfig.History_StartDate;
@ -994,22 +1000,18 @@ namespace VEPROMS
AnnotationAuditInfoList aail; AnnotationAuditInfoList aail;
if (pi.MyDocVersion.DocVersionConfig.SelectedSlave > 0) if (pi.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
{ {
cail = ContentAuditInfoList.GetSummaryByUnit(pi.ItemID, pi.ItemID, false, pi.MyDocVersion.DocVersionConfig.SelectedSlave); pi = ProcedureInfo.GetItemAndChildrenByUnit(pi.ItemID, 0, pi.MyDocVersion.DocVersionConfig.SelectedSlave);
aail = AnnotationAuditInfoList.GetChronologyByUnit(pi.ItemID, pi.ItemID, pi.MyDocVersion.DocVersionConfig.SelectedSlave); pi.ChangeBarDate = myDTS;
cail = ContentAuditInfoList.GetSummaryByUnit(pi.ItemID, pi.ItemID, false, pi.MyDocVersion.DocVersionConfig.SelectedSlave, pi.ChangeBarDate);
aail = AnnotationAuditInfoList.GetChronologyByUnit(pi.ItemID, pi.ItemID, pi.MyDocVersion.DocVersionConfig.SelectedSlave, pi.ChangeBarDate);
} }
else else
{ {
cail = ContentAuditInfoList.GetSummary(pi.ItemID, pi.ItemID, false); pi = ProcedureInfo.GetItemAndChildren(pi.ItemID);
aail = AnnotationAuditInfoList.GetChronology(pi.ItemID, pi.ItemID); pi.ChangeBarDate = myDTS;
cail = ContentAuditInfoList.GetSummary(pi.ItemID, pi.ItemID, false, pi.ChangeBarDate);
aail = AnnotationAuditInfoList.GetChronology(pi.ItemID, pi.ItemID, pi.ChangeBarDate);
} }
if (pi.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
{
pi = ProcedureInfo.GetItemAndChildrenByUnit(pi.ItemID, 0, pi.MyDocVersion.DocVersionConfig.SelectedSlave);
}
//else
//{
// pi = ProcedureInfo.GetItemAndChildren(pi.ItemID, 0);
//}
Volian.Print.Library.PDFChronologyReport myChronoRpt = new Volian.Print.Library.PDFChronologyReport(summaryPDF, pi, cail, aail); Volian.Print.Library.PDFChronologyReport myChronoRpt = new Volian.Print.Library.PDFChronologyReport(summaryPDF, pi, cail, aail);
myChronoRpt.BuildSummary(ViewPDF); myChronoRpt.BuildSummary(ViewPDF);
FileInfo pdfFile = new FileInfo(summaryPDF); FileInfo pdfFile = new FileInfo(summaryPDF);
@ -1024,7 +1026,7 @@ namespace VEPROMS
if (revision == null) if (revision == null)
{ {
RevisionConfig cfg = new RevisionConfig(); RevisionConfig cfg = new RevisionConfig();
cfg.History_StartDate = pi.DTS; cfg.History_StartDate = myDTS; // pi.DTS;
cfg.Applicability_Index = ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave; cfg.Applicability_Index = ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave;
//cfg.Save(); //cfg.Save();
revision = Revision.MakeRevision(pi.ItemID, RevType, ap.RevNumber, ap.RevDate, RevNote, cfg.ToString(), DateTime.Now, Volian.Base.Library.VlnSettings.UserID); revision = Revision.MakeRevision(pi.ItemID, RevType, ap.RevNumber, ap.RevDate, RevNote, cfg.ToString(), DateTime.Now, Volian.Base.Library.VlnSettings.UserID);
@ -1067,14 +1069,37 @@ namespace VEPROMS
// Moved to end so that Item and Content are saved at the same time // Moved to end so that Item and Content are saved at the same time
//UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, myDTS); //UpdateProcedureConfig(pi, ap.RevNumber, ap.RevDate, myDTS);
string waterMark = Stage.Get(RevStage).IsApproved > 0 ? null : Stage.Get(RevStage).Name; string waterMark = Stage.Get(RevStage).IsApproved > 0 ? null : Stage.Get(RevStage).Name;
using (ProcedureInfo myproc = ProcedureInfo.GetItemAndChildren(pi.ItemID)) //ProcedureInfo myproc = pi;
{
//frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumber, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location); //frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumber, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumAndDate, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location); //myproc.ChangeBarDate = myDTS;
frmPDFStatusForm frm = new frmPDFStatusForm(pi, ap.RevNumAndDate, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
frm.AllowAllWatermarks = true; frm.AllowAllWatermarks = true;
frm.CloseWhenDone = !ViewPDF; frm.CloseWhenDone = !ViewPDF;
frm.ShowDialog(); frm.ShowDialog();
} //if (ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
//{
// using (ProcedureInfo myproc = ProcedureInfo.GetItemAndChildrenByUnit(pi.ItemID, 0, ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave))
// {
// //frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumber, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
// myproc.ChangeBarDate = myDTS;
// frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumAndDate, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
// frm.AllowAllWatermarks = true;
// frm.CloseWhenDone = !ViewPDF;
// frm.ShowDialog();
// }
//}
//else
//{
// using (ProcedureInfo myproc = ProcedureInfo.GetItemAndChildren(pi.ItemID))
// {
// //frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumber, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
// myproc.ChangeBarDate = myDTS;
// frmPDFStatusForm frm = new frmPDFStatusForm(myproc, ap.RevNumAndDate, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location);
// frm.AllowAllWatermarks = true;
// frm.CloseWhenDone = !ViewPDF;
// frm.ShowDialog();
// }
//}
pdfFile = new FileInfo(pdfPath); pdfFile = new FileInfo(pdfPath);
fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
byte[] buf = new byte[pdfFile.Length]; byte[] buf = new byte[pdfFile.Length];
@ -1110,6 +1135,7 @@ namespace VEPROMS
pc.Print_Rev = revNumber; pc.Print_Rev = revNumber;
//AppRevDate Change //AppRevDate Change
pc.Print_RevDate = revDate.ToString("MM/dd/yyyy"); pc.Print_RevDate = revDate.ToString("MM/dd/yyyy");
pc.Print_ChangeBarDate = dts.ToString("MM/dd/yyyy HH:mm:ss");
using (Item itm = Item.Get(procedureInfo.ItemID)) using (Item itm = Item.Get(procedureInfo.ItemID))
{ {
itm.MyContent.Config = pc.ToString(); itm.MyContent.Config = pc.ToString();