EndState added to MeterTestResult, UpdateTestResults added to EntryForms and IDataEntry

This commit is contained in:
Milan Hanajik 2014-07-28 23:12:43 +02:00
parent 16228800d4
commit 805e66d537
9 changed files with 71 additions and 27 deletions

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using TBF.BenchControl; using TBF.BenchControl;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Munich namespace TBF.BenchControl.DataEntry.Munich
{ {
@ -136,5 +137,20 @@ namespace TBF.BenchControl.DataEntry.Munich
modelessDlg = null; modelessDlg = null;
currentOp = CurrentOp.None; currentOp = CurrentOp.None;
} }
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="results">Test results to be updated with the information</param>
public void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<Entities.TestResult> results)
{
foreach (var test in results)
{
if (test.MetersKind != Entities.MetersKind.Combined) continue;
//TODO
}
}
}
} }

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using TBF.BenchControl; using TBF.BenchControl;
using TBF.BenchControl.GenericDevices;
namespace TBF.BenchControl.DataEntry.Munich3 namespace TBF.BenchControl.DataEntry.Munich3
{ {
@ -128,5 +129,20 @@ namespace TBF.BenchControl.DataEntry.Munich3
modelessDlg = null; modelessDlg = null;
currentOp = CurrentOp.None; currentOp = CurrentOp.None;
} }
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="results">Test results to be updated with the information</param>
public void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<Entities.TestResult> results)
{
foreach (var test in results)
{
if (test.MetersKind != Entities.MetersKind.Single) continue;
//TODO
}
}
} }
} }

View File

@ -5,7 +5,25 @@ namespace TBF.BenchControl.GenericDevices
{ {
public interface IDataEntry : IComponent public interface IDataEntry : IComponent
{ {
/// <summary>
/// Displays form at the beginning of the cycle (usually to enter S/N).
/// </summary>
/// <param name="waterMeters">Watermetes to be updated by the operation</param>
/// <returns>Operation to be used in the sequence</returns>
IOperation ShowFormAtCycleBeginningOp(IList<IWaterMeter> waterMeters); IOperation ShowFormAtCycleBeginningOp(IList<IWaterMeter> waterMeters);
IOperation ShowFormAtCycleEndOp(IList<IWaterMeter> waterMeters);
/// <summary>
/// Displays form at the end of the cycle (usually to enter S/N).
/// </summary>
/// <param name="waterMeters">Watermetes to be updated by the operation</param>
/// <returns>Operation to be used in the sequence</returns>
IOperation ShowFormAtCycleEndOp(IList<IWaterMeter> waterMeters);
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="results">Test results to be updated with the information</param>
void UpdateTestResults(IList<IWaterMeter> waterMeters, IList<Entities.TestResult> results);
} }
} }

View File

@ -176,8 +176,9 @@ namespace TBF.BenchControl.Sequences
} }
//-------------------------------- //--------------------------------
Generic.IComponent dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry); GenericDevices.IDataEntry dataEntryCmpnt =
if ((dataEntryCmpnt as GenericDevices.IDataEntry) != null) TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
if (dataEntryCmpnt != null)
{ {
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")
@ -345,8 +346,8 @@ namespace TBF.BenchControl.Sequences
//-------------------------------- //--------------------------------
string protocolTitle = string.Empty; string protocolTitle = string.Empty;
dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry); dataEntryCmpnt = TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IDataEntry;
if ((dataEntryCmpnt as GenericDevices.IDataEntry) != null) if (dataEntryCmpnt != null)
{ {
Bridge.OnActivity(this, "Enter the protokoll data"); Bridge.OnActivity(this, "Enter the protokoll data");
State.Create("MainSeq : Enter end data") State.Create("MainSeq : Enter end data")
@ -364,6 +365,8 @@ namespace TBF.BenchControl.Sequences
{ {
protocolTitle = (dataEntryCmpnt as IHasProtocolTitle).ProtocolTitle; protocolTitle = (dataEntryCmpnt as IHasProtocolTitle).ProtocolTitle;
} }
dataEntryCmpnt.UpdateTestResults(WaterMeters, results);
} }
//-------------------------------- //--------------------------------

View File

@ -9,10 +9,10 @@ namespace TBF.BenchControl.WaterMeter
{ {
public class ProcParams : IParamsProvider, IProcedureParams public class ProcParams : IParamsProvider, IProcedureParams
{ {
public string Producer; public string Producer; /// Hersteller
public float Qn; public float Qn;
public string ApprovalInfo; public string ApprovalInfo; /// Zulassungszeichen
public string MetrologicalClass; public string MetrologicalClass; /// Metr. Klasse
string[] paramNames = new string[] string[] paramNames = new string[]
{ {

View File

@ -8,11 +8,6 @@ namespace TBF.BenchControl.WaterMeter
{ {
public class WaterMeterCfg : ComponentCfgBase, Generic.IComponentCfg public class WaterMeterCfg : ComponentCfgBase, Generic.IComponentCfg
{ {
public string Producer; /// Hersteller
public float Qn;
public string ApprovalInfo; /// Zulassungszeichen
public string MetrologicalClass; /// Metr. Klasse
/// Parameterless constructor /// Parameterless constructor
public WaterMeterCfg() public WaterMeterCfg()
{ {
@ -23,20 +18,14 @@ namespace TBF.BenchControl.WaterMeter
/// </summary> /// </summary>
/// <param name="factory">Data entry form factory</param> /// <param name="factory">Data entry form factory</param>
/// <param name="name">Component name</param> /// <param name="name">Component name</param>
public WaterMeterCfg(IComponentFactory factory, string name, string producer, public WaterMeterCfg(IComponentFactory factory, string name)
float qn, string approvalInfo, string metrologicalClass)
: base(factory, name) : base(factory, name)
{ {
Producer = producer;
Qn = qn;
ApprovalInfo = approvalInfo;
MetrologicalClass = metrologicalClass;
} }
public IComponentCfg Clone() public IComponentCfg Clone()
{ {
return new WaterMeterCfg(Factory, Name, Producer, return new WaterMeterCfg(Factory, Name);
Qn, ApprovalInfo, MetrologicalClass);
} }
public string ToString(int i) public string ToString(int i)

View File

@ -20,7 +20,7 @@ namespace TBF.BenchControl.WaterMeter
public IComponentCfg DefaultConfig(IList<Entities.Component> components) public IComponentCfg DefaultConfig(IList<Entities.Component> components)
{ {
return new WaterMeterCfg(this, "WaterMeter", "", 2.5f, "", "A"); return new WaterMeterCfg(this, "WaterMeter");
} }
public IComponentCfgCtrl CreateCfgCtrl() public IComponentCfgCtrl CreateCfgCtrl()

View File

@ -7,7 +7,8 @@ namespace TBF.Entities
public virtual int Id { get; protected set; } public virtual int Id { get; protected set; }
public virtual TestResult TestResult { get; set; } /// reference to the TestResult entity public virtual TestResult TestResult { get; set; } /// reference to the TestResult entity
public virtual string SerialNr { get; set; } public virtual string SerialNr { get; set; }
public virtual string EndState { get; set; }
public virtual float VolumeStart { get; set; } /// liter public virtual float VolumeStart { get; set; } /// liter
public virtual float VolumeEnd { get; set; } /// liter public virtual float VolumeEnd { get; set; } /// liter
public virtual float VolumeMeter { get; set; } /// liter public virtual float VolumeMeter { get; set; } /// liter
@ -33,6 +34,7 @@ namespace TBF.Entities
MeterTestResult result = new MeterTestResult(testResult); MeterTestResult result = new MeterTestResult(testResult);
result.SerialNr = SerialNr; result.SerialNr = SerialNr;
result.EndState = EndState;
result.VolumeStart = VolumeStart; result.VolumeStart = VolumeStart;
result.VolumeEnd = VolumeEnd; result.VolumeEnd = VolumeEnd;
result.VolumeMeter = VolumeMeter; result.VolumeMeter = VolumeMeter;

View File

@ -97,13 +97,13 @@ namespace TBF.Entities
if (kind == MetersKind.Single) if (kind == MetersKind.Single)
{ {
for (int i = 0; i < Program.WMsCount; i++) Meters.Add(new MeterTestResult()); for (int i = 0; i < Program.WMsCount; i++) Meters.Add(new MeterTestResult(this));
} }
else if (kind == MetersKind.Combined) else if (kind == MetersKind.Combined)
{ {
int combinedCount = Program.WMsCount / 2; int combinedCount = Program.WMsCount / 2;
for (int i = 0; i < 2 * combinedCount; i++) Meters.Add(new MeterTestResult()); for (int i = 0; i < 2 * combinedCount; i++) Meters.Add(new MeterTestResult(this));
for (int i = 0; i < combinedCount; i++) CombinedMeters.Add(new MeterTestResult()); for (int i = 0; i < combinedCount; i++) CombinedMeters.Add(new MeterTestResult(this));
} }
} }