C2025-024 Electronic Procedures Phase 2 - XML Export
Multi-Unit Resolution, and Fix RO Annotation resolution in Text
This commit is contained in:
@@ -128,10 +128,6 @@ namespace VEPROMS
|
||||
MyProcedure = procedureInfo;
|
||||
InitializeComponent();
|
||||
this.Text = mode + " Dialog for " + procedureInfo.DisplayNumber;
|
||||
|
||||
//Preset path for single procedures.
|
||||
PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database;
|
||||
txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber.Replace("/", "_").Replace("\\", "_"));
|
||||
_UnitIndex = unitIndex;
|
||||
|
||||
if (_UnitIndex > 0)
|
||||
@@ -140,6 +136,10 @@ namespace VEPROMS
|
||||
MyProcedure.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = _UnitIndex;
|
||||
FormClosed += RemoveUnit_OnClose;
|
||||
}
|
||||
|
||||
//Preset path for single procedures.
|
||||
PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database;
|
||||
txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber.Replace("/", "_").Replace("\\", "_"));
|
||||
}
|
||||
private void dlgExportImport_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -1972,39 +1972,46 @@ namespace VEPROMS
|
||||
private string ResolveMultiUnitROs(ContentInfo ci)
|
||||
{
|
||||
string ciText = ci.Text;
|
||||
|
||||
if (_UnitIndex != 0 && ci.ContentRoUsageCount > 0)
|
||||
DocVersionInfo docver = null;
|
||||
if (MyProcedure?.MyDocVersion != null)
|
||||
{
|
||||
ROFSTLookup lookup = null;
|
||||
if (MyProcedure?.MyDocVersion != null)
|
||||
{
|
||||
lookup = MyProcedure.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyProcedure.MyDocVersion);
|
||||
}
|
||||
else if (MyDocVersion != null)
|
||||
{
|
||||
lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
|
||||
}
|
||||
else if (MyFolder.FolderDocVersions != null && MyFolder.FolderDocVersions.Count > 0)
|
||||
{
|
||||
lookup = MyFolder.FolderDocVersions[0].DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyFolder.FolderDocVersions[0]);
|
||||
}
|
||||
docver = MyProcedure.MyDocVersion;
|
||||
}
|
||||
else if (MyDocVersion != null)
|
||||
{
|
||||
docver = MyDocVersion;
|
||||
}
|
||||
else if (MyFolder.FolderDocVersions != null && MyFolder.FolderDocVersions.Count > 0)
|
||||
{
|
||||
docver = MyFolder.FolderDocVersions[0];
|
||||
}
|
||||
|
||||
if (lookup != null)
|
||||
|
||||
if (_UnitIndex != 0 && docver != null)
|
||||
{
|
||||
ciText = DisplayText.ResolveUnitSpecific(docver, ciText);
|
||||
|
||||
if (ci.ContentRoUsageCount > 0)
|
||||
{
|
||||
foreach (var RO in ci.ContentRoUsages)
|
||||
ROFSTLookup lookup = docver.DocVersionAssociations[0].MyROFst.GetROFSTLookup(docver);
|
||||
|
||||
if (lookup != null)
|
||||
{
|
||||
string roid = ROFSTLookup.FormatRoidKey(RO.ROID, true);
|
||||
ROFSTLookup.rochild roc = lookup.GetRoChild(roid);
|
||||
//need to search / replace in content info
|
||||
string lookFor = string.Format(@"(<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~]))(.*?)((\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>)", RO.ROUsageID);
|
||||
Match m = Regex.Match(ciText, lookFor, RegexOptions.Singleline);
|
||||
if (m != null && m.Groups.Count > 1)
|
||||
foreach (var RO in ci.ContentRoUsages)
|
||||
{
|
||||
ciText = ciText.Replace($"{m.Groups[1].Value}{m.Groups[5].Value}{m.Groups[6].Value}", $"{m.Groups[1].Value}{roc.value}{m.Groups[6].Value}");
|
||||
string roid = ROFSTLookup.FormatRoidKey(RO.ROID, true);
|
||||
ROFSTLookup.rochild roc = lookup.GetRoChild(roid);
|
||||
//need to search / replace in content info
|
||||
string lookFor = string.Format(@"(<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~]))(.*?)((\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>)", RO.ROUsageID);
|
||||
Match m = Regex.Match(ciText, lookFor, RegexOptions.Singleline);
|
||||
if (m != null && m.Groups.Count > 1)
|
||||
{
|
||||
ciText = ciText.Replace($"{m.Groups[1].Value}{m.Groups[5].Value}{m.Groups[6].Value}", $"{m.Groups[1].Value}{roc.value}{m.Groups[6].Value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user