Bug fix in MetrologyDlgFlowMeterTab, etc. when ranges are enabled, ver. 2.26.1588
This commit is contained in:
parent
55d9d58978
commit
2e75d91adc
@ -67,9 +67,13 @@ namespace TBF.BenchControl.Elde.FlowMeter
|
||||
///
|
||||
public void Initialize()
|
||||
{
|
||||
if (flowMeterCfg.CalibValidDate != DateTime.MinValue && flowMeterCfg.CalibValidDate.Date < DateTime.Now.Date)
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
throw new Exception(string.Format("{0}: {1}", Name, Strings.Calibration_certificate_validity_expired));
|
||||
if (RangeEnabled(r) && flowMeterCfg.GetCalibValidDate(r) != DateTime.MinValue
|
||||
&& flowMeterCfg.GetCalibValidDate(r).Date < DateTime.Now.Date)
|
||||
{
|
||||
throw new Exception(string.Format("{0}/r{1}: {2}", Name, r, Strings.Calibration_certificate_validity_expired));
|
||||
}
|
||||
}
|
||||
|
||||
log.FatalFormat("Successfully initialized device {0}", Name);
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.26.1586.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1586.0")]
|
||||
[assembly: AssemblyVersion("2.26.1588.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1588.0")]
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using NHibernate;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.UI.Bench.Metrology
|
||||
@ -14,6 +15,8 @@ namespace TBF.UI.Bench.Metrology
|
||||
/// </summary>
|
||||
Component MeterEntity { get; set; }
|
||||
|
||||
void SaveEntityToDB(ISession session);
|
||||
|
||||
/// <summary>
|
||||
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
|
||||
/// </summary>
|
||||
|
||||
@ -110,15 +110,26 @@ namespace TBF.UI.Bench.Metrology
|
||||
{
|
||||
BenchControl.Elde.FlowMeter.FlowMeterCfg flowMeterCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.Elde.FlowMeter.FlowMeterCfg;
|
||||
|
||||
|
||||
for (int r = 0; r <= 5; r++)
|
||||
{
|
||||
if (flowMeterCfg.RangeEnabled(r))
|
||||
{
|
||||
bool isLastFlowMeterRange = true;
|
||||
for (int nxt = r + 1; nxt <= 5; nxt++)
|
||||
{
|
||||
if (flowMeterCfg.RangeEnabled(nxt))
|
||||
{
|
||||
isLastFlowMeterRange = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
flowMetersCount++;
|
||||
TabPage tabPage = new TabPage(string.Format(((r == 0) ? " {0} " : " {0} r{1} "), cmpnt.Name, r));
|
||||
MetrologyDlgFlowMeterTab uiControl = new MetrologyDlgFlowMeterTab(r);
|
||||
MetrologyDlgFlowMeterTab uiControl = new MetrologyDlgFlowMeterTab(r, isLastFlowMeterRange);
|
||||
uiControl.MeterEntity = cmpnt;
|
||||
uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibRangesCfg;
|
||||
uiControl.CalibInfoCfg = flowMeterCfg;
|
||||
uiControl.Dock = DockStyle.Fill;
|
||||
tabPage.Tag = uiControl;
|
||||
tabPage.Controls.Add(uiControl);
|
||||
@ -236,7 +247,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
if (tab != null)
|
||||
{
|
||||
tab.OkBtnClicked();
|
||||
session.SaveOrUpdate(tab.MeterEntity);
|
||||
tab.SaveEntityToDB(session);
|
||||
foreach (var entity in tab.ToBeRemoved) session.Delete(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@ -395,5 +395,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveEntityToDB(NHibernate.ISession session)
|
||||
{
|
||||
session.SaveOrUpdate(MeterEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,5 +127,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveEntityToDB(NHibernate.ISession session)
|
||||
{
|
||||
session.SaveOrUpdate(MeterEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,5 +182,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
densityCorrTextBox.Text = Config.Formulas.DensityCorrection(density, temp).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveEntityToDB(NHibernate.ISession session)
|
||||
{
|
||||
session.SaveOrUpdate(MeterEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -345,5 +345,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveEntityToDB(NHibernate.ISession session)
|
||||
{
|
||||
session.SaveOrUpdate(MeterEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -345,5 +345,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveEntityToDB(NHibernate.ISession session)
|
||||
{
|
||||
session.SaveOrUpdate(MeterEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,12 +48,13 @@ namespace TBF.UI.Bench.Metrology
|
||||
Control measurementTextBox;
|
||||
Control correctionTextBox;
|
||||
Control errorTextBox;
|
||||
int rangeIx; /// 0 (no range) or 1..5 (range #)
|
||||
readonly int rangeIx; /// 0 (no range) or 1..5 (range #)
|
||||
readonly bool isLastFlowMeterRange; /// true when this is the last range of this flow meter.
|
||||
/// This is to prevent double saving of the meter entity to a DB
|
||||
|
||||
public MetrologyDlgFlowMeterTab() : this(0, true) {}
|
||||
|
||||
public MetrologyDlgFlowMeterTab() : this(0) {}
|
||||
|
||||
public MetrologyDlgFlowMeterTab(int rangeIx1)
|
||||
public MetrologyDlgFlowMeterTab(int rangeIx1, bool isLastFlowMeterRange)
|
||||
{
|
||||
InitializeComponent();
|
||||
calibDateTimePicker.CustomFormat = Constants.DateFormat;
|
||||
@ -61,6 +62,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat;
|
||||
calibExpirationDateTimePicker.MinDate = Constants.MinDate;
|
||||
this.rangeIx = rangeIx1;
|
||||
this.isLastFlowMeterRange = isLastFlowMeterRange;
|
||||
toBeRemoved = new List<MeasurementCorrection>();
|
||||
unlocked = false;
|
||||
}
|
||||
@ -279,9 +281,6 @@ namespace TBF.UI.Bench.Metrology
|
||||
CalibInfoCfg.SetCalibCertificate(rangeIx, calibCertificateNrTextBox.Text);
|
||||
CalibInfoCfg.SetCalibDate(rangeIx, calibDateTimePicker.Value.Date);
|
||||
CalibInfoCfg.SetCalibValidDate(rangeIx, calibExpirationDateTimePicker.Value.Date);
|
||||
|
||||
Component modified = CalibInfoCfg.CreateDbEntity();
|
||||
MeterEntity.Parameters = modified.Parameters;
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -393,5 +392,15 @@ namespace TBF.UI.Bench.Metrology
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveEntityToDB(NHibernate.ISession session)
|
||||
{
|
||||
if (isLastFlowMeterRange)
|
||||
{
|
||||
Component modified = CalibInfoCfg.CreateDbEntity();
|
||||
MeterEntity.Parameters = modified.Parameters;
|
||||
session.SaveOrUpdate(MeterEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -345,5 +345,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveEntityToDB(NHibernate.ISession session)
|
||||
{
|
||||
session.SaveOrUpdate(MeterEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,5 +231,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveEntityToDB(NHibernate.ISession session)
|
||||
{
|
||||
session.SaveOrUpdate(MeterEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,5 +372,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveEntityToDB(NHibernate.ISession session)
|
||||
{
|
||||
session.SaveOrUpdate(MeterEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,5 +372,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
public void UpdateRelatedItems(Dictionary<string, string> renameInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveEntityToDB(NHibernate.ISession session)
|
||||
{
|
||||
session.SaveOrUpdate(MeterEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user