From e9e934cfb1bab26cfbb54e9b9c2c63be2c6814f4 Mon Sep 17 00:00:00 2001 From: mschill Date: Fri, 2 May 2025 11:46:55 -0400 Subject: [PATCH] C2025-023 - Electronic Procedures - Modifications to PROMS RO input functionality --- PROMS/Formats/epall/EPFormatTST1.xml | Bin 2884 -> 2952 bytes .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 3 +- .../Format/EPFormatFile.cs | 75 +++++++++++++++--- 3 files changed, 64 insertions(+), 14 deletions(-) diff --git a/PROMS/Formats/epall/EPFormatTST1.xml b/PROMS/Formats/epall/EPFormatTST1.xml index 1aa1e26efd44ea29bc6a291562fcb48201fea14b..cd99e3c7034a73022cec70157ef5de85e9c9a58b 100644 GIT binary patch delta 88 zcmX>i)*-&Zfm61KA(f$op_HMBA&()MA)g_Kp_svzL5abUL5IO tmpEP = EP.validforsteptypes(); + if (tmpEP.Any(steptypelist.Contains)) filtered.Add(EP); } diff --git a/PROMS/VEPROMS.CSLA.Library/Format/EPFormatFile.cs b/PROMS/VEPROMS.CSLA.Library/Format/EPFormatFile.cs index 75595fe1..456f043d 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/EPFormatFile.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/EPFormatFile.cs @@ -272,6 +272,7 @@ namespace VEPROMS.CSLA.Library return LazyLoad(ref _text, "@text"); } } + //roid of group item that individual sub-items will be the choices for the list/combobox for ROSINGLE and ROMULTI private LazyLoad _rosource; public string rosource { @@ -280,6 +281,22 @@ namespace VEPROMS.CSLA.Library return LazyLoad(ref _rosource, "@rosource"); } } + //the columns in the RO that will be included in the exports + private LazyLoad _returncols; + public List returncols() + { + try + { + string tmp = LazyLoad(ref _returncols, "@returncols"); + return tmp.Split(',').Select(p => p.Trim()).ToList(); + } + catch + { + throw new ArgumentException($"Error in returncols for EP file: {((EPFormatFile)MyParentFormat).Name}.xml, field: {name}"); + } + } + + //number of lines for a multi-line text box to span private LazyLoad _numlines; public int numlines { @@ -295,27 +312,26 @@ namespace VEPROMS.CSLA.Library } //step types that the EPForma Item is valid for (as a list of types) private LazyLoad _validforsteptypes; - public List validforsteptypes + public List validforsteptypes() { - get + try { - try - { - string tmp = LazyLoad(ref _validforsteptypes, "@validforsteptypes"); - return tmp.Split(',').Select(p => p.Trim()).ToList(); - } - catch - { - throw new ArgumentException($"Error in validforsteptypes for EP file: {((EPFormatFile) MyParentFormat).Name}.xml, field: {name}"); - } + string tmp = LazyLoad(ref _validforsteptypes, "@validforsteptypes"); + return tmp.Split(',').Select(p => p.Trim()).ToList(); + } + catch + { + throw new ArgumentException($"Error in validforsteptypes for EP file: {((EPFormatFile) MyParentFormat).Name}.xml, field: {name}"); } } public bool IsValidForStepType(string StepType) { - return validforsteptypes.Contains(StepType); + List tmp = validforsteptypes(); + return tmp.Contains(StepType); } //return a list of items based on the ROsource specified in the EPFormat File + //will return all RO items under the Group that's roid = the rosource public List getROList(AnnotationInfo currAnn, bool includeblank) { if (string.IsNullOrEmpty(rosource)) @@ -329,7 +345,7 @@ namespace VEPROMS.CSLA.Library string roid = FormatRoidKey(rosource, false); rochild[] children = lookup.GetRoChildrenByRoid(roid); - List mylist = children.Select(x => new ROListItem(x.title, x.roid)).ToList(); + List mylist = children.Select(x => new ROListItem(x.title, x.roid.Substring(0, 12))).ToList(); if (includeblank) mylist.Insert(0, new ROListItem("", "")); @@ -340,6 +356,39 @@ namespace VEPROMS.CSLA.Library throw new ArgumentException($"Error in rosource for EP file: {((EPFormatFile)MyParentFormat).Name}.xml, field: {name}"); } } + + + //return a list of values for the specified ROID + //given the EP items return columns + //will return all RO items under the Group that's roid = the rosource + public List getROValuesList(AnnotationInfo currAnn, string roid) + { + if (string.IsNullOrEmpty(roid)) + return new List(); + + List values = new List(); + DocVersionInfo MyDocVersion = currAnn.MyItem.MyDocVersion; + ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion); + rochild ro = lookup.GetRoChild(roid); + + List rtncols = returncols(); + + if (rtncols.Count == 0) + { + values.Add(ro.value); + } + else + { + foreach (string rcol in rtncols) + { + rochild ro_indiv = Array.Find(ro.children, x => x.appid.EndsWith($".{rcol}")); + if (ro_indiv.value != null) values.Add(ro_indiv.value); + } + } + + return values; + + } } #endregion //C2025-023 - Electronic Procedures - Modifications to PROMS