tbf/TBF/Rig/TestMethods/FixedStartMassCollAdvanced/HeatMeters/Component.cs

59 lines
2.1 KiB
C#

///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Common;
using Config.Entities;
using TBF.Rig.GenericDevices;
using TBF.Rig.Sequences;
namespace TBF.Rig.TestMethods.FixedStartMassCollAdvanced.HeatMeters
{
public class Component : ComponentBase, GenericDevices.ITestMethod, ISequenceCondition
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public FlowType MethodFlowType => FlowType.volume;
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
public bool CanTest(MetersKind meters) { return meters == MetersKind.HeatMeter; }
public bool DoTransitions() { return true; }
public bool CheckDeviceCaps(Test test, OutputPath devices, out string message)
{
return FixedStartMassCollAdvancedSeq.CheckDeviceCaps(test, devices, out message);
}
readonly TestMethodCfg testMethodCfg;
public Component() { }
public Component(Generic.IComponentCfg cfg) : base(cfg)
{
testMethodCfg = cfg as TestMethodCfg;
log.Warn(this.ToString());
}
///
public override void Initialize() { }
public IList<Event> Execute(Test test, int repetNr, bool isLastRepetition)
{
return (new FixedStartMassCollAdvancedSeq()).Execute(test, repetNr, isLastRepetition, !testMethodCfg.DataEntryInTransBefore, false, testMethodCfg.TestParams, DebugLevel);
}
public int ConditionsCount { get { return 1; } }
public string ConditionName(int i) { return (i == 0) ? "Data Entry Form" : string.Empty; }
public IOperation ConditionOp(int i)
{
GenericDevices.IHasWMStatesForm wmStatesForm =
TbfComponents.FindComponent(StateMachine.Procedure.DataEntry) as GenericDevices.IHasWMStatesForm;
if ((i == 0) && (wmStatesForm != null))
{
return wmStatesForm.ShowAdvancedTestStartFormOp(ProcessData.RegisterReaders, ProcessData.BatchRslts.Batch.WaterMeters, true);
}
return null;
}
}
}