B2013-078 – Add code to automatically separate the RevDate from the RevNumber and put the information in the proper config fields

This commit is contained in:
John Jenko 2013-04-04 13:54:53 +00:00
parent 381fa7361a
commit 89dd2f72b0

View File

@ -48,7 +48,8 @@ namespace VEPROMS
// Therefore we need to build a revison number string with a revdate appended to it but only // Therefore we need to build a revison number string with a revdate appended to it but only
// if either the DoRevDate or the RevDateWithForwardSlash is true. otherwise we should use // if either the DoRevDate or the RevDateWithForwardSlash is true. otherwise we should use
// only the RevNumber. // only the RevNumber.
if (txbRevDate.Text == "" || if (RevDate == "" ||
(RevNum.Contains("\\") || RevNum.Contains("/")) ||
(!MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash && (!MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash &&
!MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate)) !MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate))
return RevNum; return RevNum;
@ -282,6 +283,22 @@ namespace VEPROMS
RevNum = pc.Print_Rev; RevNum = pc.Print_Rev;
RevDate = pc.Print_RevDate; //== null || pc.Print_RevDate=="" ? DateTime.Today : Convert.ToDateTime(pc.Print_RevDate); RevDate = pc.Print_RevDate; //== null || pc.Print_RevDate=="" ? DateTime.Today : Convert.ToDateTime(pc.Print_RevDate);
ReviewDate = pc.Print_ReviewDate; // == null ? DateTime.Today : Convert.ToDateTime(pc.Print_ReviewDate); ReviewDate = pc.Print_ReviewDate; // == null ? DateTime.Today : Convert.ToDateTime(pc.Print_ReviewDate);
//Now check the format flags to determine if/how the Rev string should be parsed.
// This will covert the old way (16-bit) of setting a RevDate (appending it to the RevNumber)
// to the new way saving the RevNumber and RevDate in there own config fields
if ((_MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate && RevNum.Contains("/"))
|| (_MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash && RevNum.Contains("\\")))
{
int indx = RevNum.IndexOf(_MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash ? '\\' : '/');
pc.Print_RevDate = RevDate = RevNum.Substring(indx + 1);
pc.Print_Rev = RevNum = RevNum.Substring(0, indx);
// save the RevNumber and RevDate to the procedure's config.
using (Item itm = Item.Get(MyProcedure.ItemID))
{
itm.MyContent.Config = MyProcedure.MyConfig.ToString();
itm.Save();
}
}
} }
else else
{ {
@ -309,12 +326,18 @@ namespace VEPROMS
ppTxbxChangeBarUserMsgTwo.Text = _DocVersionConfig.Print_UserCBMess2; ppTxbxChangeBarUserMsgTwo.Text = _DocVersionConfig.Print_UserCBMess2;
ppGpbxUserSpecTxt.Enabled = ppCmbxChgBarTxtType.SelectedIndex == (int)PrintChangeBarText.UserDef; ppGpbxUserSpecTxt.Enabled = ppCmbxChgBarTxtType.SelectedIndex == (int)PrintChangeBarText.UserDef;
bool hasReviewDate = _MyProcedure.ActiveFormat.PlantFormat.HasPageListToken("{REVIEWDATE}"); bool hasReviewDate = _MyProcedure.ActiveFormat.PlantFormat.HasPageListToken("{REVIEWDATE}");
bool usesRevDate = _MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate; bool usesRevDate = _MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate || _MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash;
if (_MyProcedure.Sections != null) if (_MyProcedure.Sections != null)
{ {
foreach (SectionInfo mysection in _MyProcedure.Sections) foreach (SectionInfo mysection in _MyProcedure.Sections)
hasReviewDate |= mysection.ActiveFormat.PlantFormat.HasPageListToken("{REVIEWDATE}"); hasReviewDate |= mysection.ActiveFormat.PlantFormat.HasPageListToken("{REVIEWDATE}");
} }
// Only the New HLP format and the MYA format use this
// South Texas does not use their new HLP format and MYA (Main Yankee) has dropped us (they closed)
// thus there is no supporting code to print a Review Date
// thus setting "hasReviewDate" to false so the Review Date entry box does not appear on the print dialog
// - jsj 4/3/2013
hasReviewDate = false; // jsj 4/3/2013
lblReviewDate.Visible = txbReviewDate.Visible = !_AllProcedures && hasReviewDate; lblReviewDate.Visible = txbReviewDate.Visible = !_AllProcedures && hasReviewDate;
lblRevDate.Visible = txbRevDate.Visible = !_AllProcedures && usesRevDate; lblRevDate.Visible = txbRevDate.Visible = !_AllProcedures && usesRevDate;
} }