B2021-066: Procedure Level PC/PC in tree view
This commit is contained in:
parent
1363170e8a
commit
0dd4889e5c
@ -2850,6 +2850,7 @@ namespace VEPROMS
|
||||
toolsPanel.Expanded = true;
|
||||
toolsTabs.SelectedTab = toolstabResults;
|
||||
}
|
||||
if (frmver._refreshProcedureList) tv.RefreshDocVersion(); //B2021-066: Refresh Procedure Numbers if Working Draft (docversion) applicability change
|
||||
MySessionInfo.CheckInItem(ownerID);
|
||||
}
|
||||
else if (args.ProcedureConfig != null)
|
||||
|
@ -255,6 +255,7 @@ namespace VEPROMS
|
||||
Settings.Default.Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
_DocVersionConfig.MyDocVersion.Config = _DocVersionConfig.ToString();
|
||||
_refreshProcedureList = true;
|
||||
_DocVersionConfig.MyDocVersion.Save().Dispose();
|
||||
if (_EnhNeedToUnlink)
|
||||
{
|
||||
@ -1509,6 +1510,7 @@ namespace VEPROMS
|
||||
lbApplicabilities.SelectedItem = cfg;
|
||||
}
|
||||
public bool _showApplicSearchResults = false;
|
||||
public bool _refreshProcedureList = false;
|
||||
private bool ApplicIsUsed(MiniConfig cfg) // B2017-230 - don't allow user to remove an applicability that is being used (specified)
|
||||
{
|
||||
if (_showApplicSearchResults)
|
||||
|
@ -162,6 +162,12 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
_Xp[group, item] = newvalue;
|
||||
}
|
||||
public int GetItemId()
|
||||
{
|
||||
if (_Procedure != null) return _Procedure.ItemID;
|
||||
if (_ProcedureInfo != null) return _ProcedureInfo.ItemID;
|
||||
return -1;
|
||||
}
|
||||
#endregion
|
||||
#region Local Properties
|
||||
[Category("General")]
|
||||
|
@ -17,6 +17,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
using System.Text.RegularExpressions;
|
||||
//using VEPROMS.Properties;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
@ -387,7 +388,93 @@ namespace VEPROMS.CSLA.Library
|
||||
return buff;
|
||||
}
|
||||
|
||||
// B2021-066: Procedure PC/PC resolve procedure number with Unit Specific info
|
||||
public string UnitSpecific(string str, int len, ItemInfo ii)
|
||||
{
|
||||
ProcedureInfo pi = ii as ProcedureInfo;
|
||||
if (pi == null) return "";
|
||||
string unitdes = "ID";
|
||||
string prefix = null;
|
||||
string fromunitdes = null;
|
||||
str = ItemInfo.ConvertToDisplayText(pi.MyContent.Number);
|
||||
bool hastoken = false;
|
||||
// Determine if there is a token in the procedure number data, default is ID
|
||||
if (str.ToUpper().Contains(@"<U"))
|
||||
{
|
||||
hastoken = true;
|
||||
if (str.ToUpper().IndexOf(@"<U-") > -1)
|
||||
{
|
||||
try
|
||||
{
|
||||
int sindx = str.ToUpper().IndexOf(@"<U-");
|
||||
int eindx = str.IndexOf(@">", sindx + 1);
|
||||
unitdes = str.Substring(sindx + 3, eindx - (sindx + 3));
|
||||
unitdes = unitdes.ToUpper();
|
||||
}
|
||||
catch
|
||||
{
|
||||
unitdes = "ID";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (unitdes == "NUMBER")
|
||||
fromunitdes = DocVersionConfig.Unit_Number;
|
||||
else if (unitdes == "ID")
|
||||
fromunitdes = DocVersionConfig.Unit_ID;
|
||||
else if (unitdes == "NAME")
|
||||
fromunitdes = DocVersionConfig.Unit_Name;
|
||||
else if (unitdes == "TEXT")
|
||||
fromunitdes = DocVersionConfig.Unit_Text;
|
||||
else
|
||||
fromunitdes = DocVersionConfig.Unit_ID;
|
||||
|
||||
// adjustments to the procedure number for applicability can be defined in 2 places:
|
||||
// 1) mstr below: working draft properties/Applicability/Procedure number field for each unit can have text. The '#' in this
|
||||
// field represents the procdure number & any text prefixing it, will be used to prefix the procedure number
|
||||
// 2) fromunitdes above: this is defined on the procedure number, seen on procedure properties, and is a token <U> with
|
||||
// optional '-xxx' after the U, see above for possible tokens.
|
||||
string mstr = (MyConfig as DocVersionConfig).Unit_ProcedureNumber;
|
||||
string[] units = mstr.Split(",".ToCharArray());
|
||||
string[] fromdata = fromunitdes.Split(",".ToCharArray());
|
||||
|
||||
// SelectedSlave is > 0 if a unit has been selected, for example from print or approve. It represents that index into
|
||||
// the list of units.
|
||||
if (DocVersionConfig.SelectedSlave > 0)
|
||||
{
|
||||
prefix = units[0].Replace("#", "");
|
||||
if (str.ToUpper().IndexOf(@"<U-") > -1) return prefix + Regex.Replace(str, @"\<[uU]-[a-zA-Z]+\>", fromunitdes);
|
||||
return prefix + Regex.Replace(str, @"\<[uU]\>", fromunitdes);
|
||||
}
|
||||
|
||||
// The following code is used to handle the treeview/tree node representation of the procedure number with any appropriate
|
||||
// unit specifications resolved, as follows:
|
||||
// 1) [] (square brackets) are placed around any prefixes determined from the <U> token or the Procedure Number data on
|
||||
// the working draft properties. If None, i.e. no units, are applicable, as selected from the Step Properties/Applicability tab.
|
||||
// there will be no text between the brackets to represent no applicability
|
||||
// 2) , (commas) are used as a delimeter. Only have 1 comma separating the prefix, there may be no text if some units are
|
||||
// not applicable, but code exists here so that ',,,' does not appear in the treenode
|
||||
// 3) don't duplicate resolved text, for example if NUMBER is used, and prefix text would be '[A,A,B,C,C]', only show '[A,B,C]'
|
||||
|
||||
bool sometext = false; // flag to use since don't want ',,,,,' before number
|
||||
List<string> prefs = new List<string>();
|
||||
for (int i = 1; i <= UnitNames.Length; i++)
|
||||
{
|
||||
bool procAppl = pi.ApplInclude(i);
|
||||
string tokRepAndPrefix = units[i - 1].Replace("#", "") + (hastoken ? fromdata[i - 1] : "");
|
||||
if (tokRepAndPrefix != "")
|
||||
{
|
||||
sometext = true;
|
||||
if (prefs.Count > 0 && prefs.Contains(tokRepAndPrefix))
|
||||
tokRepAndPrefix = "";
|
||||
else
|
||||
if (procAppl) prefs.Add(tokRepAndPrefix);
|
||||
}
|
||||
if (procAppl && tokRepAndPrefix != "") prefix = prefix + (prefix == null ? tokRepAndPrefix : (prefix != null && prefix.Length > 0 && prefix[prefix.Length - 1] != ',' ? "," : "") + tokRepAndPrefix);
|
||||
}
|
||||
str = Regex.Replace(str, @"\<[uU]-[a-zA-Z]+\>", "");
|
||||
str = Regex.Replace(str, @"\<[uU]\>", "");
|
||||
return (!sometext) ? str: "[" + prefix + "]" + str;
|
||||
}
|
||||
public string UnitSpecific(string str, int len)
|
||||
{
|
||||
|
||||
|
@ -2875,7 +2875,18 @@ namespace VEPROMS.CSLA.Library
|
||||
string str = MyContent.Number;
|
||||
if (MyDocVersion != null)
|
||||
{
|
||||
str = (this.IsProcedure) ? MyDocVersion.UnitSpecific(MyContent.Number, 0) : MyContent.Number;
|
||||
// call to UnitSpecific 0 is all, need what is applicable
|
||||
if (IsProcedure)
|
||||
{
|
||||
// B2021-066: show Procedure level applicability in tree view
|
||||
if (ActiveFormat.PlantFormat.FormatData.ProcData.ProcAppl)
|
||||
str = MyDocVersion.UnitSpecific(MyContent.Number, 1, this);
|
||||
else
|
||||
str = MyDocVersion.UnitSpecific(MyContent.Number, 1);
|
||||
|
||||
}
|
||||
else
|
||||
str = MyContent.Number;
|
||||
str = Regex.Replace(str, @"\<U-ID\>", MyDocVersion.DocVersionConfig.Unit_ID, RegexOptions.IgnoreCase);
|
||||
str = Regex.Replace(str, @"\<ID\>", MyDocVersion.DocVersionConfig.Unit_ID, RegexOptions.IgnoreCase);
|
||||
}
|
||||
@ -6917,6 +6928,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (ActiveFormat.PlantFormat.FormatData.ProcData.ProcAppl)
|
||||
{
|
||||
MyConfig = null; // force refresh
|
||||
ProcedureConfig cfg = MyConfig as ProcedureConfig;
|
||||
return (cfg.MasterSlave_Applicability.GetFlags().Count == 0 || cfg.MasterSlave_Applicability.GetFlags().Contains(ApplicabilityIndex));
|
||||
}
|
||||
|
@ -3975,7 +3975,25 @@ namespace Volian.Controls.Library
|
||||
Console.WriteLine("vlntreeview:refreshrelatednote:end");
|
||||
return child;
|
||||
}
|
||||
|
||||
// B2021-066: refresh the procedure numbers within Working Draft (docversion) for applicability changed
|
||||
public void RefreshDocVersion()
|
||||
{
|
||||
VETreeNode vetn = SelectedNode as VETreeNode;
|
||||
if (vetn != null)
|
||||
{
|
||||
DocVersionInfo dvi = vetn.VEObject as DocVersionInfo;
|
||||
if (dvi != null)
|
||||
{
|
||||
if (SelectedNode.Nodes != null && SelectedNode.Nodes.Count > 0 && SelectedNode.Nodes[0] is VETreeNode)
|
||||
{
|
||||
foreach (VETreeNode tn in SelectedNode.Nodes)
|
||||
{
|
||||
tn.RefreshNode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private VETreeNode GetChildNode(IVEDrillDownReadOnly selectedItem, VETreeNode parent)
|
||||
{
|
||||
foreach (TreeNode childNode in parent.Nodes)
|
||||
|
@ -1759,6 +1759,8 @@ i = 0;
|
||||
eopnum = unitnum.Replace("!", unitname);
|
||||
if (eopnum == string.Empty)
|
||||
eopnum = section.MyProcedure.MyContent.Number;
|
||||
// B2021-066: found and fixed during proc pc/pc work
|
||||
if (eopnum.ToUpper().Contains(@"<U")) eopnum = section.MyProcedure.DisplayNumber;
|
||||
}
|
||||
if (token.Equals("{PREDELIMEOPNUM}"))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user