diff --git a/.gitignore b/.gitignore index fb760125..cb363074 100644 --- a/.gitignore +++ b/.gitignore @@ -98,6 +98,7 @@ StyleCopReport.xml *.pidb *.svclog *.scc +*.cache # Chutzpah Test files _Chutzpah* diff --git a/Common/.vs/config/applicationhost.config b/Common/.vs/config/applicationhost.config index 40cde372..1b9332b4 100644 --- a/Common/.vs/config/applicationhost.config +++ b/Common/.vs/config/applicationhost.config @@ -155,7 +155,7 @@ - + diff --git a/ServiceFwUpdate/Documents/2021-10-15 Quick Reference Cordonel Service FW-Update Loader - Rev C.pdf b/ServiceFwUpdate/Documents/2021-10-15 Quick Reference Cordonel Service FW-Update Loader - Rev C.pdf new file mode 100644 index 00000000..56665b80 Binary files /dev/null and b/ServiceFwUpdate/Documents/2021-10-15 Quick Reference Cordonel Service FW-Update Loader - Rev C.pdf differ diff --git a/ServiceFwUpdate/Documents/Quick Reference Cordonel Service FW-Update Loader.docx b/ServiceFwUpdate/Documents/Quick Reference Cordonel Service FW-Update Loader.docx index 4ab26063..477d84ce 100644 Binary files a/ServiceFwUpdate/Documents/Quick Reference Cordonel Service FW-Update Loader.docx and b/ServiceFwUpdate/Documents/Quick Reference Cordonel Service FW-Update Loader.docx differ diff --git a/ServiceFwUpdate/Ui/ServiceFwUpdateLoader/FrmFwUpdateLoader.cs b/ServiceFwUpdate/Ui/ServiceFwUpdateLoader/FrmFwUpdateLoader.cs index b78ab6b3..7c48bec8 100644 --- a/ServiceFwUpdate/Ui/ServiceFwUpdateLoader/FrmFwUpdateLoader.cs +++ b/ServiceFwUpdate/Ui/ServiceFwUpdateLoader/FrmFwUpdateLoader.cs @@ -104,6 +104,16 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateLoader /// private const String FwUpdateProjectName = "ServiceFwUpdateSw"; + /// + /// Search strings for "Firmware up to date!" messages in report file, copied from Resources.resx of all + /// language packages from "ServiceFwUpdateSw" + /// + private readonly String[] _firmwareUpToDateSearchStrings = + { + "Firmware is up to date!", + "Firmware ist aktuell!" + }; + /// /// 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 ----------------------------------------------------- + /// + /// 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! + /// + /// + /// - Initial + /// + 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; + } + } + /// /// Search for report files /// /// /// - Initial /// - private Boolean IsPcbIdProcessed(String pcbId) + /// + /// - 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. + /// + private Boolean IsPcbIdProcessed(String pcbId, String orderNo) { try { @@ -707,7 +748,8 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateLoader var fileList = new List(); 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(); 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 /// /// - Initial. /// + /// + /// - Added order number to search for successfully updated device in linked to this safe. + /// 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);