Changes in counters, part 1.
This commit is contained in:
parent
073ee3bf30
commit
d8927a9052
@ -29,11 +29,6 @@ namespace Results.Entities
|
||||
public virtual float DensityCorr { get; set; } /// Density correction in [kg/m3]
|
||||
public virtual float Custom2 { get; set; }
|
||||
public virtual float Custom3 { get; set; }
|
||||
public virtual int Counter1 { get; set; }
|
||||
public virtual int Counter2 { get; set; }
|
||||
public virtual int Counter3 { get; set; }
|
||||
public virtual int Counter4 { get; set; }
|
||||
public virtual int Counter5 { get; set; }
|
||||
public virtual int Counter6 { get; set; }
|
||||
public virtual int Counter7 { get; set; }
|
||||
public virtual int Counter8 { get; set; }
|
||||
|
||||
@ -131,7 +131,13 @@ namespace Results.Entities
|
||||
public virtual float Custom8 { get; set; } /// [°C] T ref lo end
|
||||
public virtual float Custom9 { get; set; } /// [°C] T ref lo min
|
||||
public virtual float Custom10 { get; set; } /// [°C] T ref lo max
|
||||
|
||||
|
||||
public virtual int Counter1 { get; set; }
|
||||
public virtual int Counter2 { get; set; }
|
||||
public virtual int Counter3 { get; set; }
|
||||
public virtual int Counter4 { get; set; }
|
||||
public virtual int Counter5 { get; set; }
|
||||
|
||||
/// Wrappers
|
||||
public virtual string Name() { return Utils.GetTestName(TestData.Name, TestData.Repeats, RepetitionNr); }
|
||||
public virtual int Repeats() { return TestData.Repeats; }
|
||||
@ -322,6 +328,7 @@ namespace Results.Entities
|
||||
FlowEnd = src.FlowEnd;
|
||||
FlowMin = src.FlowMin;
|
||||
FlowMax = src.FlowMax;
|
||||
|
||||
Custom1 = src.Custom1;
|
||||
Custom2 = src.Custom2;
|
||||
Custom3 = src.Custom3;
|
||||
@ -332,6 +339,12 @@ namespace Results.Entities
|
||||
Custom8 = src.Custom8;
|
||||
Custom9 = src.Custom9;
|
||||
Custom10 = src.Custom10;
|
||||
|
||||
Counter1 = src.Counter1;
|
||||
Counter2 = src.Counter2;
|
||||
Counter3 = src.Counter3;
|
||||
Counter4 = src.Counter4;
|
||||
Counter5 = src.Counter5;
|
||||
}
|
||||
|
||||
/// <summary> Wrapper </summary>
|
||||
|
||||
@ -26,16 +26,13 @@ namespace Results.Mappings
|
||||
.Column("Custom1"); ;
|
||||
Map(x => x.Custom2);
|
||||
Map(x => x.Custom3);
|
||||
Map(x => x.Counter1);
|
||||
Map(x => x.Counter2);
|
||||
Map(x => x.Counter3);
|
||||
Map(x => x.Counter4);
|
||||
Map(x => x.Counter5);
|
||||
|
||||
Map(x => x.Counter6);
|
||||
Map(x => x.Counter7);
|
||||
Map(x => x.Counter8);
|
||||
Map(x => x.Counter9);
|
||||
Map(x => x.Counter10);
|
||||
|
||||
Map(x => x.StartTime);
|
||||
Map(x => x.EndTime);
|
||||
Map(x => x.Dirty);
|
||||
|
||||
@ -117,6 +117,12 @@ namespace Results.Mappings
|
||||
Map(x => x.Custom6);
|
||||
Map(x => x.Custom7);
|
||||
Map(x => x.Custom8);
|
||||
}
|
||||
|
||||
Map(x => x.Counter1);
|
||||
Map(x => x.Counter2);
|
||||
Map(x => x.Counter3);
|
||||
Map(x => x.Counter4);
|
||||
Map(x => x.Counter5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,16 +91,22 @@ namespace Results
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void GetCounterStates(Results.Entities.TestRslt tstRslt, int[] counters)
|
||||
{
|
||||
if (tstRslt != null)
|
||||
{
|
||||
tstRslt.Counter1 = ((counters != null) && (counters.Length >= 1)) ? counters[0] : 0;
|
||||
tstRslt.Counter2 = ((counters != null) && (counters.Length >= 2)) ? counters[1] : 0;
|
||||
tstRslt.Counter3 = ((counters != null) && (counters.Length >= 3)) ? counters[2] : 0;
|
||||
tstRslt.Counter4 = ((counters != null) && (counters.Length >= 4)) ? counters[3] : 0;
|
||||
tstRslt.Counter5 = ((counters != null) && (counters.Length >= 5)) ? counters[4] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void GetCounterStates(Results.Entities.Batch batch, int[] counters)
|
||||
{
|
||||
if (batch != null)
|
||||
{
|
||||
batch.Counter1 = ((counters != null) && (counters.Length >= 1)) ? counters[0] : 0;
|
||||
batch.Counter2 = ((counters != null) && (counters.Length >= 2)) ? counters[1] : 0;
|
||||
batch.Counter3 = ((counters != null) && (counters.Length >= 3)) ? counters[2] : 0;
|
||||
batch.Counter4 = ((counters != null) && (counters.Length >= 4)) ? counters[3] : 0;
|
||||
batch.Counter5 = ((counters != null) && (counters.Length >= 5)) ? counters[4] : 0;
|
||||
batch.Counter6 = ((counters != null) && (counters.Length >= 6)) ? counters[5] : 0;
|
||||
batch.Counter7 = ((counters != null) && (counters.Length >= 7)) ? counters[6] : 0;
|
||||
batch.Counter8 = ((counters != null) && (counters.Length >= 8)) ? counters[7] : 0;
|
||||
|
||||
@ -485,17 +485,96 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Table_row_nr, "Table row #", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? TableRowNr.ToString() : string.Format(f, TableRowNr)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Table_column_nr, "Table column #", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? TableColumnNr.ToString() : string.Format(f, TableColumnNr)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.WMRemark, string.Format("{0} {1}", Strings.Water_Meter, Strings.Remark), Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.Remark)));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter1, string.Format(Strings.Counter_0, 1), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter1)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter2, string.Format(Strings.Counter_0, 2), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter2)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter3, string.Format(Strings.Counter_0, 3), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter3)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter4, string.Format(Strings.Counter_0, 4), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter4)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter5, string.Format(Strings.Counter_0, 5), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter5)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter6, string.Format(Strings.Counter_0, 6), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter6)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter7, string.Format(Strings.Counter_0, 7), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter7)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter8, string.Format(Strings.Counter_0, 8), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter8)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter9, string.Format(Strings.Counter_0, 9), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter9)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter10, string.Format(Strings.Counter_0, 10), Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.Counter10)));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter1,
|
||||
string.Format(Strings.Counter_0, 1),
|
||||
Quantity.Number,
|
||||
ItemCategory.Other,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return (w.GetTestRslt(t) != null) ? FormatInt(f, w.GetTestRslt(t).Counter1) : string.Empty;
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter2,
|
||||
string.Format(Strings.Counter_0, 2),
|
||||
Quantity.Number,
|
||||
ItemCategory.Other,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return (w.GetTestRslt(t) != null) ? FormatInt(f, w.GetTestRslt(t).Counter2) : string.Empty;
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter3,
|
||||
string.Format(Strings.Counter_0, 3),
|
||||
Quantity.Number,
|
||||
ItemCategory.Other,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return (w.GetTestRslt(t) != null) ? FormatInt(f, w.GetTestRslt(t).Counter3) : string.Empty;
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter4,
|
||||
string.Format(Strings.Counter_0, 4),
|
||||
Quantity.Number,
|
||||
ItemCategory.Other,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return (w.GetTestRslt(t) != null) ? FormatInt(f, w.GetTestRslt(t).Counter4) : string.Empty;
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter5,
|
||||
string.Format(Strings.Counter_0, 5),
|
||||
Quantity.Number,
|
||||
ItemCategory.Other,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return (w.GetTestRslt(t) != null) ? FormatInt(f, w.GetTestRslt(t).Counter5) : string.Empty;
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter6,
|
||||
string.Format(Strings.Counter_0, 6),
|
||||
Quantity.Number,
|
||||
ItemCategory.TestResult,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return FormatInt(f, w.Batch.Counter6);
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter7,
|
||||
string.Format(Strings.Counter_0, 7),
|
||||
Quantity.Number,
|
||||
ItemCategory.TestResult,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return FormatInt(f, w.Batch.Counter7);
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter8,
|
||||
string.Format(Strings.Counter_0, 8),
|
||||
Quantity.Number,
|
||||
ItemCategory.TestResult,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return FormatInt(f, w.Batch.Counter8);
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter9,
|
||||
string.Format(Strings.Counter_0, 9),
|
||||
Quantity.Number,
|
||||
ItemCategory.TestResult,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return FormatInt(f, w.Batch.Counter9);
|
||||
}));
|
||||
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Counter10,
|
||||
string.Format(Strings.Counter_0, 10),
|
||||
Quantity.Number,
|
||||
ItemCategory.TestResult,
|
||||
(w, t, u, f, p) =>
|
||||
{
|
||||
return FormatInt(f, w.Batch.Counter10);
|
||||
}));
|
||||
}
|
||||
|
||||
/// To be updated by Output.FileWriter or Output.Printer
|
||||
|
||||
@ -37,7 +37,14 @@ namespace TBF.BenchControl.TestMethods.Counter
|
||||
TBF.UiBridge.Bridge.OnSaveSettings(this, null);
|
||||
|
||||
/// Update results
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr), null));
|
||||
var testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
var testResults = BatchRslts.GetTestRslt(testName, test.Part);
|
||||
global::Results.Utils.GetCounterStates(testResults, Program.LocalSettings.Counters);
|
||||
if (testResults != null)
|
||||
{
|
||||
testResults.TestDone = true;
|
||||
}
|
||||
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, testResults));
|
||||
|
||||
return new List<Event> { Event.Done };
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user