All entry forms modified to use Result.Entities.WaterMeter, EndStateAux introduced. TODO: display, saving, printing.

This commit is contained in:
Milan Hanajik
2016-01-04 17:55:39 +01:00
parent e14dc37060
commit d91ca4b56b
19 changed files with 160 additions and 206 deletions
+11 -5
View File
@@ -12,19 +12,19 @@ namespace Results.Entities
public virtual string SerialNr { get; set; } /// Main s/n for compound meters, PCB Number for iPerl water meter public virtual string SerialNr { get; set; } /// Main s/n for compound meters, PCB Number for iPerl water meter
public virtual string SerialNrEx { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter public virtual string SerialNrEx { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter
public virtual string PurchaseOrder { get; set; } public virtual string PurchaseOrder { get; set; }
public virtual int WMPosition { get; set; } public virtual int YearOfProduction { get; set; }
public virtual string EndState { get; set; } public virtual int WMPosition { get; set; }
public virtual string EndState { get; set; } /// End state (of the main water meter)
public virtual string EndStateAux { get; set; } /// End state of the auxiliary water meter
public virtual double QRise { get; set; } ///![m3/h] detected Q_rise of a composed meter public virtual double QRise { get; set; } ///![m3/h] detected Q_rise of a composed meter
public virtual double QFall { get; set; } ///![m3/h] detected Q_fall of a composed meter public virtual double QFall { get; set; } ///![m3/h] detected Q_fall of a composed meter
public virtual int YearOfProduction { get; set; } public virtual bool Passed { get; set; }
public virtual bool Passed { get; set; }
#if IPERLST #if IPERLST
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 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
public virtual WaterMeterData WaterMeterData { get; set; } public virtual WaterMeterData WaterMeterData { get; set; }
public virtual Batch Batch { get; set; } public virtual Batch Batch { get; set; }
public virtual IList<MeterTestRslt> MeterTestRslts { get; set; } public virtual IList<MeterTestRslt> MeterTestRslts { get; set; }
@@ -50,6 +50,12 @@ namespace Results.Entities
public virtual DateTime StartTime() { return Batch.StartTime; } public virtual DateTime StartTime() { return Batch.StartTime; }
public virtual DateTime EndTime() { return Batch.EndTime; } public virtual DateTime EndTime() { return Batch.EndTime; }
///
/// Not mapped to the database
///
public virtual bool Disabled { get; set; } /// true = Disabled water meters (not saved into DB)
public virtual MeterTestRslt MeterTestRslt(string testName) public virtual MeterTestRslt MeterTestRslt(string testName)
{ {
foreach (var tr in MeterTestRslts) foreach (var tr in MeterTestRslts)
+2 -1
View File
@@ -14,11 +14,12 @@ namespace Results.Mappings
Map(x => x.SerialNr); Map(x => x.SerialNr);
Map(x => x.SerialNrEx); Map(x => x.SerialNrEx);
Map(x => x.PurchaseOrder); Map(x => x.PurchaseOrder);
Map(x => x.YearOfProduction);
Map(x => x.WMPosition); Map(x => x.WMPosition);
Map(x => x.EndState); Map(x => x.EndState);
Map(x => x.EndStateAux);
Map(x => x.QRise); Map(x => x.QRise);
Map(x => x.QFall); Map(x => x.QFall);
Map(x => x.YearOfProduction);
Map(x => x.Passed); Map(x => x.Passed);
#if IPERLST #if IPERLST
Map(x => x.OrigCalibFactor); Map(x => x.OrigCalibFactor);
@@ -47,9 +47,9 @@ namespace TBF.BenchControl.DataEntry.Combined
double errLimLo; double errLimLo;
double errLimHi; double errLimHi;
bool resultSaved; bool resultSaved; /// Set in Run() when results are saved
IList<IWaterMeter> waterMeters; Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp public enum CurrentOp
{ {
@@ -83,20 +83,20 @@ namespace TBF.BenchControl.DataEntry.Combined
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleBeginFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning; currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleEndFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd; currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
@@ -142,14 +142,14 @@ namespace TBF.BenchControl.DataEntry.Combined
/// ///
void OpenTestEndStatesDlg(EntryForm myRef) void OpenTestEndStatesDlg(EntryForm myRef)
{ {
string[] mainStartSateStr = new string[Config.Data.CompoundWMsCount]; string[] mainStartStateStr = new string[Config.Data.CompoundWMsCount];
string[] auxStartSateStr = new string[Config.Data.CompoundWMsCount]; string[] auxStartStateStr = new string[Config.Data.CompoundWMsCount];
for (int i = 0; i < Config.Data.CompoundWMsCount; i++) for (int i = 0; i < Config.Data.CompoundWMsCount; i++)
{ {
mainStartSateStr[i] = wmStartStateStr[2 * i]; mainStartStateStr[i] = wmStartStateStr[2 * i];
auxStartSateStr[i] = wmStartStateStr[2 * i + 1]; auxStartStateStr[i] = wmStartStateStr[2 * i + 1];
} }
myRef.modelessDlg = new TestStartEndForm(Config.Data.CompoundWMsCount, mainStartSateStr, auxStartSateStr, disabled, refVolume, errLimLo, errLimHi); myRef.modelessDlg = new TestStartEndForm(Config.Data.CompoundWMsCount, mainStartStateStr, auxStartStateStr, disabled, refVolume, errLimLo, errLimHi);
modelessDlg.Show(); modelessDlg.Show();
} }
@@ -196,13 +196,13 @@ namespace TBF.BenchControl.DataEntry.Combined
{ {
purchaseOrder = dlg.PurchaseOrder; purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count / 2); i++) for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length / 2); i++)
{ {
if (waterMeters[i] != null) if (waterMeters[i] != null)
{ {
serialNr[2 * i] = waterMeters[2 * i].SerialNr = dlg.MainSNText[i]; serialNr[2 * i] = waterMeters[i].SerialNr = dlg.MainSNText[i];
serialNr[2 * i + 1] = waterMeters[2 * i + 1].SerialNr = dlg.AuxSNText[i]; serialNr[2 * i + 1] = waterMeters[i].SerialNrEx = dlg.AuxSNText[i];
disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i]; disabled[i] = waterMeters[i].Disabled = dlg.Disabled[i];
} }
} }
} }
@@ -269,21 +269,9 @@ namespace TBF.BenchControl.DataEntry.Combined
/// </summary> /// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param> /// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="testResults">Test results to be updated with the information</param> /// <param name="testResults">Test results to be updated with the information</param>
public void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<TestResult> testResults) public void UpdateTestResults(Results.BatchResults results)
{ {
foreach (var testRslt in testResults) /// Nothing to be done
{ }
if (testRslt.MetersKind != MetersKind.Combined) continue;
testRslt.PurchaseOrder = PurchaseOrder;
for (int i = 0; i < testRslt.Meters.Count; i++)
{
testRslt.Meters[i].SerialNr = SerialNr(i);
testRslt.Meters[i].Disabled = Disabled(i);
testRslt.Meters[i].EndState = WMCycleEndState(i);
}
}
}
} }
} }
@@ -43,9 +43,9 @@ namespace TBF.BenchControl.DataEntry.Munich
System.Windows.Forms.Form modelessDlg; System.Windows.Forms.Form modelessDlg;
bool resultSaved; bool resultSaved; /// Set in Run() when results are saved
IList<IWaterMeter> wMeters; Results.Entities.WaterMeter[] wMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp public enum CurrentOp
{ {
@@ -73,20 +73,20 @@ namespace TBF.BenchControl.DataEntry.Munich
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleBeginFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning; currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.wMeters = waterMeters; this.wMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleEndFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd; currentOp = CurrentOp.ShowFormAtCycleEnd;
this.wMeters = waterMeters; this.wMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
@@ -142,21 +142,21 @@ namespace TBF.BenchControl.DataEntry.Munich
{ {
if (modelessDlg is CycleBeginningForm) if (modelessDlg is CycleBeginningForm)
{ {
if (wMeters.Count >= 2 && wMeters[0] != null) wMeters[0].SerialNr = (modelessDlg as CycleBeginningForm).MainSNText[0]; if (wMeters.Length >= 1 && wMeters[0] != null) wMeters[0].SerialNr = (modelessDlg as CycleBeginningForm).MainSNText[0];
if (wMeters.Count >= 2 && wMeters[1] != null) wMeters[1].SerialNr = (modelessDlg as CycleBeginningForm).AuxSNText[0]; if (wMeters.Length >= 1 && wMeters[0] != null) wMeters[0].SerialNrEx = (modelessDlg as CycleBeginningForm).AuxSNText[0];
if (wMeters.Count >= 4 && wMeters[2] != null) wMeters[2].SerialNr = (modelessDlg as CycleBeginningForm).MainSNText[1]; if (wMeters.Length >= 2 && wMeters[1] != null) wMeters[1].SerialNr = (modelessDlg as CycleBeginningForm).MainSNText[1];
if (wMeters.Count >= 4 && wMeters[3] != null) wMeters[3].SerialNr = (modelessDlg as CycleBeginningForm).AuxSNText[1]; if (wMeters.Length >= 2 && wMeters[1] != null) wMeters[1].SerialNrEx = (modelessDlg as CycleBeginningForm).AuxSNText[1];
if (wMeters.Count >= 6 && wMeters[4] != null) wMeters[4].SerialNr = (modelessDlg as CycleBeginningForm).MainSNText[2]; if (wMeters.Length >= 3 && wMeters[2] != null) wMeters[2].SerialNr = (modelessDlg as CycleBeginningForm).MainSNText[2];
if (wMeters.Count >= 6 && wMeters[5] != null) wMeters[5].SerialNr = (modelessDlg as CycleBeginningForm).AuxSNText[2]; if (wMeters.Length >= 3 && wMeters[2] != null) wMeters[2].SerialNrEx = (modelessDlg as CycleBeginningForm).AuxSNText[2];
} }
else if (modelessDlg is CycleEndForm) else if (modelessDlg is CycleEndForm)
{ {
if (wMeters.Count >= 2 && wMeters[0] != null) wMeters[0].EndState = (modelessDlg as CycleEndForm).MainStateText[0]; if (wMeters.Length >= 1 && wMeters[0] != null) wMeters[0].EndState = (modelessDlg as CycleEndForm).MainStateText[0];
if (wMeters.Count >= 2 && wMeters[1] != null) wMeters[1].EndState = (modelessDlg as CycleEndForm).AuxStateText[0]; if (wMeters.Length >= 1 && wMeters[0] != null) wMeters[0].EndStateAux = (modelessDlg as CycleEndForm).AuxStateText[0];
if (wMeters.Count >= 4 && wMeters[2] != null) wMeters[2].EndState = (modelessDlg as CycleEndForm).MainStateText[1]; if (wMeters.Length >= 2 && wMeters[1] != null) wMeters[1].EndState = (modelessDlg as CycleEndForm).MainStateText[1];
if (wMeters.Count >= 4 && wMeters[3] != null) wMeters[3].EndState = (modelessDlg as CycleEndForm).AuxStateText[1]; if (wMeters.Length >= 2 && wMeters[1] != null) wMeters[1].EndStateAux = (modelessDlg as CycleEndForm).AuxStateText[1];
if (wMeters.Count >= 6 && wMeters[4] != null) wMeters[4].EndState = (modelessDlg as CycleEndForm).MainStateText[2]; if (wMeters.Length >= 3 && wMeters[2] != null) wMeters[2].EndState = (modelessDlg as CycleEndForm).MainStateText[2];
if (wMeters.Count >= 6 && wMeters[5] != null) wMeters[5].EndState = (modelessDlg as CycleEndForm).AuxStateText[2]; if (wMeters.Length >= 3 && wMeters[2] != null) wMeters[2].EndStateAux = (modelessDlg as CycleEndForm).AuxStateText[2];
protocolTitle = (modelessDlg as CycleEndForm).ProtocolTitle; protocolTitle = (modelessDlg as CycleEndForm).ProtocolTitle;
} }
resultSaved = true; resultSaved = true;
@@ -182,18 +182,9 @@ namespace TBF.BenchControl.DataEntry.Munich
/// </summary> /// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param> /// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="results">Test results to be updated with the information</param> /// <param name="results">Test results to be updated with the information</param>
public void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<TestResult> results) public void UpdateTestResults(Results.BatchResults results)
{ {
foreach (var test in results) /// Nothing to be done
{
if (test.MetersKind != MetersKind.Combined) continue;
/// Todo: Generalize !!! Now implemented for Munich = one combined meter.
test.Meters[0].SerialNr = waterMeters[0].SerialNr;
test.Meters[0].EndState = waterMeters[0].EndState;
test.Meters[1].SerialNr = waterMeters[1].SerialNr;
test.Meters[1].EndState = waterMeters[1].EndState;
}
} }
} }
} }
@@ -45,7 +45,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
bool resultSaved; bool resultSaved;
IList<IWaterMeter> waterMeters; Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp public enum CurrentOp
{ {
@@ -73,20 +73,20 @@ namespace TBF.BenchControl.DataEntry.Munich3
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleBeginFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning; currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleEndFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd; currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
@@ -144,7 +144,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
{ {
CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm); CycleBeginningForm dlg = (modelessDlg as CycleBeginningForm);
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++) for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{ {
if (waterMeters[i] != null) if (waterMeters[i] != null)
{ {
@@ -158,7 +158,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
protocolTitle = dlg.ProtocolTitle; protocolTitle = dlg.ProtocolTitle;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++) for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{ {
if (waterMeters[i] != null) if (waterMeters[i] != null)
{ {
@@ -189,19 +189,9 @@ namespace TBF.BenchControl.DataEntry.Munich3
/// </summary> /// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param> /// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="results">Test results to be updated with the information</param> /// <param name="results">Test results to be updated with the information</param>
public void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<TestResult> results) public void UpdateTestResults(Results.BatchResults results)
{ {
foreach (var test in results) /// Nothing to be done
{ }
if (test.MetersKind != MetersKind.Single) continue;
int nrMtrsToUpdate = Math.Min(waterMeters.Count, test.Meters.Count);
for (int i = 0; i < nrMtrsToUpdate; i++)
{
test.Meters[i].SerialNr = waterMeters[i].SerialNr;
test.Meters[i].EndState = waterMeters[i].EndState;
}
}
}
} }
} }
@@ -47,9 +47,9 @@ namespace TBF.BenchControl.DataEntry.Standard
double errLimLo; double errLimLo;
double errLimHi; double errLimHi;
bool resultSaved; /// Set in Run() when results are saved bool resultSaved; /// Set in Run() when results are saved
IList<IWaterMeter> waterMeters; /// Passesd as an argument of ShowCycleBeginFormOp/ShowCycleEndFormOp constructor Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp public enum CurrentOp
{ {
@@ -83,20 +83,20 @@ namespace TBF.BenchControl.DataEntry.Standard
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleBeginFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning; currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleEndFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd; currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
@@ -187,7 +187,7 @@ namespace TBF.BenchControl.DataEntry.Standard
{ {
purchaseOrder = dlg.PurchaseOrder; purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++) for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{ {
if (waterMeters[i] != null) if (waterMeters[i] != null)
{ {
@@ -200,7 +200,7 @@ namespace TBF.BenchControl.DataEntry.Standard
else if (currentOp == CurrentOp.ShowFormAtCycleEnd) else if (currentOp == CurrentOp.ShowFormAtCycleEnd)
{ {
CycleEndForm dlg = (modelessDlg as CycleEndForm); CycleEndForm dlg = (modelessDlg as CycleEndForm);
int count = waterMeters.Count; int count = waterMeters.Length;
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount; if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
@@ -260,21 +260,18 @@ namespace TBF.BenchControl.DataEntry.Standard
/// </summary> /// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param> /// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="testResults">Test results to be updated with the information</param> /// <param name="testResults">Test results to be updated with the information</param>
public void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<TestResult> testResults) public void UpdateTestResults(Results.BatchResults results)
{ {
foreach (var testRslt in testResults) /// Nothing to be done
{
if (testRslt.MetersKind != MetersKind.Single) continue;
testRslt.PurchaseOrder = PurchaseOrder; //for (int i = 0; i < results.WMPositionsCount; i++)
//{
// if (results.Batch.WaterMeters[i] == null || results.Batch.WaterMeters[i].Compound()) continue;
for (int i = 0; i < testRslt.Meters.Count; i++) // results.Batch.WaterMeters[i].SerialNr = SerialNr(i);
{ // results.Batch.WaterMeters[i].Disabled = Disabled(i);
testRslt.Meters[i].SerialNr = SerialNr(i); // results.Batch.WaterMeters[i].EndState = WMCycleEndState(i);
testRslt.Meters[i].Disabled = Disabled(i); //}
testRslt.Meters[i].EndState = WMCycleEndState(i); }
}
}
}
} }
} }
@@ -47,9 +47,9 @@ namespace TBF.BenchControl.DataEntry.Standard12
double errLimLo; double errLimLo;
double errLimHi; double errLimHi;
bool resultSaved; /// Set in Run() when results are saved bool resultSaved; /// Set in Run() when results are saved
IList<IWaterMeter> waterMeters; /// Passesd as an argument of ShowCycleBeginFormOp/ShowCycleEndFormOp constructor Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp public enum CurrentOp
{ {
@@ -83,20 +83,20 @@ namespace TBF.BenchControl.DataEntry.Standard12
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleBeginFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning; currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleEndFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd; currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
@@ -188,7 +188,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
{ {
purchaseOrder = dlg.PurchaseOrder; purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++) for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{ {
if (waterMeters[i] != null) if (waterMeters[i] != null)
{ {
@@ -201,7 +201,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
else if (currentOp == CurrentOp.ShowFormAtCycleEnd) else if (currentOp == CurrentOp.ShowFormAtCycleEnd)
{ {
CycleEndForm dlg = (modelessDlg as CycleEndForm); CycleEndForm dlg = (modelessDlg as CycleEndForm);
int count = waterMeters.Count; int count = waterMeters.Length;
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount; if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
@@ -257,21 +257,18 @@ namespace TBF.BenchControl.DataEntry.Standard12
/// </summary> /// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param> /// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="testResults">Test results to be updated with the information</param> /// <param name="testResults">Test results to be updated with the information</param>
public void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<TestResult> testResults) public void UpdateTestResults(Results.BatchResults results)
{ {
foreach (var testRslt in testResults) /// Nothing to be done
{
if (testRslt.MetersKind != MetersKind.Single) continue;
testRslt.PurchaseOrder = PurchaseOrder; //for (int i = 0; i < results.WMPositionsCount; i++)
//{
// if (results.Batch.WaterMeters[i] == null || results.Batch.WaterMeters[i].Compound()) continue;
for (int i = 0; i < testRslt.Meters.Count; i++) // results.Batch.WaterMeters[i].SerialNr = SerialNr(i);
{ // results.Batch.WaterMeters[i].Disabled = Disabled(i);
testRslt.Meters[i].SerialNr = SerialNr(i); // results.Batch.WaterMeters[i].EndState = WMCycleEndState(i);
testRslt.Meters[i].Disabled = Disabled(i); //}
testRslt.Meters[i].EndState = WMCycleEndState(i); }
}
}
}
} }
} }
@@ -47,9 +47,9 @@ namespace TBF.BenchControl.DataEntry.Standard24
double errLimLo; double errLimLo;
double errLimHi; double errLimHi;
bool resultSaved; /// Set in Run() when results are saved bool resultSaved; /// Set in Run() when results are saved
IList<IWaterMeter> waterMeters; /// Passesd as an argument of ShowCycleBeginFormOp/ShowCycleEndFormOp constructor Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp public enum CurrentOp
{ {
@@ -83,20 +83,20 @@ namespace TBF.BenchControl.DataEntry.Standard24
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleBeginFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning; currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleEndFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd; currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
@@ -257,21 +257,18 @@ namespace TBF.BenchControl.DataEntry.Standard24
/// </summary> /// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param> /// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="testResults">Test results to be updated with the information</param> /// <param name="testResults">Test results to be updated with the information</param>
public void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<TestResult> testResults) public void UpdateTestResults(Results.BatchResults results)
{ {
foreach (var testRslt in testResults) /// Nothing to be done
{
if (testRslt.MetersKind != MetersKind.Single) continue;
testRslt.PurchaseOrder = PurchaseOrder; //for (int i = 0; i < results.WMPositionsCount; i++)
//{
// if (results.Batch.WaterMeters[i] == null || results.Batch.WaterMeters[i].Compound()) continue;
for (int i = 0; i < testRslt.Meters.Count; i++) // results.Batch.WaterMeters[i].SerialNr = SerialNr(i);
{ // results.Batch.WaterMeters[i].Disabled = Disabled(i);
testRslt.Meters[i].SerialNr = SerialNr(i); // results.Batch.WaterMeters[i].EndState = WMCycleEndState(i);
testRslt.Meters[i].Disabled = Disabled(i); //}
testRslt.Meters[i].EndState = WMCycleEndState(i); }
}
}
}
} }
} }
@@ -47,9 +47,9 @@ namespace TBF.BenchControl.DataEntry.Standard48
double errLimLo; double errLimLo;
double errLimHi; double errLimHi;
bool resultSaved; /// Set in Run() when results are saved bool resultSaved; /// Set in Run() when results are saved
IList<IWaterMeter> waterMeters; /// Passesd as an argument of ShowCycleBeginFormOp/ShowCycleEndFormOp constructor Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp public enum CurrentOp
{ {
@@ -83,20 +83,20 @@ namespace TBF.BenchControl.DataEntry.Standard48
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleBeginFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning; currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleEndFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd; currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
@@ -188,7 +188,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
{ {
purchaseOrder = dlg.PurchaseOrder; purchaseOrder = dlg.PurchaseOrder;
for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Count); i++) for (int i = 0; i < Math.Min(dlg.WaterMetersCount, waterMeters.Length); i++)
{ {
if (waterMeters[i] != null) if (waterMeters[i] != null)
{ {
@@ -201,7 +201,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
else if (currentOp == CurrentOp.ShowFormAtCycleEnd) else if (currentOp == CurrentOp.ShowFormAtCycleEnd)
{ {
CycleEndForm dlg = (modelessDlg as CycleEndForm); CycleEndForm dlg = (modelessDlg as CycleEndForm);
int count = waterMeters.Count; int count = waterMeters.Length;
if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount; if ((dlg != null) && (count > dlg.WaterMetersCount)) count = dlg.WaterMetersCount;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
@@ -257,21 +257,18 @@ namespace TBF.BenchControl.DataEntry.Standard48
/// </summary> /// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param> /// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="testResults">Test results to be updated with the information</param> /// <param name="testResults">Test results to be updated with the information</param>
public void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<TestResult> testResults) public void UpdateTestResults(Results.BatchResults results)
{ {
foreach (var testRslt in testResults) /// Nothing to be done
{
if (testRslt.MetersKind != MetersKind.Single) continue;
testRslt.PurchaseOrder = PurchaseOrder; //for (int i = 0; i < results.WMPositionsCount; i++)
//{
// if (results.Batch.WaterMeters[i] == null || results.Batch.WaterMeters[i].Compound()) continue;
for (int i = 0; i < testRslt.Meters.Count; i++) // results.Batch.WaterMeters[i].SerialNr = SerialNr(i);
{ // results.Batch.WaterMeters[i].Disabled = Disabled(i);
testRslt.Meters[i].SerialNr = SerialNr(i); // results.Batch.WaterMeters[i].EndState = WMCycleEndState(i);
testRslt.Meters[i].Disabled = Disabled(i); //}
testRslt.Meters[i].EndState = WMCycleEndState(i); }
}
}
}
} }
} }
@@ -48,7 +48,7 @@ namespace TBF.BenchControl.DataEntry.WMStates
} }
/// <summary> Not supported </summary> /// <summary> Not supported </summary>
public void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<TestResult> results) public void UpdateTestResults(Results.BatchResults results)
{ {
} }
@@ -47,9 +47,9 @@ namespace TBF.BenchControl.DataEntry.iPerl
double errLimLo; double errLimLo;
double errLimHi; double errLimHi;
bool resultSaved; /// Set in Run() when results are saved bool resultSaved; /// Set in Run() when results are saved
IList<IWaterMeter> waterMeters; /// Passesd as an argument of ShowCycleBeginFormOp/ShowCycleEndFormOp constructor Results.Entities.WaterMeter[] waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
public enum CurrentOp public enum CurrentOp
{ {
@@ -83,20 +83,20 @@ namespace TBF.BenchControl.DataEntry.iPerl
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleBeginFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleBeginning; currentOp = CurrentOp.ShowFormAtCycleBeginning;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
public IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters) public IOperation ShowCycleEndFormOp()
{ {
if (currentOp != CurrentOp.None) throw new Exception("Sequence error"); if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
currentOp = CurrentOp.ShowFormAtCycleEnd; currentOp = CurrentOp.ShowFormAtCycleEnd;
this.waterMeters = waterMeters; this.waterMeters = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters;
return this; return this;
} }
@@ -221,7 +221,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
/// </summary> /// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param> /// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="testResults">Test results to be updated with the information</param> /// <param name="testResults">Test results to be updated with the information</param>
public void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<TestResult> testResults) public void UpdateTestResults(Results.BatchResults results)
{ {
foreach (var testRslt in testResults) foreach (var testRslt in testResults)
{ {
@@ -12,8 +12,7 @@ namespace TBF.BenchControl.GenericDevices
/// <summary> /// <summary>
/// Updates test results with the information collected in watermeters. /// Updates test results with the information collected in watermeters.
/// </summary> /// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param> /// <param name="results">Results of a batch of water meters to be updated with information from forms</param>
/// <param name="results">Test results to be updated with the information</param> void UpdateTestResults(Results.BatchResults results);
void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<TestResult> results);
} }
} }
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2015 Sensus Metering Systems /// Copyright (c) 2013-2016 Sensus Metering Systems
/// ///
using System.Collections.Generic; using System.Collections.Generic;
@@ -25,8 +25,7 @@ namespace TBF.BenchControl.GenericDevices
/// <summary> /// <summary>
/// Displays form at the beginning of the cycle (usually to enter S/N). /// Displays form at the beginning of the cycle (usually to enter S/N).
/// </summary> /// </summary>
/// <param name="waterMeters">Watermetes to be updated by the operation</param>
/// <returns>Operation to be used in the sequence</returns> /// <returns>Operation to be used in the sequence</returns>
IOperation ShowCycleBeginFormOp(IList<IWaterMeter> waterMeters); IOperation ShowCycleBeginFormOp();
} }
} }
@@ -1,5 +1,5 @@
/// ///
/// Copyright (c) 2013-2015 Sensus Metering Systems /// Copyright (c) 2013-2016 Sensus Metering Systems
/// ///
using System.Collections.Generic; using System.Collections.Generic;
@@ -15,8 +15,7 @@ namespace TBF.BenchControl.GenericDevices
/// <summary> /// <summary>
/// Displays form at the end of the cycle (usually to enter the end state). /// Displays form at the end of the cycle (usually to enter the end state).
/// </summary> /// </summary>
/// <param name="waterMeters">Watermetes to be updated by the operation</param>
/// <returns>Operation to be used in the sequence</returns> /// <returns>Operation to be used in the sequence</returns>
IOperation ShowCycleEndFormOp(IList<IWaterMeter> waterMeters); IOperation ShowCycleEndFormOp();
} }
} }
@@ -12,13 +12,10 @@ namespace TBF.BenchControl.GenericDevices
/// <summary> /// <summary>
/// Prints the test cycle results, Events: Event.ResultsPrinted /// Prints the test cycle results, Events: Event.ResultsPrinted
/// </summary> /// </summary>
/// <param name="results">Results to print</param> /// <param name="batchResults">Results to print</param>
/// <param name="title">Title of the printed protocol</param>
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
IOperation PrintResultsOp(IBenchInfo benchInfo, IOperation PrintResultsOp(Results.BatchResults batchResults, string title);
IList<IWaterMeter> waterMeters,
Procedure procedure,
IList<TestResult> results,
string title);
/// <summary> /// <summary>
/// When true printing at the end of cycle is bypassed. /// When true printing at the end of cycle is bypassed.
@@ -12,11 +12,7 @@ namespace TBF.BenchControl.GenericDevices
/// <summary> /// <summary>
/// Writes the test cycle results into a file, Events: Event.ResultsWritten /// Writes the test cycle results into a file, Events: Event.ResultsWritten
/// </summary> /// </summary>
/// <param name="results">Results to write into a file</param>
/// <returns>Reference to the operation</returns> /// <returns>Reference to the operation</returns>
IOperation WriteResultsOp(string TestBenchId, IOperation WriteResultsOp(Results.BatchResults batchResults);
Procedure procedure,
IList<IWaterMeter> waterMeters,
IList<TestResult> results);
} }
} }
@@ -636,7 +636,7 @@ namespace TBF.BenchControl.Sequences
protocolTitle = (dataEntryCmpnt as IHasProtocolTitle).ProtocolTitle; protocolTitle = (dataEntryCmpnt as IHasProtocolTitle).ProtocolTitle;
} }
dataEntryCmpnt.UpdateTestResults(WaterMeters, results); dataEntryCmpnt.UpdateTestResults(BatchRslts);
} }
//------------------------------------------------------ //------------------------------------------------------
@@ -646,12 +646,11 @@ 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.TestBenchName : string.Empty, savingAndPrintingRslts.AddOperation(writer.WriteResultsOp(ProcessData.BatchRslts));
StateMachine.Procedure, WaterMeters, results));
} }
if (printer != null && !printer.SupressPrinting) if (printer != null && !printer.SupressPrinting)
{ {
savingAndPrintingRslts.AddOperation(printer.PrintResultsOp(BenchInfo, WaterMeters, StateMachine.Procedure, results, protocolTitle)); savingAndPrintingRslts.AddOperation(printer.PrintResultsOp(ProcessData.BatchRslts, protocolTitle));
} }
savingAndPrintingRslts.AddOperation(checkUiOp).EnterState(); savingAndPrintingRslts.AddOperation(checkUiOp).EnterState();
do do
@@ -29,11 +29,12 @@ namespace TBF.BenchControl.Sequences
public static double CurrentMassRaw; /// [kg] public static double CurrentMassRaw; /// [kg]
public static double EndMassRaw; /// [kg] public static double EndMassRaw; /// [kg]
public static Results.BatchResults BatchRslts; public static Results.BatchResults BatchRslts;
/// ///
/// Statistics /// Statistics of 'continuous' variables (temperature, pressure, flow, etc.)
/// ///
public static FloatStatistics AmbientTempStat = new FloatStatistics(); public static FloatStatistics AmbientTempStat = new FloatStatistics();
public static FloatStatistics AmbientPressureStat = new FloatStatistics(); public static FloatStatistics AmbientPressureStat = new FloatStatistics();
@@ -488,7 +488,7 @@ namespace TBF.BenchControl.Sequences
{ {
Bridge.OnActivity(this, "Enter the water meter data"); Bridge.OnActivity(this, "Enter the water meter data");
State.Create("MainSeq : Enter begin data") State.Create("MainSeq : Enter begin data")
.AddPermanentOperation((dataEntryCmpnt as IHasCycleBeginForm).ShowCycleBeginFormOp(WaterMeters)) .AddPermanentOperation((dataEntryCmpnt as IHasCycleBeginForm).ShowCycleBeginFormOp())
.AddOperation(checkUiOp) .AddOperation(checkUiOp)
.EnterState(); .EnterState();
e = StateMachine.WaitRunDevsRunOps(); e = StateMachine.WaitRunDevsRunOps();