diff --git a/Common/.shared/SharedAssemblyInfo.cs b/Common/.shared/SharedAssemblyInfo.cs index c3c3da14..bcca328f 100644 --- a/Common/.shared/SharedAssemblyInfo.cs +++ b/Common/.shared/SharedAssemblyInfo.cs @@ -14,4 +14,4 @@ using System.Reflection; //[assembly: AssemblyVersion("1.2.*.0")] -[assembly: AssemblyVersion("2.6.15.*")] +[assembly: AssemblyVersion("2.6.16.*")] diff --git a/Common/.vs/Common/config/applicationhost.config b/Common/.vs/Common/config/applicationhost.config index 40cde372..c55a7f21 100644 --- a/Common/.vs/Common/config/applicationhost.config +++ b/Common/.vs/Common/config/applicationhost.config @@ -155,7 +155,7 @@ - + diff --git a/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache b/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache index 8865d283..4163759b 100644 --- a/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache +++ b/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -89102b0142e574de38a9f47d370f3334e5e6c268 +8cb55c312de586b683d72cf58c13e2801d10e14b767777d98338d3e1473a1213 diff --git a/Common/Production/ProductionUiCordonel/Docu/Handbuch Cordonel Versandfertigmachen (VFM).docx b/Common/Production/ProductionUiCordonel/Docu/Handbuch Cordonel Versandfertigmachen (VFM).docx index 176ad90c..90ccf4d2 100644 Binary files a/Common/Production/ProductionUiCordonel/Docu/Handbuch Cordonel Versandfertigmachen (VFM).docx and b/Common/Production/ProductionUiCordonel/Docu/Handbuch Cordonel Versandfertigmachen (VFM).docx differ diff --git a/Common/Production/ProductionUiCordonel/Docu/Handbuch Cordonel Versandfertigmachen (VFM).pdf b/Common/Production/ProductionUiCordonel/Docu/Handbuch Cordonel Versandfertigmachen (VFM).pdf index 99fda4bf..edc3b5e4 100644 Binary files a/Common/Production/ProductionUiCordonel/Docu/Handbuch Cordonel Versandfertigmachen (VFM).pdf and b/Common/Production/ProductionUiCordonel/Docu/Handbuch Cordonel Versandfertigmachen (VFM).pdf differ diff --git a/Common/Production/ProductionUiCordonel/Docu/ProductionUiCordonel.qea b/Common/Production/ProductionUiCordonel/Docu/ProductionUiCordonel.qea index 7d62edf2..f1298663 100644 Binary files a/Common/Production/ProductionUiCordonel/Docu/ProductionUiCordonel.qea and b/Common/Production/ProductionUiCordonel/Docu/ProductionUiCordonel.qea differ diff --git a/Common/Production/ProductionUiCordonel/FinalTest.xaml.cs b/Common/Production/ProductionUiCordonel/FinalTest.xaml.cs index ed4519f2..96393683 100644 --- a/Common/Production/ProductionUiCordonel/FinalTest.xaml.cs +++ b/Common/Production/ProductionUiCordonel/FinalTest.xaml.cs @@ -74,7 +74,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel { msg = $"{Properties.Resources.StrStartMessageSwLicenseExpired} {_version}"; _logger.Error(msg); - MessageBox.Show(msg, Properties.Resources.StrProcessStateError, + MessageBox.Show(msg, Properties.Resources.StrProcessStateError, MessageBoxButton.OK, MessageBoxImage.Error); Close(); return; @@ -82,7 +82,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel } catch (Exception e) { - msg = Properties.Resources.StrErrorMsgMissingNetworkConnetction + " " + e.Message ; + msg = Properties.Resources.StrErrorMsgMissingNetworkConnetction + " " + e.Message; _logger.Error(msg); MessageBox.Show(msg, Properties.Resources.StrProcessStateError, @@ -377,6 +377,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel /// /// - Extended. /// + /// + /// - Extended. + /// private void ProcessStateChange_Handler(Object sender, ProcessStateArgs e) { _logger.Debug($"Slot:{Slot} - Final test state: {e.State}"); @@ -426,7 +429,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel // Ready for shipping if (e.State == ProcessState.ReadyForShipping) { - StoreSuccessNote(out _); + // Create extended report including all steps and each register write, read and comparison + CreateFile(Properties.Resources.StrInfoSuccessPapers); BtnStop_Click(this, null); } // Print return report @@ -802,38 +806,30 @@ namespace Xylem.Common.Production.ProductionUiCordonel private void PrintErrorNote() { - var sb = new StringBuilder(); - sb.AppendLine("========================================================================"); - sb.AppendLine(Properties.Resources.StrInstructionReturnPapers); - sb.AppendLine("========================================================================"); - CreateFile(sb, out var fileName); - Process.Start(fileName); - } - - private void StoreSuccessNote(out String fileName) - { - var sb = new StringBuilder(); - sb.AppendLine("========================================================================"); - sb.AppendLine(Properties.Resources.StrInfoSuccessPapers); - sb.AppendLine("========================================================================"); - CreateFile(sb, out fileName); + // Safe report to file + CreateFile(Properties.Resources.StrInstructionReturnPapers, true, true); } private void PrintSuccessNote() { - StoreSuccessNote(out var fileName); - Process.Start(fileName); + // Safe report to file + CreateFile(Properties.Resources.StrInfoSuccessPapers, true, true); } - private void CreateFile(StringBuilder sb, out String fileName) + /// + /// Logging a file with all process information, building a compressed report for printout. + /// + /// + /// - Reduced printout. + /// + private void CreateFile(String headerInfo, Boolean shortReport = false, Boolean printReport = false) { - if (sb == null) - sb = new StringBuilder(); - + var sb = new StringBuilder(); var genesisMeter = _processCtrl.GetGenesisMeter(); - var loggingPath = $"C:\\GenesisLog\\{DateTime.Now:yyyy-MM-dd}\\ProductionUiCordonel\\"; - fileName = $"{loggingPath}{DateTime.Now.ToString("yyyyMMddHHmmss")}_Report_{genesisMeter.PcbId}.txt"; + sb.AppendLine("========================================================================"); + sb.AppendLine(headerInfo); + sb.AppendLine("========================================================================"); sb.AppendLine(_strSoftwareNameVersion); sb.AppendLine("------------------------------------------------------------------------"); sb.AppendLine($"{Properties.Resources.StrDateTime}: {DateTime.Now}"); @@ -843,12 +839,50 @@ namespace Xylem.Common.Production.ProductionUiCordonel sb.AppendLine($"{Properties.Resources.StrLblSerialNumberTxt}: {genesisMeter.CustomerSerialNumber}"); sb.AppendLine($"{Properties.Resources.StrLblOperatorNameText}: {Software.UserName}"); sb.AppendLine("------------------------------------------------------------------------"); + + //TODO THW take the log path from setup (done with GTB) + var loggingPath = $"C:\\GenesisLog\\{DateTime.Now:yyyy-MM-dd}\\ProductionUiCordonel\\"; + var fileName = $"{loggingPath}{DateTime.Now.ToString("yyyyMMddHHmmss")}_ExtendedReport_{genesisMeter.PcbId}.txt"; + + // Copy the header to the compressed string builder + var compressedSb = new StringBuilder(); + if (shortReport) + { + compressedSb.Append(sb); + } + var rtbText = new TextRange( rtbLog.Document.ContentStart, rtbLog.Document.ContentEnd ); sb.Append($"{rtbText.Text}"); + // Write the complete report to the file File.WriteAllText(fileName, sb.ToString()); + + // Reduce sb content to compress it for printout + if (shortReport) + { + + fileName = $"{loggingPath}{DateTime.Now.ToString("yyyyMMddHHmmss")}" + + $"_ShortReport_{genesisMeter.PcbId}.txt"; + var sr = new StringReader(rtbText.Text); + var srLine = sr.ReadLine(); + while (srLine != null) + { + if (srLine.Contains(Properties.Resources.StrProcessStateError) || + srLine.Contains(Properties.Resources.StrProcessStateDone) || + srLine.Contains(Properties.Resources.StrProcessStateWarning) || + srLine.Contains(Properties.Resources.StrProcessStateSkipped) || + srLine.Contains(Properties.Resources.StrWarningMsgSpecialRequirementActive)) + compressedSb.AppendLine(srLine); + srLine = sr.ReadLine(); + } + + // Returns the compressed file for error report printout + File.WriteAllText(fileName, compressedSb.ToString()); + if (printReport) + Process.Start(fileName); + } } /// diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/PrepareShipping.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/PrepareShipping.cs index cac3474e..5ecdbfd7 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/PrepareShipping.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/PrepareShipping.cs @@ -111,24 +111,25 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr // Exit if meanwhile cancellation is required if (CancellationToken.IsCancellationRequested) return CancellationProcedure(); - + ActualProcessProgress++; } - + if (!eolTriggerReturn) { if (!string.IsNullOrEmpty(error)) Meter.WriteLog(error); - foreach (var feed in feedback) - { - ErrorMsgDispatcher(Resources.StrErrorMsgSentinelConcerns + " " + - feed.Key + ": " + feed.Value); - } + if (feedback != null) + foreach (var feed in feedback) + { + ErrorMsgDispatcher(Resources.StrErrorMsgSentinelConcerns + " " + + feed.Key + ": " + feed.Value); + } ErrorMsgDispatcher(Resources.StrErrorMsgSentinelCheckEolProgress); return StatusReturn.Failed; } - + SuccessMsgDispatcher(Resources.StrSuccessMsgSentinelCheckEolProgress); ActualProcessProgress++; @@ -154,7 +155,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr ActualProcessProgress = MaxActualProgressSteps; SetOverallProcessTo100Percent(); - + while (_waitOnUserFeedback && SingleProcessState != SingleProcessState.Idle) { } @@ -164,7 +165,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr } catch (Exception e) { - ErrorMsgDispatcher( e.Message); + ErrorMsgDispatcher(e.Message); return StatusReturn.Failed; } } diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/FinalProcessController.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/FinalProcessController.cs index 11d6a882..408c53a3 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/FinalProcessController.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/FinalProcessController.cs @@ -363,10 +363,15 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses break; case ProcessState.DetectCordonel: - // Reset the cancellation request - _cancellationTokenSource?.Dispose(); - _cancellationTokenSource = new CancellationTokenSource(); - _cancellationToken = _cancellationTokenSource.Token; + // Wait for cancellation + if (_cancellationToken.IsCancellationRequested) + { + Thread.Sleep(1000); + // Reset the cancellation request + _cancellationTokenSource?.Dispose(); + _cancellationTokenSource = new CancellationTokenSource(); + _cancellationToken = _cancellationTokenSource.Token; + } // Set up the counter for maximum overall process progress bar in GUI CalcAndPushMaxOverAllProcessSteps(); @@ -572,6 +577,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses /// Clears all collected data on new genesisMeter and reminds the detected for next /// detection and run of this comparison. /// + /// true for new meter /// /// - Initial /// @@ -582,7 +588,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses /// /// - Handle genesis meter is null as new meter. /// - /// true for new meter private Boolean CheckForNewMeter() { if (_genesisMeter == null || @@ -857,10 +862,14 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses /// Check all processes for error or abort request /// /// true if abort required + /// + /// - Cancellation token. + /// private Boolean AnyProcessRequiresAbortion() { return Processes.Any(pp => pp.SingleProcessState == SingleProcessState.Error || - pp.SingleProcessState == SingleProcessState.Abort); + pp.SingleProcessState == SingleProcessState.Abort || + _cancellationToken.IsCancellationRequested); } /// /// Check process if in status waiting or running (incomplete) @@ -944,6 +953,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses /// /// - Abort register access. /// + /// + /// - Cancellation token source. + /// private void KillProcesses() { _cancellationTokenSource?.Cancel();