Changes for Xylem Nanjing, ver. 3.1.1676
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2019-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using Common;
|
||||
|
||||
namespace TBF.Rig.DataContainer.BackupAndSecurityOptions
|
||||
{
|
||||
@@ -31,8 +32,8 @@ namespace TBF.Rig.DataContainer.BackupAndSecurityOptions
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
Users.GlobalData.MinPasswdLength = myCfg.MinPasswdLength;
|
||||
Users.GlobalData.PasswdExpirationPeriodDays = myCfg.PasswdExpirationPeriodDays;
|
||||
GlobalData.MinPasswdLength = myCfg.MinPasswdLength;
|
||||
GlobalData.PasswdExpirationPeriodDays = myCfg.PasswdExpirationPeriodDays;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
@@ -12,7 +13,7 @@ namespace TBF.Rig.DataContainer.BackupAndSecurityOptions
|
||||
/// <summary>
|
||||
/// Holds backup and security options - serializable configuration.
|
||||
/// </summary>
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
@@ -106,7 +107,7 @@ namespace TBF.Rig.DataContainer.BackupAndSecurityOptions
|
||||
prms.PasswdExpirationPeriodDays = this.PasswdExpirationPeriodDays;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
ComponentCfg pars = new ComponentCfg();
|
||||
CopyContentTo(pars);
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
///
|
||||
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig;
|
||||
using TBF.Rig.Generic;
|
||||
@@ -21,14 +22,21 @@ namespace TBF.Rig.DataContainer.BenchInfo
|
||||
|
||||
readonly ComponentCfg myCfg;
|
||||
|
||||
public string TestBenchName { get { return myCfg.TestBenchName; } }
|
||||
public int TestBenchId { get { return myCfg.TestBenchId; } }
|
||||
public string Address1 { get { return myCfg.Address1; } }
|
||||
public string Address2 { get { return myCfg.Address2; } }
|
||||
public string Address3 { get { return myCfg.Address3; } }
|
||||
public string Address4 { get { return myCfg.Address4; } }
|
||||
public string Address5 { get { return myCfg.Address5; } }
|
||||
public RemoteDBUse RemoteDBUse { get { return myCfg.RemoteDBUse; } }
|
||||
public string TestBenchName { get { return myCfg.TestBenchName; } }
|
||||
public int TestBenchId { get { return myCfg.TestBenchId; } }
|
||||
public string Address1 { get { return myCfg.Address1; } }
|
||||
public string Address2 { get { return myCfg.Address2; } }
|
||||
public string Address3 { get { return myCfg.Address3; } }
|
||||
public string Address4 { get { return myCfg.Address4; } }
|
||||
public string Address5 { get { return myCfg.Address5; } }
|
||||
public int WaterMetersCount { get { return myCfg.WaterMetersCount; } }
|
||||
public int LinesCount { get { return myCfg.LinesCount; } }
|
||||
public int CompoundMetersCount { get { return myCfg.CompoundMetersCount; } }
|
||||
|
||||
public ICollection<ProcedureSelection> Source
|
||||
{
|
||||
get { return new ProcedureSelection[] { myCfg.Source1, myCfg.Source2, myCfg.Source3, myCfg.Source4 }; }
|
||||
}
|
||||
|
||||
|
||||
public Component() { }
|
||||
@@ -42,7 +50,7 @@ namespace TBF.Rig.DataContainer.BenchInfo
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
Events.DB.SetBenchName(myCfg.TestBenchName);
|
||||
SharedDatabase.EventsDB.SetBenchName(myCfg.TestBenchName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
@@ -12,7 +13,7 @@ namespace TBF.Rig.DataContainer.BenchInfo
|
||||
/// <summary>
|
||||
/// Holds information identifying the test bench - serializable configuration.
|
||||
/// </summary>
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
@@ -22,17 +23,23 @@ namespace TBF.Rig.DataContainer.BenchInfo
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public string TestBenchName;
|
||||
public int TestBenchId;
|
||||
public string Address1;
|
||||
public string Address2;
|
||||
public string Address3;
|
||||
public string Address4;
|
||||
public string Address5;
|
||||
public string ApprovalId;
|
||||
public string ApprovalDate;
|
||||
public string ApprovedBy;
|
||||
public RemoteDBUse RemoteDBUse;
|
||||
public string TestBenchName; /// 0
|
||||
public int TestBenchId; /// 1
|
||||
public string Address1; /// 2
|
||||
public string Address2; /// 3
|
||||
public string Address3; /// 4
|
||||
public string Address4; /// 5
|
||||
public string Address5; /// 6
|
||||
public string ApprovalId; /// 7
|
||||
public string ApprovalDate; /// 8
|
||||
public string ApprovedBy; /// 9
|
||||
public int WaterMetersCount; /// 10
|
||||
public int LinesCount; /// 11
|
||||
public int CompoundMetersCount; /// 12
|
||||
public ProcedureSelection Source1; /// 13
|
||||
public ProcedureSelection Source2; /// 14
|
||||
public ProcedureSelection Source3; /// 15
|
||||
public ProcedureSelection Source4; /// 16
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
ComponentCfg() {}
|
||||
@@ -52,57 +59,75 @@ namespace TBF.Rig.DataContainer.BenchInfo
|
||||
{
|
||||
TestBenchName = "1";
|
||||
TestBenchId = 1;
|
||||
|
||||
Address1 = string.Empty;
|
||||
Address2 = string.Empty;
|
||||
Address3 = string.Empty;
|
||||
Address4 = string.Empty;
|
||||
Address5 = string.Empty;
|
||||
|
||||
ApprovalId = string.Empty;
|
||||
ApprovalDate = string.Empty;
|
||||
ApprovedBy = string.Empty;
|
||||
|
||||
RemoteDBUse = RemoteDBUse.LocalDBOnly;
|
||||
WaterMetersCount = 20;
|
||||
LinesCount = 2;
|
||||
CompoundMetersCount = 1;
|
||||
Source1 = ProcedureSelection.FromLocalDB;
|
||||
Source2 = ProcedureSelection.None;
|
||||
Source3 = ProcedureSelection.None;
|
||||
Source4 = ProcedureSelection.None;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Test bench name",
|
||||
"Test bench ID",
|
||||
"Address 1",
|
||||
"Address 2",
|
||||
"Address 3",
|
||||
"Address 4",
|
||||
"Address 5",
|
||||
"Approval",
|
||||
"Approval date",
|
||||
"Approved by",
|
||||
"Remote DB use",
|
||||
"Test bench name", /// 0
|
||||
"Test bench ID", /// 1
|
||||
"Address 1", /// 2
|
||||
"Address 2", /// 3
|
||||
"Address 3", /// 4
|
||||
"Address 4", /// 5
|
||||
"Address 5", /// 6
|
||||
"Approval", /// 7
|
||||
"Approval date", /// 8
|
||||
"Approved by", /// 9
|
||||
"Water meters count", /// 10
|
||||
"Lines count", /// 11
|
||||
"Compound meters count", /// 12
|
||||
"Procedure selection source 1", /// 13
|
||||
"Procedure selection source 2", /// 14
|
||||
"Procedure selection source 3", /// 15
|
||||
"Procedure selection source 4", /// 16
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public ICollection<string> ParamValues(int i)
|
||||
{
|
||||
if (i == 10)
|
||||
switch (i)
|
||||
{
|
||||
return new string[] { RemoteDBUse.LocalDBOnly.ToString(),
|
||||
RemoteDBUse.RemoteDBOnly.ToString(),
|
||||
RemoteDBUse.BothDBsLocalFirst.ToString(),
|
||||
RemoteDBUse.BothDBsRemoteFirst.ToString() };
|
||||
}
|
||||
case 10:
|
||||
return new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "10", "12", "14", "16", "18", "20" };
|
||||
case 11:
|
||||
return new string[] { "1", "2", "3", "4" };
|
||||
case 12:
|
||||
return new string[] { "0", "1", "2", "3" };
|
||||
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
IList<string> items = new List<string>();
|
||||
for (ProcedureSelection src = 0; src < ProcedureSelection.Count; src++)
|
||||
{
|
||||
items.Add(src.ToDescription());
|
||||
}
|
||||
return items;
|
||||
|
||||
return null;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
return string.Format("{0}: Bench name={1}, Bench Id={2}, Procedures={3}", Name, TestBenchName, TestBenchId, RemoteDBUse.ToDescription());
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return TestBenchName;
|
||||
@@ -115,49 +140,71 @@ namespace TBF.Rig.DataContainer.BenchInfo
|
||||
case 7: return ApprovalId;
|
||||
case 8: return ApprovalDate;
|
||||
case 9: return ApprovedBy;
|
||||
case 10: return RemoteDBUse.ToDescription();
|
||||
default: return string.Empty;
|
||||
case 10: return WaterMetersCount.ToString();
|
||||
case 11: return LinesCount.ToString();
|
||||
case 12: return CompoundMetersCount.ToString();
|
||||
case 13: return Source1.ToDescription();
|
||||
case 14: return Source2.ToDescription();
|
||||
case 15: return Source3.ToDescription();
|
||||
case 16: return Source4.ToDescription();
|
||||
default:
|
||||
return string.Format("{0}: Bench={1}, ID={2}, Mtrs={3}, Lines={4}, Compund mtrs={5}, S1={6}, S2={7}, S3={8}, S4={9}",
|
||||
Name, TestBenchName, TestBenchId, WaterMetersCount, LinesCount, CompoundMetersCount, Source1, Source2, Source3, Source4);
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: TestBenchName = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: TestBenchId = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: Address1 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: Address2 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: Address3 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: Address4 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 6: Address5 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 7: ApprovalId = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 8: ApprovalDate = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 9: ApprovedBy = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 0: TestBenchName = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: TestBenchId = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: Address1 = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: Address2 = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: Address3 = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: Address4 = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 6: Address5 = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 7: ApprovalId = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 8: ApprovalDate = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 9: ApprovedBy = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 10: WaterMetersCount = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 11: LinesCount = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 12: CompoundMetersCount = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
case 10:
|
||||
for (RemoteDBUse rdbu = 0; rdbu < RemoteDBUse.Count; rdbu++)
|
||||
case 13:
|
||||
for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++)
|
||||
{
|
||||
if (strValue == rdbu.ToDescription())
|
||||
{
|
||||
if (RemoteDBUse != rdbu)
|
||||
{
|
||||
RemoteDBUse = rdbu;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
if (str == source.ToDescription()) { Source1 = source; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
return CfgUpdateFlags.Error;
|
||||
break;
|
||||
|
||||
case 14:
|
||||
for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++)
|
||||
{
|
||||
if (str == source.ToDescription()) { Source2 = source; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
break;
|
||||
|
||||
case 15:
|
||||
for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++)
|
||||
{
|
||||
if (str == source.ToDescription()) { Source3 = source; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
break;
|
||||
|
||||
case 16:
|
||||
for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++)
|
||||
{
|
||||
if (str == source.ToDescription()) { Source4 = source; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
break;
|
||||
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
return CfgUpdateFlags.Error;
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int idummy;
|
||||
@@ -175,14 +222,26 @@ namespace TBF.Rig.DataContainer.BenchInfo
|
||||
case 9:
|
||||
return true;
|
||||
case 1:
|
||||
if (int.TryParse(strValue, out idummy) && (idummy >= 0)) return true;
|
||||
if (int.TryParse(str, out idummy) && (idummy >= 0)) return true;
|
||||
break;
|
||||
case 10:
|
||||
for (RemoteDBUse rdbu = 0; rdbu < RemoteDBUse.Count; rdbu++)
|
||||
if (int.TryParse(str, out idummy) && idummy >= 1 && idummy <= 20) return true;
|
||||
break;
|
||||
case 11:
|
||||
if (int.TryParse(str, out idummy) && idummy >= 1 && idummy <= 4) return true;
|
||||
break;
|
||||
case 12:
|
||||
if (int.TryParse(str, out idummy) && idummy >= 0 && idummy <= 3) return true;
|
||||
break;
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++)
|
||||
{
|
||||
if (strValue == rdbu.ToDescription()) return true;
|
||||
if (str == source.ToDescription()) return true;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
@@ -204,10 +263,16 @@ namespace TBF.Rig.DataContainer.BenchInfo
|
||||
prms.ApprovalId = this.ApprovalId;
|
||||
prms.ApprovalDate = this.ApprovalDate;
|
||||
prms.ApprovedBy = this.ApprovedBy;
|
||||
prms.RemoteDBUse = this.RemoteDBUse;
|
||||
prms.WaterMetersCount = this.WaterMetersCount;
|
||||
prms.LinesCount = this.LinesCount;
|
||||
prms.CompoundMetersCount = this.CompoundMetersCount;
|
||||
prms.Source1 = this.Source1;
|
||||
prms.Source2 = this.Source2;
|
||||
prms.Source3 = this.Source3;
|
||||
prms.Source4 = this.Source4;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
ComponentCfg pars = new ComponentCfg();
|
||||
CopyContentTo(pars);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace TBF.Rig.DataContainer.Buoyancy
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
Config.Data.Buoyancy = Buoyancy; /// This is to use Buoyancy from this component in formulas
|
||||
Common.Data.Buoyancy = Buoyancy; /// This is to use Buoyancy from this component in formulas
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
@@ -12,7 +13,7 @@ namespace TBF.Rig.DataContainer.Buoyancy
|
||||
/// <summary>
|
||||
/// Holds backup and security options - serializable configuration.
|
||||
/// </summary>
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
@@ -105,7 +106,7 @@ namespace TBF.Rig.DataContainer.Buoyancy
|
||||
prms.Buoyancy = this.Buoyancy;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
ComponentCfg pars = new ComponentCfg();
|
||||
CopyContentTo(pars);
|
||||
|
||||
@@ -34,8 +34,8 @@ namespace TBF.Rig.DataContainer.Density
|
||||
public override void Initialize()
|
||||
{
|
||||
/// This is to use sample density and temp. from this component in formulas
|
||||
Config.Data.SampleDensity = SampleDensity;
|
||||
Config.Data.SampleTemp = SampleTemp;
|
||||
Common.Data.SampleDensity = SampleDensity;
|
||||
Common.Data.SampleTemp = SampleTemp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
@@ -12,7 +13,7 @@ namespace TBF.Rig.DataContainer.Density
|
||||
/// <summary>
|
||||
/// Holds water density - serializable configuration.
|
||||
/// </summary>
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
@@ -115,7 +116,7 @@ namespace TBF.Rig.DataContainer.Density
|
||||
prms.SampleTemp = this.SampleTemp;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
ComponentCfg pars = new ComponentCfg();
|
||||
CopyContentTo(pars);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
@@ -22,7 +23,7 @@ namespace TBF.Rig.DataContainer.Evaporation
|
||||
/// </summary>
|
||||
public double EvaporationRate(double temperature)
|
||||
{
|
||||
return Config.Formulas.GetCorrection(temperature, Corrections) / 3600.0; /// Converted from kg/h to kg/s
|
||||
return MeasurementCorrection.GetCorrection(temperature, Corrections) / 3600.0; /// Converted from kg/h to kg/s
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig;
|
||||
using TBF.Rig.Generic;
|
||||
@@ -22,16 +23,23 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
|
||||
readonly ComponentCfg myCfg;
|
||||
|
||||
public string TestBenchName { get { return myCfg.TestBenchName; } }
|
||||
public int TestBenchId { get { return myCfg.TestBenchId; } }
|
||||
public string Address1 { get { return myCfg.Address1; } }
|
||||
public string Address2 { get { return myCfg.Address2; } }
|
||||
public string Address3 { get { return myCfg.Address3; } }
|
||||
public string Address4 { get { return myCfg.Address4; } }
|
||||
public string Address5 { get { return myCfg.Address5; } }
|
||||
public RemoteDBUse RemoteDBUse { get { return myCfg.RemoteDBUse; } }
|
||||
public Side Side { get { return myCfg.Side; } }
|
||||
public int MaxTestIndex { get { return myCfg.MaxTestIndex; } } /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
public string TestBenchName { get { return myCfg.TestBenchName; } }
|
||||
public int TestBenchId { get { return myCfg.TestBenchId; } }
|
||||
public string Address1 { get { return myCfg.Address1; } }
|
||||
public string Address2 { get { return myCfg.Address2; } }
|
||||
public string Address3 { get { return myCfg.Address3; } }
|
||||
public string Address4 { get { return myCfg.Address4; } }
|
||||
public string Address5 { get { return myCfg.Address5; } }
|
||||
public int WaterMetersCount { get { return myCfg.WaterMetersCount; } }
|
||||
public int LinesCount { get { return myCfg.LinesCount; } }
|
||||
public int CompoundMetersCount { get { return myCfg.CompoundMetersCount; } }
|
||||
public Side Side { get { return myCfg.Side; } }
|
||||
public int MaxTestIndex { get { return myCfg.MaxTestIndex; } } /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
|
||||
public ICollection<ProcedureSelection> Source
|
||||
{
|
||||
get { return new ProcedureSelection[] { myCfg.Source1, myCfg.Source2, myCfg.Source3, myCfg.Source4 }; }
|
||||
}
|
||||
|
||||
|
||||
public Component() { }
|
||||
@@ -45,7 +53,7 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
Events.DB.SetBenchName(myCfg.TestBenchName);
|
||||
SharedDatabase.EventsDB.SetBenchName(myCfg.TestBenchName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
///
|
||||
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2018-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
@@ -13,7 +14,7 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
/// <summary>
|
||||
/// Holds information identifying the test bench - serializable configuration.
|
||||
/// </summary>
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg
|
||||
public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, IParamsProvider, TBF.Rig.GenericDevices.ICalibInfoCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
@@ -23,19 +24,25 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public string TestBenchName;
|
||||
public int TestBenchId;
|
||||
public string Address1;
|
||||
public string Address2;
|
||||
public string Address3;
|
||||
public string Address4;
|
||||
public string Address5;
|
||||
public string ApprovalId;
|
||||
public string ApprovalDate;
|
||||
public string ApprovedBy;
|
||||
public RemoteDBUse RemoteDBUse;
|
||||
public Side Side;
|
||||
public int MaxTestIndex; /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
public string TestBenchName; /// 0
|
||||
public int TestBenchId; /// 1
|
||||
public string Address1; /// 2
|
||||
public string Address2; /// 3
|
||||
public string Address3; /// 4
|
||||
public string Address4; /// 5
|
||||
public string Address5; /// 6
|
||||
public string ApprovalId; /// 7
|
||||
public string ApprovalDate; /// 8
|
||||
public string ApprovedBy; /// 9
|
||||
public int WaterMetersCount; /// 10
|
||||
public int LinesCount; /// 11
|
||||
public int CompoundMetersCount; /// 12
|
||||
public Side Side; /// 13
|
||||
public int MaxTestIndex; /// 14 (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
public ProcedureSelection Source1; /// 15
|
||||
public ProcedureSelection Source2; /// 16
|
||||
public ProcedureSelection Source3; /// 17
|
||||
public ProcedureSelection Source4; /// 18
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
string calibCertificateNr;
|
||||
@@ -76,69 +83,83 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
{
|
||||
TestBenchName = "1";
|
||||
TestBenchId = 1;
|
||||
|
||||
Address1 = string.Empty;
|
||||
Address2 = string.Empty;
|
||||
Address3 = string.Empty;
|
||||
Address4 = string.Empty;
|
||||
Address5 = string.Empty;
|
||||
|
||||
ApprovalId = string.Empty;
|
||||
ApprovalDate = string.Empty;
|
||||
ApprovedBy = string.Empty;
|
||||
|
||||
RemoteDBUse = RemoteDBUse.LocalDBOnly;
|
||||
WaterMetersCount = 20;
|
||||
LinesCount = 2;
|
||||
CompoundMetersCount = 1;
|
||||
Side = Side.Left;
|
||||
MaxTestIndex = 4;
|
||||
Source1 = ProcedureSelection.FromSharedDB;
|
||||
Source2 = ProcedureSelection.FromLocalDB;
|
||||
Source3 = ProcedureSelection.None;
|
||||
Source4 = ProcedureSelection.None;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Test bench name",
|
||||
"Test bench ID",
|
||||
"Address 1",
|
||||
"Address 2",
|
||||
"Address 3",
|
||||
"Address 4",
|
||||
"Address 5",
|
||||
"Approval",
|
||||
"Approval date",
|
||||
"Approved by",
|
||||
"Remote DB use",
|
||||
Strings.Side,
|
||||
"Max.test index",
|
||||
"Test bench name", /// 0
|
||||
"Test bench ID", /// 1
|
||||
"Address 1", /// 2
|
||||
"Address 2", /// 3
|
||||
"Address 3", /// 4
|
||||
"Address 4", /// 5
|
||||
"Address 5", /// 6
|
||||
"Approval", /// 7
|
||||
"Approval date", /// 8
|
||||
"Approved by", /// 9
|
||||
"Water meters count", /// 10
|
||||
"Lines count", /// 11
|
||||
"Compound meters count", /// 12
|
||||
Strings.Side, /// 13
|
||||
"Max.test index", /// 14
|
||||
"Procedure selection source 1", /// 15
|
||||
"Procedure selection source 2", /// 16
|
||||
"Procedure selection source 3", /// 17
|
||||
"Procedure selection source 4", /// 18
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public ICollection<string> ParamValues(int i)
|
||||
{
|
||||
if (i == 10)
|
||||
switch (i)
|
||||
{
|
||||
return new string[] { RemoteDBUse.LocalDBOnly.ToString(),
|
||||
RemoteDBUse.RemoteDBOnly.ToString(),
|
||||
RemoteDBUse.BothDBsLocalFirst.ToString(),
|
||||
RemoteDBUse.BothDBsRemoteFirst.ToString() };
|
||||
}
|
||||
else if (i == 11)
|
||||
{
|
||||
IList<string> list = new List<string>();
|
||||
for (Side side = 0; side < Side.Count; side++) list.Add(side.ToDescription());
|
||||
return list;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
case 10:
|
||||
return new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "10", "12", "14", "16", "18", "20" };
|
||||
case 11:
|
||||
return new string[] { "1", "2", "3", "4" };
|
||||
case 12:
|
||||
return new string[] { "0", "1", "2", "3" };
|
||||
case 13:
|
||||
IList<string> list = new List<string>();
|
||||
for (Side side = 0; side < Side.Count; side++) list.Add(side.ToDescription());
|
||||
return list;
|
||||
|
||||
case 15:
|
||||
case 16:
|
||||
case 17:
|
||||
case 18:
|
||||
IList<string> items = new List<string>();
|
||||
for (ProcedureSelection src = 0; src < ProcedureSelection.Count; src++)
|
||||
{
|
||||
items.Add(src.ToDescription());
|
||||
}
|
||||
return items;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
if (i == -1)
|
||||
{
|
||||
return string.Format("{0}: Bench name={1}, Bench Id={2}, Procedures={3}", Name, TestBenchName, TestBenchId, RemoteDBUse.ToDescription());
|
||||
}
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0: return TestBenchName;
|
||||
@@ -151,50 +172,43 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
case 7: return ApprovalId;
|
||||
case 8: return ApprovalDate;
|
||||
case 9: return ApprovedBy;
|
||||
case 10: return RemoteDBUse.ToDescription();
|
||||
case 11: return Side.ToDescription();
|
||||
case 12: return MaxTestIndex.ToString();
|
||||
default: return string.Empty;
|
||||
case 10: return WaterMetersCount.ToString();
|
||||
case 11: return LinesCount.ToString();
|
||||
case 12: return CompoundMetersCount.ToString();
|
||||
case 13: return Side.ToDescription();
|
||||
case 14: return MaxTestIndex.ToString();
|
||||
case 15: return Source1.ToDescription();
|
||||
case 16: return Source2.ToDescription();
|
||||
case 17: return Source3.ToDescription();
|
||||
case 18: return Source4.ToDescription();
|
||||
default:
|
||||
return string.Format("{0}: Bench={1}, ID={2}, Mtrs={3}, Lines={4}, Compund mtrs={5}, S1={6}, S2={7}, S3={8}, S4={9}",
|
||||
Name, TestBenchName, TestBenchId, WaterMetersCount, LinesCount, CompoundMetersCount, Source1, Source2, Source3, Source4);
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: TestBenchName = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: TestBenchId = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: Address1 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: Address2 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: Address3 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: Address4 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 6: Address5 = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 7: ApprovalId = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 8: ApprovalDate = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 9: ApprovedBy = strValue; return CfgUpdateFlags.RestartRqrd;
|
||||
case 0: TestBenchName = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: TestBenchId = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: Address1 = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 3: Address2 = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 4: Address3 = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 5: Address4 = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 6: Address5 = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 7: ApprovalId = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 8: ApprovalDate = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 9: ApprovedBy = str; return CfgUpdateFlags.RestartRqrd;
|
||||
case 10: WaterMetersCount = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 11: LinesCount = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 12: CompoundMetersCount = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
case 10:
|
||||
for (RemoteDBUse rdbu = 0; rdbu < RemoteDBUse.Count; rdbu++)
|
||||
{
|
||||
if (strValue == rdbu.ToDescription())
|
||||
{
|
||||
if (RemoteDBUse != rdbu)
|
||||
{
|
||||
RemoteDBUse = rdbu;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
return CfgUpdateFlags.Error;
|
||||
|
||||
case 11:
|
||||
case 13:
|
||||
for (Side side = 0; side < Side.Count; side++)
|
||||
{
|
||||
if (strValue == side.ToDescription())
|
||||
if (str == side.ToDescription())
|
||||
{
|
||||
if (Side != side)
|
||||
{
|
||||
@@ -209,12 +223,42 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
}
|
||||
return CfgUpdateFlags.Error;
|
||||
|
||||
case 12: MaxTestIndex = int.Parse(strValue); return CfgUpdateFlags.RestartRqrd;
|
||||
case 14: MaxTestIndex = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
case 15:
|
||||
for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++)
|
||||
{
|
||||
if (str == source.ToDescription()) { Source1 = source; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
break;
|
||||
|
||||
case 16:
|
||||
for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++)
|
||||
{
|
||||
if (str == source.ToDescription()) { Source2 = source; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
break;
|
||||
|
||||
case 17:
|
||||
for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++)
|
||||
{
|
||||
if (str == source.ToDescription()) { Source3 = source; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
break;
|
||||
|
||||
case 18:
|
||||
for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++)
|
||||
{
|
||||
if (str == source.ToDescription()) { Source4 = source; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
break;
|
||||
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
return CfgUpdateFlags.Error;
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int idummy;
|
||||
@@ -232,19 +276,31 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
case 9:
|
||||
return true;
|
||||
case 1:
|
||||
case 12:
|
||||
if (int.TryParse(strValue, out idummy) && (idummy >= 0)) return true;
|
||||
break;
|
||||
case 10:
|
||||
for (RemoteDBUse rdbu = 0; rdbu < RemoteDBUse.Count; rdbu++)
|
||||
{
|
||||
if (strValue == rdbu.ToDescription()) return true;
|
||||
}
|
||||
if (int.TryParse(str, out idummy) && idummy >= 1 && idummy <= 20) return true;
|
||||
break;
|
||||
case 11:
|
||||
if (int.TryParse(str, out idummy) && idummy >= 1 && idummy <= 4) return true;
|
||||
break;
|
||||
case 12:
|
||||
if (int.TryParse(str, out idummy) && idummy >= 0 && idummy <= 3) return true;
|
||||
break;
|
||||
case 13:
|
||||
for (Side side = 0; side < Side.Count; side++)
|
||||
{
|
||||
if (strValue == side.ToDescription()) return true;
|
||||
if (str == side.ToDescription()) return true;
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
if (int.TryParse(str, out idummy) && (idummy >= 0)) return true;
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
case 17:
|
||||
case 18:
|
||||
for (ProcedureSelection source = 0; source < ProcedureSelection.Count; source++)
|
||||
{
|
||||
if (str == source.ToDescription()) return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -268,12 +324,18 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
prms.ApprovalId = this.ApprovalId;
|
||||
prms.ApprovalDate = this.ApprovalDate;
|
||||
prms.ApprovedBy = this.ApprovedBy;
|
||||
prms.RemoteDBUse = this.RemoteDBUse;
|
||||
prms.WaterMetersCount = this.WaterMetersCount;
|
||||
prms.LinesCount = this.LinesCount;
|
||||
prms.CompoundMetersCount = this.CompoundMetersCount;
|
||||
prms.Side = this.Side;
|
||||
prms.MaxTestIndex = this.MaxTestIndex;
|
||||
prms.Source1 = this.Source1;
|
||||
prms.Source2 = this.Source2;
|
||||
prms.Source3 = this.Source3;
|
||||
prms.Source4 = this.Source4;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
public IParamsProvider Clone()
|
||||
{
|
||||
ComponentCfg pars = new ComponentCfg();
|
||||
CopyContentTo(pars);
|
||||
|
||||
Reference in New Issue
Block a user