C2021-027: Procedure level PC/PC

This commit is contained in:
Kathy Ruffing 2021-05-20 14:31:59 +00:00
parent 1a543f663d
commit a203bc199b
11 changed files with 138 additions and 51 deletions

Binary file not shown.

View File

@ -670,29 +670,33 @@ namespace VEPROMS
// This is master/slave & a slave has been selected for printing (SelectedSlave > 0)
if (SelectedSlave > 0)
{
MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = SelectedSlave;
SetupForProcedure();
pbPDFsStatus.TextVisible = true;
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
pbPDFsStatus.Value = i;
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
// C2018-015 add the procedure tree path and the procedure number and title to the meta file
if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
string myPDFPath = GetMultiunitPDFPath();
_MergedPdfPath = myPDFPath; // If Slave, need its subdirectory/unit path for merging
// 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, myPDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd);//C2018-009 print PROMS version
frmStatus.CloseWhenDone = true;
Application.DoEvents();
frmStatus.CancelStop = true;
frmStatus.ShowDialog();
locpdfname = frmStatus.PdfFile;
if (frmStatus.CancelPrinting) break;
AddToMergeList(myProc, locpdfname);
bool includeProc = MyProcedure.ApplInclude(SelectedSlave); // C2021-027: Procedure level PC/PC
if (includeProc)
{
MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = SelectedSlave;
SetupForProcedure();
pbPDFsStatus.TextVisible = true;
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
pbPDFsStatus.Value = i;
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
// C2018-015 add the procedure tree path and the procedure number and title to the meta file
if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
string myPDFPath = GetMultiunitPDFPath();
_MergedPdfPath = myPDFPath; // If Slave, need its subdirectory/unit path for merging
// 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, myPDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd);//C2018-009 print PROMS version
frmStatus.CloseWhenDone = true;
Application.DoEvents();
frmStatus.CancelStop = true;
frmStatus.ShowDialog();
locpdfname = frmStatus.PdfFile;
if (frmStatus.CancelPrinting) break;
AddToMergeList(myProc, locpdfname);
}
}
// This is a master/slave for printing of all slaves (SelectedSave == 0)
else if (SelectedSlave == 0)

View File

@ -74,8 +74,12 @@ namespace VEPROMS
SetupComboBoxes();
foreach (ProcedureInfo pi in myDocVersion.Procedures)
{
pi.MyDocVersion.DocVersionConfig.SelectedSlave = ApplicabilityIndex;
_MyApproval.AddProcedure(pi);
bool includeProc = pi.ApplInclude(ApplicabilityIndex); // C2021-027: Procedure level PC/PC
if (includeProc)
{
pi.MyDocVersion.DocVersionConfig.SelectedSlave = ApplicabilityIndex;
_MyApproval.AddProcedure(pi);
}
}
SetupMyApproval();
// C2018-008 redesign of user interface
@ -188,22 +192,26 @@ namespace VEPROMS
dpl.Clear();
foreach (ProcedureInfo pi in _MyDocVersion.Procedures)
{
OwnerInfo oi = OwnerInfo.GetByItemID(pi.ItemID, CheckOutType.Procedure);
pi.MyDocVersion.DocVersionConfig.SelectedSlave = _MyDocVersion.DocVersionConfig.SelectedSlave;
if (clbMore.Items.Contains(pi.DisplayNumber))
bool includeProc = pi.ApplInclude(ApplicabilityIndex); // C2021-027: Procedure level PC/PC
if (includeProc)
{
if (!dpl.Contains(pi.DisplayNumber)) dpl.Add(pi.DisplayNumber); //C2020-036 add to duplicate proc number list
continue;
OwnerInfo oi = OwnerInfo.GetByItemID(pi.ItemID, CheckOutType.Procedure);
pi.MyDocVersion.DocVersionConfig.SelectedSlave = _MyDocVersion.DocVersionConfig.SelectedSlave;
if (clbMore.Items.Contains(pi.DisplayNumber))
{
if (!dpl.Contains(pi.DisplayNumber)) dpl.Add(pi.DisplayNumber); //C2020-036 add to duplicate proc number list
continue;
}
// B2018-083: check for null MySessionInfo.
if (oi != null && MySessionInfo != null && oi.SessionID != MySessionInfo.SessionID)
{
string prcNumber = pi.DisplayNumber + string.Format(" Checked out to {0}", oi.SessionUserID);
clbMore.Items.Add(prcNumber);
}
else
clbMore.Items.Add(pi.DisplayNumber);
tmpProcedures.Add(pi.DisplayNumber, pi);
}
// B2018-083: check for null MySessionInfo.
if (oi != null && MySessionInfo != null && oi.SessionID != MySessionInfo.SessionID)
{
string prcNumber = pi.DisplayNumber + string.Format(" Checked out to {0}", oi.SessionUserID);
clbMore.Items.Add(prcNumber);
}
else
clbMore.Items.Add(pi.DisplayNumber);
tmpProcedures.Add(pi.DisplayNumber, pi);
}
}
if (dpl.Count > 0) return false; // C2018-025 cannot load list of procedure - duplicate proc numbers
@ -267,6 +275,7 @@ namespace VEPROMS
// C2018-008 redesign of user interface
expAddProcConChk.Expanded = true;
_initializing = true;
ApplicabilityIndex = myDocVersion.DocVersionConfig.SelectedSlave;
InitializePanelApprove();
InitializePanelSelect();
_initializing = false;

View File

@ -3569,7 +3569,8 @@ namespace VEPROMS
displayTags.IsVisible = true;
}
infotabHistory.Visible = true;
if (args.MyItemInfo.MyDocVersion.MultiUnitCount > 1 && !args.MyItemInfo.IsProcedure)
// C2021-027: Procedure level PC/PC
if (args.MyItemInfo.MyDocVersion.MultiUnitCount > 1 && args.MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ProcAppl) //&& !args.MyItemInfo.IsProcedure)
{
infotabApplicability.Visible = true;
displayApplicability.MyItemInfo = args.MyEditItem.MyItemInfo;

View File

@ -987,7 +987,10 @@ namespace VEPROMS.CSLA.Library
}
set
{
_Xp["MasterSlave", "Applicability"] = value.FlagList;
if (value != null)
_Xp["MasterSlave", "Applicability"] = value.FlagList;
else
_Xp["MasterSlave", "Applicability"] = null;
OnPropertyChanged("MasterSlave_Applicability");
}
}

View File

@ -2740,7 +2740,11 @@ namespace VEPROMS.CSLA.Library
return true;
ItemInfo parent = this.ActiveParent as ItemInfo;
IItemConfig cfg = this.MyConfig as IItemConfig;
return (this.IsProcedure || parent.IsApplicable(apple)) && (cfg.MasterSlave_Applicability.GetFlags().Count == 0 || cfg.MasterSlave_Applicability.GetFlags().Contains(apple));
if (IsProcedure) // C2021-027: Procedure level PC/PC. if procedure, don't go to parent.
{
return (cfg.MasterSlave_Applicability.GetFlags().Count == 0 || cfg.MasterSlave_Applicability.GetFlags().Contains(apple));
}
return (parent.IsApplicable(apple)) && (cfg.MasterSlave_Applicability.GetFlags().Count == 0 || cfg.MasterSlave_Applicability.GetFlags().Contains(apple));
}
//end jcb added inherited applicability
public string FormattedDisplayText
@ -5282,6 +5286,7 @@ namespace VEPROMS.CSLA.Library
{
if (_SectionCheckOffHeader == null)
{
if (ActiveSection == null) return _SectionCheckOffHeader;
// first check if format has checkoff data, including checkoffheaders.
ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData;
if (pd.CheckOffData == null || pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.MaxIndex <= 1) _SectionCheckOffHeader = string.Empty;
@ -6906,6 +6911,34 @@ namespace VEPROMS.CSLA.Library
[Serializable()]
public partial class ProcedureInfo : ItemInfo, IVEDrillDownReadOnly
{
// C2021-027: Procedure level PC/PC. these 2 methods determine whether a procedure is included, either by an integer index
// or by a string name of the unit
public bool ApplInclude(int ApplicabilityIndex)
{
if (ActiveFormat.PlantFormat.FormatData.ProcData.ProcAppl)
{
ProcedureConfig cfg = MyConfig as ProcedureConfig;
return (cfg.MasterSlave_Applicability.GetFlags().Count == 0 || cfg.MasterSlave_Applicability.GetFlags().Contains(ApplicabilityIndex));
}
return true;
}
public bool ApplIncludeFromStr(string s)
{
// s is the unitname, find this name in list of applicabilities & then see if this one is used
if (ActiveFormat.PlantFormat.FormatData.ProcData.ProcAppl)
{
// get index
int i = 1;
foreach (string str in MyDocVersion.UnitNames)
{
if (str == s) break;
i++;
}
ProcedureConfig cfg = MyConfig as ProcedureConfig;
return (cfg.MasterSlave_Applicability.GetFlags().Count == 0 || cfg.MasterSlave_Applicability.GetFlags().Contains(i));
}
return true;
}
private bool? _ProcHasSupInfoData = null;
public bool ProcHasSupInfoData
{

View File

@ -1395,6 +1395,14 @@ namespace VEPROMS.CSLA.Library
return LazyLoad(ref _NotesToFootnotes, "@NotesToFootnotes");
}
}
private LazyLoad<bool> _ProcAppl;
public bool ProcAppl // C2021-027: Procedure level PC/PC
{
get
{
return LazyLoad(ref _ProcAppl, "@ProcAppl");
}
}
private LazyLoad<bool> _CountFoldoutPages;
public bool CountFoldoutPages
{

View File

@ -214,7 +214,13 @@ namespace Volian.Controls.Library
List<InvalidTransition> invalidTrans = WillTransitionsBeValidCommand.Execute(MyItemInfo.ItemID, MyApplicability);
if (invalidTrans.Count == 0)
{
if (MyItemInfo.IsSection)
// C2021 - 027: Procedure level PC/PC
if (MyItemInfo.IsProcedure && MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ProcAppl)
{
ProcedureConfig sc = MyItemInfo.MyConfig as ProcedureConfig;
sc.MasterSlave_Applicability = Volian.Base.Library.BigNum.MakeBigNum(MyApplicability);
}
else if (MyItemInfo.IsSection)
{
SectionConfig sc = MyItemInfo.MyConfig as SectionConfig;
sc.MasterSlave_Applicability = Volian.Base.Library.BigNum.MakeBigNum(MyApplicability);
@ -237,6 +243,9 @@ namespace Volian.Controls.Library
FlexibleMessageBox.Show(sb.ToString(), "Transitions Affected By Applicability Change");
MyItemInfo = MyItemInfo;
}
// C2021 - 027: Procedure level PC/PC - checkbox for applicability changed, fix ribbon's menus
if (MyItemInfo.IsProcedure) _MyDisplayTabItem.MyStepTabPanel.MyStepTabRibbon.SetParentChildCreatePDFButton(MyItemInfo.MyDocVersion.UnitNames, MyItemInfo);
//using (Content cnt = Content.Get(MyItemInfo.MyContent.ContentID))
//{
// cnt.DTS = DateTime.Now;
@ -375,9 +384,12 @@ namespace Volian.Controls.Library
EnableCheckboxes();
OnApplicabilityViewModeChanged();
EditItem ei = MyDisplayTabItem.MyStepTabPanel.SelectedEditItem;
while (ei.Enabled == false)
while (ei!=null && ei.Enabled == false)
ei = ei.MyParentEditItem ?? ei.MyPreviousEditItem;
ei.MyStepRTB.Focus();
// C2021 - 027: Procedure level PC/PC - handle procedure level too for viewing in editor
if (MyDisplayTabItem.MyStepTabPanel.SelectedItemInfo != null && MyDisplayTabItem.MyStepTabPanel.SelectedItemInfo.IsProcedure)
ei = MyDisplayTabItem.MyStepTabPanel.SelectedEditItem;
if (ei != null) ei.MyStepRTB.Focus();
}
}

View File

@ -263,8 +263,9 @@ namespace Volian.Controls.Library
if (dvi == null) return;
if (dvi.VersionType > 127)
MyStepTabPanel.MyStepPanel.VwMode = E_ViewMode.View;
// C2021 - 027: Procedure level PC/PC - add _MyIteminfo to argument list
if (dvi.MultiUnitCount > 1)
this.MyStepTabPanel.MyStepTabRibbon.SetParentChildCreatePDFButton(dvi.UnitNames); //C2020-013 add parent/child sub menu items for printing specific children (units)
this.MyStepTabPanel.MyStepTabRibbon.SetParentChildCreatePDFButton(dvi.UnitNames, _MyItemInfo); //C2020-013 add parent/child sub menu items for printing specific children (units)
}
void _MyItemInfo_Changed(object sender)
{

View File

@ -716,6 +716,9 @@ namespace Volian.Controls.Library
// if in Calvert Alarms Condition/Response, disable insert of Cautions and Notes
//if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
//btnInsCaut.Enabled = btnInsNote.Enabled = btnCMInsCaution.Enabled = btnCMInsNote.Enabled = allow && !MyItemInfo.IsInCalvertConditionResponse;
// C2021 - 027: Procedure level PC/PC - if text changed, i.e. applicability may have changed, redo the print menus
if (MyItemInfo != null && MyItemInfo.MyDocVersion.MultiUnitCount > 1)
SetParentChildCreatePDFButton(MyItemInfo.MyDocVersion.UnitNames, MyItemInfo);
}
void MyFlexGrid_SelChange(object sender, EventArgs e)
@ -1916,7 +1919,7 @@ namespace Volian.Controls.Library
}
MyItemInfo.MyProcedure.ProcedureConfig.SelectedSlave = 0; // unselect the unit (child)
}
public void SetParentChildCreatePDFButton(string[] unitNames)
public void SetParentChildCreatePDFButton(string[] unitNames, ItemInfo ii)
{
btnPdfCreate.SubItems.Clear();
btnPdfCreate.Tag = null;
@ -1930,15 +1933,23 @@ namespace Volian.Controls.Library
int k = 0;
foreach (string s in unitNames)
{
// C2021-027: Procedure level PC/PC - see if menu items for unit should be enabled
bool procAppl = ii.MyProcedure.ApplIncludeFromStr(s);
k++;
btnPdfCreate.SubItems.Add(MakeSubMenuButton(s,k,miMultiUnit_Click));
btnReviewCreatePDF.SubItems.Add(MakeSubMenuButton(s, k, miMultiUnit_Click));
btnCASCreate.SubItems.Add(MakeSubMenuButton(s, k, miMultiUnit_Click));
ButtonItem btn = MakeSubMenuButton(s, k, miMultiUnit_Click);
btn.Enabled = procAppl;
btnPdfCreate.SubItems.Add(btn);
btn = MakeSubMenuButton(s, k, miMultiUnit_Click);
btn.Enabled = procAppl;
btnReviewCreatePDF.SubItems.Add(btn);
btn = MakeSubMenuButton(s, k, miMultiUnit_Click);
btn.Enabled = procAppl;
btnCASCreate.SubItems.Add(btn);
}
btnPdfCreate.AutoExpandOnClick = true;
btnReviewCreatePDF.AutoExpandOnClick = true;
btnCASCreate.AutoExpandOnClick = true;
}
}
private DevComponents.DotNetBar.ButtonItem MakeSubMenuButton(string s, object tag, EventHandler ehandler)
{
DevComponents.DotNetBar.ButtonItem bi = new DevComponents.DotNetBar.ButtonItem();

View File

@ -829,12 +829,17 @@ namespace Volian.Controls.Library
int k = 0;
foreach (string s in pri.MyDocVersion.UnitNames)
{
// C2021-027: Procedure level PC/PC - see if menu items for unit should be enabled
bool procAppl = pri.ApplIncludeFromStr(s);
k++;
MenuItem mp = mip.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
mp.Enabled = procAppl;
mp.Tag = k;
MenuItem ma = mia.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
ma.Enabled = procAppl;
ma.Tag = k;
MenuItem mc = micas.MenuItems.Add(s, new EventHandler(miMultiUnit_Click));
mc.Enabled = procAppl;
mc.Tag = k;
}
cm.MenuItems.Add(micas);