diff --git a/Results/Entities/WaterMeter.cs b/Results/Entities/WaterMeter.cs index 0ce6cac7b..5ebed0984 100644 --- a/Results/Entities/WaterMeter.cs +++ b/Results/Entities/WaterMeter.cs @@ -95,7 +95,7 @@ namespace Results.Entities public virtual string CompleteSerialNr { get; set; } public virtual string OriRadioAddress { get; set; } /// Original radio address of a 640 water meter (AlbatrosID) public virtual int WMTypeRevision { get; set; } - public virtual int Pruefindex { get; set; } /// >= 1 ... pruefindex + public virtual int Pruefindex { get; set; } /// >=1 ... pruefindex, 0 ... unknown (no reading from DB yet) public virtual int HydrPruefung { get; set; } public virtual object RawTestInfos { get; set; } /// Not mapped to DB !!! IList fetched from Oracle at the beginning of the cycle, not mapped to DB !!! public virtual object CompleteTestInfos { get; set; } /// Not mapped to DB !!! SensusTestInfo[] obtained as a best match at the beginning of the cycle, not mapped to DB !!! @@ -444,7 +444,7 @@ namespace Results.Entities CompleteSerialNr = string.Empty; OriRadioAddress = string.Empty; WMTypeRevision = 0; - Pruefindex = 1; + Pruefindex = 0; HydrPruefung = 0; RawTestInfos = null; CompleteTestInfos = null; diff --git a/Results/Forms/OneWMResultsColumnsCtrl.Designer.cs b/Results/Forms/OneWMResultsColumnsCtrl.Designer.cs index ca8e0a63a..f8b41435f 100644 --- a/Results/Forms/OneWMResultsColumnsCtrl.Designer.cs +++ b/Results/Forms/OneWMResultsColumnsCtrl.Designer.cs @@ -41,6 +41,7 @@ // this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.splitContainer1.Location = new System.Drawing.Point(0, 0); this.splitContainer1.Name = "splitContainer1"; this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; @@ -48,12 +49,13 @@ // splitContainer1.Panel1 // this.splitContainer1.Panel1.Controls.Add(this.tBox); + this.splitContainer1.Panel1MinSize = 26; // // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.lView); this.splitContainer1.Size = new System.Drawing.Size(352, 318); - this.splitContainer1.SplitterDistance = 25; + this.splitContainer1.SplitterDistance = 26; this.splitContainer1.SplitterWidth = 1; this.splitContainer1.TabIndex = 0; // @@ -62,7 +64,7 @@ this.tBox.Dock = System.Windows.Forms.DockStyle.Fill; this.tBox.Location = new System.Drawing.Point(0, 0); this.tBox.Name = "tBox"; - this.tBox.Size = new System.Drawing.Size(352, 20); + this.tBox.Size = new System.Drawing.Size(352, 26); this.tBox.TabIndex = 0; this.tBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tBox_MouseDoubleClick); // @@ -73,17 +75,17 @@ this.lView.GridLines = true; this.lView.Location = new System.Drawing.Point(0, 0); this.lView.Name = "lView"; - this.lView.Size = new System.Drawing.Size(352, 292); + this.lView.Size = new System.Drawing.Size(352, 291); this.lView.TabIndex = 0; this.lView.UseCompatibleStateImageBehavior = false; this.lView.View = System.Windows.Forms.View.Details; // - // OneWMResultsCtrl + // OneWMResultsColumnsCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.splitContainer1); - this.Name = "OneWMResultsCtrl"; + this.Name = "OneWMResultsColumnsCtrl"; this.Size = new System.Drawing.Size(352, 318); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel1.PerformLayout(); diff --git a/Results/Forms/OneWMResultsColumnsCtrl.cs b/Results/Forms/OneWMResultsColumnsCtrl.cs index 7ddcf6faa..03b3469dd 100644 --- a/Results/Forms/OneWMResultsColumnsCtrl.cs +++ b/Results/Forms/OneWMResultsColumnsCtrl.cs @@ -85,7 +85,11 @@ namespace Results.Forms /// Update caption #if ORACLE_DB - tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message); + tBox.Text = caption = string.Format("{0} ({1}) {2} {3}", + wMtr.WMPosition, + wMtr.Pruefindex == 0 ? "?" : string.Format("{0}x", wMtr.Pruefindex % 100), + (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), + message); #else tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr); #endif diff --git a/Results/Forms/OneWMResultsRowsCtrl.Designer.cs b/Results/Forms/OneWMResultsRowsCtrl.Designer.cs index 3319e17a6..8f8fb3be3 100644 --- a/Results/Forms/OneWMResultsRowsCtrl.Designer.cs +++ b/Results/Forms/OneWMResultsRowsCtrl.Designer.cs @@ -48,21 +48,23 @@ // splitContainer1.Panel1 // this.splitContainer1.Panel1.Controls.Add(this.tBox); + this.splitContainer1.Panel1MinSize = 26; // // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.lView); this.splitContainer1.Size = new System.Drawing.Size(352, 318); - this.splitContainer1.SplitterDistance = 25; + this.splitContainer1.SplitterDistance = 26; this.splitContainer1.SplitterWidth = 1; this.splitContainer1.TabIndex = 0; // // tBox // this.tBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.tBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.tBox.Location = new System.Drawing.Point(0, 0); this.tBox.Name = "tBox"; - this.tBox.Size = new System.Drawing.Size(352, 20); + this.tBox.Size = new System.Drawing.Size(352, 26); this.tBox.TabIndex = 0; this.tBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tBox_MouseDoubleClick); // @@ -73,17 +75,17 @@ this.lView.GridLines = true; this.lView.Location = new System.Drawing.Point(0, 0); this.lView.Name = "lView"; - this.lView.Size = new System.Drawing.Size(352, 292); + this.lView.Size = new System.Drawing.Size(352, 291); this.lView.TabIndex = 0; this.lView.UseCompatibleStateImageBehavior = false; this.lView.View = System.Windows.Forms.View.Details; // - // OneWMResultsCtrl + // OneWMResultsRowsCtrl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.splitContainer1); - this.Name = "OneWMResultsCtrl"; + this.Name = "OneWMResultsRowsCtrl"; this.Size = new System.Drawing.Size(352, 318); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel1.PerformLayout(); diff --git a/Results/Forms/OneWMResultsRowsCtrl.cs b/Results/Forms/OneWMResultsRowsCtrl.cs index 6534a5ca6..01f17a42d 100644 --- a/Results/Forms/OneWMResultsRowsCtrl.cs +++ b/Results/Forms/OneWMResultsRowsCtrl.cs @@ -97,7 +97,11 @@ namespace Results.Forms /// Update caption #if ORACLE_DB - tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message); + tBox.Text = caption = string.Format("{0} ({1}) {2} {3}", + wMtr.WMPosition, + wMtr.Pruefindex == 0 ? "?" : string.Format("{0}x", wMtr.Pruefindex % 100), + (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), + message); #else tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr); #endif diff --git a/Results/Output/SensusTestInfo.cs b/Results/Output/SensusTestInfo.cs index 3b63396b8..2d5f2198b 100644 --- a/Results/Output/SensusTestInfo.cs +++ b/Results/Output/SensusTestInfo.cs @@ -102,7 +102,8 @@ namespace Results.Output } /// - /// Determines whether test infos are compatible with procedure tests. + /// Determines whether test infos are compatible with procedure tests: + /// For each 'cti'in candidate SensusTestInfo array there must exist a string 'cti.TestName' in testNames. /// /// true when compatible public static bool AreCompatible(SensusTestInfo[] completeTestInfo, IList testNames) @@ -127,7 +128,9 @@ namespace Results.Output /// - /// Determines whether Oracle and complete test infos are compatible. + /// Determines whether Oracle and complete test infos are compatible: + /// For each 'oti' in OracleTestInfo there must exist a compatible ... + /// ... cti.PruefungsNrDB + cti.QBezeichnungDB pair in candidate SensusTestInfo. /// /// true when compatible public static bool AreCompatible(IList oracleTestInfo, SensusTestInfo[] completeTestInfo) diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index 65d24ca09..ef5605a28 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.27.1917.0")] -[assembly: AssemblyFileVersion("2.27.1917.0")] +[assembly: AssemblyVersion("2.28.1921.0")] +[assembly: AssemblyFileVersion("2.28.1921.0")] diff --git a/TBF/Rig/Output/DB/SensusOracle/Database.cs b/TBF/Rig/Output/DB/SensusOracle/Database.cs index 335eb286e..bbee2558c 100644 --- a/TBF/Rig/Output/DB/SensusOracle/Database.cs +++ b/TBF/Rig/Output/DB/SensusOracle/Database.cs @@ -526,7 +526,6 @@ namespace TBF.Rig.Output.DB.SensusOracle int pruefreiheID = 0; int wmPosition = 0; bool passed = false; - int resultCode = 0; int userId = 0; int q2CorrectionRL = 0; int q2CorrectionLR = 0; @@ -560,8 +559,9 @@ namespace TBF.Rig.Output.DB.SensusOracle /// /// Water meter with given PCB number was not found in ORACLE /// - log.ErrorFormat("Water meter {0} was not found in ORACLE database.", wm.SerialNr); dr.Close(); + wm.Pruefindex = 1; + log.ErrorFormat("Water meter {0} was not found in ORACLE database.", wm.SerialNr); return StartInfoIsRequired ? Retv.Error : Retv.OK; } dr.Close(); @@ -663,7 +663,7 @@ namespace TBF.Rig.Output.DB.SensusOracle /// /// Copy acquired data to WaterMeter object /// - wm.Pruefindex = maxPruefindex + 1; /// Increment the proefindex from Oracle so that it is the pruefindex of the current cycle + wm.Pruefindex = Math.Max(1, maxPruefindex + 1); /// Increment the proefindex from Oracle so that it is the pruefindex of the current cycle log.InfoFormat("Data of water meter {0} successfully read from ORACLE database.", wm.SerialNr); log.DebugFormat(" MaxPruefindex = {0}", wm.Pruefindex); #if TURA_SPECIAL diff --git a/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs b/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs index 6c315db1a..80e79313e 100644 --- a/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs +++ b/TBF/Rig/TestMethods/iPerlCommunication/iPerlCommunicationForm.cs @@ -2366,6 +2366,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication static CommErr InitOrReadQ2Corrections(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr) { if (ihead.CommFailed) return CommErr.CommFailed; + if (wm.Pruefindex == 0) return CommErr.CommFailed; /// Unknown pruefindex if (wm.Pruefindex == 1) { diff --git a/TBF/Rig/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs b/TBF/Rig/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs index 1ad1bc6e0..0b61de753 100644 --- a/TBF/Rig/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs +++ b/TBF/Rig/TestMethods/iPerlCommunication/iPerlHead/IperlHead.cs @@ -1,9 +1,11 @@ /// -/// Copyright (c) 2015-2021 Sensus Slovensko a.s. +/// Copyright (c) 2015-2022 Sensus Slovensko a.s. /// using System; +using System.Collections.Generic; using System.IO; using System.IO.Ports; +using System.Linq; using log4net; using Common; using Common.Iperl; @@ -398,11 +400,11 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead : base(cfg) { iperlHeadCfg = cfg as IperlHeadCfg; - x = new float[FeatureVectorSize]; } public override void Initialize() { + x = new float[FeatureVectorSize]; flowDirectionDetection = new FlowDirectionDetection(); /// Allocate memory for opto-data from iPerl @@ -748,20 +750,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead /// Select or create appropriate 'qBezeichnung' /// string fullTestName = Results.Utils.GetTestName(testName, testRepeats, repetitionNr); - string qBezeichnungOpto = null; /// To be determined from TestInfo-s (if there are any) - foreach (var ti in testInfos) - { - if ((ti.PruefungsNrOpto != 0) && (ti.TestName == fullTestName)) - { - qBezeichnungOpto = string.IsNullOrEmpty(ti.QBezeichnungOpto) ? ti.PruefungsNrOpto.ToString("D2") : ti.QBezeichnungOpto; - break; - } - } - if (qBezeichnungOpto == null) - { - qBezeichnungOpto = fullTestName; /// No appropriate TestInfo found => set default opto data file name - } - + var ti = testInfos.FirstOrDefault(x => x.PruefungsNrOpto != 0 && x.TestName == fullTestName); + string qBezeichnung = (ti == null) ? fullTestName /// No appropriate TestInfo found => set default opto data file name + : string.IsNullOrEmpty(ti.QBezeichnungOpto) ? ti.PruefungsNrOpto.ToString("D2") + : ti.QBezeichnungOpto; /// /// Get other required pieces of information /// @@ -773,7 +765,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead /// /// Return the file name /// - return string.Format("{0}_{1}_{2}_{3}.txt", pcbNr, wmPosition, qBezeichnungOpto, cycleStartTime); + return string.Format("{0}_{1}_{2}_{3}.txt", pcbNr, wmPosition, qBezeichnung, cycleStartTime); }