Results.BatchResults.NewFromProcedure(...) added, BenchId -> TestBenchId, BenchName -> TestBenchName, etc.

This commit is contained in:
Milan Hanajik
2016-01-02 19:21:43 +01:00
parent 61bfa51fa7
commit 494c6edf76
26 changed files with 480 additions and 225 deletions
+170
View File
@@ -0,0 +1,170 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Results.Entities;
namespace Results
{
public class BatchResults
{
public IList<Entities.TestData> TestDataList;
public IList<Entities.Components> ComponentsList;
public IList<Entities.WaterMeterData> WaterMeterDataList;
public IDictionary<string, TestRslt> TestRsltsMap;
public IDictionary<string, MeterTestRslt>[] MeterTestRsltsMap;
public IDictionary<string, MeterTestRslt>[] MainMeterTestRsltsMap;
public IDictionary<string, MeterTestRslt>[] AuxMeterTestRsltsMap;
private BatchResults()
{
TestDataList = new List<Entities.TestData>();
ComponentsList = new List<Entities.Components>();
WaterMeterDataList = new List<Entities.WaterMeterData>();
TestRsltsMap = new Dictionary<string, TestRslt>();
}
public int WMPositionsCount;
public Batch Batch;
public WaterMeter[] WaterMeters;
public IList<TestRslt> TestRslts;
public IList<TestRslt> MeterTestRslts;
public static BatchResults NewFromProcedure(int batchNr,
int benchId,
string user,
string programVer,
Config.Entities.Procedure procedure,
WaterMeterData[] waterMeterDatas,
int[] waterMeterParts)
{
BatchResults d = new BatchResults();
d.WMPositionsCount = waterMeterDatas.Length;
///
d.MeterTestRsltsMap = new Dictionary<string, MeterTestRslt>[d.WMPositionsCount];
d.MainMeterTestRsltsMap = new Dictionary<string, MeterTestRslt>[d.WMPositionsCount];
d.AuxMeterTestRsltsMap = new Dictionary<string, MeterTestRslt>[d.WMPositionsCount];
for (int wmnr = 0; wmnr < d.WMPositionsCount; wmnr++)
{
d.MeterTestRsltsMap[wmnr] = new Dictionary<string, MeterTestRslt>();
d.MainMeterTestRsltsMap[wmnr] = new Dictionary<string, MeterTestRslt>();
d.AuxMeterTestRsltsMap[wmnr] = new Dictionary<string, MeterTestRslt>();
}
/// Create new batch
d.Batch = new Batch()
{
TestBenchId = benchId,
BatchNr = batchNr,
ProgramVersion = programVer,
UserName = user,
ProcedureName = procedure.Name,
ProcedureRevision = procedure.Revision,
StartTime = DateTime.Now,
};
///
/// Add watermeter to an array, array index is WM position.
/// AddWaterMetersToBatch() has to be used before saving results.
///
d.WaterMeters = new WaterMeter[d.WMPositionsCount];
for (int i = 0; i < d.WMPositionsCount; i++)
{
if (waterMeterDatas[i] == null) continue;
WaterMeterData wmd = WaterMeterData.UpdateList(d.WaterMeterDataList, waterMeterDatas[i]);
d.WaterMeters[i] = new WaterMeter() { Batch = d.Batch, WaterMeterData = wmd, WMPosition = i + 1 };
}
foreach (var t in procedure.Tests)
{
if (t.Publish)
{
TestData td = TestData.UpdateList(d.TestDataList, new TestData(t));
for (int rnr = 1; rnr <= t.Repeats; rnr++)
{
/// Create an empty test result and add it to the list
TestRslt tr = new TestRslt(d.Batch, td, t.Part, rnr);
d.TestRslts.Add(tr);
d.TestRsltsMap.Add(tr.Name(), tr);
for (int i = 0; i < d.WMPositionsCount; i++)
{
if (d.WaterMeters[i] == null) continue;
if (t.Part != 0 && waterMeterParts[i] != 0 && t.Part != waterMeterParts[i]) continue;
/// Create empty watermeter test results and add them to the list and to dictionaries
if (procedure.MetersKind == Config.Entities.MetersKind.Single)
{
MeterTestRslt mtr = new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Single);
d.WaterMeters[i].MeterTestRslts.Add(mtr);
d.MeterTestRsltsMap[i].Add(tr.Name(), mtr);
}
else
{
MeterTestRslt mainMTR = new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundMain);
d.WaterMeters[i].MeterTestRslts.Add(mainMTR);
d.MainMeterTestRsltsMap[i].Add(tr.Name(), mainMTR);
MeterTestRslt auxMTR = new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.CompoundAux);
d.WaterMeters[i].MeterTestRslts.Add(auxMTR);
d.MainMeterTestRsltsMap[i].Add(tr.Name(), auxMTR);
MeterTestRslt cmpdMTR = new MeterTestRslt(d.WaterMeters[i], tr, Config.Entities.CompoundMeterId.Compound);
d.WaterMeters[i].MeterTestRslts.Add(cmpdMTR);
d.MainMeterTestRsltsMap[i].Add(tr.Name(), cmpdMTR);
}
}
}
}
}
return d;
}
public TestRslt GetTestRslt(string name, int part)
{
foreach (var tr in TestRslts)
{
if (part == tr.Part && name.Equals(tr.Name())) return tr;
}
return null;
}
public MeterTestRslt GetMeterTestRslt(string name, int wmnr0, Config.Entities.CompoundMeterId meterId)
{
if (WaterMeters[wmnr0] != null)
{
foreach (var mtr in WaterMeters[wmnr0].MeterTestRslts)
{
if (mtr.CompoundMeterId == (byte)meterId && name.Equals(mtr.Name())) return mtr;
}
}
return null;
}
/// <summary>
/// Adds non-null water meters from an array to a Batch water meters list.
/// This method should be used when results are prepared and
/// all disabled water meters are deleted.
/// </summary>
public void AddWaterMetersToBatch()
{
for (int i = 0; i < WMPositionsCount; i++)
{
if (WaterMeters[i] != null) Batch.WaterMeters.Add(WaterMeters[i]);
}
}
}
}
-98
View File
@@ -1,98 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Results.Entities;
namespace Results
{
public class Data
{
public int WMPositionsCount;
public Batch Batch;
public IList<TestRslt> TestRslts;
public IList<TestRslt> MeterTestRslts;
public WaterMeter[] WaterMeters;
public IDictionary<string, TestRslt> TestRsltsMap;
public IDictionary<string, MeterTestRslt> MeterTestRsltsMap;
public Data()
{
TestRsltsMap = new Dictionary<string, TestRslt>();
MeterTestRsltsMap = new Dictionary<string, MeterTestRslt>();
}
public static Data NewFromProcedure(Config.Entities.Procedure procedure,
WaterMeterData[] waterMeterDatas,
int batchNr,
int benchId,
string programVer,
string user)
{
Data d = new Data();
d.WMPositionsCount = waterMeterDatas.Length;
d.Batch = new Batch()
{
BenchId = benchId,
BatchNr = batchNr,
ProgramVersion = programVer,
UserName = user,
ProcedureName = procedure.Name,
ProcedureRevision = procedure.Revision,
StartTime = DateTime.Now
};
foreach (var t in procedure.Tests)
{
}
d.WaterMeters = new WaterMeter[d.WMPositionsCount];
for (int i = 0; i < d.WMPositionsCount; i++)
{
if (waterMeterDatas[i] != null)
{
d.WaterMeters[i] = new WaterMeter(d.Batch, waterMeterDatas[i]);
}
}
foreach (var t in procedure.Tests)
{
if (t.Publish)
{
d.Batch.Tests.Add(new TestData(t));
for (int i = 0; i < d.WMPositionsCount; i++)
{
if (d.WaterMeters[i] != null)
{
if (procedure.MetersKind == Config.Entities.MetersKind.Single)
{
//d.WaterMeters[i].MeterTestRslts.Add(
}
//else
//{
//}
}
}
}
}
return d;
}
/// <summary>
/// Adds non-null water meters from the array to a Batch water meters list.
/// This method should be used when results are prepared and
/// all disabled water meters are deleted.
/// </summary>
public void AddWaterMetersToBatch()
{
for (int i = 0; i < WMPositionsCount; i++)
{
if (WaterMeters[i] != null) Batch.WaterMeters.Add(WaterMeters[i]);
}
}
}
}
+1 -1
View File
@@ -9,8 +9,8 @@ namespace Results.Entities
public class Batch public class Batch
{ {
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual int BenchId { get; set; }
public virtual int BatchNr { get; set; } public virtual int BatchNr { get; set; }
public virtual int TestBenchId { get; set; }
public virtual string ProgramVersion { get; set; } public virtual string ProgramVersion { get; set; }
public virtual string UserName { get; set; } public virtual string UserName { get; set; }
public virtual string ProcedureName { get; set; } public virtual string ProcedureName { get; set; }
+32 -8
View File
@@ -3,14 +3,15 @@
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Results.Entities namespace Results.Entities
{ {
public class Components public class Components
{ {
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual int BenchId { get; set; } public virtual int TestBenchId { get; set; }
public virtual string BenchName { get; set; } public virtual string TestBenchName { get; set; }
public virtual string Pump { get; set; } public virtual string Pump { get; set; }
public virtual string RegValve { get; set; } public virtual string RegValve { get; set; }
public virtual string Flowmeter { get; set; } public virtual string Flowmeter { get; set; }
@@ -22,8 +23,8 @@ namespace Results.Entities
protected Components() protected Components()
{ {
BenchId = 0; TestBenchId = 0;
BenchName = string.Empty; TestBenchName = string.Empty;
Pump = string.Empty; Pump = string.Empty;
RegValve = string.Empty; RegValve = string.Empty;
Flowmeter = string.Empty; Flowmeter = string.Empty;
@@ -37,8 +38,8 @@ namespace Results.Entities
public Components(int benchId, string benchName, string pump, string flowmeter, public Components(int benchId, string benchName, string pump, string flowmeter,
string scale, string regValve, string diverter) string scale, string regValve, string diverter)
{ {
BenchId = benchId; TestBenchId = benchId;
BenchName = benchName; TestBenchName = benchName;
Pump = pump; Pump = pump;
RegValve = regValve; RegValve = regValve;
Flowmeter = flowmeter; Flowmeter = flowmeter;
@@ -49,10 +50,16 @@ namespace Results.Entities
Custom3 = string.Empty; Custom3 = string.Empty;
} }
/// <summary>
/// Method to compare the content of two entities
/// </summary>
/// <param name="wmd">Second entity to compare with</param>
/// <returns>first = two entities are equal (except of Id)</returns>
public virtual bool Equals(Components bc) public virtual bool Equals(Components bc)
{ {
if (BenchId != bc.BenchId) return false; if (TestBenchId != bc.TestBenchId) return false;
if (!BenchName.Equals(bc.BenchName)) return false; if (!TestBenchName.Equals(bc.TestBenchName)) return false;
if (!Pump.Equals(bc.Pump)) return false; if (!Pump.Equals(bc.Pump)) return false;
if (!RegValve.Equals(bc.RegValve)) return false; if (!RegValve.Equals(bc.RegValve)) return false;
if (!Flowmeter.Equals(bc.Flowmeter)) return false; if (!Flowmeter.Equals(bc.Flowmeter)) return false;
@@ -64,5 +71,22 @@ namespace Results.Entities
return true; return true;
} }
/// <summary>
/// Adds an item to the list if it does not occur there
/// </summary>
/// <param name="list">List of items</param>
/// <param name="item">Item to add to the list or find there</param>
/// <returns>Item from the list (existing or added)</returns>
public static Components UpdateList(IList<Components> list, Components item)
{
Components found = list.FirstOrDefault<Components>(x => x.Equals(item));
if (found != null) return found;
list.Add(item);
return item;
}
} }
} }
+8 -4
View File
@@ -20,7 +20,8 @@ namespace Results.Entities
public virtual double TimestampEnd { get; set; } /// sec. public virtual double TimestampEnd { get; set; } /// sec.
public virtual double TestTime { get; set; } /// sec. public virtual double TestTime { get; set; } /// sec.
public virtual double Error { get; set; } /// % public virtual double Error { get; set; } /// %
public virtual bool Passed { get; set; } /// true=test passed - Not mapped to DB !!! public virtual bool TestDone { get; set; } /// true = test was completed
public virtual bool Passed { get; set; } /// true = test passed, water meter is OK
public virtual WaterMeter WaterMeter { get; set; } /// reference to the TestData entity public virtual WaterMeter WaterMeter { get; set; } /// reference to the TestData entity
public virtual TestRslt TestRslt { get; set; } /// reference to the TestData entity public virtual TestRslt TestRslt { get; set; } /// reference to the TestData entity
@@ -48,15 +49,18 @@ namespace Results.Entities
public virtual double Uncertainty() { return TestData().Uncertainty; } public virtual double Uncertainty() { return TestData().Uncertainty; }
protected MeterTestRslt() public MeterTestRslt()
{ {
TestDone = false;
Passed = false;
} }
public MeterTestRslt(WaterMeter waterMeterRslt, TestRslt testRslt) public MeterTestRslt(WaterMeter waterMeterRslt, TestRslt testRslt, Config.Entities.CompoundMeterId compoundMeterId)
: this() : this()
{ {
WaterMeter = waterMeterRslt; WaterMeter = waterMeterRslt;
TestRslt = testRslt; TestRslt = testRslt;
} CompoundMeterId = (byte)compoundMeterId;
}
} }
} }
+25 -1
View File
@@ -1,8 +1,9 @@
/// ///
/// Copyright (c) 2015 Sensus Metering Systems /// Copyright (c) 2016 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Results.Entities namespace Results.Entities
{ {
@@ -47,6 +48,12 @@ namespace Results.Entities
Evaluate = test.Evaluate; Evaluate = test.Evaluate;
} }
/// <summary>
/// Method to compare the content of two entities
/// </summary>
/// <param name="wmd">Second entity to compare with</param>
/// <returns>first = two entities are equal (except of Id)</returns>
public virtual bool Equals(TestData td) public virtual bool Equals(TestData td)
{ {
if (!Name.Equals(td.Name)) return false; if (!Name.Equals(td.Name)) return false;
@@ -63,5 +70,22 @@ namespace Results.Entities
return true; return true;
} }
/// <summary>
/// Adds an item to the list if it does not occur there
/// </summary>
/// <param name="list">List of items</param>
/// <param name="item">Item to add to the list or find there</param>
/// <returns>Item from the list (existing or added)</returns>
public static TestData UpdateList(IList<TestData> list, TestData item)
{
TestData found = list.FirstOrDefault<TestData>(x => x.Equals(item));
if (found != null) return found;
list.Add(item);
return item;
}
} }
} }
+4 -21
View File
@@ -21,6 +21,7 @@ namespace Results.Entities
public virtual int SerialNrEx { get; set; } /// iPerl : This is the serial number assigned later public virtual int SerialNrEx { get; set; } /// iPerl : This is the serial number assigned later
public virtual double OrigCalibFactor { get; set; } /// iPerl calibration factor used during the test - Not mapped to DB !!! public virtual double OrigCalibFactor { get; set; } /// iPerl calibration factor used during the test - Not mapped to DB !!!
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test - Not mapped to DB !!! public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test - Not mapped to DB !!!
public virtual bool Q2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
public virtual double Q2Correction { get; set; } /// iPerl Q2 correction used during the test - Not mapped to DB !!! public virtual double Q2Correction { get; set; } /// iPerl Q2 correction used during the test - Not mapped to DB !!!
#endif #endif
@@ -43,7 +44,7 @@ namespace Results.Entities
public virtual bool Compound() { return WaterMeterData.Compound; } public virtual bool Compound() { return WaterMeterData.Compound; }
public virtual int BatchNr() { return Batch.BatchNr; } public virtual int BatchNr() { return Batch.BatchNr; }
public virtual int BenchId() { return Batch.BenchId; } public virtual int BenchId() { return Batch.TestBenchId; }
public virtual string ProcedureName() { return Batch.ProcedureName; } public virtual string ProcedureName() { return Batch.ProcedureName; }
public virtual int ProcedureRevision() { return Batch.ProcedureRevision; } public virtual int ProcedureRevision() { return Batch.ProcedureRevision; }
public virtual DateTime StartTime() { return Batch.StartTime; } public virtual DateTime StartTime() { return Batch.StartTime; }
@@ -67,31 +68,13 @@ namespace Results.Entities
/// <summary> /// <summary>
/// Private constructor, initializes a list, used as a base /// Constructor, initializes a list, used as a base for other constructors
/// </summary> /// </summary>
protected WaterMeter() public WaterMeter()
{ {
MeterTestRslts = new List<MeterTestRslt>(); MeterTestRslts = new List<MeterTestRslt>();
} }
/// <summary>
/// Constructor used to construct WaterMeterResults from the first meter test result
/// </summary>
public WaterMeter(Batch batch, WaterMeterData waterMeterData)
: this()
{
Batch = batch;
WaterMeterData = waterMeterData;
}
/// <summary>
/// Function to append result to a list of results and update start/end dates
/// </summary>
public virtual void Append(MeterTestResult meterTestResult)
{
/// TODO
}
public override string ToString() public override string ToString()
{ {
+41 -1
View File
@@ -1,8 +1,9 @@
/// ///
/// Copyright (c) 2015 Sensus Metering Systems /// Copyright (c) 2016 Sensus Metering Systems
/// ///
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Results.Entities namespace Results.Entities
{ {
@@ -27,5 +28,44 @@ namespace Results.Entities
public WaterMeterData() public WaterMeterData()
{ {
} }
/// <summary>
/// Method to compare the content of two entities
/// </summary>
/// <param name="wmd">Second entity to compare with</param>
/// <returns>first = two entities are equal (except of Id)</returns>
public virtual bool Equals(WaterMeterData wmd)
{
if (!ProductName.Equals(wmd.ProductName)) return false;
if (!Producer.Equals(wmd.Producer)) return false;
if (!MetrologicalClass.Equals(wmd.MetrologicalClass)) return false;
if (!ApprovalInfo.Equals(wmd.ApprovalInfo)) return false;
if (Q4_Qmax != wmd.Q4_Qmax) return false;
if (Qn != wmd.Qn) return false;
if (Q3 != wmd.Q3) return false;
if (Q2_Qt != wmd.Q2_Qt) return false;
if (Q1_Qmin != wmd.Q1_Qmin) return false;
if (Compound != wmd.Compound) return false;
return true;
}
/// <summary>
/// Adds an item to the list if it does not occur there
/// </summary>
/// <param name="list">List of items</param>
/// <param name="item">Item to add to the list or find there</param>
/// <returns>Item from the list (existing or added)</returns>
public static WaterMeterData UpdateList(IList<WaterMeterData> list, WaterMeterData item)
{
WaterMeterData found = list.FirstOrDefault<WaterMeterData>(x => x.Equals(item));
if (found != null) return found;
list.Add(item);
return item;
}
} }
} }
+1 -1
View File
@@ -11,8 +11,8 @@ namespace Results.Mappings
public BatchMap() public BatchMap()
{ {
Id(x => x.Id); Id(x => x.Id);
Map(x => x.BenchId);
Map(x => x.BatchNr); Map(x => x.BatchNr);
Map(x => x.TestBenchId);
Map(x => x.ProgramVersion); Map(x => x.ProgramVersion);
Map(x => x.UserName); Map(x => x.UserName);
Map(x => x.ProcedureName); Map(x => x.ProcedureName);
+2 -2
View File
@@ -11,8 +11,8 @@ namespace Results.Mappings
public ComponentsMap() public ComponentsMap()
{ {
Id(x => x.Id); Id(x => x.Id);
Map(x => x.BenchId); Map(x => x.TestBenchId);
Map(x => x.BenchName); Map(x => x.TestBenchName);
Map(x => x.Pump); Map(x => x.Pump);
Map(x => x.RegValve); Map(x => x.RegValve);
Map(x => x.Flowmeter); Map(x => x.Flowmeter);
+1
View File
@@ -22,6 +22,7 @@ namespace Results.Mappings
Map(x => x.TimestampEnd); Map(x => x.TimestampEnd);
Map(x => x.TestTime); Map(x => x.TestTime);
Map(x => x.Error); Map(x => x.Error);
Map(x => x.TestDone);
Map(x => x.Passed); Map(x => x.Passed);
References(x => x.WaterMeter); References(x => x.WaterMeter);
+1
View File
@@ -23,6 +23,7 @@ namespace Results.Mappings
Map(x => x.SerialNrEx); Map(x => x.SerialNrEx);
Map(x => x.OrigCalibFactor); Map(x => x.OrigCalibFactor);
Map(x => x.CalibFactor); Map(x => x.CalibFactor);
Map(x =? x.Q2CorrectionDone);
Map(x => x.Q2Correction); Map(x => x.Q2Correction);
#endif #endif
References(x => x.WaterMeterData); References(x => x.WaterMeterData);
+1 -1
View File
@@ -56,7 +56,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Data.cs" /> <Compile Include="BatchResults.cs" />
<Compile Include="Entities\Batch.cs" /> <Compile Include="Entities\Batch.cs" />
<Compile Include="Entities\Components.cs" /> <Compile Include="Entities\Components.cs" />
<Compile Include="Entities\MeterTestRslt.cs" /> <Compile Include="Entities\MeterTestRslt.cs" />
+2 -1
View File
@@ -78,7 +78,8 @@ namespace ResultsBrowser
{ {
for (int i = 0; i < Math.Min(tr.Meters.Count, wmResults.Count); i++) for (int i = 0; i < Math.Min(tr.Meters.Count, wmResults.Count); i++)
{ {
wmResults[i].Append(tr.Meters[i]); // TODO: Rewrite
//wmResults[i].MeterTestResults(tr.Meters[i]);
} }
} }
} }
@@ -22,7 +22,8 @@ namespace TBF.BenchControl.BenchInfo.Munich
readonly ComponentCfg benchInfoCfg; readonly ComponentCfg benchInfoCfg;
public string TestBenchId { get { return benchInfoCfg.TestBenchId; } } public string TestBenchName { get { return benchInfoCfg.TestBenchName; } }
public int TestBenchId { get { return benchInfoCfg.TestBenchId; } }
public Component() public Component()
{ {
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2015 Sensus Metering Systems /// Copyright (c) 2013-2016 Sensus Metering Systems
/// Author: Milan Hanajík /// Author: Milan Hanajík
/// ///
using System; using System;
@@ -20,15 +20,17 @@ namespace TBF.BenchControl.BenchInfo.Munich
/// ///
/// Serialized parameters /// Serialized parameters
/// ///
public string TestBenchId; public string TestBenchName;
public int TestBenchId;
/// Private parameterless constructor invoked by all other (public) constructors /// Private parameterless constructor invoked by all other (public) constructors
ComponentCfg() ComponentCfg()
{ {
Name = "BenchInfo"; Name = "BenchInfo";
ParentName = string.Empty; ParentName = string.Empty;
TestBenchId = "1"; TestBenchName = "1";
} TestBenchId = 1;
}
public ComponentCfg(IComponentFactory factory) public ComponentCfg(IComponentFactory factory)
: this() : this()
@@ -38,7 +40,7 @@ namespace TBF.BenchControl.BenchInfo.Munich
public string ToString(int i) public string ToString(int i)
{ {
return string.Format("Name={0}, TestBenchId={1}", Name, TestBenchId); return string.Format("Name={0}, Bench name={1}, Bench Id={2}", Name, TestBenchName, TestBenchId);
} }
} }
} }
@@ -35,7 +35,8 @@ namespace TBF.BenchControl.BenchInfo.Munich
private void EntryFormCfgCtrl_Load(object sender, EventArgs e) private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
{ {
nameLabel.Text = Strings.Name; nameLabel.Text = Strings.Name;
numberLabel.Text = Strings.Test_bench_number; benchNameLabel.Text = Strings.Test_bench_name;
benchIdLabel.Text = Strings.Test_bench_number;
Redraw(); Redraw();
} }
@@ -46,20 +47,30 @@ namespace TBF.BenchControl.BenchInfo.Munich
void Redraw() void Redraw()
{ {
if (config == null) return; /// Control was not loaded, settings were not changed if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName; classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name; nameTextBox.Text = config.Name;
numberTextBox.Text = config.TestBenchId; benchNameTextBox.Text = config.TestBenchName;
benchIdTextBox.Text = config.TestBenchId.ToString();
} }
public void Unlock() public void Unlock()
{ {
nameTextBox.Enabled = true; nameTextBox.Enabled = true;
numberTextBox.Enabled = true; benchNameTextBox.Enabled = true;
benchIdTextBox.Enabled = true;
} }
public CfgUpdateFlags VerifyCfg(ref string message) public CfgUpdateFlags VerifyCfg(ref string message)
{ {
CfgUpdateFlags flags = CfgUpdateFlags.None; CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!int.TryParse(benchIdTextBox.Text, out dummy) || dummy < 0)
{
flags = CfgUpdateFlags.Error;
message = string.Format("Invalid {0} parameter", Strings.Test_bench_number);
}
return flags; return flags;
} }
@@ -70,7 +81,8 @@ namespace TBF.BenchControl.BenchInfo.Munich
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
/// ///
config.Name = nameTextBox.Text; config.Name = nameTextBox.Text;
config.TestBenchId = numberTextBox.Text; config.TestBenchName = benchNameTextBox.Text;
config.TestBenchId = int.Parse(benchIdTextBox.Text);
return flags; return flags;
} }
@@ -34,14 +34,16 @@ namespace TBF.BenchControl.BenchInfo.Munich
this.nameTextBox = new System.Windows.Forms.TextBox(); this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label(); this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label(); this.classNameLabel = new System.Windows.Forms.Label();
this.numberLabel = new System.Windows.Forms.Label(); this.benchNameLabel = new System.Windows.Forms.Label();
this.numberTextBox = new System.Windows.Forms.TextBox(); this.benchNameTextBox = new System.Windows.Forms.TextBox();
this.benchIdTextBox = new System.Windows.Forms.TextBox();
this.benchIdLabel = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// nameTextBox // nameTextBox
// //
this.nameTextBox.Enabled = false; this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(135, 55); this.nameTextBox.Location = new System.Drawing.Point(140, 55);
this.nameTextBox.Name = "nameTextBox"; this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20); this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 5; this.nameTextBox.TabIndex = 5;
@@ -58,35 +60,54 @@ namespace TBF.BenchControl.BenchInfo.Munich
// classNameLabel // classNameLabel
// //
this.classNameLabel.AutoSize = true; this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(132, 31); this.classNameLabel.Location = new System.Drawing.Point(137, 31);
this.classNameLabel.Name = "classNameLabel"; this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(60, 13); this.classNameLabel.Size = new System.Drawing.Size(60, 13);
this.classNameLabel.TabIndex = 3; this.classNameLabel.TabIndex = 3;
this.classNameLabel.Text = "ClassName"; this.classNameLabel.Text = "ClassName";
// //
// numberLabel // benchNameLabel
// //
this.numberLabel.AutoSize = true; this.benchNameLabel.AutoSize = true;
this.numberLabel.Location = new System.Drawing.Point(25, 86); this.benchNameLabel.Location = new System.Drawing.Point(25, 84);
this.numberLabel.Name = "numberLabel"; this.benchNameLabel.Name = "benchNameLabel";
this.numberLabel.Size = new System.Drawing.Size(44, 13); this.benchNameLabel.Size = new System.Drawing.Size(90, 13);
this.numberLabel.TabIndex = 6; this.benchNameLabel.TabIndex = 6;
this.numberLabel.Text = "Number"; this.benchNameLabel.Text = "Test bench name";
// //
// numberTextBox // benchNameTextBox
// //
this.numberTextBox.Enabled = false; this.benchNameTextBox.Enabled = false;
this.numberTextBox.Location = new System.Drawing.Point(135, 83); this.benchNameTextBox.Location = new System.Drawing.Point(140, 81);
this.numberTextBox.Name = "numberTextBox"; this.benchNameTextBox.Name = "benchNameTextBox";
this.numberTextBox.Size = new System.Drawing.Size(57, 20); this.benchNameTextBox.Size = new System.Drawing.Size(67, 20);
this.numberTextBox.TabIndex = 7; this.benchNameTextBox.TabIndex = 7;
//
// benchIdTextBox
//
this.benchIdTextBox.Enabled = false;
this.benchIdTextBox.Location = new System.Drawing.Point(140, 107);
this.benchIdTextBox.Name = "benchIdTextBox";
this.benchIdTextBox.Size = new System.Drawing.Size(67, 20);
this.benchIdTextBox.TabIndex = 9;
//
// benchIdLabel
//
this.benchIdLabel.AutoSize = true;
this.benchIdLabel.Location = new System.Drawing.Point(25, 110);
this.benchIdLabel.Name = "benchIdLabel";
this.benchIdLabel.Size = new System.Drawing.Size(99, 13);
this.benchIdLabel.TabIndex = 8;
this.benchIdLabel.Text = "Test bench number";
// //
// ComponentCfgCtrl // ComponentCfgCtrl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.numberTextBox); this.Controls.Add(this.benchIdTextBox);
this.Controls.Add(this.numberLabel); this.Controls.Add(this.benchIdLabel);
this.Controls.Add(this.benchNameTextBox);
this.Controls.Add(this.benchNameLabel);
this.Controls.Add(this.nameTextBox); this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel); this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel); this.Controls.Add(this.classNameLabel);
@@ -103,7 +124,9 @@ namespace TBF.BenchControl.BenchInfo.Munich
private System.Windows.Forms.TextBox nameTextBox; private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel; private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel; private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.Label numberLabel; private System.Windows.Forms.Label benchNameLabel;
private System.Windows.Forms.TextBox numberTextBox; private System.Windows.Forms.TextBox benchNameTextBox;
private System.Windows.Forms.TextBox benchIdTextBox;
private System.Windows.Forms.Label benchIdLabel;
} }
} }
@@ -22,7 +22,8 @@ namespace TBF.BenchControl.BenchInfo.Polska
readonly ComponentCfg benchInfoCfg; readonly ComponentCfg benchInfoCfg;
public string TestBenchId { get { return benchInfoCfg.TestBenchId; } } public string TestBenchName { get { return benchInfoCfg.TestBenchName; } }
public int TestBenchId { get { return benchInfoCfg.TestBenchId; } }
public Component() public Component()
{ {
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2015 Sensus Metering Systems /// Copyright (c) 2015-2016 Sensus Metering Systems
/// Author: Milan Hanajík /// Author: Milan Hanajík
/// ///
using System; using System;
@@ -20,7 +20,8 @@ namespace TBF.BenchControl.BenchInfo.Polska
/// ///
/// Serialized parameters /// Serialized parameters
/// ///
public string TestBenchId; public string TestBenchName;
public int TestBenchId;
public string Address1; public string Address1;
public string Address2; public string Address2;
public string Address3; public string Address3;
@@ -35,7 +36,8 @@ namespace TBF.BenchControl.BenchInfo.Polska
{ {
Name = "BenchInfo"; Name = "BenchInfo";
ParentName = string.Empty; ParentName = string.Empty;
TestBenchId = "1"; TestBenchName = "1";
TestBenchId = 1;
Address1 = string.Empty; Address1 = string.Empty;
Address2 = string.Empty; Address2 = string.Empty;
@@ -56,7 +58,7 @@ namespace TBF.BenchControl.BenchInfo.Polska
public string ToString(int i) public string ToString(int i)
{ {
return string.Format("Name={0}, TestBenchId={1}", Name, TestBenchId); return string.Format("Name={0}, Bench name={1}, Bench Id={2}", Name, TestBenchName, TestBenchId);
} }
} }
} }
@@ -35,6 +35,7 @@ namespace TBF.BenchControl.BenchInfo.Polska
private void EntryFormCfgCtrl_Load(object sender, EventArgs e) private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
{ {
nameLabel.Text = Strings.Name; nameLabel.Text = Strings.Name;
benchNameLabel.Text = Strings.Test_bench_name;
benchIdLabel.Text = Strings.Test_bench_number; benchIdLabel.Text = Strings.Test_bench_number;
address1Label.Text = Strings.Address + " 1"; address1Label.Text = Strings.Address + " 1";
@@ -56,10 +57,11 @@ namespace TBF.BenchControl.BenchInfo.Polska
void Redraw() void Redraw()
{ {
if (config == null) return; /// Control was not loaded, settings were not changed if (config == null) return; /// Control was not loaded, settings were not changed
///
classNameLabel.Text = config.Factory.ClassName; classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name; nameTextBox.Text = config.Name;
benchIdTextBox.Text = config.TestBenchId; benchNameTextBox.Text = config.TestBenchName;
benchIdTextBox.Text = config.TestBenchId.ToString();
address1TextBox.Text = config.Address1; address1TextBox.Text = config.Address1;
address2TextBox.Text = config.Address2; address2TextBox.Text = config.Address2;
@@ -75,6 +77,7 @@ namespace TBF.BenchControl.BenchInfo.Polska
public void Unlock() public void Unlock()
{ {
nameTextBox.Enabled = true; nameTextBox.Enabled = true;
benchNameTextBox.Enabled = true;
benchIdTextBox.Enabled = true; benchIdTextBox.Enabled = true;
address1TextBox.Enabled = true; address1TextBox.Enabled = true;
@@ -91,6 +94,13 @@ namespace TBF.BenchControl.BenchInfo.Polska
public CfgUpdateFlags VerifyCfg(ref string message) public CfgUpdateFlags VerifyCfg(ref string message)
{ {
CfgUpdateFlags flags = CfgUpdateFlags.None; CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!int.TryParse(benchIdTextBox.Text, out dummy) || dummy < 0)
{
flags = CfgUpdateFlags.Error;
message = string.Format("Invalid {0} parameter", Strings.Test_bench_number);
}
return flags; return flags;
} }
@@ -101,7 +111,8 @@ namespace TBF.BenchControl.BenchInfo.Polska
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
/// ///
config.Name = nameTextBox.Text; config.Name = nameTextBox.Text;
config.TestBenchId = benchIdTextBox.Text; config.TestBenchName = benchNameTextBox.Text;
config.TestBenchId = int.Parse(benchIdTextBox.Text);
config.Address1 = address1TextBox.Text; config.Address1 = address1TextBox.Text;
config.Address2 = address2TextBox.Text; config.Address2 = address2TextBox.Text;
@@ -52,23 +52,25 @@ namespace TBF.BenchControl.BenchInfo.Polska
this.approvalDateLabel = new System.Windows.Forms.Label(); this.approvalDateLabel = new System.Windows.Forms.Label();
this.approvalIdTextBox = new System.Windows.Forms.TextBox(); this.approvalIdTextBox = new System.Windows.Forms.TextBox();
this.approvalIdLabel = new System.Windows.Forms.Label(); this.approvalIdLabel = new System.Windows.Forms.Label();
this.benchNameTextBox = new System.Windows.Forms.TextBox();
this.benchNameLabel = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// nameTextBox // nameTextBox
// //
this.nameTextBox.Enabled = false; this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(113, 26); this.nameTextBox.Location = new System.Drawing.Point(113, 24);
this.nameTextBox.Name = "nameTextBox"; this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(88, 20); this.nameTextBox.Size = new System.Drawing.Size(88, 20);
this.nameTextBox.TabIndex = 5; this.nameTextBox.TabIndex = 2;
// //
// nameLabel // nameLabel
// //
this.nameLabel.AutoSize = true; this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(6, 29); this.nameLabel.Location = new System.Drawing.Point(6, 27);
this.nameLabel.Name = "nameLabel"; this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13); this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 4; this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name"; this.nameLabel.Text = "Name";
// //
// classNameLabel // classNameLabel
@@ -77,109 +79,109 @@ namespace TBF.BenchControl.BenchInfo.Polska
this.classNameLabel.Location = new System.Drawing.Point(110, 6); this.classNameLabel.Location = new System.Drawing.Point(110, 6);
this.classNameLabel.Name = "classNameLabel"; this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(60, 13); this.classNameLabel.Size = new System.Drawing.Size(60, 13);
this.classNameLabel.TabIndex = 3; this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ClassName"; this.classNameLabel.Text = "ClassName";
// //
// benchIdLabel // benchIdLabel
// //
this.benchIdLabel.AutoSize = true; this.benchIdLabel.AutoSize = true;
this.benchIdLabel.Location = new System.Drawing.Point(6, 50); this.benchIdLabel.Location = new System.Drawing.Point(6, 66);
this.benchIdLabel.Name = "benchIdLabel"; this.benchIdLabel.Name = "benchIdLabel";
this.benchIdLabel.Size = new System.Drawing.Size(52, 13); this.benchIdLabel.Size = new System.Drawing.Size(99, 13);
this.benchIdLabel.TabIndex = 6; this.benchIdLabel.TabIndex = 5;
this.benchIdLabel.Text = "Bench ID"; this.benchIdLabel.Text = "Test bench number";
// //
// benchIdTextBox // benchIdTextBox
// //
this.benchIdTextBox.Enabled = false; this.benchIdTextBox.Enabled = false;
this.benchIdTextBox.Location = new System.Drawing.Point(113, 47); this.benchIdTextBox.Location = new System.Drawing.Point(113, 64);
this.benchIdTextBox.Name = "benchIdTextBox"; this.benchIdTextBox.Name = "benchIdTextBox";
this.benchIdTextBox.Size = new System.Drawing.Size(57, 20); this.benchIdTextBox.Size = new System.Drawing.Size(57, 20);
this.benchIdTextBox.TabIndex = 7; this.benchIdTextBox.TabIndex = 6;
// //
// address1TextBox // address1TextBox
// //
this.address1TextBox.Enabled = false; this.address1TextBox.Enabled = false;
this.address1TextBox.Location = new System.Drawing.Point(73, 75); this.address1TextBox.Location = new System.Drawing.Point(73, 86);
this.address1TextBox.Name = "address1TextBox"; this.address1TextBox.Name = "address1TextBox";
this.address1TextBox.Size = new System.Drawing.Size(220, 20); this.address1TextBox.Size = new System.Drawing.Size(220, 20);
this.address1TextBox.TabIndex = 9; this.address1TextBox.TabIndex = 8;
// //
// address1Label // address1Label
// //
this.address1Label.AutoSize = true; this.address1Label.AutoSize = true;
this.address1Label.Location = new System.Drawing.Point(6, 78); this.address1Label.Location = new System.Drawing.Point(6, 89);
this.address1Label.Name = "address1Label"; this.address1Label.Name = "address1Label";
this.address1Label.Size = new System.Drawing.Size(54, 13); this.address1Label.Size = new System.Drawing.Size(54, 13);
this.address1Label.TabIndex = 8; this.address1Label.TabIndex = 7;
this.address1Label.Text = "Address 1"; this.address1Label.Text = "Address 1";
// //
// address2TextBox // address2TextBox
// //
this.address2TextBox.Enabled = false; this.address2TextBox.Enabled = false;
this.address2TextBox.Location = new System.Drawing.Point(73, 95); this.address2TextBox.Location = new System.Drawing.Point(73, 106);
this.address2TextBox.Name = "address2TextBox"; this.address2TextBox.Name = "address2TextBox";
this.address2TextBox.Size = new System.Drawing.Size(220, 20); this.address2TextBox.Size = new System.Drawing.Size(220, 20);
this.address2TextBox.TabIndex = 11; this.address2TextBox.TabIndex = 10;
// //
// address2Label // address2Label
// //
this.address2Label.AutoSize = true; this.address2Label.AutoSize = true;
this.address2Label.Location = new System.Drawing.Point(6, 98); this.address2Label.Location = new System.Drawing.Point(6, 109);
this.address2Label.Name = "address2Label"; this.address2Label.Name = "address2Label";
this.address2Label.Size = new System.Drawing.Size(54, 13); this.address2Label.Size = new System.Drawing.Size(54, 13);
this.address2Label.TabIndex = 10; this.address2Label.TabIndex = 9;
this.address2Label.Text = "Address 2"; this.address2Label.Text = "Address 2";
// //
// address3TextBox // address3TextBox
// //
this.address3TextBox.Enabled = false; this.address3TextBox.Enabled = false;
this.address3TextBox.Location = new System.Drawing.Point(73, 115); this.address3TextBox.Location = new System.Drawing.Point(73, 126);
this.address3TextBox.Name = "address3TextBox"; this.address3TextBox.Name = "address3TextBox";
this.address3TextBox.Size = new System.Drawing.Size(220, 20); this.address3TextBox.Size = new System.Drawing.Size(220, 20);
this.address3TextBox.TabIndex = 13; this.address3TextBox.TabIndex = 12;
// //
// address3Label // address3Label
// //
this.address3Label.AutoSize = true; this.address3Label.AutoSize = true;
this.address3Label.Location = new System.Drawing.Point(6, 118); this.address3Label.Location = new System.Drawing.Point(6, 129);
this.address3Label.Name = "address3Label"; this.address3Label.Name = "address3Label";
this.address3Label.Size = new System.Drawing.Size(54, 13); this.address3Label.Size = new System.Drawing.Size(54, 13);
this.address3Label.TabIndex = 12; this.address3Label.TabIndex = 11;
this.address3Label.Text = "Address 3"; this.address3Label.Text = "Address 3";
// //
// address4TextBox // address4TextBox
// //
this.address4TextBox.Enabled = false; this.address4TextBox.Enabled = false;
this.address4TextBox.Location = new System.Drawing.Point(73, 136); this.address4TextBox.Location = new System.Drawing.Point(73, 146);
this.address4TextBox.Name = "address4TextBox"; this.address4TextBox.Name = "address4TextBox";
this.address4TextBox.Size = new System.Drawing.Size(220, 20); this.address4TextBox.Size = new System.Drawing.Size(220, 20);
this.address4TextBox.TabIndex = 15; this.address4TextBox.TabIndex = 14;
// //
// address4Label // address4Label
// //
this.address4Label.AutoSize = true; this.address4Label.AutoSize = true;
this.address4Label.Location = new System.Drawing.Point(6, 139); this.address4Label.Location = new System.Drawing.Point(6, 149);
this.address4Label.Name = "address4Label"; this.address4Label.Name = "address4Label";
this.address4Label.Size = new System.Drawing.Size(54, 13); this.address4Label.Size = new System.Drawing.Size(54, 13);
this.address4Label.TabIndex = 14; this.address4Label.TabIndex = 13;
this.address4Label.Text = "Address 4"; this.address4Label.Text = "Address 4";
// //
// address5TextBox // address5TextBox
// //
this.address5TextBox.Enabled = false; this.address5TextBox.Enabled = false;
this.address5TextBox.Location = new System.Drawing.Point(73, 157); this.address5TextBox.Location = new System.Drawing.Point(73, 166);
this.address5TextBox.Name = "address5TextBox"; this.address5TextBox.Name = "address5TextBox";
this.address5TextBox.Size = new System.Drawing.Size(220, 20); this.address5TextBox.Size = new System.Drawing.Size(220, 20);
this.address5TextBox.TabIndex = 17; this.address5TextBox.TabIndex = 16;
// //
// address5Label // address5Label
// //
this.address5Label.AutoSize = true; this.address5Label.AutoSize = true;
this.address5Label.Location = new System.Drawing.Point(6, 160); this.address5Label.Location = new System.Drawing.Point(6, 169);
this.address5Label.Name = "address5Label"; this.address5Label.Name = "address5Label";
this.address5Label.Size = new System.Drawing.Size(54, 13); this.address5Label.Size = new System.Drawing.Size(54, 13);
this.address5Label.TabIndex = 16; this.address5Label.TabIndex = 15;
this.address5Label.Text = "Address 5"; this.address5Label.Text = "Address 5";
// //
// approvedByTextBox // approvedByTextBox
@@ -188,7 +190,7 @@ namespace TBF.BenchControl.BenchInfo.Polska
this.approvedByTextBox.Location = new System.Drawing.Point(113, 227); this.approvedByTextBox.Location = new System.Drawing.Point(113, 227);
this.approvedByTextBox.Name = "approvedByTextBox"; this.approvedByTextBox.Name = "approvedByTextBox";
this.approvedByTextBox.Size = new System.Drawing.Size(180, 20); this.approvedByTextBox.Size = new System.Drawing.Size(180, 20);
this.approvedByTextBox.TabIndex = 23; this.approvedByTextBox.TabIndex = 22;
// //
// approvedByLabel // approvedByLabel
// //
@@ -196,47 +198,66 @@ namespace TBF.BenchControl.BenchInfo.Polska
this.approvedByLabel.Location = new System.Drawing.Point(6, 230); this.approvedByLabel.Location = new System.Drawing.Point(6, 230);
this.approvedByLabel.Name = "approvedByLabel"; this.approvedByLabel.Name = "approvedByLabel";
this.approvedByLabel.Size = new System.Drawing.Size(67, 13); this.approvedByLabel.Size = new System.Drawing.Size(67, 13);
this.approvedByLabel.TabIndex = 22; this.approvedByLabel.TabIndex = 21;
this.approvedByLabel.Text = "Approved by"; this.approvedByLabel.Text = "Approved by";
// //
// approvalDateTextBox // approvalDateTextBox
// //
this.approvalDateTextBox.Enabled = false; this.approvalDateTextBox.Enabled = false;
this.approvalDateTextBox.Location = new System.Drawing.Point(113, 206); this.approvalDateTextBox.Location = new System.Drawing.Point(113, 207);
this.approvalDateTextBox.Name = "approvalDateTextBox"; this.approvalDateTextBox.Name = "approvalDateTextBox";
this.approvalDateTextBox.Size = new System.Drawing.Size(180, 20); this.approvalDateTextBox.Size = new System.Drawing.Size(180, 20);
this.approvalDateTextBox.TabIndex = 21; this.approvalDateTextBox.TabIndex = 20;
// //
// approvalDateLabel // approvalDateLabel
// //
this.approvalDateLabel.AutoSize = true; this.approvalDateLabel.AutoSize = true;
this.approvalDateLabel.Location = new System.Drawing.Point(6, 209); this.approvalDateLabel.Location = new System.Drawing.Point(6, 210);
this.approvalDateLabel.Name = "approvalDateLabel"; this.approvalDateLabel.Name = "approvalDateLabel";
this.approvalDateLabel.Size = new System.Drawing.Size(73, 13); this.approvalDateLabel.Size = new System.Drawing.Size(73, 13);
this.approvalDateLabel.TabIndex = 20; this.approvalDateLabel.TabIndex = 19;
this.approvalDateLabel.Text = "Approval date"; this.approvalDateLabel.Text = "Approval date";
// //
// approvalIdTextBox // approvalIdTextBox
// //
this.approvalIdTextBox.Enabled = false; this.approvalIdTextBox.Enabled = false;
this.approvalIdTextBox.Location = new System.Drawing.Point(113, 185); this.approvalIdTextBox.Location = new System.Drawing.Point(113, 187);
this.approvalIdTextBox.Name = "approvalIdTextBox"; this.approvalIdTextBox.Name = "approvalIdTextBox";
this.approvalIdTextBox.Size = new System.Drawing.Size(180, 20); this.approvalIdTextBox.Size = new System.Drawing.Size(180, 20);
this.approvalIdTextBox.TabIndex = 19; this.approvalIdTextBox.TabIndex = 18;
// //
// approvalIdLabel // approvalIdLabel
// //
this.approvalIdLabel.AutoSize = true; this.approvalIdLabel.AutoSize = true;
this.approvalIdLabel.Location = new System.Drawing.Point(6, 188); this.approvalIdLabel.Location = new System.Drawing.Point(6, 190);
this.approvalIdLabel.Name = "approvalIdLabel"; this.approvalIdLabel.Name = "approvalIdLabel";
this.approvalIdLabel.Size = new System.Drawing.Size(61, 13); this.approvalIdLabel.Size = new System.Drawing.Size(61, 13);
this.approvalIdLabel.TabIndex = 18; this.approvalIdLabel.TabIndex = 17;
this.approvalIdLabel.Text = "Approval Id"; this.approvalIdLabel.Text = "Approval Id";
// //
// benchNameTextBox
//
this.benchNameTextBox.Enabled = false;
this.benchNameTextBox.Location = new System.Drawing.Point(113, 44);
this.benchNameTextBox.Name = "benchNameTextBox";
this.benchNameTextBox.Size = new System.Drawing.Size(57, 20);
this.benchNameTextBox.TabIndex = 4;
//
// benchNameLabel
//
this.benchNameLabel.AutoSize = true;
this.benchNameLabel.Location = new System.Drawing.Point(6, 46);
this.benchNameLabel.Name = "benchNameLabel";
this.benchNameLabel.Size = new System.Drawing.Size(90, 13);
this.benchNameLabel.TabIndex = 3;
this.benchNameLabel.Text = "Test bench name";
//
// ComponentCfgCtrl // ComponentCfgCtrl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.benchNameTextBox);
this.Controls.Add(this.benchNameLabel);
this.Controls.Add(this.approvedByTextBox); this.Controls.Add(this.approvedByTextBox);
this.Controls.Add(this.approvedByLabel); this.Controls.Add(this.approvedByLabel);
this.Controls.Add(this.approvalDateTextBox); this.Controls.Add(this.approvalDateTextBox);
@@ -289,5 +310,7 @@ namespace TBF.BenchControl.BenchInfo.Polska
private System.Windows.Forms.Label approvalDateLabel; private System.Windows.Forms.Label approvalDateLabel;
private System.Windows.Forms.TextBox approvalIdTextBox; private System.Windows.Forms.TextBox approvalIdTextBox;
private System.Windows.Forms.Label approvalIdLabel; private System.Windows.Forms.Label approvalIdLabel;
private System.Windows.Forms.TextBox benchNameTextBox;
private System.Windows.Forms.Label benchNameLabel;
} }
} }
@@ -11,6 +11,7 @@ namespace TBF.BenchControl.GenericDevices
/// </summary> /// </summary>
public interface IBenchInfo : IComponent public interface IBenchInfo : IComponent
{ {
string TestBenchId { get; } string TestBenchName { get; }
int TestBenchId { get; }
} }
} }
@@ -128,7 +128,7 @@ namespace TBF.BenchControl.ResultsPrinters.Munich
PrintAt(e, Tab1, lineNr * SpacingOne, prn.Version); PrintAt(e, Tab1, lineNr * SpacingOne, prn.Version);
lineNr++; lineNr++;
PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Prüfstand Nr :"); PrintBoldAt(e, Tab1, lineNr * SpacingOne, "Prüfstand Nr :");
PrintBoldAt(e, Tab2, lineNr * SpacingOne, (prn.BenchId != null) ? prn.BenchId.TestBenchId : ""); PrintBoldAt(e, Tab2, lineNr * SpacingOne, (prn.BenchId != null) ? prn.BenchId.TestBenchName : "");
PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Datum :"); PrintBoldAt(e, Tab3, lineNr * SpacingOne, "Datum :");
PrintBoldAt(e, Tab4, lineNr * SpacingOne, DateTime.Now.Date.ToString("d")); PrintBoldAt(e, Tab4, lineNr * SpacingOne, DateTime.Now.Date.ToString("d"));
lineNr++; lineNr++;
@@ -230,7 +230,34 @@ namespace TBF.BenchControl.Sequences
/// ///
/// Procedure selected at this point, a new batch was started /// Procedure selected at this point, a new batch was started
/// ///
StateMachine.CycleStartTimeStamp = DateTime.Now;
/// Prepare new water meters
bool compound = (StateMachine.Procedure.MetersKind == MetersKind.Combined);
int nrWMs = Math.Min(WaterMeters.Count, compound ? Config.Data.CompoundWMsCount : Config.Data.WMsCount);
///
Results.Entities.WaterMeterData[] waterMeterData = new Results.Entities.WaterMeterData[nrWMs];
///
int[] waterMeterParts = new int[nrWMs];
for (int i = 0; i < nrWMs; i++)
{
waterMeterParts[i] = Utils.PartNr(i + 1, compound);
waterMeterData[i] = new Results.Entities.WaterMeterData()
{
ProductName = StateMachine.Procedure.Name,
Producer = WaterMeters[i].Producer,
MetrologicalClass = WaterMeters[i].MetrologicalClass,
ApprovalInfo = WaterMeters[i].ApprovalInfo,
Qn = WaterMeters[i].Qn,
Compound = compound,
};
}
/// Prepare empty results
BatchRslts = Results.BatchResults.NewFromProcedure(Program.LocalSettings.BatchNr, BenchInfo.TestBenchId,
User.CurrentUser.Name, Program.Version,
StateMachine.Procedure, waterMeterData, waterMeterParts);
StateMachine.CycleStartTimeStamp = BatchRslts.Batch.StartTime;
foreach (var wm in WaterMeters) wm.ClearData(); /// Clean water meter data foreach (var wm in WaterMeters) wm.ClearData(); /// Clean water meter data
ResetResults(); ResetResults();
@@ -482,7 +509,7 @@ namespace TBF.BenchControl.Sequences
{ {
foreach (var rr in sensPath.RegisterReaders) foreach (var rr in sensPath.RegisterReaders)
if (rr is WaterMeters.iPerl.WaterMeter) if (rr is WaterMeters.iPerl.WaterMeter)
(rr as WaterMeters.iPerl.WaterMeter).BenchName = BenchInfo.TestBenchId; (rr as WaterMeters.iPerl.WaterMeter).BenchName = BenchInfo.TestBenchName;
} }
e = testMethodSequence.Execute(test); e = testMethodSequence.Execute(test);
@@ -539,7 +566,7 @@ namespace TBF.BenchControl.Sequences
{ {
foreach (var rr in sensPath.RegisterReaders) foreach (var rr in sensPath.RegisterReaders)
if (rr is WaterMeters.iPerl.WaterMeter) if (rr is WaterMeters.iPerl.WaterMeter)
(rr as WaterMeters.iPerl.WaterMeter).BenchName = BenchInfo.TestBenchId; (rr as WaterMeters.iPerl.WaterMeter).BenchName = BenchInfo.TestBenchName;
} }
e = testMethodSequence.Execute(test); e = testMethodSequence.Execute(test);
@@ -618,7 +645,7 @@ namespace TBF.BenchControl.Sequences
State savingAndPrintingRslts = State.Create("MainSeq : Saving and printing results"); State savingAndPrintingRslts = State.Create("MainSeq : Saving and printing results");
if (writer != null) if (writer != null)
{ {
savingAndPrintingRslts.AddOperation(writer.WriteResultsOp((BenchInfo != null) ? BenchInfo.TestBenchId : string.Empty, savingAndPrintingRslts.AddOperation(writer.WriteResultsOp((BenchInfo != null) ? BenchInfo.TestBenchName : string.Empty,
StateMachine.Procedure, WaterMeters, results)); StateMachine.Procedure, WaterMeters, results));
} }
if (printer != null && !printer.SupressPrinting) if (printer != null && !printer.SupressPrinting)
@@ -21,5 +21,7 @@ namespace TBF.BenchControl.Sequences
public static FloatBox RefFreq = new FloatBox() { Name = "RefFreq", Format = "F2" }; public static FloatBox RefFreq = new FloatBox() { Name = "RefFreq", Format = "F2" };
public static FloatBox RefFlow = new FloatBox() { Name = "RefFlow", Format = "F2" }; /// [m3/h] public static FloatBox RefFlow = new FloatBox() { Name = "RefFlow", Format = "F2" }; /// [m3/h]
public static FloatBox Mass = new FloatBox() { Name = "Mass", Format = "F3" }; /// [kg] public static FloatBox Mass = new FloatBox() { Name = "Mass", Format = "F3" }; /// [kg]
public static Results.BatchResults BatchRslts;
} }
} }