From 30c8433cb0bed3d3054d01ae925a0deebc3797b1 Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Mon, 8 Nov 2021 11:45:40 +0100 Subject: [PATCH] Results.Entities.WaterMeter bug fixes, style changes. --- Results/Entities/WaterMeter.cs | 79 ++++++++++++++++--------------- Results/Mappings/WaterMeterMap.cs | 2 +- Results/WMeterRsltItemSpec.cs | 10 ++-- 3 files changed, 48 insertions(+), 43 deletions(-) diff --git a/Results/Entities/WaterMeter.cs b/Results/Entities/WaterMeter.cs index dc0f4e3c0..0ce6cac7b 100644 --- a/Results/Entities/WaterMeter.cs +++ b/Results/Entities/WaterMeter.cs @@ -93,16 +93,16 @@ namespace Results.Entities public virtual string Prefix { get; set; } public virtual string Suffix { get; set; } public virtual string CompleteSerialNr { get; set; } - public virtual string OriRadioAddress { get; set; } /// Not mapped to DB !!! Original radio address of a 640 water meter (albatrosID) + 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 HydrPruefung { get; set; } - public virtual object RawTestInfos { get; set; } /// IList fetched from Oracle at the beginning of the cycle, not mapped to DB !!! - public virtual object CompleteTestInfos { get; set; } /// SensusTestInfo[] obtained as a best match at the beginning of the cycle, not mapped to DB !!! + 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 !!! #endif - public virtual int ProcessId { get; set; } /// Not mapped to DB !!! Tracing DB Process ID - public virtual int SessionId { get; set; } /// Not mapped to DB !!! 1 (regular tracing DB session) or 2 (alternative tracing DB session) - public virtual bool LastRecordIsNok { get; set; } /// Not mapped to DB !!! Previous record verification result + public virtual int ProcessId { get; set; } /// Not mapped to DB !!! Tracing DB Process ID + public virtual int SessionId { get; set; } /// Not mapped to DB !!! 1 (regular tracing DB session) or 2 (alternative tracing DB session) + public virtual bool LastRecordIsNok { get; set; } /// Not mapped to DB !!! Previous record verification result public virtual WaterMeterData WaterMeterData { get; set; } public virtual Batch Batch { get; set; } @@ -418,11 +418,31 @@ namespace Results.Entities public WaterMeter() { MeterTestRslts = new List(); + + /// Initialize strings + SerialNr = string.Empty; + SerialNrAux = string.Empty; + RadioAddress = string.Empty; + PurchaseOrder = string.Empty; + EndState = string.Empty; + EndStateAux = string.Empty; + ErrorFlags = 0; + InfoFlags = 0; + ArchivePath = string.Empty; + Remark = string.Empty; +#if IPERL + FWVersion = string.Empty; +#endif +#if TURA_SPECIAL + ProdUserName = string.Empty; + ProdPurchaseOrder = string.Empty; +#endif #if ORACLE_DB AssignedSerialNr = 0; Prefix = string.Empty; Suffix = string.Empty; CompleteSerialNr = string.Empty; + OriRadioAddress = string.Empty; WMTypeRevision = 0; Pruefindex = 1; HydrPruefung = 0; @@ -431,25 +451,7 @@ namespace Results.Entities #endif ProcessId = 0; SessionId = 0; - ErrorFlags = 0; LastRecordIsNok = false; - - /// Initialize strings - SerialNr = string.Empty; - SerialNrAux = string.Empty; - PurchaseOrder = string.Empty; - EndState = string.Empty; - EndStateAux = string.Empty; - ArchivePath = string.Empty; - Remark = string.Empty; -#if TURA_SPECIAL - RadioAddress = string.Empty; - ProdUserName = string.Empty; - ProdPurchaseOrder = string.Empty; -#endif -#if IPERL - FWVersion = string.Empty; -#endif } @@ -459,6 +461,7 @@ namespace Results.Entities SerialNr = src.SerialNr; SerialNrAux = src.SerialNrAux; + RadioAddress = src.RadioAddress; PurchaseOrder = src.PurchaseOrder; YearOfProduction = src.YearOfProduction; WMPosition = src.WMPosition; @@ -487,23 +490,23 @@ namespace Results.Entities FWVersion = src.FWVersion; #endif #if TURA_SPECIAL - RadioAddress = src.RadioAddress; - PaletteNr = src.PaletteNr; - UmkartonNr = src.UmkartonNr; - ProdTestBench = src.ProdTestBench; - ProdWMPosition = src.ProdWMPosition; - ProdUserName = src.ProdUserName; - ProdPurchaseOrder = src.ProdPurchaseOrder; - ProdPassed = src.ProdPassed; - ProdResultCode = src.ProdResultCode; - ProdQ2CorrRL = src.ProdQ2CorrRL; - ProdQ2CorrLR = src.ProdQ2CorrLR; + PaletteNr = src.PaletteNr; + UmkartonNr = src.UmkartonNr; + ProdTestBench = src.ProdTestBench; + ProdWMPosition = src.ProdWMPosition; + ProdUserName = src.ProdUserName; + ProdPurchaseOrder = src.ProdPurchaseOrder; + ProdPassed = src.ProdPassed; + ProdResultCode = src.ProdResultCode; + ProdQ2CorrRL = src.ProdQ2CorrRL; + ProdQ2CorrLR = src.ProdQ2CorrLR; #endif #if ORACLE_DB AssignedSerialNr = src.AssignedSerialNr; Prefix = src.Prefix; Suffix = src.Suffix; CompleteSerialNr = src.CompleteSerialNr; + OriRadioAddress = src.OriRadioAddress; WMTypeRevision = src.WMTypeRevision; Pruefindex = src.Pruefindex; HydrPruefung = src.HydrPruefung; @@ -640,6 +643,7 @@ namespace Results.Entities writer.Write(Id); writer.Write((SerialNr != null) ? SerialNr : string.Empty); writer.Write((SerialNrAux != null) ? SerialNrAux : string.Empty); + writer.Write((RadioAddress != null) ? RadioAddress : string.Empty); writer.Write((PurchaseOrder != null) ? PurchaseOrder : string.Empty); writer.Write(YearOfProduction); writer.Write(WMPosition); @@ -668,7 +672,6 @@ namespace Results.Entities writer.Write((FWVersion != null) ? FWVersion : string.Empty); #endif #if TURA_SPECIAL - writer.Write((RadioAddress != null) ? RadioAddress : string.Empty); writer.Write(PaletteNr); writer.Write(UmkartonNr); writer.Write((ProdTestBench != null) ? ProdTestBench : string.Empty); @@ -685,6 +688,7 @@ namespace Results.Entities writer.Write((Prefix != null) ? Prefix : string.Empty); writer.Write((Suffix != null) ? Suffix : string.Empty); writer.Write((CompleteSerialNr != null) ? CompleteSerialNr : string.Empty); + writer.Write((OriRadioAddress != null) ? OriRadioAddress : string.Empty); writer.Write(WMTypeRevision); writer.Write(Pruefindex); writer.Write(HydrPruefung); @@ -735,6 +739,7 @@ namespace Results.Entities Id = reader.ReadInt32(); SerialNr = reader.ReadString(); SerialNrAux = reader.ReadString(); + RadioAddress = reader.ReadString(); PurchaseOrder = reader.ReadString(); YearOfProduction = reader.ReadInt32(); WMPosition = reader.ReadInt32(); @@ -763,7 +768,6 @@ namespace Results.Entities FWVersion = reader.ReadString(); #endif #if TURA_SPECIAL - RadioAddress = reader.ReadString(); PaletteNr = reader.ReadInt32(); UmkartonNr = reader.ReadInt32(); ProdTestBench = reader.ReadString(); @@ -780,6 +784,7 @@ namespace Results.Entities Prefix = reader.ReadString(); Suffix = reader.ReadString(); CompleteSerialNr = reader.ReadString(); + OriRadioAddress = reader.ReadString(); WMTypeRevision = reader.ReadInt32(); Pruefindex = reader.ReadInt32(); HydrPruefung = reader.ReadInt32(); diff --git a/Results/Mappings/WaterMeterMap.cs b/Results/Mappings/WaterMeterMap.cs index 568c37012..d95887032 100644 --- a/Results/Mappings/WaterMeterMap.cs +++ b/Results/Mappings/WaterMeterMap.cs @@ -61,9 +61,9 @@ namespace Results.Mappings Map(x => x.Suffix); Map(x => x.CompleteSerialNr); Map(x => x.OriRadioAddress); + Map(x => x.WMTypeRevision); Map(x => x.Pruefindex); Map(x => x.HydrPruefung); - Map(x => x.WMTypeRevision); #endif References(x => x.WaterMeterData); References(x => x.Batch); diff --git a/Results/WMeterRsltItemSpec.cs b/Results/WMeterRsltItemSpec.cs index dbf0d61dc..ddf1d0315 100644 --- a/Results/WMeterRsltItemSpec.cs +++ b/Results/WMeterRsltItemSpec.cs @@ -24,7 +24,7 @@ namespace Results public readonly ItemCategory Category; /// public string Caption; /// Specifies item description to be printed as a caption (in the header, etc.) public string TestID; /// Specifies the test - public Config.Unit Units; /// Specifies units for the output + public Unit Units; /// Specifies units for the output public string Format; /// Specifies format for the output public string Precision; /// Specifies precision for the output public int Width; /// Specifies the number of characters of the output, 0 = automatic @@ -46,7 +46,7 @@ namespace Results /// /// Function to pick a MeterTestResult field and convert it into a string /// - public delegate string PrintDlgt(WaterMeter waterMeterResult, string testID, Config.Unit units, string format, string precision); + public delegate string PrintDlgt(WaterMeter waterMeterResult, string testID, Unit units, string format, string precision); private readonly PrintDlgt printDlgt; @@ -660,7 +660,7 @@ namespace Results return string.IsNullOrEmpty(format) ? value.ToString() : string.Format(format, value); } - public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v) + public static string FormatDbl(Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v) { return FormatDbl(units, format, precisionOrEmpty, dfltPrecision, v, CultureInfo.CurrentCulture); } @@ -697,12 +697,12 @@ namespace Results } } - public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v1, double v2) + public static string FormatDbl(Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v1, double v2) { return FormatDbl(units, format, precisionOrEmpty, dfltPrecision, v1, v2, CultureInfo.CurrentCulture); } /// - public static string FormatDbl(Config.Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v1, double v2, CultureInfo ci) + public static string FormatDbl(Unit units, string format, string precisionOrEmpty, string dfltPrecision, double v1, double v2, CultureInfo ci) { double val1 = Config.Units.ConvertTo(units, v1); double val2 = Config.Units.ConvertTo(units, v2);