diff --git a/Results/Forms/BatchResultsDlg.cs b/Results/Forms/BatchResultsDlg.cs index a1a35575c..58ba6d6fb 100644 --- a/Results/Forms/BatchResultsDlg.cs +++ b/Results/Forms/BatchResultsDlg.cs @@ -16,6 +16,16 @@ namespace Results.Forms { static readonly ILog log = LogManager.GetLogger(typeof(BatchResultsDlg)); + + static readonly Color NotCompletedColor = Color.White; + static readonly Color OkColor = Color.LightGreen; + static readonly Color NokColor = Color.LightPink; + static readonly Color RejectColor = Color.Magenta; + static readonly Color ProductionTracing = Color.RoyalBlue; + static readonly Color WrongDirection = Color.Gold; + static readonly Color WrongQ2FactorsColor = Color.Red; + + DateTime lastRedraw; DateTime lastSizeChange; bool loaded; @@ -178,14 +188,16 @@ namespace Results.Forms this.ResumeLayout(false); } + /// /// Get an empty ListView control with appropriate parameters. /// /// ListView control - OneWMResultsCtrl GetListView() + OneWMResultsCtrl GetListView(Color backColor) { - return new OneWMResultsCtrl(Color.White, lvWidth, lvHeight); + return new OneWMResultsCtrl(backColor, lvWidth, lvHeight); } + OneWMResultsCtrl GetListView() { return GetListView(Color.White); } /// @@ -199,8 +211,10 @@ namespace Results.Forms foreach (var mtr in wMtr.MeterTestRslts) { - if (mtr.IsPilotRslt() && mtr.TestDone && (mtr.Publish() != Config.Entities.Publish.Never) - && (mtr.Publish() != Config.Entities.Publish.Internal)) + if ((mtr.CompoundMeterId == (byte)CompoundMeterId.Single || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound || mtr.CompoundMeterId == (byte)CompoundMeterId.HeatMeterEnergy) + && mtr.TestDone + && (mtr.Publish() != Config.Entities.Publish.Never) + && (mtr.Publish() != Config.Entities.Publish.Internal)) { testNames.Add(mtr.Name()); } @@ -209,6 +223,57 @@ namespace Results.Forms return testNames; } + /// + /// Get color for highlighting results and an apporpriate text message. + /// + /// Water meter results entity + /// Appropriate message + /// Color for results + Color GetColorOfResults(Results.Entities.WaterMeter wMtr, out string message) + { + bool wmtrCompleted = wMtr.CompletedFromTests(); + bool wmtrPassed = wMtr.PassedFromTests(); + + if ((wMtr.ErrorFlags & (int)ErrorFlagMask.E28) != 0) + { + message = Strings.Previous_step_is_missing_or_NOK; + return ProductionTracing; + } + else if ((wMtr.ErrorFlags & (int)ErrorFlagMask.E27) != 0) + { + message = Strings.Wrong_iPerl_counting_direction; + return WrongDirection; + } + else if ((wMtr.ErrorFlags & (int)ErrorFlagMask.E26) != 0) + { + message = Strings.Invalid_Q2_correction_factors; + return WrongQ2FactorsColor; + } + else if ((wMtr.ErrorFlags & (int)ErrorFlagMask.E25) != 0) + { + message = Strings.Test_repetition_count_exceeded_upper_limit; + return RejectColor; + } + else if (wmtrPassed) + { + /// Water meter passed (therefore is was also completed) + message = Strings.Passed; + return OkColor; + } + else if (wmtrCompleted) + { + /// Water meter was completed but did not pass => Failed + message = Strings.Failed; + return NokColor; + } + else + { + /// Water meter was not completed yet => did not pass, did not fail + message = Strings.Test_in_progress; + return NotCompletedColor; + } + } + /// /// Get a ListView control filled with results of the meter 'mtr' @@ -219,9 +284,11 @@ namespace Results.Forms { metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single); - OneWMResultsCtrl lview = GetListView(); + string message = string.Empty; + Color commonBackColor = GetColorOfResults(wMtr, out message); + OneWMResultsCtrl lview = GetListView(commonBackColor); #if ORACLE_DB - lview.Caption = string.Format("PCB {0} {1} {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), Strings.repetition, (wMtr.Pruefindex % 100)); + lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message); #else lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr); #endif @@ -289,9 +356,11 @@ namespace Results.Forms { metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single); - OneWMResultsCtrl lview = GetListView(); + string message; + Color commonBackColor = GetColorOfResults(wMtr, out message); + OneWMResultsCtrl lview = GetListView(commonBackColor); #if ORACLE_DB - lview.Caption = string.Format("PCB {0} {1} {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), Strings.repetition, (wMtr.Pruefindex % 100)); + lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message); #else lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr); #endif diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs index 1e6f62bbd..6b6f8270e 100644 --- a/Results/Properties/AssemblyInfo.cs +++ b/Results/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.18.1162.0")] -[assembly: AssemblyFileVersion("2.18.1162.0")] +[assembly: AssemblyVersion("2.18.1166.0")] +[assembly: AssemblyFileVersion("2.18.1166.0")] diff --git a/Results/Resources/Strings.Designer.cs b/Results/Resources/Strings.Designer.cs index d99b31db2..5efbb5155 100644 --- a/Results/Resources/Strings.Designer.cs +++ b/Results/Resources/Strings.Designer.cs @@ -384,6 +384,15 @@ namespace Results.Resources { } } + /// + /// Looks up a localized string similar to NOK. + /// + internal static string Failed { + get { + return ResourceManager.GetString("Failed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Failed meters count. /// @@ -447,6 +456,15 @@ namespace Results.Resources { } } + /// + /// Looks up a localized string similar to Invalid Q2 correction factors. + /// + internal static string Invalid_Q2_correction_factors { + get { + return ResourceManager.GetString("Invalid_Q2_correction_factors", resourceCulture); + } + } + /// /// Looks up a localized string similar to Item. /// @@ -627,6 +645,15 @@ namespace Results.Resources { } } + /// + /// Looks up a localized string similar to OK. + /// + internal static string Passed { + get { + return ResourceManager.GetString("Passed", resourceCulture); + } + } + /// /// Looks up a localized string similar to Passed meters count. /// @@ -663,6 +690,15 @@ namespace Results.Resources { } } + /// + /// Looks up a localized string similar to Previous step is missing or NOK. + /// + internal static string Previous_step_is_missing_or_NOK { + get { + return ResourceManager.GetString("Previous_step_is_missing_or_NOK", resourceCulture); + } + } + /// /// Looks up a localized string similar to Procedure. /// @@ -1032,6 +1068,15 @@ namespace Results.Resources { } } + /// + /// Looks up a localized string similar to Test in progress. + /// + internal static string Test_in_progress { + get { + return ResourceManager.GetString("Test_in_progress", resourceCulture); + } + } + /// /// Looks up a localized string similar to Test method. /// @@ -1050,6 +1095,15 @@ namespace Results.Resources { } } + /// + /// Looks up a localized string similar to Test repetition count exceeded upper limit. + /// + internal static string Test_repetition_count_exceeded_upper_limit { + get { + return ResourceManager.GetString("Test_repetition_count_exceeded_upper_limit", resourceCulture); + } + } + /// /// Looks up a localized string similar to Test vol.. /// @@ -1923,6 +1977,15 @@ namespace Results.Resources { } } + /// + /// Looks up a localized string similar to Wrong iPerl counting direction. + /// + internal static string Wrong_iPerl_counting_direction { + get { + return ResourceManager.GetString("Wrong_iPerl_counting_direction", resourceCulture); + } + } + /// /// Looks up a localized string similar to Year. /// diff --git a/Results/Resources/Strings.cs.resx b/Results/Resources/Strings.cs.resx index b19d3bf94..6f7533d13 100644 --- a/Results/Resources/Strings.cs.resx +++ b/Results/Resources/Strings.cs.resx @@ -258,4 +258,25 @@ opakování + + Nesprávne Q2 korekčné faktory + + + Predchádzajúci krok chýba alebo neprešiel + + + Počet opakovaní testu prekročil dovolené maximum + + + Nesprávny smer počítania iPerlu + + + NOK + + + OK + + + Probíhá test + \ No newline at end of file diff --git a/Results/Resources/Strings.resx b/Results/Resources/Strings.resx index 8506411f4..087105b98 100644 --- a/Results/Resources/Strings.resx +++ b/Results/Resources/Strings.resx @@ -744,4 +744,25 @@ repetition + + Invalid Q2 correction factors + + + Previous step is missing or NOK + + + Test repetition count exceeded upper limit + + + Wrong iPerl counting direction + + + NOK + + + OK + + + Test in progress + \ No newline at end of file diff --git a/Results/Utils.cs b/Results/Utils.cs index 6f0952f4d..763a26da0 100644 --- a/Results/Utils.cs +++ b/Results/Utils.cs @@ -48,14 +48,14 @@ namespace Results /// - /// Converts ErrorFlags integer to string. Supports up to 31 flags (E1..E31). + /// Converts ErrorFlags integer to string. Supports up to 31 flags (E1..E31, i.e. bit0..bit30). /// /// Input /// Output string public static string ErrorFlagsStr(int errorFlags) { StringBuilder sb = new StringBuilder(); - for (int i = 0; i < 30; i++) + for (int i = 0; i < 31; i++) { if ((errorFlags & (1 << i)) != 0) { diff --git a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs index 4afa32167..8063790ae 100644 --- a/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs +++ b/TBF/BenchControl/TestMethods/iPerlCommunication/iPerlCommunicationSeq.cs @@ -49,8 +49,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication /// public IList Execute(Config.Entities.Test test, int repetitionNr, TestMethodCfg cfg, iPerlCommunicationParams testParams) { - IList e = new List(); /// Events from currently running operations - Event retVal = Event.Done; + IList e; /// Events from currently running operations checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state modelessDlg = null; @@ -74,10 +73,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(test.Name, 0))); allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file - IList rList = new List(1); - rList.Add(Event.Done); - return rList; - } + return new List { Event.Done }; + } else if (testParams.Activity.ToLower().Contains(Q2correctionCheckCmd)) { TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 }); @@ -95,9 +92,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(test.Name, 0))); allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file - IList rList = new List(1); - rList.Add(Event.Done); - return rList; + return new List { Event.Done }; } else if (testParams.Activity.ToLower().Contains(IperlCheckCmd)) { @@ -113,108 +108,116 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(test.Name, 0); - int wrongMetersCount = 0; - string message = string.Empty; - - for (int i = 0; i < BatchRslts.WMPositionsCount; i++) + if (tstRslt != null) { - Results.Entities.WaterMeter wm = BatchRslts.WaterMeters[i]; - Results.Entities.MeterTestRslt mtr = ProcessData.BatchRslts.GetMeterTestRslt(test.Name, i, CompoundMeterId.Single); + tstRslt.StartTime = DateTime.Now; - if ((wm != null) && (mtr != null)) + int wrongMetersCount = 0; + string message = string.Empty; + + for (int i = 0; i < BatchRslts.WMPositionsCount; i++) { - int errorIndicators = 0; - bool anyErrorOfThisMeter = false; - foreach (var arg in args) + Results.Entities.WaterMeter wm = BatchRslts.WaterMeters[i]; + Results.Entities.MeterTestRslt mtr = ProcessData.BatchRslts.GetMeterTestRslt(test.Name, i, CompoundMeterId.Single); + + ///// Reference to iPerl water meter or null: + //TestMethods.iPerlCommunication.iPerlHead.IperlHead iPerlHead = ((sensPath.RegisterReaders != null) && (i < sensPath.RegisterReaders.Length)) + // ? (sensPath.RegisterReaders[i] as TestMethods.iPerlCommunication.iPerlHead.IperlHead) + // : null; + + if ((wm != null) && (mtr != null)) { -#if ORACLE_DB - if (arg.ToLower() == "pruefindex") + int errorIndicators = 0; + bool anyErrorOfThisMeter = false; + foreach (var arg in args) { - if (wm.Pruefindex > maxTestIndex) +#if ORACLE_DB + if (arg.ToLower() == "pruefindex") { - anyErrorOfThisMeter = true; - message += string.Format("iPerl{0} : Príliš veľa opakovaní testu vodomera{1}", wm.WMPosition, Environment.NewLine); - errorIndicators |= (int)ErrorFlagMask.E25; /// Max pruefindex exceeded + if (wm.Pruefindex > maxTestIndex) + { + anyErrorOfThisMeter = true; + message += string.Format("iPerl{0} : Príliš veľa opakovaní testu vodomera{1}", wm.WMPosition, Environment.NewLine); + errorIndicators |= (int)ErrorFlagMask.E25; /// Max pruefindex exceeded + } } - } #endif #if TURA_SPECIAL if (arg.ToLower() == "q2factors") { if ((wm.ProdQ2CorrRL != wm.Q2CorrRL) || (wm.ProdQ2CorrLR != wm.Q2CorrLR)) { - anyMeterError = true; + anyErrorOfThisMeter = true; message += string.Format("Q2 korekčné faktory vodomera {0} nesedia{1}", wm.WMPosition, Environment.NewLine); errorIndicators |= (int)ErrorFlagMask.E26; /// Q2 correction factors not valid } } #endif - if (arg.ToLower() == "direction") - { - //if (wm.Pruefindex > maxTestIndex) - //{ - // anyErrorOfThisMeter = true; - // message += string.Format("Príliš veľa opakovaní testu vodomera {0}{1}", wm.WMPosition, Environment.NewLine); - // errorIndicators |= (int)ErrorFlagMask.E27; /// Wrong direction (positive/negative counting) - //} - } - - if (arg.ToLower() == "prevworkstep") - { - if (!wm.IsLastRecordOk) + if (arg.ToLower() == "direction") { - anyErrorOfThisMeter = true; - message += string.Format("iPerl{0} : Predchádzajúci krok nebol zaznamenaný{1}", wm.WMPosition, Environment.NewLine); - errorIndicators |= (int)ErrorFlagMask.E28; /// Previous workstep missing or NOK (production tracing) + //if (wm.Pruefindex > maxTestIndex) + //{ + // anyErrorOfThisMeter = true; + // message += string.Format("Príliš veľa opakovaní testu vodomera {0}{1}", wm.WMPosition, Environment.NewLine); + // errorIndicators |= (int)ErrorFlagMask.E27; /// Wrong direction (positive/negative counting) + //} + } + + if (arg.ToLower() == "prevworkstep") + { + if (!wm.IsLastRecordOk) + { + anyErrorOfThisMeter = true; + message += string.Format("iPerl{0} : Predchádzajúci krok nebol zaznamenaný{1}", wm.WMPosition, Environment.NewLine); + errorIndicators |= (int)ErrorFlagMask.E28; /// Previous workstep missing or NOK (production tracing) + } } } - } - mtr.TestDone = true; - mtr.ErrorIndicators = errorIndicators; - /// - if (anyErrorOfThisMeter) - { - /// This iPerl check did not pass - mtr.Passed = false; - wm.Disabled = true; - wrongMetersCount++; + mtr.TestDone = true; + mtr.ErrorIndicators = errorIndicators; + /// + if (anyErrorOfThisMeter) + { + /// This iPerl check did not pass + mtr.Passed = false; + wrongMetersCount++; + } + else + { + /// Check passed OK + mtr.Passed = true; + } } - else + } + + tstRslt.EndTime = DateTime.Now; + tstRslt.TestDone = true; + + Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.Completed)); + Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, tstRslt)); + allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file + + if (wrongMetersCount >= cfg.IperlCheckErrorsToStop) + { + State.Create("iPerlCommunicationSeq : Show check result") + .AddOperation(new Operations.LargeMessageBoxOp(message)) + .EnterState(); + do { - /// Check passed OK - mtr.Passed = true; + e = StateMachine.WaitRunDevsRunOps(); + } + while (!e.Contains(Event.Continue) && !e.Contains(Event.Abort)); + + if (e.Contains(Event.Abort)) + { + Bridge.OnError(this, string.Format("Niečo nie je v poriadku !")); + return new List { Event.UiCmdStop }; } } } - Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.Completed)); - Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(test.Name, 0))); - allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file - - IList rList = new List(1); - - if (wrongMetersCount >= cfg.IperlCheckErrorsToStop) - { - State.Create("iPerlCommunicationSeq : Show check result") - .AddOperation(new Operations.LargeMessageBoxOp(message)) - .EnterState(); - do - { - e = StateMachine.WaitRunDevsRunOps(); - } - while (!e.Contains(Event.Continue) && !e.Contains(Event.Abort)); - - if (e.Contains(Event.Abort)) - { - Bridge.OnError(this, string.Format("Niečo nie je v poriadku !")); - rList.Add(Event.UiCmdStop); - return rList; - } - } - - rList.Add(Event.Done); - return rList; + return new List { Event.Done }; } else if (testParams.Activity.ToLower().Contains("simulate ")) { @@ -243,7 +246,10 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication .EnterState(); e = StateMachine.WaitRunDevsRunOps(); - if (TestAndLogUiCmdStop(test,e)) retVal = Event.UiCmdStop; + if (TestAndLogUiCmdStop(test, e)) + { + return new List { Event.UiCmdStop }; + } } else { @@ -274,7 +280,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication if (stopPressed) { CloseIPerlCommForm(); - retVal = Event.UiCmdStop; + return new List { Event.UiCmdStop }; } else { @@ -286,9 +292,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication } /// Create a list with one item 'retVal' (default is Event.Done) and return it - IList retList = new List(1); - retList.Add(retVal); - return retList; + return new List { Event.Done }; } diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 1adb05748..ab105d835 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.18.1165.0")] -[assembly: AssemblyFileVersion("2.18.1165.0")] +[assembly: AssemblyVersion("2.18.1167.0")] +[assembly: AssemblyFileVersion("2.18.1167.0")] diff --git a/TBF/Screens/ResultsTabPageCtrl.cs b/TBF/Screens/ResultsTabPageCtrl.cs index 2b06b11fc..dfdcf936a 100644 --- a/TBF/Screens/ResultsTabPageCtrl.cs +++ b/TBF/Screens/ResultsTabPageCtrl.cs @@ -309,6 +309,7 @@ namespace TBF.Screens { return new OneWMResultsCtrl(backColor, lvWidth, lvHeight); } + OneWMResultsCtrl GetListView() { return GetListView(Color.White); } /// @@ -376,7 +377,7 @@ namespace TBF.Screens /// Water meter was completed but did not pass => Failed #if ORACLE_DB if ((TBF.BenchControl.Sequences.ProcessData.BenchInfo is TBF.BenchControl.BenchInfo.iPerl.Component) && - wMtr.Pruefindex >= (TBF.BenchControl.Sequences.ProcessData.BenchInfo as TBF.BenchControl.BenchInfo.iPerl.Component).MaxTestIndex) + (wMtr.Pruefindex % 100) >= (TBF.BenchControl.Sequences.ProcessData.BenchInfo as TBF.BenchControl.BenchInfo.iPerl.Component).MaxTestIndex) { /// Proefindex reached the limit => Proefindex would be above this limit next time => Reject message = Strings.Test_repetition_count_exceeded_upper_limit;