diff --git a/PROMS/Volian.Controls.Library/DisplayApplicability.cs b/PROMS/Volian.Controls.Library/DisplayApplicability.cs index 67f01532..56e270b2 100644 --- a/PROMS/Volian.Controls.Library/DisplayApplicability.cs +++ b/PROMS/Volian.Controls.Library/DisplayApplicability.cs @@ -212,7 +212,9 @@ namespace Volian.Controls.Library // } //} List invalidTrans = WillTransitionsBeValidCommand.Execute(MyItemInfo.ItemID, MyApplicability); - if (invalidTrans.Count == 0) + // B2021-149: for Procedure level PC/PC, continue processing if all 'invalid' transitions are internal (query used + // return internal and external for the procedure level) + if ((!MyItemInfo.IsProcedure && invalidTrans.Count == 0) || IsProcWithNoExternalTrans(MyItemInfo, invalidTrans)) { // C2021 - 027: Procedure level PC/PC if (MyItemInfo.IsProcedure && MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ProcAppl) @@ -236,8 +238,11 @@ namespace Volian.Controls.Library StringBuilder sb = new StringBuilder(); sb.AppendLine("Changing the applicability for this step will invalidate a transition in the following steps..."); sb.AppendLine(); + // B2021-149: if step, put out line for every invalidTrans, if procedure only put out those that are external + // determine this by looking strings for source and target (to), if procedure level and internal the target starts + // with the src, i.e. procedure. foreach (InvalidTransition inv in invalidTrans) - sb.AppendLine(string.Format("From {0} to {1}", inv.SrcStep, inv.TgtStep)); + if (!MyItemInfo.IsProcedure || !inv.TgtStep.StartsWith(inv.SrcStep))sb.AppendLine(string.Format("From {0} to {1}",inv.TgtStep, inv.SrcStep)); // MessageBox.Show(sb.ToString()); // B2013-185 use FlexibleMessageBox to display a long list with a scroll bar FlexibleMessageBox.Show(sb.ToString(), "Transitions Affected By Applicability Change"); @@ -261,6 +266,18 @@ namespace Volian.Controls.Library // s.Save(); //} } + // B2021-149: for procedure, only consider external transitions as invalid + private bool IsProcWithNoExternalTrans(ItemInfo ii, List invalidTrans) + { + if (invalidTrans.Count == 0) return true; + foreach (InvalidTransition iT in invalidTrans) + { + // if target (to location) does not start with source location (procedure) then this is external + // i.e. from a different procedure + if (!iT.TgtStep.StartsWith(iT.SrcStep)) return false; + } + return true; + } private bool AllNumbered(CheckState checkState) { foreach (CheckBox cb in MyCheckBoxes.Values)