From 8d1ac8f41df9eae70295925be99d703634d02724 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Mon, 15 Oct 2018 14:42:17 +0200 Subject: [PATCH] (1) 'Max_test_index' added to Results, (2) "Max.test index" added to BenchInfoEx, (3) ResultsTabPageCtrl draws NOK wm-s with max. test index in 'Orange', (4) bug fix in ProductionTracing simulation, ver. 2.18.1027 --- Results/ItemID.cs | 2 ++ Results/Properties/AssemblyInfo.cs | 4 ++-- Results/WMeterRsltItemSpec.cs | 19 ++++++++++-------- .../BenchInfo/Extended/Component.cs | 4 ++++ .../BenchInfo/Extended/ComponentCfg.cs | 20 ++++++++++++++++++- .../BenchInfo/Munich/Component.cs | 3 +++ TBF/BenchControl/GenericDevices/IBenchInfo.cs | 5 ++++- .../Output/DB/ProductionTracing/Tracing.cs | 2 ++ TBF/Properties/AssemblyInfo.cs | 4 ++-- TBF/Screens/ResultsTabPageCtrl.cs | 12 ++++++++++- 10 files changed, 60 insertions(+), 15 deletions(-) diff --git a/Results/ItemID.cs b/Results/ItemID.cs index 2b2b8cb3b..e29294c6a 100644 --- a/Results/ItemID.cs +++ b/Results/ItemID.cs @@ -261,6 +261,8 @@ namespace Results Bench_address4, /// 226 'Address 4' from IBenchInfo Bench_address5, /// 227 'Address 5' from IBenchInfo + Max_test_index, /// 228 MaxPruefindex % 100 + Count, } } diff --git a/Results/Properties/AssemblyInfo.cs b/Results/Properties/AssemblyInfo.cs index 62317bfeb..f031fbd8e 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.1017.0")] -[assembly: AssemblyFileVersion("2.18.1017.0")] +[assembly: AssemblyVersion("2.18.1027.0")] +[assembly: AssemblyFileVersion("2.18.1027.0")] diff --git a/Results/WMeterRsltItemSpec.cs b/Results/WMeterRsltItemSpec.cs index 1269f9cab..52e5a5db1 100644 --- a/Results/WMeterRsltItemSpec.cs +++ b/Results/WMeterRsltItemSpec.cs @@ -409,14 +409,17 @@ namespace Results #endif #if IPERL - AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactor, "iPerl OrigCalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.OrigCalibFactor))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactor, "iPerl CalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactor))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.Q2ErrWOCorrection))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? Strings.Yes : Strings.No))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2CorrRFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRFlow))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2CorrLFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLFlow))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrFlowRight))); - AllItems.Add(new WMeterRsltItemSpec(ItemID.FW_Version, "iPerl FW version", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.FWVersion))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactor, "iPerl OrigCalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.OrigCalibFactor))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactor, "iPerl CalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactor))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection",Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.Q2ErrWOCorrection))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean,ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? Strings.Yes : Strings.No))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2CorrRFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRFlow))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2CorrLFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLFlow))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrFlowRight))); + AllItems.Add(new WMeterRsltItemSpec(ItemID.FW_Version, "iPerl FW version", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.FWVersion))); + #if ORACLE_DB + AllItems.Add(new WMeterRsltItemSpec(ItemID.Max_test_index, "iPerl test index", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, (w.Pruefindex % 100)))); + #endif #endif AllItems.Add(new WMeterRsltItemSpec(ItemID.TestDone, Strings.Test_done + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => FormatBool(f, (w.GetMeterTestRslt(t) != null) && w.GetMeterTestRslt(t).TestDone))); AllItems.Add(new WMeterRsltItemSpec(ItemID.TestPassed, Strings.Test_passed + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => FormatBool(f, (w.GetMeterTestRslt(t) != null) && w.GetMeterTestRslt(t).Passed))); diff --git a/TBF/BenchControl/BenchInfo/Extended/Component.cs b/TBF/BenchControl/BenchInfo/Extended/Component.cs index 2c95e465f..8dddba2c4 100644 --- a/TBF/BenchControl/BenchInfo/Extended/Component.cs +++ b/TBF/BenchControl/BenchInfo/Extended/Component.cs @@ -30,6 +30,10 @@ namespace TBF.BenchControl.BenchInfo.Extended public string Address5 { get { return myCfg.Address5; } } public RemoteDBUse RemoteDBUse { get { return myCfg.RemoteDBUse; } } +#if ORACLE_DB + public int MaxTestIndex { get { return myCfg.MaxTestIndex; } } /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK +#endif + public Component() { } diff --git a/TBF/BenchControl/BenchInfo/Extended/ComponentCfg.cs b/TBF/BenchControl/BenchInfo/Extended/ComponentCfg.cs index 75d5796b0..dbf7efb5c 100644 --- a/TBF/BenchControl/BenchInfo/Extended/ComponentCfg.cs +++ b/TBF/BenchControl/BenchInfo/Extended/ComponentCfg.cs @@ -33,6 +33,9 @@ namespace TBF.BenchControl.BenchInfo.Extended public string ApprovalDate; public string ApprovedBy; public RemoteDBUse RemoteDBUse; +#if ORACLE_DB + public int MaxTestIndex; /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK +#endif /// Private parameterless constructor invoked by all other (public) constructors ComponentCfg() {} @@ -64,6 +67,9 @@ namespace TBF.BenchControl.BenchInfo.Extended ApprovedBy = string.Empty; RemoteDBUse = RemoteDBUse.LocalDBOnly; +#if ORACLE_DB + MaxTestIndex = 4; +#endif } string[] paramNames = new string[] @@ -79,6 +85,9 @@ namespace TBF.BenchControl.BenchInfo.Extended "Approval date", "Approved by", "Remote DB use", +#if ORACLE_DB + "Max.test index", +#endif }; public string ParamName(int i) { return paramNames[i]; } public int ParamsCount() { return paramNames.Length; } @@ -117,6 +126,9 @@ namespace TBF.BenchControl.BenchInfo.Extended case 8: return ApprovalDate; case 9: return ApprovedBy; case 10: return RemoteDBUse.ToDescription(); +#if ORACLE_DB + case 11: return MaxTestIndex.ToString(); +#endif default: return string.Empty; } } @@ -153,7 +165,9 @@ namespace TBF.BenchControl.BenchInfo.Extended } } return CfgUpdateFlags.Error; - +#if ORACLE_DB + case 11: MaxTestIndex = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd; +#endif default: return CfgUpdateFlags.None; } } @@ -176,6 +190,7 @@ namespace TBF.BenchControl.BenchInfo.Extended case 9: return true; case 1: + case 11: if (int.TryParse(strValue, out idummy) && (idummy >= 0)) return true; break; case 10: @@ -206,6 +221,9 @@ namespace TBF.BenchControl.BenchInfo.Extended prms.ApprovalDate = this.ApprovalDate; prms.ApprovedBy = this.ApprovedBy; prms.RemoteDBUse = this.RemoteDBUse; +#if ORACLE_DB + prms.MaxTestIndex = this.MaxTestIndex; +#endif } public Config.Entities.IParamsProvider Clone() diff --git a/TBF/BenchControl/BenchInfo/Munich/Component.cs b/TBF/BenchControl/BenchInfo/Munich/Component.cs index da8f6f8e8..53da1d20b 100644 --- a/TBF/BenchControl/BenchInfo/Munich/Component.cs +++ b/TBF/BenchControl/BenchInfo/Munich/Component.cs @@ -29,6 +29,9 @@ namespace TBF.BenchControl.BenchInfo.Munich public string Address4 { get { return string.Empty; } } public string Address5 { get { return string.Empty; } } public RemoteDBUse RemoteDBUse { get { return RemoteDBUse.LocalDBOnly; } } +#if ORACLE_DB + public int MaxTestIndex { get { return 0; } } +#endif public Component() { diff --git a/TBF/BenchControl/GenericDevices/IBenchInfo.cs b/TBF/BenchControl/GenericDevices/IBenchInfo.cs index ed2ba6e70..3619793ec 100644 --- a/TBF/BenchControl/GenericDevices/IBenchInfo.cs +++ b/TBF/BenchControl/GenericDevices/IBenchInfo.cs @@ -19,5 +19,8 @@ namespace TBF.BenchControl.GenericDevices string Address4 { get; } string Address5 { get; } RemoteDBUse RemoteDBUse { get; } - } +#if ORACLE_DB + int MaxTestIndex { get; } /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK +#endif + } } diff --git a/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs b/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs index 013fcfc36..2c71a1be7 100644 --- a/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs +++ b/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs @@ -99,6 +99,8 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing public void StopDevice() { + if (tracingCfg.DebugLevel == DebugMode.Simulate) return; + using (ISession session = sessionFactory.OpenSession()) { TracingDB.DB.UnregisterWorkplace(session, workplace); diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 49668b1bf..403c974ea 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.1026.0")] -[assembly: AssemblyFileVersion("2.18.1026.0")] +[assembly: AssemblyVersion("2.18.1027.0")] +[assembly: AssemblyFileVersion("2.18.1027.0")] diff --git a/TBF/Screens/ResultsTabPageCtrl.cs b/TBF/Screens/ResultsTabPageCtrl.cs index 0eec1a64f..9c988cacc 100644 --- a/TBF/Screens/ResultsTabPageCtrl.cs +++ b/TBF/Screens/ResultsTabPageCtrl.cs @@ -322,7 +322,17 @@ namespace TBF.Screens ListView GetResultsTestsAreRows(Results.Entities.WaterMeter wMtr, int printedWMNr) { metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single); - Color commonBackColor = wMtr.PassedFromTests() ? Color.LightGreen : (wMtr.CompletedFromTests() ? Color.LightPink : Color.White); + bool wmtrCompleted = wMtr.CompletedFromTests(); + bool wmtrPassed = wMtr.PassedFromTests(); + + Color commonBackColor = wmtrPassed ? Color.LightGreen : (wmtrCompleted ? Color.LightPink : Color.White); +#if ORACLE_DB + if (TBF.BenchControl.Sequences.ProcessData.BenchInfo != null) + { + int maxTrials = TBF.BenchControl.Sequences.ProcessData.BenchInfo.MaxTestIndex; + if (wmtrCompleted && !wmtrPassed && ((wMtr.Pruefindex % 100) >= maxTrials)) commonBackColor = Color.DarkOrange; + } +#endif ListView lview = GetListView(commonBackColor); IList items = GetRsltItems(metersKind);