FwUpdateLoader: - Check order number, position and PcbId and parse report file to search for "Firmware up to date!" string to mark only successfully performed updates in the PcbId table on the main screen. This keeps the user informed of the status of the "Firmware Update Procedure", if the PcbId is check-marked, this has been successfully updated according to this update order number!

This commit is contained in:
Thomas Wiedebusch 2021-10-15 08:01:23 +02:00
parent 0a72be12ab
commit 56ef6731cd
5 changed files with 53 additions and 5 deletions

1
.gitignore vendored
View File

@ -98,6 +98,7 @@ StyleCopReport.xml
*.pidb
*.svclog
*.scc
*.cache
# Chutzpah Test files
_Chutzpah*

View File

@ -155,7 +155,7 @@
</site>
<site name="MeterProcessState" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" />

View File

@ -104,6 +104,16 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateLoader
/// </summary>
private const String FwUpdateProjectName = "ServiceFwUpdateSw";
/// <summary>
/// Search strings for "Firmware up to date!" messages in report file, copied from Resources.resx of all
/// language packages from "ServiceFwUpdateSw"
/// </summary>
private readonly String[] _firmwareUpToDateSearchStrings =
{
"Firmware is up to date!",
"Firmware ist aktuell!"
};
/// <summary>
/// Name of the file which contains the meter file names that can be erased before the FW-Update
/// to free disk space and have to be restored after the FW-Update
@ -691,13 +701,44 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateLoader
#region ------------------------------------------ Checks -----------------------------------------------------
/// <summary>
/// Search "Firmware is up to date!" string in file to guarantee the successfully execution of the update
/// process. Get success string for all language settings!
/// </summary>
/// <remarks date="2021-Oct-15" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private Boolean IsSuccessStringInFile(String fileNamePath)
{
try
{
// Get search strings from resources StrFwUpToDateMessage from ServiceFwUpdateSw
var fileLines = File.ReadAllLines(fileNamePath);
var fwIsUpToDate = false;
foreach (var searchString in _firmwareUpToDateSearchStrings)
{
if (fileLines.Any(line => line.Contains(searchString))) fwIsUpToDate = true;
}
return fwIsUpToDate;
}
catch (Exception)
{
return false;
}
}
/// <summary>
/// Search for report files
/// </summary>
/// <remarks date="2021-Apr-28" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private Boolean IsPcbIdProcessed(String pcbId)
/// <remarks date="2021-Oct-15" author="Thomas Wiedebusch">
/// - Check file content for "success" string to mark exclusively the validated updates.
/// - Check order number to enable more than one update for a specific pcbId.
/// </remarks>
private Boolean IsPcbIdProcessed(String pcbId, String orderNo)
{
try
{
@ -707,7 +748,8 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateLoader
var fileList = new List<String>();
SystemControl.GetFilesOfDirectoryAndSubDirectory(FwUpdateConfig.UnreportedPath, fileList,
$"*{FwUpdateConfig.ReportFileExtension}");
if (fileList.Any(file => file.Contains(pcbId))) return true;
if (fileList.Any(file => file.Contains(pcbId) && file.Contains(orderNo)
&& IsSuccessStringInFile(file))) return true;
}
// If this directory is existent and contains files, these files have to be checked
if (SystemControl.FilesExistingInPath(FwUpdateConfig.ReportedPath))
@ -715,7 +757,8 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateLoader
var fileList = new List<String>();
SystemControl.GetFilesOfDirectoryAndSubDirectory(FwUpdateConfig.ReportedPath, fileList,
$"*{FwUpdateConfig.ReportFileExtension}");
if (fileList.Any(file => file.Contains(pcbId))) return true;
if (fileList.Any(file => file.Contains(pcbId) && file.Contains(orderNo)
&& IsSuccessStringInFile(file))) return true;
}
}
catch (Exception)
@ -1721,9 +1764,13 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateLoader
/// <remarks date="2021-Apr-28" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
/// <remarks date="2021-Oct-15" author="Thomas Wiedebusch">
/// - Added order number to search for successfully updated device in linked to this safe.
/// </remarks>
private void FillDataGridWithPcbIdInfos()
{
if (_fwUpdateSafe?.Updates?.CordonelDeviceInfos == null) return;
grpLanguageSelection.Enabled = false;
_dataTablePcbIds?.Dispose();
@ -1739,7 +1786,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateLoader
foreach (var cordSearch in _fwUpdateSafe.Updates.CordonelDeviceInfos)
{
var row = _dataTablePcbIds.NewRow();
row[Resources.StrTableUpdated] = IsPcbIdProcessed(cordSearch.PcbId);
row[Resources.StrTableUpdated] = IsPcbIdProcessed(cordSearch.PcbId, _customerAndOrderInfo);
row[Resources.StrTableCordonelPcbId] = cordSearch.PcbId ?? "?";
_dataTablePcbIds.Rows.Add(row);