Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55c72ffeba | ||
|
|
e9586a3f39 | ||
|
|
0449c38de2 | ||
|
|
eb6f76d6f5 | ||
|
|
6fdb030b9f | ||
|
|
6079c8419f | ||
|
|
ef6f21eb9e | ||
|
|
50db69e5cb | ||
|
|
9194871508 | ||
|
|
5dde27bad9 | ||
|
|
e61e5c59cb | ||
|
|
ff3118068d | ||
|
|
c3d5e157ec | ||
|
|
ef5320917a | ||
|
|
e37dd87ece | ||
|
|
128d71bcd8 | ||
|
|
da220f4e7f |
@@ -29,5 +29,6 @@ Users/obj/
|
||||
UserManagement/bin/
|
||||
UserManagement/obj/
|
||||
Doc/
|
||||
.vs/
|
||||
*.suo
|
||||
*.bak
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;FILIPINY_50</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;PETERSBURG_50;LANG_RU</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -28,7 +28,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;FILIPINY_50</DefineConstants>
|
||||
<DefineConstants>TRACE;PETERSBURG_50;LANG_RU</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
+10
-2
@@ -85,7 +85,15 @@ namespace Config
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Extract and return a database name from a MySQL connection string.
|
||||
/// Extract and return a DB server from a MySQL connection string.
|
||||
/// </summary>
|
||||
public static string GetDBServer(string connectionString)
|
||||
{
|
||||
return GetFromConnectionString(connectionString, new string[] { "SERVER=" });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract and return a DB name from a MySQL connection string.
|
||||
/// </summary>
|
||||
public static string GetDBName(string connectionString)
|
||||
{
|
||||
@@ -105,7 +113,7 @@ namespace Config
|
||||
/// </summary>
|
||||
public static string GetDBPassword(string connectionString)
|
||||
{
|
||||
return GetFromConnectionString(connectionString, new string[] { "PASSWORD=" });
|
||||
return GetFromConnectionString(connectionString, new string[] { "PASSWORD=", "PWD=" });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -528,6 +528,12 @@ namespace Results.Entities
|
||||
return NokColor;
|
||||
}
|
||||
}
|
||||
else if (Disabled)
|
||||
{
|
||||
/// Water meter was not completed yet => did not pass, did not fail
|
||||
message = Strings.This_position_is_disabled;
|
||||
return NotCompletedColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Water meter was not completed yet => did not pass, did not fail
|
||||
|
||||
+194
-298
@@ -1,10 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
@@ -18,43 +13,33 @@ namespace Results.Forms
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(BatchResultsDlg));
|
||||
|
||||
|
||||
DateTime lastRedraw;
|
||||
DateTime lastSizeChange;
|
||||
bool loaded;
|
||||
|
||||
///
|
||||
/// Public members
|
||||
///
|
||||
public Results.BatchResults Results;
|
||||
public IList<Results.WMeterRsltItemSpec> Items;
|
||||
public MetersArrangement MetersArrangement;
|
||||
public TestsArrangement TestsArrangement;
|
||||
public int NrMetersInOneGroup;
|
||||
|
||||
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_SingleWM;
|
||||
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_CombinedWM;
|
||||
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_HeatM;
|
||||
public int[] RsltsClmnWidths { set { rsltsClmnWidths = value; } }
|
||||
|
||||
public bool ShowDisabledPositions;
|
||||
public int MinWidth;
|
||||
public int MinHeight;
|
||||
public int PopupResultsLeft;
|
||||
public int PopupResultsTop;
|
||||
public int PopupResultsWidth;
|
||||
public int PopupResultsHeight;
|
||||
public int[] RsltsClmnWidths;
|
||||
|
||||
public Results.BatchResults Results { set { Display(value); } }
|
||||
|
||||
///
|
||||
/// Private members
|
||||
///
|
||||
Results.BatchResults results;
|
||||
MetersKind metersKind;
|
||||
|
||||
OneWMResultsCtrl firstListView;
|
||||
public int[] rsltsClmnWidths;
|
||||
int rsltsClmnCount { get { return (rsltsClmnWidths != null) ? rsltsClmnWidths.Length : 0; } }
|
||||
|
||||
int lvWidth;
|
||||
int lvHeight;
|
||||
|
||||
IOneWMResultsCtrl[] wmRsltsCtrl; /// An array of controls with water meter results.
|
||||
IOneWMResultsCtrl firstEnabledControl;
|
||||
DateTime lastRedraw;
|
||||
DateTime lastSizeChange;
|
||||
int metersInOneGroup;
|
||||
int nrGroups;
|
||||
|
||||
Timer timer;
|
||||
|
||||
@@ -62,310 +47,193 @@ namespace Results.Forms
|
||||
public BatchResultsDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
Text = Strings.Results;
|
||||
|
||||
firstEnabledControl = null;
|
||||
lastSizeChange = DateTime.Now;
|
||||
nrGroups = 1;
|
||||
metersInOneGroup = 1;
|
||||
|
||||
// Create a timer with a ten second interval.
|
||||
/// Create a timer with one second interval.
|
||||
timer = new Timer();
|
||||
timer.Interval = 500; /// ms
|
||||
timer.Interval = 1000; /// ms
|
||||
timer.Tick += new EventHandler(OnTimer);
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
private void BatchResultsDlg_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (PopupResultsLeft != 0) Left = PopupResultsLeft;
|
||||
if (PopupResultsTop != 0) Top = PopupResultsTop;
|
||||
if (PopupResultsWidth != 0) Width = PopupResultsWidth;
|
||||
if (PopupResultsLeft != 0) Left = PopupResultsLeft;
|
||||
if (PopupResultsTop != 0) Top = PopupResultsTop;
|
||||
if (PopupResultsWidth != 0) Width = PopupResultsWidth;
|
||||
if (PopupResultsHeight != 0) Height = PopupResultsHeight;
|
||||
|
||||
loaded = true;
|
||||
if (results != null) Redraw();
|
||||
}
|
||||
|
||||
public void Display(Results.BatchResults results)
|
||||
{
|
||||
this.results = results;
|
||||
if (loaded) Redraw();
|
||||
CreateControlsAndFillPanel(Results);
|
||||
UpdateColumnWidths(RsltsClmnWidths);
|
||||
UpdateResults(Results);
|
||||
}
|
||||
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> GetRsltItems(MetersKind metersKind)
|
||||
///
|
||||
/// Handle double-click inside a water meter results control
|
||||
///
|
||||
void OnDoubleClick(object sender, Results.Forms.WaterMeterEventArgs args)
|
||||
{
|
||||
IList<Results.WMeterRsltItemSpec> srcItems;
|
||||
switch (metersKind)
|
||||
if (Results.WaterMeters != null && args.WMPosition > 0)
|
||||
{
|
||||
default:
|
||||
case MetersKind.Single: srcItems = RsltItems_Screen_SingleWM; break;
|
||||
case MetersKind.Combined: srcItems = RsltItems_Screen_CombinedWM; break;
|
||||
case MetersKind.HeatMeter: srcItems = RsltItems_Screen_HeatM; break;
|
||||
foreach (var wm in Results.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && (wm.WMPosition == args.WMPosition))
|
||||
{
|
||||
ShowMoreWMResults(wm);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> copiedItems = new List<Results.WMeterRsltItemSpec>();
|
||||
foreach (var it in srcItems) copiedItems.Add(it.Clone());
|
||||
return copiedItems;
|
||||
MessageBox.Show(Strings.No_water_meter);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void UpdateColumnWidths(int[] columnWidths)
|
||||
{
|
||||
foreach (var ctrl in wmRsltsCtrl) ctrl.Update(columnWidths);
|
||||
}
|
||||
|
||||
void UpdateScrollpositions(int scrollStart)
|
||||
{
|
||||
/// TODO
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Re-draw the results. Apply new settings if they changed.
|
||||
/// </summary>
|
||||
public void Redraw()
|
||||
void CreateControlsAndFillPanel(Results.BatchResults results)
|
||||
{
|
||||
lastRedraw = DateTime.Now;
|
||||
|
||||
this.SuspendLayout();
|
||||
|
||||
try
|
||||
if ((results == null) || (results.WMPositionsCount == 0))
|
||||
{
|
||||
/// Determine how many water meters were enabled for result evaluation and printing
|
||||
int enabledWMsCount = 0;
|
||||
for (int i = 0; i < results.WMPositionsCount; i++)
|
||||
{
|
||||
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
enabledWMsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
int metersInOneGroup = Math.Max(1, Math.Min(enabledWMsCount, NrMetersInOneGroup));
|
||||
int nrGroups = Math.Max(1, (enabledWMsCount + metersInOneGroup - 1) / metersInOneGroup);
|
||||
|
||||
if (MetersArrangement == MetersArrangement.Horizontally)
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
|
||||
lvWidth = flowLayoutPanel.Width / metersInOneGroup - 6;
|
||||
lvHeight = flowLayoutPanel.Height / nrGroups - 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
|
||||
lvWidth = flowLayoutPanel.Width / nrGroups - 6;
|
||||
lvHeight = flowLayoutPanel.Height / metersInOneGroup - 6;
|
||||
}
|
||||
/// There are no water meters at all
|
||||
flowLayoutPanel.Controls.Clear();
|
||||
flowLayoutPanel.WrapContents = true;
|
||||
flowLayoutPanel.AutoScroll = true;
|
||||
|
||||
bool first = true;
|
||||
for (int i = 0; i < results.WMPositionsCount; i++)
|
||||
{
|
||||
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
OneWMResultsCtrl lview = (TestsArrangement == TestsArrangement.Rows)
|
||||
? GetResultsTestsAreRows(results.WaterMeters[i], i + 1)
|
||||
: GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
|
||||
if (lview != null)
|
||||
{
|
||||
flowLayoutPanel.Controls.Add(lview);
|
||||
if (first)
|
||||
{
|
||||
firstListView = lview;
|
||||
first = false;
|
||||
}
|
||||
|
||||
lview.WMResultsClickedHandler += delegate(object sender, Results.Forms.WaterMeterEventArgs args)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new EventHandler<Results.Forms.WaterMeterEventArgs>(OnDoubleClick), sender, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnDoubleClick(sender, args);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.FatalFormat("Redrawing results failed : {0}", e.Message);
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
|
||||
}
|
||||
log.FatalFormat("StackTrace : {0}{1}", Environment.NewLine, e.StackTrace);
|
||||
}
|
||||
|
||||
this.ResumeLayout(false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get an empty ListView control with appropriate parameters.
|
||||
/// </summary>
|
||||
/// <returns>ListView control</returns>
|
||||
OneWMResultsCtrl GetListView(Color backColor, Results.Entities.WaterMeter wm)
|
||||
{
|
||||
return new OneWMResultsCtrl(backColor, lvWidth, lvHeight, wm);
|
||||
}
|
||||
///
|
||||
OneWMResultsCtrl GetListView(Results.Entities.WaterMeter wm)
|
||||
{
|
||||
return GetListView(Color.White, wm);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a ListView control filled with results of the meter 'mtr'
|
||||
/// </summary>
|
||||
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
|
||||
/// <returns>ListView object</returns>
|
||||
OneWMResultsCtrl GetResultsTestsAreRows(Results.Entities.WaterMeter wMtr, int printedWMNr)
|
||||
{
|
||||
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
|
||||
|
||||
string message = string.Empty;
|
||||
Color commonBackColor = wMtr.GetColorOfResults(false, out message);
|
||||
OneWMResultsCtrl lview = GetListView(commonBackColor, wMtr);
|
||||
#if ORACLE_DB
|
||||
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
|
||||
|
||||
if (items == null || items.Count == 0) return lview;
|
||||
|
||||
// Header
|
||||
lview.Columns.Add(printedWMNr.ToString(), (rsltsClmnCount > 0) ? rsltsClmnWidths[0] : 40);
|
||||
int col = 1;
|
||||
foreach (var item in items)
|
||||
{
|
||||
lview.Columns.Add(item.Caption, (rsltsClmnCount > col) ? rsltsClmnWidths[col] : 70);
|
||||
col++;
|
||||
}
|
||||
|
||||
|
||||
IList<string> testNames = wMtr.GetAllDecoratedTestNames();
|
||||
int ix = 0;
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never
|
||||
&& mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(testNames[ix++]);
|
||||
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
string str = items[i].Print(wMtr, mtr.Name());
|
||||
|
||||
/// Extract and use color information
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
lview.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
return lview;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a ListView control filled with results of the meter 'mtr'
|
||||
/// </summary>
|
||||
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
|
||||
/// <returns>ListView object</returns>
|
||||
OneWMResultsCtrl GetResultsTestsAreColumns(Results.Entities.WaterMeter wMtr, int printedWMNr)
|
||||
{
|
||||
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
|
||||
|
||||
string message;
|
||||
Color commonBackColor = wMtr.GetColorOfResults(false, out message);
|
||||
OneWMResultsCtrl lview = GetListView(commonBackColor, wMtr);
|
||||
#if ORACLE_DB
|
||||
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
|
||||
|
||||
if (items == null || items.Count == 0) return lview;
|
||||
|
||||
// Header
|
||||
lview.Columns.Add(printedWMNr.ToString(), (rsltsClmnCount > 0) ? rsltsClmnWidths[0] : 40);
|
||||
int i = 1;
|
||||
foreach (var str in wMtr.GetAllDecoratedTestNames())
|
||||
{
|
||||
lview.Columns.Add(str, (rsltsClmnCount > i) ? rsltsClmnWidths[i] : 70);
|
||||
i++;
|
||||
}
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(item.Caption);
|
||||
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
string str = item.Print(wMtr, mtr.Name());
|
||||
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lview.Items.Add(lvi);
|
||||
}
|
||||
|
||||
return lview;
|
||||
}
|
||||
|
||||
|
||||
void OnDoubleClick(object sender, Results.Forms.WaterMeterEventArgs args)
|
||||
{
|
||||
if ( args.WM == null || args.WM.Disabled)
|
||||
{
|
||||
MessageBox.Show(Strings.No_water_meter);
|
||||
wmRsltsCtrl = new OneWMResultsRowsCtrl[0];
|
||||
firstEnabledControl = null;
|
||||
return;
|
||||
}
|
||||
else if ((TracingDB.DB.SessionFactory == null) || string.IsNullOrEmpty(args.WM.SerialNr))
|
||||
|
||||
///
|
||||
/// Determine water meter positions count
|
||||
///
|
||||
int displayedControlsCount = 0;
|
||||
for (int i = 0; i < results.WaterMeters.Length; i++)
|
||||
{
|
||||
new Results.Forms.MoreWMResultsDlg( args.WM, null).ShowDialog();
|
||||
if (results.WaterMeters[i] != null)
|
||||
{
|
||||
if (ShowDisabledPositions || !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
displayedControlsCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Calculate geometry
|
||||
///
|
||||
metersInOneGroup = Math.Max(1, Math.Min(displayedControlsCount, NrMetersInOneGroup));
|
||||
nrGroups = Math.Max(1, (displayedControlsCount + metersInOneGroup - 1) / metersInOneGroup);
|
||||
|
||||
int oneWidth;
|
||||
int oneHeight;
|
||||
///
|
||||
if (MetersArrangement == MetersArrangement.Horizontally)
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / metersInOneGroup - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / nrGroups - 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / nrGroups - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
|
||||
}
|
||||
|
||||
///
|
||||
/// Create controls and fill the FlowLayoutPanel
|
||||
///
|
||||
flowLayoutPanel.SuspendLayout();
|
||||
flowLayoutPanel.Controls.Clear();
|
||||
flowLayoutPanel.WrapContents = true;
|
||||
flowLayoutPanel.AutoScroll = true;
|
||||
|
||||
wmRsltsCtrl = new IOneWMResultsCtrl[displayedControlsCount];
|
||||
int ix = 0;
|
||||
firstEnabledControl = null;
|
||||
for (int i = 0; i < results.WaterMeters.Length; i++)
|
||||
{
|
||||
if (results.WaterMeters[i] != null)
|
||||
{
|
||||
if (!results.WaterMeters[i].Disabled || ShowDisabledPositions)
|
||||
{
|
||||
/// Create one water meter position / control
|
||||
wmRsltsCtrl[ix] = (TestsArrangement == TestsArrangement.Rows)
|
||||
? new OneWMResultsRowsCtrl() as IOneWMResultsCtrl
|
||||
: new OneWMResultsColumnsCtrl() as IOneWMResultsCtrl;
|
||||
wmRsltsCtrl[ix].Width = oneWidth;
|
||||
wmRsltsCtrl[ix].Height = oneHeight;
|
||||
wmRsltsCtrl[ix].Update(Items);
|
||||
wmRsltsCtrl[ix].WMResultsClickedHandler += delegate(object s, Results.Forms.WaterMeterEventArgs args)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new EventHandler<Results.Forms.WaterMeterEventArgs>(OnDoubleClick), s, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnDoubleClick(s, args);
|
||||
}
|
||||
};
|
||||
|
||||
flowLayoutPanel.Controls.Add(wmRsltsCtrl[ix] as UserControl);
|
||||
if ((firstEnabledControl == null) && !results.WaterMeters[i].Disabled) firstEnabledControl = wmRsltsCtrl[ix];
|
||||
ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flowLayoutPanel.ResumeLayout();
|
||||
|
||||
lastRedraw = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
void UpdateResults(Results.BatchResults batchResults)
|
||||
{
|
||||
if ((batchResults != null) && (batchResults.WaterMeters != null))
|
||||
{
|
||||
int ctrlIx = 0;
|
||||
for (int i = 0; i < batchResults.WaterMeters.Length; i++)
|
||||
{
|
||||
if (!batchResults.WaterMeters[i].Disabled || ShowDisabledPositions)
|
||||
{
|
||||
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(batchResults.WaterMeters[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ShowMoreWMResults(Results.Entities.WaterMeter wm)
|
||||
{
|
||||
if ((TracingDB.DB.SessionFactory == null) || string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
new Results.Forms.MoreWMResultsDlg(wm, null).ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
using (ISession session = TracingDB.DB.SessionFactory.OpenSession())
|
||||
{
|
||||
IList<ReferenceRecord> refRecords = session.QueryOver<ReferenceRecord>()
|
||||
.Where(x => (x.Code == args.WM.SerialNr))
|
||||
.Where(x => (x.Code == wm.SerialNr))
|
||||
.OrderBy(x => x.TimeStamp).Desc
|
||||
.List();
|
||||
for (int i = 0; i < refRecords.Count; i++)
|
||||
@@ -391,7 +259,7 @@ namespace Results.Forms
|
||||
}
|
||||
}
|
||||
|
||||
new Results.Forms.MoreWMResultsDlg(args.WM, refRecords).ShowDialog();
|
||||
new Results.Forms.MoreWMResultsDlg(wm, refRecords).ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -405,6 +273,7 @@ namespace Results.Forms
|
||||
PopupResultsHeight = Height;
|
||||
}
|
||||
|
||||
|
||||
private void flowLayoutPanel_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
lastSizeChange = DateTime.Now;
|
||||
@@ -414,13 +283,40 @@ namespace Results.Forms
|
||||
{
|
||||
if (DateTime.Compare(lastSizeChange, lastRedraw) > 0)
|
||||
{
|
||||
/// The last size change was later then the last redraw
|
||||
/// The last size change was more recent then the last redraw
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
if (DateTime.Compare(lastSizeChange + new TimeSpan(0, 0, 1), now) < 0)
|
||||
{
|
||||
/// More then 1s since the last size change
|
||||
Redraw();
|
||||
/// More then 1 second since the last panel size change
|
||||
|
||||
/// Calculate geometry
|
||||
int oneWidth;
|
||||
int oneHeight;
|
||||
///
|
||||
if (MetersArrangement == MetersArrangement.Horizontally)
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / metersInOneGroup - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / nrGroups - 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / nrGroups - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
|
||||
}
|
||||
|
||||
/// Update size of controls
|
||||
flowLayoutPanel.SuspendLayout();
|
||||
///
|
||||
foreach (var oneCtrl in wmRsltsCtrl)
|
||||
{
|
||||
oneCtrl.Width = oneWidth;
|
||||
oneCtrl.Height = oneHeight;
|
||||
}
|
||||
///
|
||||
flowLayoutPanel.ResumeLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public interface IOneWMResultsCtrl
|
||||
{
|
||||
event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
|
||||
|
||||
bool Disabled { get; } /// true when water meter position is disabled
|
||||
int WMPosition { get; } /// 1-based WM position
|
||||
int Width { get; set; } /// Control width
|
||||
int Height { get; set; } /// Control height
|
||||
ListView.ColumnHeaderCollection Columns { get; } /// Embedded ListView control columns
|
||||
|
||||
void Update(int[] columnWidths);
|
||||
void Update(IList<Results.WMeterRsltItemSpec> items);
|
||||
void Update(Results.Entities.WaterMeter wMtr);
|
||||
}
|
||||
}
|
||||
+11
-24
@@ -29,15 +29,13 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.allResultsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.graphsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.productionTracingTabPage = new System.Windows.Forms.TabPage();
|
||||
this.productionTracingSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.messageLabel = new System.Windows.Forms.Label();
|
||||
this.tracingResultsListView = new System.Windows.Forms.ListView();
|
||||
this.oneWMResultsCtrl = new Results.Forms.OneWMResultsCtrl();
|
||||
this.allResultsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.allResultsTabPage.SuspendLayout();
|
||||
this.productionTracingTabPage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.productionTracingSplitContainer)).BeginInit();
|
||||
this.productionTracingSplitContainer.Panel1.SuspendLayout();
|
||||
@@ -57,17 +55,6 @@
|
||||
this.tabControl1.Size = new System.Drawing.Size(1195, 448);
|
||||
this.tabControl1.TabIndex = 0;
|
||||
//
|
||||
// allResultsTabPage
|
||||
//
|
||||
this.allResultsTabPage.Controls.Add(this.oneWMResultsCtrl);
|
||||
this.allResultsTabPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.allResultsTabPage.Name = "allResultsTabPage";
|
||||
this.allResultsTabPage.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.allResultsTabPage.Size = new System.Drawing.Size(1187, 422);
|
||||
this.allResultsTabPage.TabIndex = 0;
|
||||
this.allResultsTabPage.Text = "All results";
|
||||
this.allResultsTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// graphsTabPage
|
||||
//
|
||||
this.graphsTabPage.Location = new System.Drawing.Point(4, 22);
|
||||
@@ -133,14 +120,15 @@
|
||||
this.tracingResultsListView.UseCompatibleStateImageBehavior = false;
|
||||
this.tracingResultsListView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// oneWMResultsCtrl
|
||||
// allResultsTabPage
|
||||
//
|
||||
this.oneWMResultsCtrl.Caption = "";
|
||||
this.oneWMResultsCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.oneWMResultsCtrl.Location = new System.Drawing.Point(3, 3);
|
||||
this.oneWMResultsCtrl.Name = "oneWMResultsCtrl";
|
||||
this.oneWMResultsCtrl.Size = new System.Drawing.Size(1181, 416);
|
||||
this.oneWMResultsCtrl.TabIndex = 0;
|
||||
this.allResultsTabPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.allResultsTabPage.Name = "allResultsTabPage";
|
||||
this.allResultsTabPage.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.allResultsTabPage.Size = new System.Drawing.Size(1187, 422);
|
||||
this.allResultsTabPage.TabIndex = 0;
|
||||
this.allResultsTabPage.Text = "All results";
|
||||
this.allResultsTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// MoreWMResultsDlg
|
||||
//
|
||||
@@ -152,7 +140,6 @@
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Water meter results";
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.allResultsTabPage.ResumeLayout(false);
|
||||
this.productionTracingTabPage.ResumeLayout(false);
|
||||
this.productionTracingSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.productionTracingSplitContainer.Panel1.PerformLayout();
|
||||
@@ -166,12 +153,12 @@
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TabControl tabControl1;
|
||||
private System.Windows.Forms.TabPage allResultsTabPage;
|
||||
private OneWMResultsCtrl oneWMResultsCtrl;
|
||||
private OneWMResultsRowsCtrl oneWMResultsCtrl;
|
||||
private System.Windows.Forms.TabPage graphsTabPage;
|
||||
private System.Windows.Forms.TabPage productionTracingTabPage;
|
||||
private System.Windows.Forms.SplitContainer productionTracingSplitContainer;
|
||||
private System.Windows.Forms.Label messageLabel;
|
||||
private System.Windows.Forms.ListView tracingResultsListView;
|
||||
private System.Windows.Forms.TabPage allResultsTabPage;
|
||||
}
|
||||
}
|
||||
@@ -51,57 +51,57 @@ namespace Results.Forms
|
||||
/// <param name="wMtr">Water meter entity</param>
|
||||
void ShowAllResults(Results.Entities.WaterMeter wMtr)
|
||||
{
|
||||
string message;
|
||||
Color commonBackColor = wMtr.GetColorOfResults(false, out message); /// Ony message is used later on
|
||||
#if ORACLE_DB
|
||||
oneWMResultsCtrl.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
oneWMResultsCtrl.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
// string message;
|
||||
// Color commonBackColor = wMtr.GetColorOfResults(false, out message); /// Ony message is used later on
|
||||
//#if ORACLE_DB
|
||||
// oneWMResultsCtrl.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
//#else
|
||||
// oneWMResultsCtrl.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
//#endif
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.AllItems;
|
||||
// IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.AllItems;
|
||||
|
||||
// Header
|
||||
oneWMResultsCtrl.Columns.Add(wMtr.WMPosition.ToString(), 100);
|
||||
int i = 1;
|
||||
foreach (var str in wMtr.GetAllDecoratedTestNames())
|
||||
{
|
||||
oneWMResultsCtrl.Columns.Add(str, 100);
|
||||
i++;
|
||||
}
|
||||
// // Header
|
||||
// oneWMResultsCtrl.Columns.Add(wMtr.WMPosition.ToString(), 100);
|
||||
// int i = 1;
|
||||
// foreach (var str in wMtr.GetAllDecoratedTestNames())
|
||||
// {
|
||||
// oneWMResultsCtrl.Columns.Add(str, 100);
|
||||
// i++;
|
||||
// }
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(item.Name);
|
||||
// foreach (var item in items)
|
||||
// {
|
||||
// ListViewItem lvi = new ListViewItem(item.Name);
|
||||
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
string str = item.Print(wMtr, mtr.Name());
|
||||
// foreach (var mtr in wMtr.MeterTestRslts)
|
||||
// {
|
||||
// if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
// mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
// {
|
||||
// string str = item.Print(wMtr, mtr.Name());
|
||||
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
// string[] texts = str.Split(new char[] { '|' });
|
||||
// if (texts.Length == 1)
|
||||
// {
|
||||
// lvi.SubItems.Add(str);
|
||||
// }
|
||||
// else if (texts.Length == 2)
|
||||
// {
|
||||
// Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
// lvi.UseItemStyleForSubItems = false;
|
||||
// lvi.SubItems.Add(texts[0]);
|
||||
// lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// lvi.SubItems.Add(string.Empty);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
oneWMResultsCtrl.Items.Add(lvi);
|
||||
}
|
||||
// oneWMResultsCtrl.Items.Add(lvi);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
namespace Results.Forms
|
||||
{
|
||||
partial class OneWMResultsColumnsCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.tBox = new System.Windows.Forms.TextBox();
|
||||
this.lView = new System.Windows.Forms.ListView();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.tBox);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lView);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(352, 318);
|
||||
this.splitContainer1.SplitterDistance = 25;
|
||||
this.splitContainer1.SplitterWidth = 1;
|
||||
this.splitContainer1.TabIndex = 0;
|
||||
//
|
||||
// tBox
|
||||
//
|
||||
this.tBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.tBox.Name = "tBox";
|
||||
this.tBox.Size = new System.Drawing.Size(352, 20);
|
||||
this.tBox.TabIndex = 0;
|
||||
this.tBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tBox_MouseDoubleClick);
|
||||
//
|
||||
// lView
|
||||
//
|
||||
this.lView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lView.FullRowSelect = true;
|
||||
this.lView.GridLines = true;
|
||||
this.lView.Location = new System.Drawing.Point(0, 0);
|
||||
this.lView.Name = "lView";
|
||||
this.lView.Size = new System.Drawing.Size(352, 292);
|
||||
this.lView.TabIndex = 0;
|
||||
this.lView.UseCompatibleStateImageBehavior = false;
|
||||
this.lView.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// OneWMResultsCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Name = "OneWMResultsCtrl";
|
||||
this.Size = new System.Drawing.Size(352, 318);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.TextBox tBox;
|
||||
private System.Windows.Forms.ListView lView;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public partial class OneWMResultsColumnsCtrl : UserControl, IOneWMResultsCtrl
|
||||
{
|
||||
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
|
||||
///
|
||||
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (WMResultsClickedHandler != null) WMResultsClickedHandler(sender, new WaterMeterEventArgs(wmPosition));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool disabled;
|
||||
int wmPosition; /// 1-based water meter position
|
||||
string caption;
|
||||
Color bkColor;
|
||||
int[] columnWidths;
|
||||
IList<Results.WMeterRsltItemSpec> items;
|
||||
|
||||
|
||||
public bool Disabled { get { return disabled; } } /// Read only
|
||||
public int WMPosition { get { return wmPosition; } } /// Read only
|
||||
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } } /// Read only
|
||||
|
||||
|
||||
public OneWMResultsColumnsCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
disabled = false;
|
||||
wmPosition = 0;
|
||||
tBox.Text = caption = "---";
|
||||
tBox.BackColor = lView.BackColor = bkColor = Color.White;
|
||||
items = new List<Results.WMeterRsltItemSpec>();
|
||||
columnWidths = new int[0];
|
||||
}
|
||||
|
||||
public void Update(int[] columnWidths)
|
||||
{
|
||||
this.columnWidths = columnWidths;
|
||||
|
||||
/// Always update ListView column widths
|
||||
int col = 0;
|
||||
foreach (ColumnHeader column in lView.Columns)
|
||||
{
|
||||
column.Width = (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : ((col == 0) ? 40 : 70);
|
||||
col++;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(IList<Results.WMeterRsltItemSpec> items)
|
||||
{
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public void Update(Results.Entities.WaterMeter wMtr)
|
||||
{
|
||||
if (wMtr == null || wMtr.Disabled)
|
||||
{
|
||||
/// Water meter position is disabled
|
||||
this.disabled = true;
|
||||
lView.Items.Clear();
|
||||
tBox.Text = caption = "---";
|
||||
tBox.BackColor = lView.BackColor = bkColor = Color.White;
|
||||
return;
|
||||
}
|
||||
|
||||
/// Update background color
|
||||
string message = string.Empty;
|
||||
Update(wMtr.GetColorOfResults(false, out message));
|
||||
|
||||
/// Update caption
|
||||
#if ORACLE_DB
|
||||
tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
/// Header
|
||||
lView.Columns.Add(wmPosition.ToString(), (columnWidths.Length > 0) ? columnWidths[0] : 40);
|
||||
int col = 1;
|
||||
foreach (var str in wMtr.GetAllDecoratedTestNames())
|
||||
{
|
||||
lView.Columns.Add(str, (columnWidths.Length > col) ? columnWidths[col] : 70);
|
||||
col++;
|
||||
}
|
||||
|
||||
lView.Items.Clear();
|
||||
if (items == null || items.Count == 0) return;
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(item.Caption);
|
||||
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
string str = item.Print(wMtr, mtr.Name());
|
||||
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lView.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Private
|
||||
///
|
||||
|
||||
void Update(int wmPosition)
|
||||
{
|
||||
this.wmPosition = wmPosition;
|
||||
if (lView.Columns.Count > 0)
|
||||
{
|
||||
lView.Columns[0].Text = wmPosition.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
void Update(Color backColor)
|
||||
{
|
||||
if (this.bkColor != backColor)
|
||||
{
|
||||
tBox.BackColor = lView.BackColor = this.bkColor = backColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public partial class OneWMResultsCtrl : UserControl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(OneWMResultsCtrl));
|
||||
|
||||
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
|
||||
|
||||
public OneWMResultsCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public OneWMResultsCtrl(Color backColor, int lvWidth, int lvHeight, Results.Entities.WaterMeter wm)
|
||||
: this()
|
||||
{
|
||||
lView.BackColor = backColor;
|
||||
tBox.BackColor = backColor;
|
||||
Size = new System.Drawing.Size(lvWidth, lvHeight);
|
||||
WM = wm;
|
||||
}
|
||||
|
||||
public Results.Entities.WaterMeter WM;
|
||||
public string Caption { get { return tBox.Text; } set { tBox.Text = value; } }
|
||||
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } }
|
||||
public ListView.ListViewItemCollection Items { get { return lView.Items; } }
|
||||
public Color BColor { set { lView.BackColor = value; tBox.BackColor = value; } }
|
||||
|
||||
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (WMResultsClickedHandler == null) return;
|
||||
try { WMResultsClickedHandler(sender, new WaterMeterEventArgs(WM)); }
|
||||
catch (Exception exc) { log.Error("WMResultsClickedHandler(...) failed", exc); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
namespace Results.Forms
|
||||
{
|
||||
partial class OneWMResultsCtrl
|
||||
partial class OneWMResultsRowsCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -0,0 +1,169 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Results.Forms
|
||||
{
|
||||
public partial class OneWMResultsRowsCtrl : UserControl, IOneWMResultsCtrl
|
||||
{
|
||||
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
|
||||
///
|
||||
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (WMResultsClickedHandler != null) WMResultsClickedHandler(sender, new WaterMeterEventArgs(wmPosition));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool disabled;
|
||||
int wmPosition; /// 1-based water meter position
|
||||
string caption;
|
||||
Color bkColor;
|
||||
int[] columnWidths;
|
||||
IList<Results.WMeterRsltItemSpec> items;
|
||||
|
||||
|
||||
public bool Disabled { get { return disabled; } } /// Read only
|
||||
public int WMPosition { get { return wmPosition; } } /// Read only
|
||||
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } } /// Read only
|
||||
|
||||
|
||||
public OneWMResultsRowsCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
disabled = false;
|
||||
wmPosition = 0;
|
||||
tBox.Text = caption = "---";
|
||||
tBox.BackColor = lView.BackColor = bkColor = Color.White;
|
||||
items = new List<Results.WMeterRsltItemSpec>();
|
||||
columnWidths = new int[0];
|
||||
}
|
||||
|
||||
public void Update(int[] columnWidths)
|
||||
{
|
||||
this.columnWidths = columnWidths;
|
||||
|
||||
/// Always update ListView column widths
|
||||
int col = 0;
|
||||
foreach (ColumnHeader column in lView.Columns)
|
||||
{
|
||||
column.Width = (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : ((col == 0) ? 40 : 70);
|
||||
col++;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(IList<Results.WMeterRsltItemSpec> items)
|
||||
{
|
||||
this.items = items;
|
||||
|
||||
/// Always draw ListView header
|
||||
lView.Columns.Clear();
|
||||
lView.Columns.Add(wmPosition.ToString(), (columnWidths.Length > 0) ? columnWidths[0] : 40);
|
||||
|
||||
if (items == null || items.Count == 0) return;
|
||||
int col = 1;
|
||||
foreach (var item in items)
|
||||
{
|
||||
lView.Columns.Add(item.Caption, (columnWidths.Length > col) ? columnWidths[col] : 70);
|
||||
col++;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Results.Entities.WaterMeter wMtr)
|
||||
{
|
||||
if (wMtr == null || wMtr.Disabled)
|
||||
{
|
||||
/// Water meter position is disabled
|
||||
this.disabled = true;
|
||||
lView.Items.Clear();
|
||||
tBox.Text = caption = "---";
|
||||
tBox.BackColor = lView.BackColor = bkColor = Color.White;
|
||||
return;
|
||||
}
|
||||
|
||||
/// Update background color
|
||||
string message = string.Empty;
|
||||
Update(wMtr.GetColorOfResults(false, out message));
|
||||
|
||||
/// Update caption
|
||||
#if ORACLE_DB
|
||||
tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
Update(wMtr.WMPosition);
|
||||
|
||||
/// Update test results
|
||||
IList<string> testNames = wMtr.GetAllDecoratedTestNames();
|
||||
int ix = 0;
|
||||
lView.Items.Clear();
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never
|
||||
&& mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(testNames[ix++]);
|
||||
|
||||
if (items != null)
|
||||
{
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
string str = items[i].Print(wMtr, mtr.Name());
|
||||
|
||||
/// Extract and use color information
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lView.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Private
|
||||
///
|
||||
|
||||
void Update(int wmPosition)
|
||||
{
|
||||
this.wmPosition = wmPosition;
|
||||
if (lView.Columns.Count > 0)
|
||||
{
|
||||
lView.Columns[0].Text = wmPosition.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
void Update(Color backColor)
|
||||
{
|
||||
if (this.bkColor != backColor)
|
||||
{
|
||||
tBox.BackColor = lView.BackColor = this.bkColor = backColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -7,8 +7,8 @@ namespace Results.Forms
|
||||
{
|
||||
public class WaterMeterEventArgs : EventArgs
|
||||
{
|
||||
public Results.Entities.WaterMeter WM;
|
||||
public int WMPosition;
|
||||
|
||||
public WaterMeterEventArgs(Results.Entities.WaterMeter wm) { WM = wm; }
|
||||
public WaterMeterEventArgs(int wmPosition) { WMPosition = wmPosition; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Results.Entities;
|
||||
@@ -12,7 +12,8 @@ namespace Results.Mappings
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.CompoundMeterId);
|
||||
Map(x => x.PulsesMeter);
|
||||
Map(x => x.RegReaderType);
|
||||
Map(x => x.PulsesMeter);
|
||||
Map(x => x.PulsesMaster);
|
||||
Map(x => x.PulsesPerLiter);
|
||||
Map(x => x.VolumeStart);
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace Results.Mappings
|
||||
References<Components>(x => x.Components);
|
||||
Map(x => x.Part);
|
||||
Map(x => x.RepetitionNr);
|
||||
Map(x => x.MethodClass);
|
||||
|
||||
Map(x => x.TestDone);
|
||||
Map(x => x.Remark)
|
||||
@@ -26,6 +27,8 @@ namespace Results.Mappings
|
||||
Map(x => x.FlowSetTime);
|
||||
Map(x => x.TestTime);
|
||||
Map(x => x.PulsesMaster);
|
||||
Map(x => x.ConstMasterRaw);
|
||||
Map(x => x.ConstMasterCorr);
|
||||
Map(x => x.ConstMaster);
|
||||
Map(x => x.MassStartRaw);
|
||||
Map(x => x.MassStart);
|
||||
|
||||
@@ -42,6 +42,8 @@ namespace Results.Mappings
|
||||
Map(x => x.MetrologicalClassAux);
|
||||
Map(x => x.ApprovalInfoAux);
|
||||
|
||||
Map(x => x.Medium);
|
||||
|
||||
Map(x => x.Text1);
|
||||
Map(x => x.Text2);
|
||||
Map(x => x.Text3);
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.18.1278.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1278.0")]
|
||||
[assembly: AssemblyVersion("2.20.1305.0")]
|
||||
[assembly: AssemblyFileVersion("2.20.1305.0")]
|
||||
|
||||
Generated
+9
@@ -1230,6 +1230,15 @@ namespace Results.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to This position is disabled.
|
||||
/// </summary>
|
||||
internal static string This_position_is_disabled {
|
||||
get {
|
||||
return ResourceManager.GetString("This_position_is_disabled", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to to.
|
||||
/// </summary>
|
||||
|
||||
@@ -333,4 +333,7 @@
|
||||
<data name="Flow" xml:space="preserve">
|
||||
<value>Průtok</value>
|
||||
</data>
|
||||
<data name="This_position_is_disabled" xml:space="preserve">
|
||||
<value>Taro pozice je vypnuta</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -816,4 +816,7 @@
|
||||
<data name="Relative_error" xml:space="preserve">
|
||||
<value>Relative error</value>
|
||||
</data>
|
||||
<data name="This_position_is_disabled" xml:space="preserve">
|
||||
<value>This position is disabled</value>
|
||||
</data>
|
||||
</root>
|
||||
+17
-7
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;FILIPINY_50</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;PETERSBURG_50;LANG_RU</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -27,7 +27,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;FILIPINY_50</DefineConstants>
|
||||
<DefineConstants>TRACE;PETERSBURG_50;LANG_RU</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
@@ -75,6 +75,7 @@
|
||||
<Compile Include="Forms\BatchResultsDlg.Designer.cs">
|
||||
<DependentUpon>BatchResultsDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\IOneWMResultsCtrl.cs" />
|
||||
<Compile Include="Forms\ListViewEx.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -87,11 +88,17 @@
|
||||
<Compile Include="Forms\MoreWMResultsDlg.Designer.cs">
|
||||
<DependentUpon>MoreWMResultsDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\OneWMResultsCtrl.cs">
|
||||
<Compile Include="Forms\OneWMResultsColumnsCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\OneWMResultsCtrl.Designer.cs">
|
||||
<DependentUpon>OneWMResultsCtrl.cs</DependentUpon>
|
||||
<Compile Include="Forms\OneWMResultsColumnsCtrl.designer.cs">
|
||||
<DependentUpon>OneWMResultsColumnsCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\OneWMResultsRowsCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\OneWMResultsRowsCtrl.Designer.cs">
|
||||
<DependentUpon>OneWMResultsRowsCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ResultsConfigCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
@@ -187,8 +194,11 @@
|
||||
<EmbeddedResource Include="Forms\MoreWMResultsDlg.resx">
|
||||
<DependentUpon>MoreWMResultsDlg.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\OneWMResultsCtrl.resx">
|
||||
<DependentUpon>OneWMResultsCtrl.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Forms\OneWMResultsColumnsCtrl.resx">
|
||||
<DependentUpon>OneWMResultsColumnsCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\OneWMResultsRowsCtrl.resx">
|
||||
<DependentUpon>OneWMResultsRowsCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\ResultsConfigCtrl.resx">
|
||||
<DependentUpon>ResultsConfigCtrl.cs</DependentUpon>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;FILIPINY_50</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;PETERSBURG_50;LANG_RU</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
@@ -31,7 +31,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;FILIPINY_50</DefineConstants>
|
||||
<DefineConstants>TRACE;PETERSBURG_50;LANG_RU</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.GenericDevices;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.Dummy.Diverter
|
||||
{
|
||||
@@ -17,6 +18,11 @@ namespace TBF.BenchControl.Dummy.Diverter
|
||||
return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1));
|
||||
}
|
||||
|
||||
FloatBox switchTimeStart;
|
||||
FloatBox switchTimeEnd;
|
||||
public FloatBox SwitchTimeStart { get { return switchTimeStart; } }
|
||||
public FloatBox SwitchTimeEnd { get { return switchTimeEnd; } }
|
||||
|
||||
public Component()
|
||||
{
|
||||
}
|
||||
@@ -24,6 +30,8 @@ namespace TBF.BenchControl.Dummy.Diverter
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
switchTimeStart = new FloatBox();
|
||||
switchTimeEnd = new FloatBox();
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
|
||||
@@ -652,7 +652,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="testName">Test name (without repetitions)</param>
|
||||
/// <param name="repetition">Repetition number</param>
|
||||
/// <returns>Created operation</returns>
|
||||
public IOperation ReadDiverterTransitionOp(IDiverter div, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, TBF.Boxes.FloatBox transitionTimeSec,
|
||||
public IOperation ReadDiverterTransitionOp(IDiverter div, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, bool toTank,
|
||||
Sequences.Statistics plotter, int batchNr, string testName, int repetition)
|
||||
{
|
||||
if (controlBoardCfg.DebugLevel == DebugMode.Simulate)
|
||||
@@ -661,7 +661,7 @@ namespace TBF.BenchControl.Elde
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ReadDiverterTransitionOp(this, div, runsCountWhenSendingCmd, runsCountWhenReadingDiv, transitionTimeSec, plotter, batchNr, testName, repetition);
|
||||
return new ReadDiverterTransitionOp(this, div, runsCountWhenSendingCmd, runsCountWhenReadingDiv, toTank, plotter, batchNr, testName, repetition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Dirichlet.Numerics;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Diverter
|
||||
@@ -45,6 +46,10 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
public int ThresholdLo { get { return diverterCfg.ThresholdLo; } }
|
||||
public int ThresholdHi { get { return diverterCfg.ThresholdHi; } }
|
||||
|
||||
FloatBox switchTimeStart;
|
||||
FloatBox switchTimeEnd;
|
||||
public FloatBox SwitchTimeStart { get { return switchTimeStart; } }
|
||||
public FloatBox SwitchTimeEnd { get { return switchTimeEnd; } }
|
||||
|
||||
/// <summary>
|
||||
/// For a given flow in [m3/h] returns a test time correction in [s]
|
||||
@@ -70,7 +75,8 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
if (diverterCfg.BitPosition < 0 || diverterCfg.BitPosition >= 64) throw new ArgumentOutOfRangeException("position");
|
||||
this.mask = (((UInt128)1) << diverterCfg.BitPosition);
|
||||
|
||||
|
||||
switchTimeStart = new FloatBox(diverterCfg.DfltSwithTimeStartMs / 1000.0f);
|
||||
switchTimeEnd = new FloatBox(diverterCfg.DfltSwithTimeEndMs / 1000.0f);
|
||||
|
||||
diverterNr0 = nextIdx++;
|
||||
///
|
||||
|
||||
@@ -19,13 +19,15 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int BitPosition; /// 0..63
|
||||
public int AdcNr; /// 0..15(?), number of the analog input
|
||||
public int AdcValueToSink; /// 0..1023
|
||||
public int AdcValueToTank; /// 0..1023
|
||||
public int StartingLevel; /// 0..100 in %, threshold for the ADC value to start the test
|
||||
public int ThresholdLo; /// 0..100 in %, threshold for low level when diverter transition time is measured
|
||||
public int ThresholdHi; /// 0..100 in %, threshold for high level when diverter transition time is measured
|
||||
public int BitPosition; /// 0..63
|
||||
public int AdcNr; /// 0..15(?), number of the analog input
|
||||
public int AdcValueToSink; /// 0..1023
|
||||
public int AdcValueToTank; /// 0..1023
|
||||
public int StartingLevel; /// 0..100 in %, threshold for the ADC value to start the test
|
||||
public int ThresholdLo; /// 0..100 in %, threshold for low level when diverter transition time is measured
|
||||
public int ThresholdHi; /// 0..100 in %, threshold for high level when diverter transition time is measured
|
||||
public int DfltSwithTimeStartMs; /// Default diverter transition time 'start' or 'to tank' in ms
|
||||
public int DfltSwithTimeEndMs; /// Default diverter transition time 'end' or 'to sink' in ms
|
||||
|
||||
/// Calibration info serialized parameters displayed in Metrology tab page
|
||||
string calibCertificateNr;
|
||||
|
||||
+92
-22
@@ -73,6 +73,12 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.thresholdHiTextBox = new System.Windows.Forms.TextBox();
|
||||
this.thresholdHiLabel = new System.Windows.Forms.Label();
|
||||
this.dfltSwitchTimeEndTextBox = new System.Windows.Forms.TextBox();
|
||||
this.dfltSwitchTimeEndLabel = new System.Windows.Forms.Label();
|
||||
this.dfltSwitchTimeStartTextBox = new System.Windows.Forms.TextBox();
|
||||
this.dfltSwitchTimeStartLabel = new System.Windows.Forms.Label();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.groupBox4.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
@@ -81,7 +87,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(137, 41);
|
||||
this.nameTextBox.Location = new System.Drawing.Point(144, 41);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
@@ -89,7 +95,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(27, 44);
|
||||
this.nameLabel.Location = new System.Drawing.Point(21, 44);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
@@ -98,7 +104,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(134, 17);
|
||||
this.classNameLabel.Location = new System.Drawing.Point(141, 17);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
@@ -107,7 +113,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// parentNameLabel
|
||||
//
|
||||
this.parentNameLabel.AutoSize = true;
|
||||
this.parentNameLabel.Location = new System.Drawing.Point(27, 67);
|
||||
this.parentNameLabel.Location = new System.Drawing.Point(21, 67);
|
||||
this.parentNameLabel.Name = "parentNameLabel";
|
||||
this.parentNameLabel.Size = new System.Drawing.Size(69, 13);
|
||||
this.parentNameLabel.TabIndex = 3;
|
||||
@@ -116,7 +122,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// bitPositionLabel
|
||||
//
|
||||
this.bitPositionLabel.AutoSize = true;
|
||||
this.bitPositionLabel.Location = new System.Drawing.Point(27, 91);
|
||||
this.bitPositionLabel.Location = new System.Drawing.Point(21, 91);
|
||||
this.bitPositionLabel.Name = "bitPositionLabel";
|
||||
this.bitPositionLabel.Size = new System.Drawing.Size(59, 13);
|
||||
this.bitPositionLabel.TabIndex = 5;
|
||||
@@ -125,7 +131,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// bitPositionTextBox
|
||||
//
|
||||
this.bitPositionTextBox.Enabled = false;
|
||||
this.bitPositionTextBox.Location = new System.Drawing.Point(137, 88);
|
||||
this.bitPositionTextBox.Location = new System.Drawing.Point(144, 88);
|
||||
this.bitPositionTextBox.Name = "bitPositionTextBox";
|
||||
this.bitPositionTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.bitPositionTextBox.TabIndex = 6;
|
||||
@@ -134,7 +140,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
//
|
||||
this.parentNameComboBox.Enabled = false;
|
||||
this.parentNameComboBox.FormattingEnabled = true;
|
||||
this.parentNameComboBox.Location = new System.Drawing.Point(137, 64);
|
||||
this.parentNameComboBox.Location = new System.Drawing.Point(144, 64);
|
||||
this.parentNameComboBox.Name = "parentNameComboBox";
|
||||
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parentNameComboBox.TabIndex = 4;
|
||||
@@ -142,7 +148,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// startingEdgeTextBox
|
||||
//
|
||||
this.startingEdgeTextBox.Enabled = false;
|
||||
this.startingEdgeTextBox.Location = new System.Drawing.Point(137, 180);
|
||||
this.startingEdgeTextBox.Location = new System.Drawing.Point(144, 180);
|
||||
this.startingEdgeTextBox.Name = "startingEdgeTextBox";
|
||||
this.startingEdgeTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.startingEdgeTextBox.TabIndex = 14;
|
||||
@@ -150,7 +156,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// startingEdgeLabel
|
||||
//
|
||||
this.startingEdgeLabel.AutoSize = true;
|
||||
this.startingEdgeLabel.Location = new System.Drawing.Point(27, 183);
|
||||
this.startingEdgeLabel.Location = new System.Drawing.Point(21, 183);
|
||||
this.startingEdgeLabel.Name = "startingEdgeLabel";
|
||||
this.startingEdgeLabel.Size = new System.Drawing.Size(68, 13);
|
||||
this.startingEdgeLabel.TabIndex = 13;
|
||||
@@ -159,7 +165,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// thresholdLoTextBox
|
||||
//
|
||||
this.thresholdLoTextBox.Enabled = false;
|
||||
this.thresholdLoTextBox.Location = new System.Drawing.Point(137, 203);
|
||||
this.thresholdLoTextBox.Location = new System.Drawing.Point(144, 203);
|
||||
this.thresholdLoTextBox.Name = "thresholdLoTextBox";
|
||||
this.thresholdLoTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.thresholdLoTextBox.TabIndex = 17;
|
||||
@@ -167,7 +173,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// thresholdLoLabel
|
||||
//
|
||||
this.thresholdLoLabel.AutoSize = true;
|
||||
this.thresholdLoLabel.Location = new System.Drawing.Point(27, 206);
|
||||
this.thresholdLoLabel.Location = new System.Drawing.Point(21, 206);
|
||||
this.thresholdLoLabel.Name = "thresholdLoLabel";
|
||||
this.thresholdLoLabel.Size = new System.Drawing.Size(69, 13);
|
||||
this.thresholdLoLabel.TabIndex = 16;
|
||||
@@ -176,7 +182,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(190, 205);
|
||||
this.label2.Location = new System.Drawing.Point(197, 205);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(15, 13);
|
||||
this.label2.TabIndex = 18;
|
||||
@@ -185,7 +191,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(190, 183);
|
||||
this.label1.Location = new System.Drawing.Point(197, 183);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(15, 13);
|
||||
this.label1.TabIndex = 15;
|
||||
@@ -225,7 +231,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// adcToTankTextBox
|
||||
//
|
||||
this.adcToTankTextBox.Enabled = false;
|
||||
this.adcToTankTextBox.Location = new System.Drawing.Point(137, 157);
|
||||
this.adcToTankTextBox.Location = new System.Drawing.Point(144, 157);
|
||||
this.adcToTankTextBox.Name = "adcToTankTextBox";
|
||||
this.adcToTankTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.adcToTankTextBox.TabIndex = 12;
|
||||
@@ -233,7 +239,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// adcTankLabel
|
||||
//
|
||||
this.adcTankLabel.AutoSize = true;
|
||||
this.adcTankLabel.Location = new System.Drawing.Point(27, 160);
|
||||
this.adcTankLabel.Location = new System.Drawing.Point(21, 160);
|
||||
this.adcTankLabel.Name = "adcTankLabel";
|
||||
this.adcTankLabel.Size = new System.Drawing.Size(94, 13);
|
||||
this.adcTankLabel.TabIndex = 11;
|
||||
@@ -242,7 +248,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// adcToSinkTextBox
|
||||
//
|
||||
this.adcToSinkTextBox.Enabled = false;
|
||||
this.adcToSinkTextBox.Location = new System.Drawing.Point(137, 134);
|
||||
this.adcToSinkTextBox.Location = new System.Drawing.Point(144, 134);
|
||||
this.adcToSinkTextBox.Name = "adcToSinkTextBox";
|
||||
this.adcToSinkTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.adcToSinkTextBox.TabIndex = 10;
|
||||
@@ -250,7 +256,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// adcSinkLabel
|
||||
//
|
||||
this.adcSinkLabel.AutoSize = true;
|
||||
this.adcSinkLabel.Location = new System.Drawing.Point(27, 137);
|
||||
this.adcSinkLabel.Location = new System.Drawing.Point(21, 137);
|
||||
this.adcSinkLabel.Name = "adcSinkLabel";
|
||||
this.adcSinkLabel.Size = new System.Drawing.Size(92, 13);
|
||||
this.adcSinkLabel.TabIndex = 9;
|
||||
@@ -419,7 +425,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// adcNrTextBox
|
||||
//
|
||||
this.adcNrTextBox.Enabled = false;
|
||||
this.adcNrTextBox.Location = new System.Drawing.Point(137, 111);
|
||||
this.adcNrTextBox.Location = new System.Drawing.Point(144, 111);
|
||||
this.adcNrTextBox.Name = "adcNrTextBox";
|
||||
this.adcNrTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.adcNrTextBox.TabIndex = 8;
|
||||
@@ -427,7 +433,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(27, 114);
|
||||
this.label7.Location = new System.Drawing.Point(21, 114);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(76, 13);
|
||||
this.label7.TabIndex = 7;
|
||||
@@ -436,7 +442,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(190, 228);
|
||||
this.label8.Location = new System.Drawing.Point(197, 228);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(15, 13);
|
||||
this.label8.TabIndex = 29;
|
||||
@@ -445,7 +451,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// thresholdHiTextBox
|
||||
//
|
||||
this.thresholdHiTextBox.Enabled = false;
|
||||
this.thresholdHiTextBox.Location = new System.Drawing.Point(137, 226);
|
||||
this.thresholdHiTextBox.Location = new System.Drawing.Point(144, 226);
|
||||
this.thresholdHiTextBox.Name = "thresholdHiTextBox";
|
||||
this.thresholdHiTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.thresholdHiTextBox.TabIndex = 28;
|
||||
@@ -453,16 +459,74 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
// thresholdHiLabel
|
||||
//
|
||||
this.thresholdHiLabel.AutoSize = true;
|
||||
this.thresholdHiLabel.Location = new System.Drawing.Point(27, 229);
|
||||
this.thresholdHiLabel.Location = new System.Drawing.Point(21, 229);
|
||||
this.thresholdHiLabel.Name = "thresholdHiLabel";
|
||||
this.thresholdHiLabel.Size = new System.Drawing.Size(67, 13);
|
||||
this.thresholdHiLabel.TabIndex = 27;
|
||||
this.thresholdHiLabel.Text = "Threshold Hi";
|
||||
//
|
||||
// dfltSwitchTimeEndTextBox
|
||||
//
|
||||
this.dfltSwitchTimeEndTextBox.Enabled = false;
|
||||
this.dfltSwitchTimeEndTextBox.Location = new System.Drawing.Point(144, 272);
|
||||
this.dfltSwitchTimeEndTextBox.Name = "dfltSwitchTimeEndTextBox";
|
||||
this.dfltSwitchTimeEndTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.dfltSwitchTimeEndTextBox.TabIndex = 33;
|
||||
//
|
||||
// dfltSwitchTimeEndLabel
|
||||
//
|
||||
this.dfltSwitchTimeEndLabel.AutoSize = true;
|
||||
this.dfltSwitchTimeEndLabel.Location = new System.Drawing.Point(21, 275);
|
||||
this.dfltSwitchTimeEndLabel.Name = "dfltSwitchTimeEndLabel";
|
||||
this.dfltSwitchTimeEndLabel.Size = new System.Drawing.Size(117, 13);
|
||||
this.dfltSwitchTimeEndLabel.TabIndex = 32;
|
||||
this.dfltSwitchTimeEndLabel.Text = "Default switch time end";
|
||||
//
|
||||
// dfltSwitchTimeStartTextBox
|
||||
//
|
||||
this.dfltSwitchTimeStartTextBox.Enabled = false;
|
||||
this.dfltSwitchTimeStartTextBox.Location = new System.Drawing.Point(144, 249);
|
||||
this.dfltSwitchTimeStartTextBox.Name = "dfltSwitchTimeStartTextBox";
|
||||
this.dfltSwitchTimeStartTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.dfltSwitchTimeStartTextBox.TabIndex = 31;
|
||||
//
|
||||
// dfltSwitchTimeStartLabel
|
||||
//
|
||||
this.dfltSwitchTimeStartLabel.AutoSize = true;
|
||||
this.dfltSwitchTimeStartLabel.Location = new System.Drawing.Point(21, 252);
|
||||
this.dfltSwitchTimeStartLabel.Name = "dfltSwitchTimeStartLabel";
|
||||
this.dfltSwitchTimeStartLabel.Size = new System.Drawing.Size(119, 13);
|
||||
this.dfltSwitchTimeStartLabel.TabIndex = 30;
|
||||
this.dfltSwitchTimeStartLabel.Text = "Default switch time start";
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(197, 252);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(20, 13);
|
||||
this.label9.TabIndex = 34;
|
||||
this.label9.Text = "ms";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(197, 275);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(20, 13);
|
||||
this.label10.TabIndex = 35;
|
||||
this.label10.Text = "ms";
|
||||
//
|
||||
// DiverterCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.label10);
|
||||
this.Controls.Add(this.label9);
|
||||
this.Controls.Add(this.dfltSwitchTimeEndTextBox);
|
||||
this.Controls.Add(this.dfltSwitchTimeEndLabel);
|
||||
this.Controls.Add(this.dfltSwitchTimeStartTextBox);
|
||||
this.Controls.Add(this.dfltSwitchTimeStartLabel);
|
||||
this.Controls.Add(this.label8);
|
||||
this.Controls.Add(this.thresholdHiTextBox);
|
||||
this.Controls.Add(this.thresholdHiLabel);
|
||||
@@ -549,5 +613,11 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.TextBox thresholdHiTextBox;
|
||||
private System.Windows.Forms.Label thresholdHiLabel;
|
||||
private System.Windows.Forms.TextBox dfltSwitchTimeEndTextBox;
|
||||
private System.Windows.Forms.Label dfltSwitchTimeEndLabel;
|
||||
private System.Windows.Forms.TextBox dfltSwitchTimeStartTextBox;
|
||||
private System.Windows.Forms.Label dfltSwitchTimeStartLabel;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.Label label10;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,8 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
startingEdgeTextBox.Text = config.StartingLevel.ToString();
|
||||
thresholdLoTextBox.Text = config.ThresholdLo.ToString();
|
||||
thresholdHiTextBox.Text = config.ThresholdHi.ToString();
|
||||
dfltSwitchTimeStartTextBox.Text = config.DfltSwithTimeStartMs.ToString();
|
||||
dfltSwitchTimeEndTextBox.Text = config.DfltSwithTimeEndMs.ToString();
|
||||
|
||||
adcTextBox1.Text = adc1.ToString();
|
||||
adcTextBox2.Text = adc2.ToString();
|
||||
@@ -98,6 +100,8 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
startingEdgeTextBox.Enabled = true;
|
||||
thresholdLoTextBox.Enabled = true;
|
||||
thresholdHiTextBox.Enabled = true;
|
||||
dfltSwitchTimeStartTextBox.Enabled = true;
|
||||
dfltSwitchTimeEndTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
@@ -160,6 +164,16 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
message += Environment.NewLine + "'Threshold HI' should be between 0 and 100%";
|
||||
}
|
||||
}
|
||||
if (!int.TryParse(dfltSwitchTimeStartTextBox.Text, out dummy) || dummy <= 0)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Default switch time start' should be positive integer";
|
||||
}
|
||||
if (!int.TryParse(dfltSwitchTimeEndTextBox.Text, out dummy) || dummy <= 0)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "'Default switch time end' should be positive integer";
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -232,6 +246,20 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
flags |= CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
tmp = int.Parse(dfltSwitchTimeStartTextBox.Text);
|
||||
if (config.DfltSwithTimeStartMs != tmp)
|
||||
{
|
||||
config.DfltSwithTimeStartMs = tmp;
|
||||
flags |= CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
tmp = int.Parse(dfltSwitchTimeEndTextBox.Text);
|
||||
if (config.DfltSwithTimeEndMs != tmp)
|
||||
{
|
||||
config.DfltSwithTimeEndMs = tmp;
|
||||
flags |= CfgUpdateFlags.RestartRqrd;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,19 +8,19 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
public class SwitchDiverterOp : IOperation
|
||||
{
|
||||
ControlBoardDev controlBoard;
|
||||
bool start;
|
||||
bool toTank;
|
||||
int flowMtrNr;
|
||||
|
||||
public SwitchDiverterOp(ControlBoardDev controlBoard, bool start, int flowMtrNr)
|
||||
public SwitchDiverterOp(ControlBoardDev controlBoard, bool toTank, int flowMtrNr)
|
||||
{
|
||||
this.controlBoard = controlBoard;
|
||||
this.start = start;
|
||||
this.toTank = toTank;
|
||||
this.flowMtrNr = flowMtrNr;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (start)
|
||||
if (toTank)
|
||||
{
|
||||
controlBoard.DiverterToTank(flowMtrNr);
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ namespace TBF.BenchControl.Elde
|
||||
/// Set by the constructor
|
||||
readonly ControlBoardDev controlBoard;
|
||||
readonly GenericDevices.IDiverter div;
|
||||
readonly bool toTank;
|
||||
readonly int runsCountWhenSendingCmd;
|
||||
readonly int runsCountWhenReadingDiv;
|
||||
readonly FloatBox transitionTimeSec;
|
||||
readonly Sequences.Statistics plotter;
|
||||
readonly int batchNr;
|
||||
readonly string testName;
|
||||
@@ -43,19 +43,19 @@ namespace TBF.BenchControl.Elde
|
||||
/// <param name="method">Test method</param>
|
||||
/// <param name="refPulses">Test duration in number of reference flowmeter pulses</param>
|
||||
/// <param name="filterConstant">Specifies filter for watermeter pulses</param>
|
||||
public ReadDiverterTransitionOp(ControlBoardDev controlBoard, GenericDevices.IDiverter div, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv,
|
||||
FloatBox transitionTimeSec, Sequences.Statistics plotter, int batchNr, string testName, int repetition)
|
||||
public ReadDiverterTransitionOp(ControlBoardDev controlBoard, GenericDevices.IDiverter div, int runsCountWhenSendingCmd, int runsCountWhenReadingDiv, bool toTank,
|
||||
Sequences.Statistics plotter, int batchNr, string testName, int repetition)
|
||||
{
|
||||
if (controlBoard == null) throw new ArgumentNullException("controlBoardDev");
|
||||
if (div == null) throw new ArgumentNullException("div");
|
||||
if (runsCountWhenSendingCmd < 0) throw new ArgumentNullException("runsCountWhenSendingCmd");
|
||||
if (runsCountWhenReadingDiv <= runsCountWhenSendingCmd) throw new ArgumentNullException("runsCountWhenReadingDiv");
|
||||
if (transitionTimeSec == null) throw new ArgumentNullException("transitionTimeSec");
|
||||
|
||||
this.controlBoard = controlBoard;
|
||||
this.div = div;
|
||||
this.runsCountWhenSendingCmd = runsCountWhenSendingCmd;
|
||||
this.runsCountWhenReadingDiv = runsCountWhenReadingDiv;
|
||||
this.transitionTimeSec = transitionTimeSec;
|
||||
this.toTank = toTank;
|
||||
this.plotter = plotter;
|
||||
this.batchNr = batchNr;
|
||||
this.testName = testName;
|
||||
@@ -102,7 +102,7 @@ namespace TBF.BenchControl.Elde
|
||||
if (plotter == null)
|
||||
{
|
||||
ReadDiverterTransitionTimes();
|
||||
log.DebugFormat("Run() ... Reading diverter {0} transition times: {1}s", div.Name, transitionTimeSec.Val);
|
||||
log.DebugFormat("Run() ... Reading diverter {0} transition times: {1}s", div.Name, (toTank ? div.SwitchTimeStart : div.SwitchTimeEnd).Val);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -115,7 +115,7 @@ namespace TBF.BenchControl.Elde
|
||||
}
|
||||
plotter.Stop();
|
||||
|
||||
log.DebugFormat("Run() ... Calculating diverter {0} transition times: {1}s", div.Name, transitionTimeSec.Val);
|
||||
log.DebugFormat("Run() ... Calculating diverter {0} transition times: {1}s", div.Name, (toTank ? div.SwitchTimeStart : div.SwitchTimeEnd).Val);
|
||||
CalculateDiverterTransitionTimes();
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,7 @@ namespace TBF.BenchControl.Elde
|
||||
/// <returns>true (always)</returns>
|
||||
bool ReadDiverterTransitionTimes()
|
||||
{
|
||||
transitionTimeSec.Val = (float)controlBoard.DivTime(2) - (float)controlBoard.DivTime(1);
|
||||
(toTank ? div.SwitchTimeStart : div.SwitchTimeEnd).Val = (float)controlBoard.DivTime(2) - (float)controlBoard.DivTime(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace TBF.BenchControl.Elde
|
||||
|
||||
if ((startedRising || startedFalling) && stopped)
|
||||
{
|
||||
transitionTimeSec.Val = 0.002f * (float)(transitionEndIdx - transitionStartIdx); /// 2 ms per sample
|
||||
(toTank ? div.SwitchTimeStart : div.SwitchTimeEnd).Val = 0.002f * (float)(transitionEndIdx - transitionStartIdx); /// 2 ms per sample
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.BenchControl.GenericDevices
|
||||
{
|
||||
@@ -33,6 +34,9 @@ namespace TBF.BenchControl.GenericDevices
|
||||
/// </summary>
|
||||
int ThresholdHi { get; }
|
||||
|
||||
FloatBox SwitchTimeStart { get; }
|
||||
FloatBox SwitchTimeEnd { get; }
|
||||
|
||||
/// <summary>
|
||||
/// For a given flow in [m3/h] returns a test time correction in [s]
|
||||
/// </summary>
|
||||
|
||||
@@ -147,13 +147,13 @@ namespace TBF.BenchControl.Output.DB.SaveDiverterCorrections
|
||||
void SaveNewCorrections(ISession session, Component dbCmpnt, IComponent runtimeCmpnt, IList<MeasurementCorrection> corrections)
|
||||
{
|
||||
if (dbCmpnt.Corrections == null) dbCmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
if (runtimeCmpnt.Corrections == null) runtimeCmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
if ((runtimeCmpnt != null) && (runtimeCmpnt.Corrections == null)) runtimeCmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
|
||||
foreach (var mc in corrections)
|
||||
{
|
||||
mc.RangeIx = 0;
|
||||
dbCmpnt.Corrections.Add(mc);
|
||||
runtimeCmpnt.Corrections.Add(mc);
|
||||
if (runtimeCmpnt != null) runtimeCmpnt.Corrections.Add(mc);
|
||||
session.SaveOrUpdate(mc);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,13 +146,13 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
|
||||
void SaveNewCorrections(ISession session, Component dbCmpnt, IComponent runtimeCmpnt, int rangeIx, IList<MeasurementCorrection> corrections)
|
||||
{
|
||||
if (dbCmpnt.Corrections == null) dbCmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
if (runtimeCmpnt.Corrections == null) runtimeCmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
if ((runtimeCmpnt != null) && (runtimeCmpnt.Corrections == null)) runtimeCmpnt.Corrections = new List<MeasurementCorrection>();
|
||||
|
||||
foreach (var mc in corrections)
|
||||
{
|
||||
mc.RangeIx = rangeIx;
|
||||
dbCmpnt.Corrections.Add(mc);
|
||||
runtimeCmpnt.Corrections.Add(mc);
|
||||
if (runtimeCmpnt != null) runtimeCmpnt.Corrections.Add(mc);
|
||||
session.SaveOrUpdate(mc);
|
||||
}
|
||||
|
||||
|
||||
@@ -331,6 +331,28 @@ namespace TBF.BenchControl.Sequences
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This function is called after a procedure was selected and all components procedure parameters of components were loaded
|
||||
/// </summary>
|
||||
void ClearSessionData()
|
||||
{
|
||||
///
|
||||
/// Clear iperlhead data (including PCB Number, avoid double use)
|
||||
///
|
||||
foreach (var cmpnt in StateMachine.Components)
|
||||
{
|
||||
if (cmpnt is TestMethods.iPerlCommunication.iPerlHead.IperlHead)
|
||||
{
|
||||
(cmpnt as TestMethods.iPerlCommunication.iPerlHead.IperlHead).ClearData();
|
||||
}
|
||||
}
|
||||
|
||||
IsQ2PreCorrectionCalculated = false;
|
||||
CalculatedQ2PreCorrectionLR = 0;
|
||||
CalculatedQ2PreCorrectionRL = 0;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Main sequence
|
||||
/// </summary>
|
||||
@@ -480,16 +502,7 @@ namespace TBF.BenchControl.Sequences
|
||||
int newBatchNr = Program.LocalSettings.BatchNr;
|
||||
log.FatalFormat("New measurement session started: batch = {0}, procedure = {1}", newBatchNr, StateMachine.Procedure.Name);
|
||||
|
||||
///
|
||||
/// Clear iperlhead data (including PCB Number, avoid double use)
|
||||
///
|
||||
foreach (var cmpnt in StateMachine.Components)
|
||||
{
|
||||
if (cmpnt is TestMethods.iPerlCommunication.iPerlHead.IperlHead)
|
||||
{
|
||||
(cmpnt as TestMethods.iPerlCommunication.iPerlHead.IperlHead).ClearData();
|
||||
}
|
||||
}
|
||||
ClearSessionData();
|
||||
|
||||
if (selection == Selection.RestoreBatch)
|
||||
{
|
||||
|
||||
@@ -48,6 +48,10 @@ namespace TBF.BenchControl.Sequences
|
||||
public static Results.BatchResults BatchRslts;
|
||||
|
||||
public static IRegisterReader[] RegisterReaders;
|
||||
|
||||
public static bool IsQ2PreCorrectionCalculated;
|
||||
public static int CalculatedQ2PreCorrectionLR;
|
||||
public static int CalculatedQ2PreCorrectionRL;
|
||||
///
|
||||
static ProcessData()
|
||||
{
|
||||
@@ -56,6 +60,10 @@ namespace TBF.BenchControl.Sequences
|
||||
/// RegisterReader[i] where i = 0..Config.Data.WMsCount-1 may be null and should always be tested
|
||||
///
|
||||
RegisterReaders = new IRegisterReader[Config.Data.WMsCount];
|
||||
|
||||
IsQ2PreCorrectionCalculated = false;
|
||||
CalculatedQ2PreCorrectionLR = 0;
|
||||
CalculatedQ2PreCorrectionRL = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ namespace TBF.BenchControl.Sequences
|
||||
|
||||
public const int FlowSettingTimeoutSec = 300; /// Flow setting timeout = 5 min.
|
||||
public const int StableMassMsrmntTimeoutSec = 300; /// Stable mass measurement timeout = 5 min.
|
||||
public const int CountWhenSendingRdDivCmd = 1; /// Passed to cBrd.ReadDiverterTransitionOp()
|
||||
public const int CountWhenReadingDiv = 3; /// Passed to cBrd.ReadDiverterTransitionOp()
|
||||
|
||||
|
||||
///------------------------------------------------------------
|
||||
|
||||
@@ -93,6 +93,7 @@ namespace TBF.BenchControl
|
||||
Factories.Add(new TestMethods.PMaxTest.TestMethodFactory());
|
||||
Factories.Add(new TestMethods.PulsesTest.Factory());
|
||||
Factories.Add(new TestMethods.PulsesTestManual.Factory());
|
||||
Factories.Add(new TestMethods.Q2CorrectionFromHistory.Factory());
|
||||
Factories.Add(new TestMethods.SensitivityTest.Factory());
|
||||
Factories.Add(new TestMethods.iPerlCommunication.TestMethodFactory()); /// iPerlCommunication
|
||||
Factories.Add(new TestMethods.RoiDetection.RoiDetectionFactory());
|
||||
|
||||
@@ -96,10 +96,6 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
if(benchPath.PressMtrDown != null) readTempPressOps.Add(benchPath.PressMtrDown.ReadPressureOp(ref PressDown));
|
||||
if(benchPath.PressMtrDelta != null) readTempPressOps.Add(benchPath.PressMtrDelta.ReadPressureOp(ref PressDelta));
|
||||
|
||||
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
@@ -495,7 +491,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
//.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
//.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -611,7 +607,7 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -710,11 +706,11 @@ namespace TBF.BenchControl.TestMethods.DiverterTest
|
||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
tstRslt.DiverterStart = outPath.Diverter.SwitchTimeStart.Val;
|
||||
tstRslt.DivStart10 = 0;
|
||||
tstRslt.DivStart50 = 0;
|
||||
tstRslt.DivStart90 = 0;
|
||||
tstRslt.DiverterEnd = switchTimeEnd.Val;
|
||||
tstRslt.DiverterEnd = outPath.Diverter.SwitchTimeEnd.Val;
|
||||
tstRslt.DivEnd90 = 0;
|
||||
tstRslt.DivEnd50 = 0;
|
||||
tstRslt.DivEnd10 = 0;
|
||||
|
||||
+4
-7
@@ -113,9 +113,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
float nextTestVolume = (singleTestParams != null) ? singleTestParams.NextTestVolume
|
||||
: ((compoundTestParams != null) ? compoundTestParams.NextTestVolume
|
||||
: heatMetersTestParams.NextTestVolume);
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
|
||||
//====================================
|
||||
loop:
|
||||
@@ -566,7 +563,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation((repetitionNr == 1) ? scale.ReadMassOp(ref Mass) : null)
|
||||
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
|
||||
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
|
||||
.AddOperation(queryEnd1)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -667,7 +664,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
|
||||
.AddOperation((repetitionNr == 1) ? cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr) : null)
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -760,11 +757,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartFirstRepetWithMassColl
|
||||
/// Calculated master pulses per liter
|
||||
tstRslt.ErrorMaster = Config.Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
tstRslt.DiverterStart = outPath.Diverter.SwitchTimeStart.Val;
|
||||
tstRslt.DivStart10 = 0;
|
||||
tstRslt.DivStart50 = 0;
|
||||
tstRslt.DivStart90 = 0;
|
||||
tstRslt.DiverterEnd = switchTimeEnd.Val;
|
||||
tstRslt.DiverterEnd = outPath.Diverter.SwitchTimeEnd.Val;
|
||||
tstRslt.DivEnd90 = 0;
|
||||
tstRslt.DivEnd50 = 0;
|
||||
tstRslt.DivEnd10 = 0;
|
||||
|
||||
+4
-7
@@ -131,9 +131,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
|
||||
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
|
||||
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
|
||||
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
@@ -672,7 +669,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -771,7 +768,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -865,11 +862,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollComparative
|
||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
tstRslt.DiverterStart = outPath.Diverter.SwitchTimeStart.Val;
|
||||
tstRslt.DivStart10 = 0;
|
||||
tstRslt.DivStart50 = 0;
|
||||
tstRslt.DivStart90 = 0;
|
||||
tstRslt.DiverterEnd = switchTimeEnd.Val;
|
||||
tstRslt.DiverterEnd = outPath.Diverter.SwitchTimeEnd.Val;
|
||||
tstRslt.DivEnd90 = 0;
|
||||
tstRslt.DivEnd50 = 0;
|
||||
tstRslt.DivEnd10 = 0;
|
||||
|
||||
+4
-8
@@ -119,10 +119,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
|
||||
|
||||
Event retVal = Event.Done;
|
||||
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
|
||||
int targetTotalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
int targetMassPulses = (int)(volumeToTank / LtrPerRefPulse + 0.5f);
|
||||
@@ -567,7 +563,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -666,7 +662,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -763,11 +759,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollProlonged
|
||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
tstRslt.DiverterStart = outPath.Diverter.SwitchTimeStart.Val;
|
||||
tstRslt.DivStart10 = 0;
|
||||
tstRslt.DivStart50 = 0;
|
||||
tstRslt.DivStart90 = 0;
|
||||
tstRslt.DiverterEnd = switchTimeEnd.Val;
|
||||
tstRslt.DiverterEnd = outPath.Diverter.SwitchTimeEnd.Val;
|
||||
tstRslt.DivEnd90 = 0;
|
||||
tstRslt.DivEnd50 = 0;
|
||||
tstRslt.DivEnd10 = 0;
|
||||
|
||||
+4
-8
@@ -112,10 +112,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
if(heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
|
||||
if(heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
|
||||
|
||||
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
@@ -557,7 +553,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -658,7 +654,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(scale.ReadMassOp(ref Mass))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.EnterState();
|
||||
@@ -752,11 +748,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartMassCollection
|
||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
tstRslt.DiverterStart = outPath.Diverter.SwitchTimeStart.Val;
|
||||
tstRslt.DivStart10 = 0;
|
||||
tstRslt.DivStart50 = 0;
|
||||
tstRslt.DivStart90 = 0;
|
||||
tstRslt.DiverterEnd = switchTimeEnd.Val;
|
||||
tstRslt.DiverterEnd = outPath.Diverter.SwitchTimeEnd.Val;
|
||||
tstRslt.DivEnd90 = 0;
|
||||
tstRslt.DivEnd50 = 0;
|
||||
tstRslt.DivEnd10 = 0;
|
||||
|
||||
+4
-7
@@ -107,9 +107,6 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold1.ReadTempOp(ref TempRefLo1));
|
||||
if (heatMetersPath != null) readTempPressOps.Add(heatMetersPath.TMeterRefCold2.ReadTempOp(ref TempRefLo2));
|
||||
|
||||
FloatBox switchTimeStart = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
FloatBox switchTimeEnd = new FloatBox(0.001f); /// in seconds, initial value is 1 ms
|
||||
|
||||
LtrPerRefPulse = outPath.FlowMeter.LtrPerPulse;
|
||||
int totalPulses = (int)(test.Volume / LtrPerRefPulse + 0.5f);
|
||||
|
||||
@@ -364,7 +361,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperations(measureOperations)
|
||||
.AddOperation(readRegistersOp)
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeStart, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, true, DiverterStart, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.QueryMeasurementEndOp())
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -444,7 +441,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
State.Create(string.Format("{0}({1}) : Waiting before the water level measurement", test.Method, test.Name))
|
||||
.AddOperation(checkUiOp)
|
||||
.AddOperations(readTempPressOps)
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, 2, 4, switchTimeEnd, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(cBrd.ReadDiverterTransitionOp(outPath.Diverter, CountWhenSendingRdDivCmd, CountWhenReadingDiv, false, DiverterEnd, BatchRslts.Batch.BatchNr, test.Name, repetitionNr))
|
||||
.AddOperation(new Operations.TimerOp(test.TimeStop2Mass))
|
||||
.AddOperation(processDataLoggingOp)
|
||||
.EnterState();
|
||||
@@ -525,11 +522,11 @@ namespace TBF.BenchControl.TestMethods.FlyingStartTankCollection
|
||||
tstRslt.FlowMin = (float)RefFlowStat.Min;
|
||||
tstRslt.FlowMax = (float)RefFlowStat.Max;
|
||||
|
||||
tstRslt.DiverterStart = switchTimeStart.Val;
|
||||
tstRslt.DiverterStart = outPath.Diverter.SwitchTimeStart.Val;
|
||||
tstRslt.DivStart10 = 0;
|
||||
tstRslt.DivStart50 = 0;
|
||||
tstRslt.DivStart90 = 0;
|
||||
tstRslt.DiverterEnd = switchTimeEnd.Val;
|
||||
tstRslt.DiverterEnd = outPath.Diverter.SwitchTimeEnd.Val;
|
||||
tstRslt.DivEnd90 = 0;
|
||||
tstRslt.DivEnd50 = 0;
|
||||
tstRslt.DivEnd10 = 0;
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
public class Component : ComponentBase, GenericDevices.ISimultTestMethod, GenericDevices.ITestMethod
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
|
||||
public override string ToString() { return string.Format("TestMethods.GrabImage({0})", Cfg.ToString(1)); }
|
||||
|
||||
public bool CanTest(MetersKind meters) { return true; }
|
||||
public bool DoTransitions() { return false; }
|
||||
|
||||
readonly FromHistoryCfg cfg;
|
||||
|
||||
public bool SimultWithPrevious { get { return true; } }
|
||||
public bool SimultWithNext { get { return false; } }
|
||||
|
||||
#region Configuration Change Handling
|
||||
|
||||
public static void OnCfgChange(object sender, CfgChangeArgs args)
|
||||
{
|
||||
if (CfgChangeHandler == null) return;
|
||||
try { CfgChangeHandler(sender, args); }
|
||||
catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
|
||||
}
|
||||
|
||||
public static event EventHandler<CfgChangeArgs> CfgChangeHandler;
|
||||
|
||||
public override void StartChangeHandler()
|
||||
{
|
||||
CfgChangeHandler += delegate(object sender, CfgChangeArgs args)
|
||||
{
|
||||
FromHistoryCfg tmpcfg = args.Cfg as FromHistoryCfg;
|
||||
if (tmpcfg != null && tmpcfg.Name.Equals(Name))
|
||||
{
|
||||
if (args.Command == CfgChangeCmd.CfgChange)
|
||||
{
|
||||
cfg.UseLocalDB = tmpcfg.UseLocalDB;
|
||||
cfg.ProcedureName = tmpcfg.ProcedureName;
|
||||
cfg.ProcedureNameAlt1 = tmpcfg.ProcedureNameAlt1;
|
||||
cfg.ProcedureNameAlt2 = tmpcfg.ProcedureNameAlt2;
|
||||
cfg.UseWebService = tmpcfg.UseWebService;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endregion Configuration Change Handling
|
||||
|
||||
|
||||
public Component()
|
||||
{
|
||||
}
|
||||
|
||||
public Component(Generic.IComponentCfg cfg)
|
||||
: base(cfg)
|
||||
{
|
||||
this.cfg = cfg as FromHistoryCfg;
|
||||
StartChangeHandler();
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public IList<Event> Execute(Test test, int repetitionNr, bool isLastRepetition)
|
||||
{
|
||||
return (new FromHistorySeq()).Execute(test, repetitionNr, isLastRepetition, cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
|
||||
|
||||
public void ResetStaticProperties() { Component.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new Component(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new FromHistoryCfg(this, this.GetType().Namespace.Substring(29)); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(FromHistoryCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
public class FromHistoryCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(FromHistoryCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl() { return new FromHistoryCfgCtrl(); }
|
||||
|
||||
|
||||
public bool UseWebService;
|
||||
public bool UseLocalDB;
|
||||
public string ProcedureName;
|
||||
public string ProcedureNameAlt1;
|
||||
public string ProcedureNameAlt2;
|
||||
public bool UseDefaultValues;
|
||||
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
FromHistoryCfg() {}
|
||||
|
||||
public FromHistoryCfg(IComponentFactory factory, string name)
|
||||
: this()
|
||||
{
|
||||
this.Factory = factory;
|
||||
Name = name;
|
||||
ParentName = string.Empty;
|
||||
|
||||
UseWebService = false;
|
||||
UseLocalDB = true;
|
||||
ProcedureName = "iPERL Smart Suez DN15 Q3_2.5 R800";
|
||||
ProcedureNameAlt1 = "iPERL Suez DN15 Q3_2.5 R800";
|
||||
ProcedureNameAlt2 = string.Empty;
|
||||
UseDefaultValues = true;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, UseLocalDB={1}, UseWebService={2}", Name, UseLocalDB, UseWebService);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Config.Entities;
|
||||
using TBF.BenchControl.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
public partial class FromHistoryCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(FromHistoryCfgCtrl));
|
||||
|
||||
private Label classNameLabel;
|
||||
private Label nameLabel;
|
||||
private TextBox nameTextBox;
|
||||
private CheckBox useLocalDBCheckBox;
|
||||
private Label procedureNameLabel;
|
||||
private TextBox procedureNameTextBox;
|
||||
private Label procedureNameAlt1Label;
|
||||
private TextBox procedureNameAlt1TextBox;
|
||||
private Label procedureNameAlt2Label;
|
||||
private TextBox procedureNameAlt2TextBox;
|
||||
private CheckBox useWebServiceCheckBox;
|
||||
private CheckBox useDefaultValuesCheckBox;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
FromHistoryCfg config;
|
||||
public IComponentCfg Config
|
||||
{
|
||||
get { return config as IComponentCfg; }
|
||||
set
|
||||
{
|
||||
config = value as FromHistoryCfg;
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
public FromHistoryCfgCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void GrabImageCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
|
||||
public void Closing()
|
||||
{
|
||||
}
|
||||
|
||||
void Redraw()
|
||||
{
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
useWebServiceCheckBox.Checked = config.UseWebService;
|
||||
useLocalDBCheckBox.Checked = config.UseLocalDB;
|
||||
procedureNameTextBox.Text = config.ProcedureName;
|
||||
procedureNameAlt1TextBox.Text = config.ProcedureNameAlt1;
|
||||
procedureNameAlt2TextBox.Text = config.ProcedureNameAlt2;
|
||||
useDefaultValuesCheckBox.Checked = config.UseDefaultValues;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
useWebServiceCheckBox.Enabled = true;
|
||||
useLocalDBCheckBox.Enabled = true;
|
||||
procedureNameTextBox.Enabled = true;
|
||||
procedureNameAlt1TextBox.Enabled = true;
|
||||
procedureNameAlt2TextBox.Enabled = true;
|
||||
useDefaultValuesCheckBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateCfg()
|
||||
{
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
if (config.Name != nameTextBox.Text)
|
||||
{
|
||||
config.Name = nameTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||
}
|
||||
|
||||
if (config.UseWebService != useWebServiceCheckBox.Checked)
|
||||
{
|
||||
config.UseWebService = useWebServiceCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.UseLocalDB != useLocalDBCheckBox.Checked)
|
||||
{
|
||||
config.UseLocalDB = useLocalDBCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.ProcedureName != procedureNameTextBox.Text)
|
||||
{
|
||||
config.ProcedureName = procedureNameTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.ProcedureNameAlt1 != procedureNameAlt1TextBox.Text)
|
||||
{
|
||||
config.ProcedureNameAlt1 = procedureNameAlt1TextBox.Text;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.ProcedureNameAlt2 != procedureNameAlt2TextBox.Text)
|
||||
{
|
||||
config.ProcedureNameAlt2 = procedureNameAlt2TextBox.Text;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.UseDefaultValues != useDefaultValuesCheckBox.Checked)
|
||||
{
|
||||
config.UseDefaultValues = useDefaultValuesCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
|
||||
{
|
||||
Component.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.procedureNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.procedureNameLabel = new System.Windows.Forms.Label();
|
||||
this.useLocalDBCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.useWebServiceCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.procedureNameAlt1TextBox = new System.Windows.Forms.TextBox();
|
||||
this.procedureNameAlt1Label = new System.Windows.Forms.Label();
|
||||
this.procedureNameAlt2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.procedureNameAlt2Label = new System.Windows.Forms.Label();
|
||||
this.useDefaultValuesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// procedureNameTextBox
|
||||
//
|
||||
this.procedureNameTextBox.Enabled = false;
|
||||
this.procedureNameTextBox.Location = new System.Drawing.Point(190, 124);
|
||||
this.procedureNameTextBox.Name = "procedureNameTextBox";
|
||||
this.procedureNameTextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.procedureNameTextBox.TabIndex = 6;
|
||||
//
|
||||
// procedureNameLabel
|
||||
//
|
||||
this.procedureNameLabel.AutoSize = true;
|
||||
this.procedureNameLabel.Location = new System.Drawing.Point(65, 127);
|
||||
this.procedureNameLabel.Name = "procedureNameLabel";
|
||||
this.procedureNameLabel.Size = new System.Drawing.Size(85, 13);
|
||||
this.procedureNameLabel.TabIndex = 5;
|
||||
this.procedureNameLabel.Text = "Procedure name";
|
||||
//
|
||||
// useLocalDBCheckBox
|
||||
//
|
||||
this.useLocalDBCheckBox.AutoSize = true;
|
||||
this.useLocalDBCheckBox.Enabled = false;
|
||||
this.useLocalDBCheckBox.Location = new System.Drawing.Point(38, 103);
|
||||
this.useLocalDBCheckBox.Name = "useLocalDBCheckBox";
|
||||
this.useLocalDBCheckBox.Size = new System.Drawing.Size(129, 17);
|
||||
this.useLocalDBCheckBox.TabIndex = 4;
|
||||
this.useLocalDBCheckBox.Text = "2. Use local database";
|
||||
this.useLocalDBCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// useWebServiceCheckBox
|
||||
//
|
||||
this.useWebServiceCheckBox.AutoSize = true;
|
||||
this.useWebServiceCheckBox.Enabled = false;
|
||||
this.useWebServiceCheckBox.Location = new System.Drawing.Point(38, 78);
|
||||
this.useWebServiceCheckBox.Name = "useWebServiceCheckBox";
|
||||
this.useWebServiceCheckBox.Size = new System.Drawing.Size(117, 17);
|
||||
this.useWebServiceCheckBox.TabIndex = 3;
|
||||
this.useWebServiceCheckBox.Text = "1. Use web service";
|
||||
this.useWebServiceCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(190, 45);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(132, 48);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
this.nameLabel.Text = "Name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(187, 16);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(89, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComponentName";
|
||||
//
|
||||
// procedureNameAlt1TextBox
|
||||
//
|
||||
this.procedureNameAlt1TextBox.Enabled = false;
|
||||
this.procedureNameAlt1TextBox.Location = new System.Drawing.Point(190, 147);
|
||||
this.procedureNameAlt1TextBox.Name = "procedureNameAlt1TextBox";
|
||||
this.procedureNameAlt1TextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.procedureNameAlt1TextBox.TabIndex = 8;
|
||||
//
|
||||
// procedureNameAlt1Label
|
||||
//
|
||||
this.procedureNameAlt1Label.AutoSize = true;
|
||||
this.procedureNameAlt1Label.Location = new System.Drawing.Point(65, 150);
|
||||
this.procedureNameAlt1Label.Name = "procedureNameAlt1Label";
|
||||
this.procedureNameAlt1Label.Size = new System.Drawing.Size(106, 13);
|
||||
this.procedureNameAlt1Label.TabIndex = 7;
|
||||
this.procedureNameAlt1Label.Text = "Procedure name Alt1";
|
||||
//
|
||||
// procedureNameAlt2TextBox
|
||||
//
|
||||
this.procedureNameAlt2TextBox.Enabled = false;
|
||||
this.procedureNameAlt2TextBox.Location = new System.Drawing.Point(190, 170);
|
||||
this.procedureNameAlt2TextBox.Name = "procedureNameAlt2TextBox";
|
||||
this.procedureNameAlt2TextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.procedureNameAlt2TextBox.TabIndex = 10;
|
||||
//
|
||||
// procedureNameAlt2Label
|
||||
//
|
||||
this.procedureNameAlt2Label.AutoSize = true;
|
||||
this.procedureNameAlt2Label.Location = new System.Drawing.Point(65, 173);
|
||||
this.procedureNameAlt2Label.Name = "procedureNameAlt2Label";
|
||||
this.procedureNameAlt2Label.Size = new System.Drawing.Size(106, 13);
|
||||
this.procedureNameAlt2Label.TabIndex = 9;
|
||||
this.procedureNameAlt2Label.Text = "Procedure name Alt2";
|
||||
//
|
||||
// useDefaultValuesCheckBox
|
||||
//
|
||||
this.useDefaultValuesCheckBox.AutoSize = true;
|
||||
this.useDefaultValuesCheckBox.Enabled = false;
|
||||
this.useDefaultValuesCheckBox.Location = new System.Drawing.Point(38, 202);
|
||||
this.useDefaultValuesCheckBox.Name = "useDefaultValuesCheckBox";
|
||||
this.useDefaultValuesCheckBox.Size = new System.Drawing.Size(126, 17);
|
||||
this.useDefaultValuesCheckBox.TabIndex = 11;
|
||||
this.useDefaultValuesCheckBox.Text = "3. Use default values";
|
||||
this.useDefaultValuesCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FromHistoryCfgCtrl
|
||||
//
|
||||
this.Controls.Add(this.useDefaultValuesCheckBox);
|
||||
this.Controls.Add(this.procedureNameAlt2TextBox);
|
||||
this.Controls.Add(this.procedureNameAlt2Label);
|
||||
this.Controls.Add(this.procedureNameAlt1TextBox);
|
||||
this.Controls.Add(this.procedureNameAlt1Label);
|
||||
this.Controls.Add(this.procedureNameTextBox);
|
||||
this.Controls.Add(this.procedureNameLabel);
|
||||
this.Controls.Add(this.useLocalDBCheckBox);
|
||||
this.Controls.Add(this.useWebServiceCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "FromHistoryCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(400, 250);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,164 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NHibernate;
|
||||
using log4net;
|
||||
using Results.Entities;
|
||||
using TBF.UiBridge;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
public class FromHistorySeq : Sequences.SequenceBase
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(FromHistorySeq));
|
||||
|
||||
|
||||
public IList<Event> Execute(Config.Entities.Test test, int repetitionNr, bool isLastRepetition, FromHistoryCfg cfg)
|
||||
{
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Test));
|
||||
|
||||
bool success = false;
|
||||
|
||||
/// 1. Use a web service if enabled
|
||||
if (cfg.UseWebService)
|
||||
{
|
||||
success = ReadCorrectionsFromWebService(cfg);
|
||||
}
|
||||
|
||||
/// 2. Calculate pre-corrections from a local database if enabled
|
||||
if (!success && cfg.UseLocalDB)
|
||||
{
|
||||
success = ReadCorrectionsFromLocalDB(cfg);
|
||||
}
|
||||
|
||||
/// 3. Use pre-defined values (IperlHead procedure parameters) if enabled
|
||||
if (!success && cfg.UseDefaultValues)
|
||||
{
|
||||
success = true;
|
||||
}
|
||||
|
||||
///
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
|
||||
if (tstRslt != null)
|
||||
{
|
||||
tstRslt.StartTime = DateTime.Now;
|
||||
tstRslt.EndTime = DateTime.Now;
|
||||
tstRslt.TestDone = true;
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
|
||||
if (meterRslt != null)
|
||||
{
|
||||
meterRslt.TestDone = true;
|
||||
meterRslt.Passed = success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Completed));
|
||||
|
||||
return new List<Event> { success ? Event.Done : Event.RecoverableError };
|
||||
}
|
||||
|
||||
|
||||
bool ReadCorrectionsFromWebService(FromHistoryCfg cfg)
|
||||
{
|
||||
/// Invalidate any previous Q2 Pre-Corrections
|
||||
IsQ2PreCorrectionCalculated = false;
|
||||
|
||||
try
|
||||
{
|
||||
return false;
|
||||
|
||||
/// TODO: Use webservice
|
||||
//IsQ2PreCorrectionCalculated = true;
|
||||
//return true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Failed to calculate Q2 corrections: {0}", exc.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ReadCorrectionsFromLocalDB(FromHistoryCfg cfg)
|
||||
{
|
||||
/// Invalidate any previous Q2 Pre-Corrections
|
||||
IsQ2PreCorrectionCalculated = false;
|
||||
|
||||
try
|
||||
{
|
||||
using (ISession session = Results.DB.CreateSession())
|
||||
{
|
||||
Batch btc = null;
|
||||
var batches = session.QueryOver<Batch>(() => btc)
|
||||
.Where(bb => (bb.ProcedureName == cfg.ProcedureName))
|
||||
.List();
|
||||
|
||||
if (!string.IsNullOrEmpty(cfg.ProcedureNameAlt1))
|
||||
{
|
||||
IList<Batch> batches2 = session.QueryOver<Batch>(() => btc)
|
||||
.Where(bb => (bb.ProcedureName == cfg.ProcedureNameAlt1))
|
||||
.List();
|
||||
foreach (var b in batches2) batches.Add(b);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(cfg.ProcedureNameAlt2))
|
||||
{
|
||||
IList<Batch> batches3 = session.QueryOver<Batch>(() => btc)
|
||||
.Where(bb => (bb.ProcedureName == cfg.ProcedureNameAlt2))
|
||||
.List();
|
||||
foreach (var b in batches3) batches.Add(b);
|
||||
}
|
||||
|
||||
int samplesCount = 0;
|
||||
double q2CorrLRsum = 0;
|
||||
double q2CorrRLsum = 0;
|
||||
|
||||
var sortedBatches = batches.OrderByDescending(b => b.EndTime);
|
||||
foreach (var b in sortedBatches)
|
||||
{
|
||||
foreach (var wm in b.WaterMeters)
|
||||
{
|
||||
if ((wm != null) && !wm.Disabled && wm.Passed)
|
||||
{
|
||||
#if IPERL
|
||||
q2CorrLRsum += wm.Q2CorrLR;
|
||||
q2CorrRLsum += wm.Q2CorrRL;
|
||||
#endif
|
||||
samplesCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (samplesCount >= 200) break;
|
||||
}
|
||||
|
||||
if (samplesCount >= 200)
|
||||
{
|
||||
IsQ2PreCorrectionCalculated = true;
|
||||
CalculatedQ2PreCorrectionLR = (int)Math.Round(q2CorrLRsum / samplesCount);
|
||||
CalculatedQ2PreCorrectionRL = (int)Math.Round(q2CorrRLsum / samplesCount);
|
||||
log.WarnFormat("Q2 corrections calculated OK: LR = {0}, RL = {1}", CalculatedQ2PreCorrectionLR, CalculatedQ2PreCorrectionRL);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.ErrorFormat("Not enough samples to calculate Q2 corrections ({0})", samplesCount);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Failed to calculate Q2 corrections: {0}", exc.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
partial class GrabImageCfgCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.loResolutionCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.blackAndWhiteCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.imageNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.imageNameLabel = new System.Windows.Forms.Label();
|
||||
this.imageRotationLabel = new System.Windows.Forms.Label();
|
||||
this.imageRotationComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(149, 69);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(24, 72);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(95, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
this.nameLabel.Text = "Test method name";
|
||||
//
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(146, 43);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// loResolutionCheckBox
|
||||
//
|
||||
this.loResolutionCheckBox.AutoSize = true;
|
||||
this.loResolutionCheckBox.Enabled = false;
|
||||
this.loResolutionCheckBox.Location = new System.Drawing.Point(149, 149);
|
||||
this.loResolutionCheckBox.Name = "loResolutionCheckBox";
|
||||
this.loResolutionCheckBox.Size = new System.Drawing.Size(94, 17);
|
||||
this.loResolutionCheckBox.TabIndex = 6;
|
||||
this.loResolutionCheckBox.Text = "Low resolution";
|
||||
this.loResolutionCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// blackAndWhiteCheckBox
|
||||
//
|
||||
this.blackAndWhiteCheckBox.AutoSize = true;
|
||||
this.blackAndWhiteCheckBox.Enabled = false;
|
||||
this.blackAndWhiteCheckBox.Location = new System.Drawing.Point(149, 126);
|
||||
this.blackAndWhiteCheckBox.Name = "blackAndWhiteCheckBox";
|
||||
this.blackAndWhiteCheckBox.Size = new System.Drawing.Size(93, 17);
|
||||
this.blackAndWhiteCheckBox.TabIndex = 5;
|
||||
this.blackAndWhiteCheckBox.Text = "Black && White";
|
||||
this.blackAndWhiteCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// imageNameTextBox
|
||||
//
|
||||
this.imageNameTextBox.Enabled = false;
|
||||
this.imageNameTextBox.Location = new System.Drawing.Point(149, 95);
|
||||
this.imageNameTextBox.Name = "imageNameTextBox";
|
||||
this.imageNameTextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.imageNameTextBox.TabIndex = 4;
|
||||
//
|
||||
// imageNameLabel
|
||||
//
|
||||
this.imageNameLabel.AutoSize = true;
|
||||
this.imageNameLabel.Location = new System.Drawing.Point(24, 98);
|
||||
this.imageNameLabel.Name = "imageNameLabel";
|
||||
this.imageNameLabel.Size = new System.Drawing.Size(81, 13);
|
||||
this.imageNameLabel.TabIndex = 3;
|
||||
this.imageNameLabel.Text = "Image file name";
|
||||
//
|
||||
// imageRotationLabel
|
||||
//
|
||||
this.imageRotationLabel.AutoSize = true;
|
||||
this.imageRotationLabel.Location = new System.Drawing.Point(24, 175);
|
||||
this.imageRotationLabel.Name = "imageRotationLabel";
|
||||
this.imageRotationLabel.Size = new System.Drawing.Size(103, 13);
|
||||
this.imageRotationLabel.TabIndex = 7;
|
||||
this.imageRotationLabel.Text = "Image rotation (ccw)";
|
||||
//
|
||||
// imageRotationComboBox
|
||||
//
|
||||
this.imageRotationComboBox.Enabled = false;
|
||||
this.imageRotationComboBox.FormattingEnabled = true;
|
||||
this.imageRotationComboBox.Location = new System.Drawing.Point(149, 172);
|
||||
this.imageRotationComboBox.Name = "imageRotationComboBox";
|
||||
this.imageRotationComboBox.Size = new System.Drawing.Size(93, 21);
|
||||
this.imageRotationComboBox.TabIndex = 8;
|
||||
//
|
||||
// GrabImageCfgCtrl
|
||||
//
|
||||
this.Controls.Add(this.imageRotationComboBox);
|
||||
this.Controls.Add(this.imageRotationLabel);
|
||||
this.Controls.Add(this.imageNameTextBox);
|
||||
this.Controls.Add(this.imageNameLabel);
|
||||
this.Controls.Add(this.blackAndWhiteCheckBox);
|
||||
this.Controls.Add(this.loResolutionCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "GrabImageCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(400, 250);
|
||||
this.Load += new System.EventHandler(this.GrabImageCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.CheckBox loResolutionCheckBox;
|
||||
private System.Windows.Forms.CheckBox blackAndWhiteCheckBox;
|
||||
private System.Windows.Forms.TextBox imageNameTextBox;
|
||||
private System.Windows.Forms.Label imageNameLabel;
|
||||
private System.Windows.Forms.Label imageRotationLabel;
|
||||
private System.Windows.Forms.ComboBox imageRotationComboBox;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -1754,17 +1754,15 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
(rdData != null) && (rdData.Length == 2) && (rdData[0] == 0) && (rdData[1] == 0))
|
||||
{
|
||||
error = CommErr.None;
|
||||
resultStr = "Q2 correction factors reset to 0";
|
||||
ihead.Q2CorrectionFactor = 0;
|
||||
resultStr = string.Format("Q2 correction set to LR={0}, RL={1}", factorLR, factorRL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (error == CommErr.None)
|
||||
if (error == CommErr.None)
|
||||
{
|
||||
resultStr = "Q2 corrections reset to 0";
|
||||
ihead.Q2CorrRL = 0;
|
||||
resultStr = string.Format("Q2 correction set to LR={0}, RL={1}", factorLR, factorRL);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1780,7 +1778,15 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
||||
|
||||
if (wm.Pruefindex == 1)
|
||||
{
|
||||
return SetQ2Correction(threadId, ihead, wm, ref resultStr, ihead.InitQ2CorrLR, ihead.InitQ2CorrRL);
|
||||
if (TBF.BenchControl.Sequences.ProcessData.IsQ2PreCorrectionCalculated)
|
||||
{
|
||||
return SetQ2Correction(threadId, ihead, wm, ref resultStr, TBF.BenchControl.Sequences.ProcessData.CalculatedQ2PreCorrectionLR,
|
||||
TBF.BenchControl.Sequences.ProcessData.CalculatedQ2PreCorrectionRL);
|
||||
}
|
||||
else
|
||||
{
|
||||
return SetQ2Correction(threadId, ihead, wm, ref resultStr, ihead.Q2PreCorrectionLR, ihead.Q2PreCorrectionRL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -40,9 +40,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication.iPerlHead
|
||||
public ushort FactorLimitLo { get { return (ushort)iperlHeadCfg.ProcParams.FactorLimitLo; } }
|
||||
public ushort FactorLimitHi { get { return (ushort)iperlHeadCfg.ProcParams.FactorLimitHi; } }
|
||||
public Counting InitFlowDir { get { return (iperlHeadCfg != null && iperlHeadCfg.ProcParams != null) ? iperlHeadCfg.ProcParams.Counting : Counting.Arbitrary; } }
|
||||
public int WMType_ID { get { return iperlHeadCfg.ProcParams.WMType_ID; } } /// Required by Oracle DB
|
||||
public int InitQ2CorrLR { get { return iperlHeadCfg.ProcParams.InitQ2CorrLR; } } /// Used by InitOrReadQ2Corrections activity
|
||||
public int InitQ2CorrRL { get { return iperlHeadCfg.ProcParams.InitQ2CorrRL; } } /// Required by Oracle DB
|
||||
public int WMType_ID { get { return iperlHeadCfg.ProcParams.WMType_ID; } } /// Required by Oracle DB
|
||||
public int Q2PreCorrectionLR { get { return iperlHeadCfg.ProcParams.InitQ2CorrLR; } } /// Used by InitOrReadQ2Corrections activity
|
||||
public int Q2PreCorrectionRL { get { return iperlHeadCfg.ProcParams.InitQ2CorrRL; } } /// Required by Oracle DB
|
||||
|
||||
|
||||
/// Properties set by the Begin and the End form
|
||||
|
||||
+15
-3
@@ -17,6 +17,8 @@ namespace TBF
|
||||
// when 'OK' is pressed.
|
||||
LocalSettings localSettings;
|
||||
|
||||
public bool CurrentDBChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor, initializes the dialog
|
||||
/// </summary>
|
||||
@@ -28,6 +30,7 @@ namespace TBF
|
||||
|
||||
InitializeComponent();
|
||||
RedrawTestBenchesListBox();
|
||||
CurrentDBChanged = false;
|
||||
}
|
||||
|
||||
private void BenchesDlg_Load(object sender, EventArgs e)
|
||||
@@ -61,8 +64,11 @@ namespace TBF
|
||||
private void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Config.DatabaseSettings bench = new Config.DatabaseSettings();
|
||||
Forms.DatabaseSettingsDlg dlg = new Forms.DatabaseSettingsDlg(bench);
|
||||
Forms.DatabaseSettingsDlg dlg = new Forms.DatabaseSettingsDlg(bench,
|
||||
Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString,
|
||||
Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString);
|
||||
DialogResult dr = dlg.ShowDialog();
|
||||
CurrentDBChanged |= dlg.CurrentDBChanged;
|
||||
if (dr == DialogResult.OK)
|
||||
{
|
||||
int nrBenches =
|
||||
@@ -99,8 +105,11 @@ namespace TBF
|
||||
Config.DatabaseSettings ori = localSettings.TestBenches[testBenchesListBox.SelectedIndex];
|
||||
Config.DatabaseSettings bench = (Config.DatabaseSettings)ori.Clone();
|
||||
|
||||
Forms.DatabaseSettingsDlg dlg = new Forms.DatabaseSettingsDlg(bench);
|
||||
Forms.DatabaseSettingsDlg dlg = new Forms.DatabaseSettingsDlg(bench,
|
||||
Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString,
|
||||
Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString);
|
||||
DialogResult dr = dlg.ShowDialog();
|
||||
CurrentDBChanged |= dlg.CurrentDBChanged;
|
||||
if (dr == DialogResult.OK)
|
||||
{
|
||||
int nrBenches =
|
||||
@@ -126,8 +135,11 @@ namespace TBF
|
||||
{
|
||||
if (testBenchesListBox.SelectedIndex >= 0)
|
||||
{
|
||||
Forms.DatabaseSettingsDlg dlg = new Forms.DatabaseSettingsDlg(localSettings.TestBenches[testBenchesListBox.SelectedIndex]);
|
||||
Forms.DatabaseSettingsDlg dlg = new Forms.DatabaseSettingsDlg(localSettings.TestBenches[testBenchesListBox.SelectedIndex],
|
||||
Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString,
|
||||
Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString);
|
||||
DialogResult dr = dlg.ShowDialog();
|
||||
CurrentDBChanged |= dlg.CurrentDBChanged;
|
||||
if (dr == DialogResult.OK)
|
||||
{
|
||||
// Update the item name
|
||||
|
||||
-7
@@ -134,7 +134,6 @@ namespace TBF.Forms
|
||||
// testConnConfigDbBtn
|
||||
//
|
||||
resources.ApplyResources(this.testConnConfigDbBtn, "testConnConfigDbBtn");
|
||||
this.testConnConfigDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.testConnConfigDbBtn.Name = "testConnConfigDbBtn";
|
||||
this.testConnConfigDbBtn.UseVisualStyleBackColor = true;
|
||||
this.testConnConfigDbBtn.Click += new System.EventHandler(this.testConnConfigDbBtn_Click);
|
||||
@@ -142,7 +141,6 @@ namespace TBF.Forms
|
||||
// testConnResultsDbBtn
|
||||
//
|
||||
resources.ApplyResources(this.testConnResultsDbBtn, "testConnResultsDbBtn");
|
||||
this.testConnResultsDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.testConnResultsDbBtn.Name = "testConnResultsDbBtn";
|
||||
this.testConnResultsDbBtn.UseVisualStyleBackColor = true;
|
||||
this.testConnResultsDbBtn.Click += new System.EventHandler(this.testConnResultsDbBtn_Click);
|
||||
@@ -150,7 +148,6 @@ namespace TBF.Forms
|
||||
// createConfigDbBtn
|
||||
//
|
||||
resources.ApplyResources(this.createConfigDbBtn, "createConfigDbBtn");
|
||||
this.createConfigDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.createConfigDbBtn.Name = "createConfigDbBtn";
|
||||
this.createConfigDbBtn.UseVisualStyleBackColor = true;
|
||||
this.createConfigDbBtn.Click += new System.EventHandler(this.createConfigDbBtn_Click);
|
||||
@@ -158,7 +155,6 @@ namespace TBF.Forms
|
||||
// createResultsDbBtn
|
||||
//
|
||||
resources.ApplyResources(this.createResultsDbBtn, "createResultsDbBtn");
|
||||
this.createResultsDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.createResultsDbBtn.Name = "createResultsDbBtn";
|
||||
this.createResultsDbBtn.UseVisualStyleBackColor = true;
|
||||
this.createResultsDbBtn.Click += new System.EventHandler(this.createResultsDbBtn_Click);
|
||||
@@ -166,7 +162,6 @@ namespace TBF.Forms
|
||||
// testConnUsersDbBtn
|
||||
//
|
||||
resources.ApplyResources(this.testConnUsersDbBtn, "testConnUsersDbBtn");
|
||||
this.testConnUsersDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.testConnUsersDbBtn.Name = "testConnUsersDbBtn";
|
||||
this.testConnUsersDbBtn.UseVisualStyleBackColor = true;
|
||||
this.testConnUsersDbBtn.Click += new System.EventHandler(this.testConnUsersDbBtn_Click);
|
||||
@@ -190,7 +185,6 @@ namespace TBF.Forms
|
||||
// importResultsDbBtn
|
||||
//
|
||||
resources.ApplyResources(this.importResultsDbBtn, "importResultsDbBtn");
|
||||
this.importResultsDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.importResultsDbBtn.Name = "importResultsDbBtn";
|
||||
this.importResultsDbBtn.UseVisualStyleBackColor = true;
|
||||
this.importResultsDbBtn.Click += new System.EventHandler(this.importResultsDbBtn_Click);
|
||||
@@ -198,7 +192,6 @@ namespace TBF.Forms
|
||||
// importConfigDbBtn
|
||||
//
|
||||
resources.ApplyResources(this.importConfigDbBtn, "importConfigDbBtn");
|
||||
this.importConfigDbBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.importConfigDbBtn.Name = "importConfigDbBtn";
|
||||
this.importConfigDbBtn.UseVisualStyleBackColor = true;
|
||||
this.importConfigDbBtn.Click += new System.EventHandler(this.importConfigDbBtn_Click);
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
/// Copyright (c) 2013-2019 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
|
||||
@@ -21,13 +20,21 @@ namespace TBF.Forms
|
||||
// Reference to bench DB settins (not a local copy)
|
||||
Config.DatabaseSettings bench;
|
||||
|
||||
string currentConfigDBConnStr; /// Initialized in constructor by the parent
|
||||
string currentResultsDBConnStr; /// Initialized in constructor by the parent
|
||||
public bool CurrentDBChanged; /// Set when a current database is modified (erased or imported)
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="bench">Test bench database settings</param>
|
||||
public DatabaseSettingsDlg(Config.DatabaseSettings bench)
|
||||
public DatabaseSettingsDlg(Config.DatabaseSettings bench, string currentConfigDBConnStr, string currentResultsDBConnStr)
|
||||
{
|
||||
this.bench = bench;
|
||||
this.currentConfigDBConnStr = currentConfigDBConnStr;
|
||||
this.currentResultsDBConnStr = currentResultsDBConnStr;
|
||||
CurrentDBChanged = false;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -161,8 +168,24 @@ namespace TBF.Forms
|
||||
{
|
||||
try
|
||||
{
|
||||
string connectionString = bench.ProceduresDBSettings.ConnectionString;
|
||||
string databaseName = Config.Utils.GetDBName(connectionString);
|
||||
string userName = Config.Utils.GetDBUser(connectionString);
|
||||
string password = Config.Utils.GetDBPassword(connectionString); /// TODO: Use password
|
||||
|
||||
if (connectionString == currentConfigDBConnStr || connectionString == currentResultsDBConnStr)
|
||||
{
|
||||
CurrentDBChanged = true;
|
||||
}
|
||||
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
Config.FluentCommon.CreateEmptyConfigDB(bench.ProceduresDBSettings.DbType, bench.ProceduresDBSettings.ConnectionString);
|
||||
|
||||
log.ErrorFormat("Going to create an empty configuration database '{0}'", databaseName);
|
||||
ExecuteMySqlCmd(string.Format("DROP DATABASE `{0}`;", databaseName), userName);
|
||||
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}`;", databaseName), userName);
|
||||
Config.FluentCommon.CreateEmptyConfigDB(bench.ProceduresDBSettings.DbType, connectionString);
|
||||
log.ErrorFormat("An empty configuration database '{0}' was created", databaseName);
|
||||
|
||||
MessageBox.Show(Strings.DB_was_successfully_created, Strings.Notification);
|
||||
Cursor.Current = Cursors.Default;
|
||||
DialogResult = DialogResult.None;
|
||||
@@ -186,10 +209,26 @@ namespace TBF.Forms
|
||||
{
|
||||
try
|
||||
{
|
||||
string connectionString = bench.WaterMetersDBSettings.ConnectionString;
|
||||
string databaseName = Config.Utils.GetDBName(connectionString);
|
||||
string userName = Config.Utils.GetDBUser(connectionString);
|
||||
string password = Config.Utils.GetDBPassword(connectionString); /// TODO: Use password
|
||||
|
||||
if (connectionString == currentConfigDBConnStr || connectionString == currentResultsDBConnStr)
|
||||
{
|
||||
CurrentDBChanged = true;
|
||||
}
|
||||
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
|
||||
log.ErrorFormat("Going to create an empty results database '{0}'", databaseName);
|
||||
ExecuteMySqlCmd(string.Format("DROP DATABASE `{0}`;", databaseName), userName);
|
||||
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}`;", databaseName), userName);
|
||||
Results.DB.DbType = bench.WaterMetersDBSettings.DbType;
|
||||
Results.DB.ConnectionString = bench.WaterMetersDBSettings.ConnectionString;
|
||||
Results.DB.ConnectionString = connectionString;
|
||||
Results.DB.CreateEmptyDB();
|
||||
log.ErrorFormat("An empty results database '{0}' was created", databaseName);
|
||||
|
||||
MessageBox.Show(Strings.DB_was_successfully_created, Strings.Notification);
|
||||
Cursor.Current = Cursors.Default;
|
||||
DialogResult = DialogResult.None;
|
||||
@@ -207,61 +246,37 @@ namespace TBF.Forms
|
||||
}
|
||||
}
|
||||
|
||||
//private void createUsersDbBtn_Click(object sender, EventArgs e)
|
||||
//{
|
||||
// /// Update database connection strings
|
||||
// if (!UpdateBenchFromUIControls()) return;
|
||||
|
||||
// if (DialogResult.OK == MessageBox.Show(Strings.DB_will_be_overwritten + Environment.NewLine +
|
||||
// Strings.Do_you_want_to_proceed, Strings.Warning,
|
||||
// MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation))
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// Cursor.Current = Cursors.WaitCursor;
|
||||
// Users.DB.DbType = bench.UsersDBSettings.DbType;
|
||||
// Users.DB.ConnectionString = bench.UsersDBSettings.ConnectionString;
|
||||
// Users.DB.CreateEmptyDB();
|
||||
// MessageBox.Show(Strings.DB_was_successfully_created, Strings.Notification);
|
||||
// Cursor.Current = Cursors.Default;
|
||||
// DialogResult = DialogResult.None;
|
||||
// }
|
||||
// catch (Exception exception)
|
||||
// {
|
||||
// Cursor.Current = Cursors.Default;
|
||||
// string msg = Strings.Error_while_creating_DB_Reason + Environment.NewLine + exception.Message;
|
||||
// if (exception.InnerException != null)
|
||||
// {
|
||||
// msg += Environment.NewLine + exception.InnerException.Message;
|
||||
// }
|
||||
// MessageBox.Show(msg, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Configuration database import (UI)
|
||||
/// </summary>
|
||||
private void importConfigDbBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
/// Update database connection strings
|
||||
/// Update database connection strings from UI
|
||||
if (!UpdateBenchFromUIControls()) return;
|
||||
|
||||
if (MessageBox.Show(Strings.Do_you_want_to_restore_configuration_qm,
|
||||
string.Empty,
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
dlg.InitialDirectory = string.Format(@"C:\TBF\DbBackups\");
|
||||
if (dlg.ShowDialog() != DialogResult.OK) return;
|
||||
string connectionString = bench.ProceduresDBSettings.ConnectionString;
|
||||
|
||||
DBImportMessageStart("Importing database with configuration");
|
||||
ImportDatabase(Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString, dlg.FileName);
|
||||
DBImportMessageEnd();
|
||||
string server = Config.Utils.GetDBServer(connectionString);
|
||||
if ((server != "localhost") && (server != "127.0.0.1"))
|
||||
{
|
||||
MessageBox.Show(Strings.Remote_database_cannot_be_imported, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
dlg.InitialDirectory = string.Format(@"C:\TBF\DbBackups\");
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (MessageBox.Show(string.Format(Strings.Do_you_want_to_restore_configuration_DB_from_file_0_qm, dlg.FileName),
|
||||
string.Empty,
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
DBImportMessageStart("Importing database with configuration");
|
||||
ImportDatabase(connectionString, dlg.FileName);
|
||||
DBImportMessageEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -269,21 +284,31 @@ namespace TBF.Forms
|
||||
/// </summary>
|
||||
private void importResultsDbBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
/// Update database connection strings
|
||||
/// Update database connection strings from UI
|
||||
if (!UpdateBenchFromUIControls()) return;
|
||||
|
||||
if (MessageBox.Show(Strings.Do_you_want_to_restore_results_qm,
|
||||
string.Empty,
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
dlg.InitialDirectory = string.Format(@"C:\TBF\DbBackups\");
|
||||
if (dlg.ShowDialog() != DialogResult.OK) return;
|
||||
string connectionString = bench.WaterMetersDBSettings.ConnectionString;
|
||||
|
||||
DBImportMessageStart("Importing database with results");
|
||||
ImportDatabase(Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString, dlg.FileName);
|
||||
DBImportMessageEnd();
|
||||
string server = Config.Utils.GetDBServer(connectionString);
|
||||
if ((server != "localhost") && (server != "127.0.0.1"))
|
||||
{
|
||||
MessageBox.Show(Strings.Remote_database_cannot_be_imported, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
dlg.InitialDirectory = string.Format(@"C:\TBF\DbBackups\");
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (MessageBox.Show(string.Format(Strings.Do_you_want_to_restore_results_DB_from_file_0_qm, dlg.FileName),
|
||||
string.Empty,
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
DBImportMessageStart("Importing database with results");
|
||||
ImportDatabase(connectionString, dlg.FileName);
|
||||
DBImportMessageEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,31 +357,65 @@ namespace TBF.Forms
|
||||
|
||||
try
|
||||
{
|
||||
Process proc = new Process();
|
||||
proc.StartInfo.FileName = @"C:\xampp\mysql\bin\mysql.exe";
|
||||
proc.StartInfo.Arguments = string.Format("--user={0} --default-character-set=utf8 --database={2}", userName, password, databaseName);
|
||||
proc.StartInfo.UseShellExecute = false; /// Must be false to redirect standard input or standard output
|
||||
proc.StartInfo.RedirectStandardOutput = false;
|
||||
proc.StartInfo.RedirectStandardInput = true;
|
||||
proc.StartInfo.CreateNoWindow = false;
|
||||
//proc.StartInfo.Verb = "runas"; /// To run mysql.exe as administrator
|
||||
Debug.WriteLine("Ideme na to.");
|
||||
proc.Start();
|
||||
if (connectionString == currentConfigDBConnStr || connectionString == currentResultsDBConnStr)
|
||||
{
|
||||
CurrentDBChanged = true;
|
||||
}
|
||||
|
||||
string command = string.Format("SOURCE {0}{1}", inputFileName, Environment.NewLine);
|
||||
proc.StandardInput.Write(command);
|
||||
Debug.Write(command);
|
||||
|
||||
proc.StandardInput.Write(string.Format("exit{0}", Environment.NewLine));
|
||||
Debug.WriteLine("exit");
|
||||
|
||||
proc.WaitForExit();
|
||||
log.ErrorFormat("Database {0} imported from file {1}", databaseName, inputFileName);
|
||||
log.ErrorFormat("Going to import database '{0}' from file {1}", databaseName, inputFileName);
|
||||
ExecuteMySqlCmd(string.Format("DROP DATABASE `{0}`;", databaseName), userName);
|
||||
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}`;", databaseName), userName);
|
||||
ExecuteMySqlCmd(string.Format("SOURCE {0}", inputFileName), userName, databaseName);
|
||||
log.ErrorFormat("Database {0} was imported from file {1}", databaseName, inputFileName);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.FatalFormat("Failed to import database {0} from file {1}: {2}", databaseName, inputFileName, exc.Message);
|
||||
log.FatalFormat("Failed to import database '{0}' from file {1}: {2}", databaseName, inputFileName, exc.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Execute a MySQL command line command without specifying a database
|
||||
/// </summary>
|
||||
/// <param name="command">MySQL command</param>
|
||||
/// <param name="userName">User name</param>
|
||||
void ExecuteMySqlCmd(string command, string userName)
|
||||
{
|
||||
ExecuteMySqlCmd(command, userName, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute a MySQL command line command, specify database to be used
|
||||
/// </summary>
|
||||
/// <param name="command">MySQL command</param>
|
||||
/// <param name="userName">User name</param>
|
||||
/// <param name="databaseToBeUsed">Database name</param>
|
||||
void ExecuteMySqlCmd(string command, string userName, string databaseToBeUsed)
|
||||
{
|
||||
Process proc = new Process();
|
||||
|
||||
proc.StartInfo.FileName = @"C:\xampp\mysql\bin\mysql.exe";
|
||||
if (string.IsNullOrEmpty(databaseToBeUsed))
|
||||
{
|
||||
proc.StartInfo.Arguments = string.Format("--user={0} --default-character-set=utf8", userName);
|
||||
}
|
||||
else
|
||||
{
|
||||
proc.StartInfo.Arguments = string.Format("--user={0} --database={1} --default-character-set=utf8", userName, databaseToBeUsed);
|
||||
}
|
||||
proc.StartInfo.UseShellExecute = false; /// Must be false to redirect standard input or standard output
|
||||
proc.StartInfo.RedirectStandardOutput = false;
|
||||
proc.StartInfo.RedirectStandardInput = true;
|
||||
proc.StartInfo.CreateNoWindow = false;
|
||||
//proc.StartInfo.Verb = "runas"; /// To run mysql.exe as administrator
|
||||
|
||||
proc.Start();
|
||||
proc.StandardInput.WriteLine(command);
|
||||
Debug.WriteLine(command);
|
||||
log.Warn(command);
|
||||
proc.StandardInput.WriteLine("exit");
|
||||
proc.WaitForExit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,43 +235,62 @@ namespace TBF.Forms
|
||||
|
||||
public void DoShowResults(object sender, PreviousResultIdEventArgs data)
|
||||
{
|
||||
Results.Forms.BatchResultsDlg dlg = new Results.Forms.BatchResultsDlg();
|
||||
dlg.PopupResultsLeft = Program.LocalSettings.PopupResultsLeft;
|
||||
dlg.PopupResultsTop = Program.LocalSettings.PopupResultsTop;
|
||||
dlg.PopupResultsWidth = Program.LocalSettings.PopupResultsWidth;
|
||||
dlg.PopupResultsHeight = Program.LocalSettings.PopupResultsHeight;
|
||||
|
||||
dlg.MetersArrangement = Program.LocalSettings.ResultsConfigMeters;
|
||||
dlg.TestsArrangement = Program.LocalSettings.ResultsConfigTests;
|
||||
dlg.NrMetersInOneGroup = Math.Max(1, Program.LocalSettings.ResultsConfigMetersInOneGroup);
|
||||
|
||||
dlg.RsltItems_Screen_SingleWM = Results.WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_SingleWM);
|
||||
dlg.RsltItems_Screen_CombinedWM = Results.WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_CombinedWM);
|
||||
dlg.RsltItems_Screen_HeatM = Results.WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_HeatM);
|
||||
dlg.RsltsClmnWidths = Program.LocalSettings.RsltsClmnWidths;
|
||||
|
||||
foreach (var b in batches)
|
||||
{
|
||||
if (b.BatchNr == data.BatchNr)
|
||||
{
|
||||
dlg.Results = Results.BatchResults.FromBatch(b);
|
||||
dlg.Text = string.Format(Strings.Results_of_batch_0, b.BatchNr);
|
||||
if (b.WaterMeters == null || b.WaterMeters.Count == 0)
|
||||
{
|
||||
return; /// No water meters in the selected batch
|
||||
}
|
||||
|
||||
/// Prepare result items
|
||||
IList<Results.WMeterRsltItemSpec> items = null;
|
||||
foreach (var wm in b.WaterMeters)
|
||||
{
|
||||
if (wm != null)
|
||||
{
|
||||
if (wm.WaterMeterData.Compound)
|
||||
{
|
||||
items = Results.WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_CombinedWM);
|
||||
}
|
||||
else if (wm.WaterMeterData.HeatMeter)
|
||||
{
|
||||
items = Results.WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_HeatM);
|
||||
}
|
||||
else
|
||||
{
|
||||
items = Results.WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_SingleWM);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (items == null) items = new List<Results.WMeterRsltItemSpec>();
|
||||
|
||||
/// Show dialog with results
|
||||
Results.Forms.BatchResultsDlg dlg = new Results.Forms.BatchResultsDlg
|
||||
{
|
||||
Text = string.Format(Strings.Results_of_batch_0, b.BatchNr),
|
||||
Results = Results.BatchResults.FromBatch(b),
|
||||
Items = items,
|
||||
PopupResultsLeft = Program.LocalSettings.PopupResultsLeft,
|
||||
PopupResultsTop = Program.LocalSettings.PopupResultsTop,
|
||||
PopupResultsWidth = Program.LocalSettings.PopupResultsWidth,
|
||||
PopupResultsHeight = Program.LocalSettings.PopupResultsHeight,
|
||||
MetersArrangement = Program.LocalSettings.ResultsConfigMeters,
|
||||
TestsArrangement = Program.LocalSettings.ResultsConfigTests,
|
||||
NrMetersInOneGroup = Math.Max(1, Program.LocalSettings.ResultsConfigMetersInOneGroup),
|
||||
ShowDisabledPositions = Program.LocalSettings.ShowDisabledPositions,
|
||||
MinWidth = Program.LocalSettings.ResultsConfigMinWidth,
|
||||
MinHeight = Program.LocalSettings.ResultsConfigMinHeight,
|
||||
RsltsClmnWidths = Program.LocalSettings.RsltsClmnWidths,
|
||||
};
|
||||
|
||||
dlg.Show();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//if (dlg.PopupResultsLeft != Program.LocalSettings.PopupResultsLeft ||
|
||||
// dlg.PopupResultsTop != Program.LocalSettings.PopupResultsTop ||
|
||||
// dlg.PopupResultsWidth != Program.LocalSettings.PopupResultsWidth ||
|
||||
// dlg.PopupResultsHeight != Program.LocalSettings.PopupResultsHeight)
|
||||
//{
|
||||
// Program.LocalSettings.PopupResultsLeft = dlg.PopupResultsLeft;
|
||||
// Program.LocalSettings.PopupResultsTop = dlg.PopupResultsTop;
|
||||
// Program.LocalSettings.PopupResultsWidth = dlg.PopupResultsWidth;
|
||||
// Program.LocalSettings.PopupResultsHeight = dlg.PopupResultsHeight;
|
||||
// Program.LocalSettings.Save();
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+14
@@ -35,6 +35,7 @@ namespace TBF.Forms
|
||||
this.testsColumnsRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.testsArangementGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.metersArangementGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.showDisabledCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.minHeightTextBox = new System.Windows.Forms.TextBox();
|
||||
this.minHeightLabel = new System.Windows.Forms.Label();
|
||||
this.minWidthTextBox = new System.Windows.Forms.TextBox();
|
||||
@@ -88,6 +89,7 @@ namespace TBF.Forms
|
||||
//
|
||||
// metersArangementGroupBox
|
||||
//
|
||||
this.metersArangementGroupBox.Controls.Add(this.showDisabledCheckBox);
|
||||
this.metersArangementGroupBox.Controls.Add(this.minHeightTextBox);
|
||||
this.metersArangementGroupBox.Controls.Add(this.minHeightLabel);
|
||||
this.metersArangementGroupBox.Controls.Add(this.minWidthTextBox);
|
||||
@@ -103,6 +105,17 @@ namespace TBF.Forms
|
||||
this.metersArangementGroupBox.TabStop = false;
|
||||
this.metersArangementGroupBox.Text = "Arangement of tested meters";
|
||||
//
|
||||
// showDisabledCheckBox
|
||||
//
|
||||
this.showDisabledCheckBox.AutoSize = true;
|
||||
this.showDisabledCheckBox.Enabled = false;
|
||||
this.showDisabledCheckBox.Location = new System.Drawing.Point(200, 44);
|
||||
this.showDisabledCheckBox.Name = "showDisabledCheckBox";
|
||||
this.showDisabledCheckBox.Size = new System.Drawing.Size(139, 17);
|
||||
this.showDisabledCheckBox.TabIndex = 10;
|
||||
this.showDisabledCheckBox.Text = "Show disabled positions";
|
||||
this.showDisabledCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// minHeightTextBox
|
||||
//
|
||||
this.minHeightTextBox.Enabled = false;
|
||||
@@ -263,5 +276,6 @@ namespace TBF.Forms
|
||||
private System.Windows.Forms.Label minHeightLabel;
|
||||
private System.Windows.Forms.TextBox minWidthTextBox;
|
||||
private System.Windows.Forms.Label minWidthLabel;
|
||||
private System.Windows.Forms.CheckBox showDisabledCheckBox;
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ namespace TBF.Forms
|
||||
public TestsArrangement TestsArrangement;
|
||||
public MetersArrangement MetersArrangement;
|
||||
public int NrMetersInOneGroup;
|
||||
public bool ShowDisabledPositions;
|
||||
public int MinWidth;
|
||||
public int MinHeight;
|
||||
|
||||
@@ -62,6 +63,7 @@ namespace TBF.Forms
|
||||
horizontallyRadioButton.Text = Strings.Horizontally;
|
||||
verticallyRadioButton.Text = Strings.Vertically;
|
||||
nrMetersLabel.Text = string.Format("{0}:", Strings.Nr_meters_in_a_group);
|
||||
showDisabledCheckBox.Text = Strings.Show_disabled_positions;
|
||||
minWidthLabel.Text = string.Format("{0}:", Strings.Min_width);
|
||||
minHeightLabel.Text = string.Format("{0}:", Strings.Min_height);
|
||||
unlockButton.Text = Strings.UnlockBtnText;
|
||||
@@ -79,6 +81,7 @@ namespace TBF.Forms
|
||||
horizontallyRadioButton.Checked = (MetersArrangement == MetersArrangement.Horizontally);
|
||||
verticallyRadioButton.Checked = (MetersArrangement == MetersArrangement.Vertically);
|
||||
nrMetersTextBox.Text = NrMetersInOneGroup.ToString();
|
||||
showDisabledCheckBox.Checked = ShowDisabledPositions;
|
||||
minWidthTextBox.Text = MinWidth.ToString();
|
||||
minHeightTextBox.Text = MinHeight.ToString();
|
||||
}
|
||||
@@ -113,6 +116,7 @@ namespace TBF.Forms
|
||||
verticallyRadioButton.Enabled = true;
|
||||
horizontallyRadioButton.Enabled = true;
|
||||
nrMetersTextBox.Enabled = true;
|
||||
showDisabledCheckBox.Enabled = true;
|
||||
minWidthTextBox.Enabled = true;
|
||||
minHeightTextBox.Enabled = true;
|
||||
resultsConfigCtrl.Unlocked = true;
|
||||
@@ -121,11 +125,9 @@ namespace TBF.Forms
|
||||
|
||||
void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (testsColumnsRadioButton.Checked) TestsArrangement = TestsArrangement.Columns;
|
||||
else TestsArrangement = TestsArrangement.Rows;
|
||||
|
||||
if (horizontallyRadioButton.Checked) MetersArrangement = MetersArrangement.Horizontally;
|
||||
else MetersArrangement = MetersArrangement.Vertically;
|
||||
TestsArrangement = testsColumnsRadioButton.Checked ? TestsArrangement.Columns : TestsArrangement.Rows;
|
||||
MetersArrangement = horizontallyRadioButton.Checked ? MetersArrangement.Horizontally : MetersArrangement.Vertically;
|
||||
ShowDisabledPositions = showDisabledCheckBox.Checked;
|
||||
|
||||
int tmpInt;
|
||||
if (int.TryParse(nrMetersTextBox.Text, out tmpInt) && tmpInt > 0) { NrMetersInOneGroup = tmpInt; }
|
||||
|
||||
@@ -240,6 +240,7 @@ namespace TBF
|
||||
public Config.Entities.MetersArrangement ResultsConfigMeters;
|
||||
public Config.Entities.TestsArrangement ResultsConfigTests;
|
||||
public int ResultsConfigMetersInOneGroup;
|
||||
public bool ShowDisabledPositions;
|
||||
public int ResultsConfigMinWidth;
|
||||
public int ResultsConfigMinHeight;
|
||||
public string[] RsltItems_Screen_SingleWM;
|
||||
@@ -359,11 +360,11 @@ namespace TBF
|
||||
|
||||
try
|
||||
{
|
||||
#if PUCHONG_200
|
||||
#if false
|
||||
/// Write settings to an unencrypted file
|
||||
using (TextWriter writer = new StreamWriter(Program.LocalSettingsFileName))
|
||||
{
|
||||
serializer.Serialize(writer, this);
|
||||
serializer.Serialize(writer, this);
|
||||
log.Warn("LocalSettings succesfully saved");
|
||||
}
|
||||
#else
|
||||
|
||||
Generated
+2
-2
@@ -54,9 +54,9 @@ namespace TBF
|
||||
this.horizontalSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.mainTabControl = new System.Windows.Forms.TabControl();
|
||||
this.homeTabPage = new System.Windows.Forms.TabPage();
|
||||
this.ctrlBrdComponent = new ControlComponent_Torino2015.UserControl1();
|
||||
this.ctrlBrdComponent = new ControlComponent_Torino2015.UserControl1();
|
||||
this.processTabPage = new System.Windows.Forms.TabPage();
|
||||
this.processTabPageCtrl = new TBF.Screens.ProcessTabPageCtrl24();
|
||||
this.processTabPageCtrl = new TBF.Screens.ProcessTabPageCtrl24();
|
||||
this.insertTabPage = new System.Windows.Forms.TabPage();
|
||||
this.resultsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.resultsTabPageCtrl = new TBF.Screens.ResultsTabPageCtrl();
|
||||
|
||||
+36
-2
@@ -494,7 +494,28 @@ namespace TBF
|
||||
private void benchMetrologyTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new MetrologyDlg().ShowDialog(); Cursor = Cursors.Default; }
|
||||
private void proceduresTSMItem_Click(object s, EventArgs e) { Cursor = Cursors.WaitCursor; new ProceduresDlg().ShowDialog(); Cursor = Cursors.Default; }
|
||||
private void localSettingsTSMItem_Click(object s, EventArgs e) { new PreferencesDlg().ShowDialog(); }
|
||||
private void databaseSettingsTSMItem_Click(object s, EventArgs e) { new BenchesDlg().ShowDialog(); }
|
||||
private void aboutTSMItem_Click(object s, EventArgs e) { new Forms.AboutDlg().ShowDialog(); }
|
||||
|
||||
private void databaseSettingsTSMItem_Click(object s, EventArgs e)
|
||||
{
|
||||
BenchesDlg dlg = new BenchesDlg();
|
||||
dlg.ShowDialog();
|
||||
if (dlg.CurrentDBChanged)
|
||||
{
|
||||
MessageBox.Show(Strings.Currently_used_database_was_restored + Environment.NewLine + Strings.Program_must_be_closed,
|
||||
string.Empty,
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
|
||||
if (TryShutdownTBF())
|
||||
{
|
||||
/// Save settings and exit TBF
|
||||
UI2Settings();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void usersTSMItem_Click(object s, EventArgs e)
|
||||
{
|
||||
Users.DB.ConnectionString = Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString;
|
||||
@@ -510,7 +531,6 @@ namespace TBF
|
||||
#endif
|
||||
dlg.ShowDialog();
|
||||
}
|
||||
private void aboutTSMItem_Click(object s, EventArgs e) { new Forms.AboutDlg().ShowDialog(); }
|
||||
|
||||
/// <summary>
|
||||
/// Read the database and re-initialize procedureComboBox items.
|
||||
@@ -840,6 +860,13 @@ namespace TBF
|
||||
{
|
||||
string connectionString = Config.Data.CurrentBench.ProceduresDBSettings.ConnectionString;
|
||||
|
||||
string server = Config.Utils.GetDBServer(connectionString);
|
||||
if ((server != "localhost") && (server != "127.0.0.1"))
|
||||
{
|
||||
MessageBox.Show(Strings.Remote_database_cannot_be_exported, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show(Strings.Do_you_want_to_back_up_configuration_qm,
|
||||
string.Empty,
|
||||
MessageBoxButtons.YesNo,
|
||||
@@ -865,6 +892,13 @@ namespace TBF
|
||||
{
|
||||
string connectionString = Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString;
|
||||
|
||||
string server = Config.Utils.GetDBServer(connectionString);
|
||||
if ((server != "localhost") && (server != "127.0.0.1"))
|
||||
{
|
||||
MessageBox.Show(Strings.Remote_database_cannot_be_exported, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show(Strings.Do_you_want_to_back_up_results_qm,
|
||||
string.Empty,
|
||||
MessageBoxButtons.YesNo,
|
||||
|
||||
+63
-20
@@ -147,33 +147,73 @@
|
||||
<data name="measurementTabPage.Text" xml:space="preserve">
|
||||
<value>Pomiar</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="userInfoStatusLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>108, 17</value>
|
||||
</data>
|
||||
<data name="userInfoStatusLabel.Text" xml:space="preserve">
|
||||
<value>Użytkownik: admin</value>
|
||||
</data>
|
||||
<data name="activityStatusLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>154, 17</value>
|
||||
</data>
|
||||
<data name="activityStatusLabel.Text" xml:space="preserve">
|
||||
<value>Proszę rozpocząć procedurę</value>
|
||||
</data>
|
||||
<data name="statusStrip1.Text" xml:space="preserve">
|
||||
<value>Pasek stanu 1</value>
|
||||
</data>
|
||||
<data name="benchTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Badanie</value>
|
||||
<data name="benchComponentsTSMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>132, 22</value>
|
||||
</data>
|
||||
<data name="benchComponentsTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Elementy</value>
|
||||
</data>
|
||||
<data name="benchPathsTSMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>132, 22</value>
|
||||
</data>
|
||||
<data name="benchPathsTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Ścieżki</value>
|
||||
</data>
|
||||
<data name="benchTransitionsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>132, 22</value>
|
||||
</data>
|
||||
<data name="benchTransitionsToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Przejścia</value>
|
||||
</data>
|
||||
<data name="benchMetrologyTSMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>132, 22</value>
|
||||
</data>
|
||||
<data name="benchMetrologyTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Metrologia</value>
|
||||
</data>
|
||||
<data name="toolStripSeparator1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>129, 6</value>
|
||||
</data>
|
||||
<data name="exitToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>132, 22</value>
|
||||
</data>
|
||||
<data name="exitToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Wyjście</value>
|
||||
</data>
|
||||
<data name="benchTSMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>61, 20</value>
|
||||
</data>
|
||||
<data name="benchTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Badanie</value>
|
||||
</data>
|
||||
<data name="homeTSMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>59, 20</value>
|
||||
</data>
|
||||
<data name="homeTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Główna</value>
|
||||
</data>
|
||||
<data name="resultsTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Wyniki</value>
|
||||
</data>
|
||||
<data name="logsTSMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>42, 20</value>
|
||||
</data>
|
||||
<data name="logsTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Logi</value>
|
||||
</data>
|
||||
@@ -192,43 +232,46 @@
|
||||
<data name="upgradeTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Aktualizacja</value>
|
||||
</data>
|
||||
<data name="editTSMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>79, 20</value>
|
||||
</data>
|
||||
<data name="editTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Ustawienia </value>
|
||||
</data>
|
||||
<data name="helpTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Pomoc</value>
|
||||
<data name="aboutTSMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>83, 22</value>
|
||||
</data>
|
||||
<data name="aboutTSMenuItem.Text" xml:space="preserve">
|
||||
<value>O</value>
|
||||
</data>
|
||||
<data name="helpTSMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>57, 20</value>
|
||||
</data>
|
||||
<data name="helpTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Pomoc</value>
|
||||
</data>
|
||||
<data name="proceduresToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>86, 20</value>
|
||||
</data>
|
||||
<data name="proceduresToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Procedury</value>
|
||||
<value>Wodomierzy</value>
|
||||
</data>
|
||||
<data name="processToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>70, 20</value>
|
||||
</data>
|
||||
<data name="processToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Czynność</value>
|
||||
</data>
|
||||
<data name="resultsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>55, 20</value>
|
||||
</data>
|
||||
<data name="resultsToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Wyniki</value>
|
||||
</data>
|
||||
<data name="printToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Drukuj</value>
|
||||
</data>
|
||||
<data name="mainMenuStrip.Text" xml:space="preserve">
|
||||
<value>Nagłówek głównego menu</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>Framework stanowiska pomiarowego</value>
|
||||
</data>
|
||||
<data name="activityStatusLabel.Text" xml:space="preserve">
|
||||
<value>Proszę rozpocząć procedurę</value>
|
||||
</data>
|
||||
<data name="measurementTSMenuItem.Text" xml:space="preserve">
|
||||
<value>Pomiar</value>
|
||||
</data>
|
||||
<data name="picturesTSMItem.Text" xml:space="preserve">
|
||||
<value>Obrazy</value>
|
||||
</data>
|
||||
<data name="userInfoStatusLabel.Text" xml:space="preserve">
|
||||
<value>Użytkownik: admin</value>
|
||||
</data>
|
||||
</root>
|
||||
+361
-358
File diff suppressed because it is too large
Load Diff
+5
-1
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -26,7 +26,11 @@ namespace TBF
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
#if KEMPNO_50
|
||||
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.MetrologicalAuthority };
|
||||
#else
|
||||
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.Metrologists };
|
||||
#endif
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove;
|
||||
sharedButtons.Unlocked += unlockButton_Click;
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
|
||||
+11
-3
@@ -65,8 +65,12 @@ namespace TBF
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
#if KEMPNO_50
|
||||
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.WaterMeterAuthority };
|
||||
#else
|
||||
sharedButtons.RequiredGroupMembership = new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists };
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
|
||||
#endif
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
|
||||
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down;
|
||||
sharedButtons.Unlocked += Unlocked;
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
@@ -105,10 +109,14 @@ namespace TBF
|
||||
this.usedNames = usedNames;
|
||||
this.openUnlocked = openUnlocked;
|
||||
|
||||
#if KEMPNO_50
|
||||
sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.WaterMeterAuthority }
|
||||
: new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.WaterMeterAuthority };
|
||||
#else
|
||||
sharedButtons.RequiredGroupMembership = procedure.Protected ? new Users.Grp.GID[] { Users.Grp.GID.Metrologists }
|
||||
: new Users.Grp.GID[] { Users.Grp.GID.TestingSpecialists, Users.Grp.GID.Metrologists };
|
||||
|
||||
/// Prepare a list of components and a list of all valves in the test bench
|
||||
#endif
|
||||
/// Prepare a list of components and a list of all valves in the test bench
|
||||
using (NHibernate.ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config))
|
||||
{
|
||||
TbfComponents = BenchControl.TbfComponents.LoadComponentsFromDB(session);
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.18.1285.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1285.0")]
|
||||
[assembly: AssemblyVersion("2.20.1305.0")]
|
||||
[assembly: AssemblyFileVersion("2.20.1305.0")]
|
||||
|
||||
Generated
+69
-6
@@ -1023,6 +1023,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to A currently used database was restored..
|
||||
/// </summary>
|
||||
internal static string Currently_used_database_was_restored {
|
||||
get {
|
||||
return ResourceManager.GetString("Currently_used_database_was_restored", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Data.
|
||||
/// </summary>
|
||||
@@ -1203,6 +1212,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Do you really want to abort this session?.
|
||||
/// </summary>
|
||||
internal static string Do_you_really_want_to_abort_this_session {
|
||||
get {
|
||||
return ResourceManager.GetString("Do_you_really_want_to_abort_this_session", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Do you really want to delete sequence '{0}' ?.
|
||||
/// </summary>
|
||||
@@ -1267,20 +1285,20 @@ namespace TBF.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Do you want to restore configuration?.
|
||||
/// Looks up a localized string similar to Do you want to restore configuration database from file {0} ?.
|
||||
/// </summary>
|
||||
internal static string Do_you_want_to_restore_configuration_qm {
|
||||
internal static string Do_you_want_to_restore_configuration_DB_from_file_0_qm {
|
||||
get {
|
||||
return ResourceManager.GetString("Do_you_want_to_restore_configuration_qm", resourceCulture);
|
||||
return ResourceManager.GetString("Do_you_want_to_restore_configuration_DB_from_file_0_qm", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Do you want to restore results?.
|
||||
/// Looks up a localized string similar to Do you want to restore results database from file {0} ?.
|
||||
/// </summary>
|
||||
internal static string Do_you_want_to_restore_results_qm {
|
||||
internal static string Do_you_want_to_restore_results_DB_from_file_0_qm {
|
||||
get {
|
||||
return ResourceManager.GetString("Do_you_want_to_restore_results_qm", resourceCulture);
|
||||
return ResourceManager.GetString("Do_you_want_to_restore_results_DB_from_file_0_qm", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3417,6 +3435,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Program must be closed..
|
||||
/// </summary>
|
||||
internal static string Program_must_be_closed {
|
||||
get {
|
||||
return ResourceManager.GetString("Program_must_be_closed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Program restart is required to apply some settings.
|
||||
/// </summary>
|
||||
@@ -3912,6 +3939,24 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remote database cannot be exported.
|
||||
/// </summary>
|
||||
internal static string Remote_database_cannot_be_exported {
|
||||
get {
|
||||
return ResourceManager.GetString("Remote_database_cannot_be_exported", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remote database cannot be imported.
|
||||
/// </summary>
|
||||
internal static string Remote_database_cannot_be_imported {
|
||||
get {
|
||||
return ResourceManager.GetString("Remote_database_cannot_be_imported", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remote database is not compatible..
|
||||
/// </summary>
|
||||
@@ -4506,6 +4551,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Show disabled positions.
|
||||
/// </summary>
|
||||
internal static string Show_disabled_positions {
|
||||
get {
|
||||
return ResourceManager.GetString("Show_disabled_positions", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Shut down computer after exiting Test Bench Framework.
|
||||
/// </summary>
|
||||
@@ -5172,6 +5226,15 @@ namespace TBF.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Test results will be lost..
|
||||
/// </summary>
|
||||
internal static string Test_results_will_be_lost {
|
||||
get {
|
||||
return ResourceManager.GetString("Test_results_will_be_lost", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Test start ({0}: step {1}/{2}).
|
||||
/// </summary>
|
||||
|
||||
@@ -1461,4 +1461,31 @@
|
||||
<data name="Saving_results_failed" xml:space="preserve">
|
||||
<value>Ukládání výsledků zlyhalo</value>
|
||||
</data>
|
||||
<data name="Show_disabled_positions" xml:space="preserve">
|
||||
<value>Zobrazit vypnuté pozice</value>
|
||||
</data>
|
||||
<data name="Do_you_really_want_to_abort_this_session" xml:space="preserve">
|
||||
<value>Skutečně chcete přerušit tento cyklus?</value>
|
||||
</data>
|
||||
<data name="Test_results_will_be_lost" xml:space="preserve">
|
||||
<value>Výsledky testů se stratí.</value>
|
||||
</data>
|
||||
<data name="Remote_database_cannot_be_exported" xml:space="preserve">
|
||||
<value>Vzdálená databáze nemůže být exportována</value>
|
||||
</data>
|
||||
<data name="Remote_database_cannot_be_imported" xml:space="preserve">
|
||||
<value>Vzdálená databáze nemůže být naimportována</value>
|
||||
</data>
|
||||
<data name="Do_you_want_to_restore_configuration_DB_from_file_0_qm" xml:space="preserve">
|
||||
<value>Chcete obnovit konfigurační databázi ze souboru {0} ?</value>
|
||||
</data>
|
||||
<data name="Do_you_want_to_restore_results_DB_from_file_0_qm" xml:space="preserve">
|
||||
<value>Chcete obnovit výsledkovou databázi ze souboru {0} ?</value>
|
||||
</data>
|
||||
<data name="Currently_used_database_was_restored" xml:space="preserve">
|
||||
<value>Databáze která se právě používá byla naimportována.</value>
|
||||
</data>
|
||||
<data name="Program_must_be_closed" xml:space="preserve">
|
||||
<value>Program musí být uzavřen.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -472,7 +472,7 @@
|
||||
<value>Wybór metody sprawdzania</value>
|
||||
</data>
|
||||
<data name="Metrological_class" xml:space="preserve">
|
||||
<value>Klasa metrologiczna</value>
|
||||
<value>Klasa obciążeń</value>
|
||||
</data>
|
||||
<data name="Metrologist" xml:space="preserve">
|
||||
<value>Legalizator</value>
|
||||
@@ -634,7 +634,7 @@
|
||||
<value>Procedura</value>
|
||||
</data>
|
||||
<data name="Procedures" xml:space="preserve">
|
||||
<value>Procedury</value>
|
||||
<value>Wodomierzy</value>
|
||||
</data>
|
||||
<data name="Producer" xml:space="preserve">
|
||||
<value>Producent</value>
|
||||
|
||||
@@ -2014,11 +2014,11 @@
|
||||
<data name="Do_you_want_to_back_up_results_qm" xml:space="preserve">
|
||||
<value>Do you want to back up results?</value>
|
||||
</data>
|
||||
<data name="Do_you_want_to_restore_configuration_qm" xml:space="preserve">
|
||||
<value>Do you want to restore configuration?</value>
|
||||
<data name="Do_you_want_to_restore_configuration_DB_from_file_0_qm" xml:space="preserve">
|
||||
<value>Do you want to restore configuration database from file {0} ?</value>
|
||||
</data>
|
||||
<data name="Do_you_want_to_restore_results_qm" xml:space="preserve">
|
||||
<value>Do you want to restore results?</value>
|
||||
<data name="Do_you_want_to_restore_results_DB_from_file_0_qm" xml:space="preserve">
|
||||
<value>Do you want to restore results database from file {0} ?</value>
|
||||
</data>
|
||||
<data name="Saving_all_results" xml:space="preserve">
|
||||
<value>Saving all results</value>
|
||||
@@ -2032,4 +2032,25 @@
|
||||
<data name="Saving_results_failed" xml:space="preserve">
|
||||
<value>Saving results failed</value>
|
||||
</data>
|
||||
<data name="Show_disabled_positions" xml:space="preserve">
|
||||
<value>Show disabled positions</value>
|
||||
</data>
|
||||
<data name="Do_you_really_want_to_abort_this_session" xml:space="preserve">
|
||||
<value>Do you really want to abort this session?</value>
|
||||
</data>
|
||||
<data name="Test_results_will_be_lost" xml:space="preserve">
|
||||
<value>Test results will be lost.</value>
|
||||
</data>
|
||||
<data name="Remote_database_cannot_be_exported" xml:space="preserve">
|
||||
<value>Remote database cannot be exported</value>
|
||||
</data>
|
||||
<data name="Remote_database_cannot_be_imported" xml:space="preserve">
|
||||
<value>Remote database cannot be imported</value>
|
||||
</data>
|
||||
<data name="Currently_used_database_was_restored" xml:space="preserve">
|
||||
<value>A currently used database was restored.</value>
|
||||
</data>
|
||||
<data name="Program_must_be_closed" xml:space="preserve">
|
||||
<value>Program must be closed.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,34 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TestBenchFramework xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Language>en</Language>
|
||||
<Language>ru</Language>
|
||||
<TestBenches>
|
||||
<DatabaseSettings>
|
||||
<BenchName>Test Bench</BenchName>
|
||||
<BenchName>Санкт-Петербург PT50</BenchName>
|
||||
<IsRealBench>true</IsRealBench>
|
||||
<DbType>MySql</DbType>
|
||||
<ConnectionString>SERVER=localhost; DATABASE=petersburg50; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
|
||||
<DbType>MySql</DbType>
|
||||
<ConnectionString>SERVER=localhost; DATABASE=petersburg50-r; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
|
||||
<ConnectionString />
|
||||
</DatabaseSettings>
|
||||
<DatabaseSettings>
|
||||
<BenchName>Санкт-Петербург PT200</BenchName>
|
||||
<IsRealBench>true</IsRealBench>
|
||||
<ProceduresDBSettings>
|
||||
<DbType>MySql</DbType>
|
||||
<ConnectionString>SERVER=localhost; DATABASE=testbench; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
|
||||
<ConnectionString>SERVER=localhost; DATABASE=petersburg200; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
|
||||
</ProceduresDBSettings>
|
||||
<WaterMetersDBSettings>
|
||||
<DbType>MySql</DbType>
|
||||
<ConnectionString>SERVER=localhost; DATABASE=testbench-r; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
|
||||
<ConnectionString>SERVER=localhost; DATABASE=petersburg200-r; UID=root; PASSWORD=; CHARSET=utf8;</ConnectionString>
|
||||
</WaterMetersDBSettings>
|
||||
<UsersDBSettings>
|
||||
<DbType>MySql</DbType>
|
||||
<ConnectionString />
|
||||
</UsersDBSettings>
|
||||
</DatabaseSettings>
|
||||
</TestBenches>
|
||||
<LastBench>Test Bench</LastBench>
|
||||
<BatchNr>1</BatchNr>
|
||||
<LoginMethod>UserName</LoginMethod>
|
||||
<LastBench>Санкт-Петербург PT50</LastBench>
|
||||
<BatchNr>21</BatchNr>
|
||||
<RealDensity>998.2008</RealDensity>
|
||||
<AtTemperature>20</AtTemperature>
|
||||
<RightPaneHorizSplitterDistance>25</RightPaneHorizSplitterDistance>
|
||||
<MainWndLeft>75</MainWndLeft>
|
||||
<MainWndTop>5</MainWndTop>
|
||||
<TopPaneVerticalSplitterDistance>596</TopPaneVerticalSplitterDistance>
|
||||
<MainWndLeft>76</MainWndLeft>
|
||||
<MainWndTop>21</MainWndTop>
|
||||
<MainWndWidth>1250</MainWndWidth>
|
||||
<MainWndHeight>750</MainWndHeight>
|
||||
<ManiWndMaximized>false</ManiWndMaximized>
|
||||
<ManiWndMaximized>true</ManiWndMaximized>
|
||||
<ComponentsDlgLeft>200</ComponentsDlgLeft>
|
||||
<ComponentsDlgTop>100</ComponentsDlgTop>
|
||||
<ComponentsDlgWidth>850</ComponentsDlgWidth>
|
||||
<ComponentsDlgHeight>500</ComponentsDlgHeight>
|
||||
<PopupResultsLeft>0</PopupResultsLeft>
|
||||
<PopupResultsTop>0</PopupResultsTop>
|
||||
<PopupResultsWidth>0</PopupResultsWidth>
|
||||
<PopupResultsHeight>0</PopupResultsHeight>
|
||||
<PathsDlgLeft>0</PathsDlgLeft>
|
||||
<PathsDlgTop>0</PathsDlgTop>
|
||||
<PathsDlgWidth>0</PathsDlgWidth>
|
||||
@@ -53,6 +72,10 @@
|
||||
<OneProcedureDlgHeight>0</OneProcedureDlgHeight>
|
||||
<PrintOrderLeft>0</PrintOrderLeft>
|
||||
<PrintOrderTop>0</PrintOrderTop>
|
||||
<EnduranceDlgLeft>0</EnduranceDlgLeft>
|
||||
<EnduranceDlgTop>0</EnduranceDlgTop>
|
||||
<EnduranceDlgWidth>0</EnduranceDlgWidth>
|
||||
<EnduranceDlgHeight>0</EnduranceDlgHeight>
|
||||
<PrintOrderOnlyGoodResult>false</PrintOrderOnlyGoodResult>
|
||||
<PrintOrderOnlyLastResult>false</PrintOrderOnlyLastResult>
|
||||
<ResultsConfigMeters>Vertically</ResultsConfigMeters>
|
||||
|
||||
@@ -60,10 +60,11 @@
|
||||
<logger name="NHibernate"> <level value="ERROR" /> </logger>
|
||||
<logger name="TBF.BenchControl.StateMachine"> <level value="INFO" /> </logger>
|
||||
<logger name="TBF.BenchControl.State"> <level value="WARN" /> </logger>
|
||||
<logger name="TBF.BenchControl.Elde.ControlComdWrap"> <level value="WARN" /> </logger>
|
||||
<logger name="TBF.BenchControl.Elde.ControlComWrap"> <level value="WARN" /> </logger>
|
||||
<logger name="TBF.BenchControl.Elde.Pump"> <level value="WARN" /> </logger>
|
||||
<logger name="TBF.BenchControl.Elde.PumpWithFM"> <level value="WARN" /> </logger>
|
||||
<logger name="TBF.BenchControl.MettlerToledo"> <level value="WARN" /> </logger>
|
||||
<logger name="TBF.BenchControl.Fomulas"> <level value="FATAL" /> </logger>
|
||||
<logger name="TBF.BenchControl.Elde.StartMeasurementOp"> <level value="WARN" /> </logger>
|
||||
<logger name="TBF.BenchControl.Modbus"> <level value="DEBUG" /> </logger>
|
||||
</log4net>
|
||||
|
||||
+1
@@ -246,6 +246,7 @@ namespace TBF.Screens
|
||||
this.flowLayoutPanel.Name = "flowLayoutPanel";
|
||||
this.flowLayoutPanel.Size = new System.Drawing.Size(1315, 660);
|
||||
this.flowLayoutPanel.TabIndex = 0;
|
||||
this.flowLayoutPanel.SizeChanged += new System.EventHandler(this.flowLayoutPanel_SizeChanged);
|
||||
//
|
||||
// ResultsTabPageCtrl
|
||||
//
|
||||
|
||||
+375
-324
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -35,6 +35,7 @@ namespace TBF.Screens
|
||||
public MetersArrangement MetersArrangement;
|
||||
public TestsArrangement TestsArrangement;
|
||||
public int NrMetersInOneGroup;
|
||||
public bool ShowDisabledPositions;
|
||||
public int MinWidth;
|
||||
public int MinHeight;
|
||||
|
||||
@@ -42,11 +43,17 @@ namespace TBF.Screens
|
||||
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_CombinedWM;
|
||||
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_HeatM;
|
||||
|
||||
MetersKind metersKind;
|
||||
OneWMResultsCtrl firstListView;
|
||||
MetersKind metersKind;
|
||||
IList<Results.WMeterRsltItemSpec> currentItems;
|
||||
IOneWMResultsCtrl[] wmRsltsCtrl; /// An array of controls with water meter results.
|
||||
IOneWMResultsCtrl firstEnabledControl;
|
||||
DateTime lastRedraw;
|
||||
DateTime lastSizeChange;
|
||||
int metersInOneGroup;
|
||||
int nrGroups;
|
||||
|
||||
Timer timer;
|
||||
|
||||
int lvWidth;
|
||||
int lvHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
@@ -55,16 +62,25 @@ namespace TBF.Screens
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
wmRsltsCtrl = new IOneWMResultsCtrl[0]; /// No water meters displayed => array with zero length
|
||||
firstEnabledControl = null; /// No water meters displayed => firstListView is null
|
||||
currentItems = new List<Results.WMeterRsltItemSpec>();
|
||||
nrGroups = 1;
|
||||
metersInOneGroup = 1;
|
||||
|
||||
if (Program.LocalSettings != null)
|
||||
{
|
||||
MetersArrangement = Program.LocalSettings.ResultsConfigMeters;
|
||||
TestsArrangement = Program.LocalSettings.ResultsConfigTests;
|
||||
NrMetersInOneGroup = Math.Max(1, Program.LocalSettings.ResultsConfigMetersInOneGroup);
|
||||
ShowDisabledPositions = Program.LocalSettings.ShowDisabledPositions;
|
||||
MinWidth = Program.LocalSettings.ResultsConfigMinWidth;
|
||||
MinHeight = Program.LocalSettings.ResultsConfigMinHeight;
|
||||
RsltItems_Screen_SingleWM = Results.WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_SingleWM);
|
||||
RsltItems_Screen_CombinedWM = Results.WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_CombinedWM);
|
||||
RsltItems_Screen_HeatM = Results.WMeterRsltItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Screen_HeatM);
|
||||
|
||||
currentItems = GetRsltItems(metersKind);
|
||||
}
|
||||
|
||||
Bridge.ProcedureSelectedHandler += delegate(object sender, ProcedureSelectedEventArgs args)
|
||||
@@ -90,24 +106,41 @@ namespace TBF.Screens
|
||||
else
|
||||
OnButtonsEtc(sndr, args);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
lastSizeChange = DateTime.Now;
|
||||
|
||||
/// Create a timer with one second interval.
|
||||
timer = new Timer();
|
||||
timer.Interval = 1000; /// ms
|
||||
timer.Tick += new EventHandler(OnTimer);
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
void OnProcedureSelected(object sender, ProcedureSelectedEventArgs args)
|
||||
{
|
||||
if ((TBF.BenchControl.Sequences.ProcessData.BatchRslts != null) && (Program.LocalSettings != null))
|
||||
Results.BatchResults batchResults = TBF.BenchControl.Sequences.ProcessData.BatchRslts;
|
||||
|
||||
if ((batchResults != null) && (Program.LocalSettings != null))
|
||||
{
|
||||
Results.Utils.GetCounterStates(TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch, Program.LocalSettings.Counters);
|
||||
Results.Utils.GetCounterStates(batchResults.Batch, Program.LocalSettings.Counters);
|
||||
}
|
||||
RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
|
||||
|
||||
if (IsLayoutChangedDueToData(batchResults)) CreateControlsAndFillPanel(batchResults);
|
||||
UpdateResults(batchResults);
|
||||
}
|
||||
|
||||
void OnTestCompleted(object sender, TestCompletedEventArgs args)
|
||||
{
|
||||
if ((TBF.BenchControl.Sequences.ProcessData.BatchRslts != null) && (Program.LocalSettings != null))
|
||||
Results.BatchResults batchResults = TBF.BenchControl.Sequences.ProcessData.BatchRslts;
|
||||
|
||||
if ((batchResults != null) && (Program.LocalSettings != null))
|
||||
{
|
||||
Results.Utils.GetCounterStates(TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch, Program.LocalSettings.Counters);
|
||||
Results.Utils.GetCounterStates(batchResults.Batch, Program.LocalSettings.Counters);
|
||||
}
|
||||
RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
|
||||
|
||||
if (IsLayoutChangedDueToData(batchResults)) CreateControlsAndFillPanel(batchResults);
|
||||
UpdateResults(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
|
||||
}
|
||||
|
||||
void OnButtonsEtc(object sender, UiBridge.ButtonsEtcEventArgs args)
|
||||
@@ -154,7 +187,9 @@ namespace TBF.Screens
|
||||
{
|
||||
Results.Utils.GetCounterStates(TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch, Program.LocalSettings.Counters);
|
||||
}
|
||||
RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
|
||||
|
||||
CreateControlsAndFillPanel(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
|
||||
UpdateResults(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +214,7 @@ namespace TBF.Screens
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Invoke a configuration dialog
|
||||
/// Handle button at the top of this form: Invoke a configuration dialog
|
||||
/// </summary>
|
||||
private void configureButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -189,6 +224,7 @@ namespace TBF.Screens
|
||||
dlg.TestsArrangement = TestsArrangement;
|
||||
dlg.MetersArrangement = MetersArrangement;
|
||||
dlg.NrMetersInOneGroup = NrMetersInOneGroup;
|
||||
dlg.ShowDisabledPositions = ShowDisabledPositions;
|
||||
dlg.MinWidth = MinWidth;
|
||||
dlg.MinHeight = MinHeight;
|
||||
dlg.SelectedItems = GetRsltItems(metersKind);
|
||||
@@ -196,13 +232,25 @@ namespace TBF.Screens
|
||||
DialogResult dr = dlg.ShowDialog();
|
||||
if (dr == DialogResult.OK && dlg.Unlocked)
|
||||
{
|
||||
Program.LocalSettings.ResultsConfigMeters = MetersArrangement = dlg.MetersArrangement;;
|
||||
Program.LocalSettings.ResultsConfigTests = TestsArrangement = dlg.TestsArrangement;
|
||||
Program.LocalSettings.ResultsConfigMetersInOneGroup = NrMetersInOneGroup = dlg.NrMetersInOneGroup;
|
||||
Program.LocalSettings.ResultsConfigMinWidth = MinWidth = dlg.MinWidth;
|
||||
Program.LocalSettings.ResultsConfigMinHeight = MinHeight = dlg.MinHeight;
|
||||
bool isLayoutChangedDueToConfig = false;
|
||||
|
||||
switch (metersKind)
|
||||
if ((MetersArrangement != dlg.MetersArrangement) ||
|
||||
(TestsArrangement != dlg.TestsArrangement) ||
|
||||
(NrMetersInOneGroup != dlg.NrMetersInOneGroup) ||
|
||||
(ShowDisabledPositions != dlg.ShowDisabledPositions) ||
|
||||
(MinWidth != dlg.MinWidth) ||
|
||||
(MinHeight != dlg.MinHeight))
|
||||
{
|
||||
Program.LocalSettings.ResultsConfigMeters = MetersArrangement = dlg.MetersArrangement;;
|
||||
Program.LocalSettings.ResultsConfigTests = TestsArrangement = dlg.TestsArrangement;
|
||||
Program.LocalSettings.ResultsConfigMetersInOneGroup = NrMetersInOneGroup = dlg.NrMetersInOneGroup;
|
||||
Program.LocalSettings.ShowDisabledPositions = ShowDisabledPositions = dlg.ShowDisabledPositions;
|
||||
Program.LocalSettings.ResultsConfigMinWidth = MinWidth = dlg.MinWidth;
|
||||
Program.LocalSettings.ResultsConfigMinHeight = MinHeight = dlg.MinHeight;
|
||||
isLayoutChangedDueToConfig = true;
|
||||
}
|
||||
|
||||
switch (metersKind)
|
||||
{
|
||||
default:
|
||||
case MetersKind.Single:
|
||||
@@ -218,313 +266,36 @@ namespace TBF.Screens
|
||||
Program.LocalSettings.RsltItems_Screen_HeatM = Results.WMeterRsltItemSpec.ToStrArray(RsltItems_Screen_HeatM);
|
||||
break;
|
||||
}
|
||||
UpdateItems(dlg.SelectedItems);
|
||||
|
||||
Program.LocalSettings.Save();
|
||||
}
|
||||
|
||||
if ((TBF.BenchControl.Sequences.ProcessData.BatchRslts != null) && (Program.LocalSettings != null))
|
||||
{
|
||||
Results.Utils.GetCounterStates(TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch, Program.LocalSettings.Counters);
|
||||
}
|
||||
RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear the results
|
||||
/// </summary>
|
||||
private void showPreviousResultsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
new TBF.Forms.PreviousResultsDlg().ShowDialog();
|
||||
}
|
||||
|
||||
private void reloadPreviousResultsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
new TBF.Forms.PreviousResultsDlg(TBF.Forms.PreviousResultsMode.Reload).ShowDialog();
|
||||
}
|
||||
|
||||
private void fixPreviousResultsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
new TBF.Forms.PreviousResultsDlg(TBF.Forms.PreviousResultsMode.Fix).ShowDialog();
|
||||
}
|
||||
|
||||
#region Redraw
|
||||
|
||||
/// <summary>
|
||||
/// Re-draw the results. Apply new settings if they changed.
|
||||
/// </summary>
|
||||
void RedrawAll(Results.BatchResults results)
|
||||
{
|
||||
this.SuspendLayout();
|
||||
|
||||
if (results == null)
|
||||
{
|
||||
flowLayoutPanel.Controls.Clear();
|
||||
ResumeLayout(false);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
/// Determine how many water meters were enabled for result evaluation and printing
|
||||
int enabledWMsCount = 0;
|
||||
for (int i = 0; i < results.WMPositionsCount; i++)
|
||||
{
|
||||
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
enabledWMsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
int metersInOneGroup = Math.Max(1, Math.Min(enabledWMsCount, NrMetersInOneGroup));
|
||||
int nrGroups = Math.Max(1, (enabledWMsCount + metersInOneGroup - 1) / metersInOneGroup);
|
||||
|
||||
if (MetersArrangement == MetersArrangement.Horizontally)
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
|
||||
lvWidth = Math.Max(MinWidth, flowLayoutPanel.Width / metersInOneGroup - 6);
|
||||
lvHeight = Math.Max(MinHeight, flowLayoutPanel.Height / nrGroups - 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
|
||||
lvWidth = Math.Max(MinWidth, flowLayoutPanel.Width / nrGroups - 6);
|
||||
lvHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
|
||||
}
|
||||
flowLayoutPanel.Controls.Clear();
|
||||
flowLayoutPanel.WrapContents = true;
|
||||
flowLayoutPanel.AutoScroll = true;
|
||||
|
||||
bool first = true;
|
||||
for (int i = 0; i < results.WMPositionsCount; i++)
|
||||
{
|
||||
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
OneWMResultsCtrl lview = (TestsArrangement == TestsArrangement.Rows)
|
||||
? GetResultsTestsAreRows(results.WaterMeters[i], i + 1)
|
||||
: GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
|
||||
if (lview != null)
|
||||
{
|
||||
flowLayoutPanel.Controls.Add(lview);
|
||||
if (first)
|
||||
{
|
||||
firstListView = lview;
|
||||
first = false;
|
||||
}
|
||||
|
||||
lview.WMResultsClickedHandler += delegate(object sender, Results.Forms.WaterMeterEventArgs args)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new EventHandler<Results.Forms.WaterMeterEventArgs>(OnDoubleClick), sender, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnDoubleClick(sender, args);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.FatalFormat("Redrawing results failed : {0}", e.Message);
|
||||
if (e.InnerException != null)
|
||||
{
|
||||
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
|
||||
}
|
||||
log.FatalFormat("StackTrace : {0}{1}", Environment.NewLine, e.StackTrace);
|
||||
}
|
||||
|
||||
this.ResumeLayout(false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get an empty ListView control with appropriate parameters.
|
||||
/// </summary>
|
||||
/// <returns>ListView control</returns>
|
||||
OneWMResultsCtrl GetListView(Color backColor, Results.Entities.WaterMeter wm)
|
||||
{
|
||||
return new OneWMResultsCtrl(backColor, lvWidth, lvHeight, wm);
|
||||
}
|
||||
///
|
||||
OneWMResultsCtrl GetListView(Results.Entities.WaterMeter wm)
|
||||
{
|
||||
return GetListView(Color.White, wm);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a ListView control filled with results of the meter 'mtr'
|
||||
/// </summary>
|
||||
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
|
||||
/// <returns>ListView object</returns>
|
||||
OneWMResultsCtrl GetResultsTestsAreRows(Results.Entities.WaterMeter wMtr, int printedWMNr)
|
||||
{
|
||||
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
|
||||
|
||||
string message = string.Empty;
|
||||
#if ORACLE_DB
|
||||
bool maxRepeatsExceeded = ((TBF.BenchControl.Sequences.ProcessData.BenchInfo is TBF.BenchControl.BenchInfo.iPerl.Component) &&
|
||||
(wMtr.Pruefindex % 100) >= (TBF.BenchControl.Sequences.ProcessData.BenchInfo as TBF.BenchControl.BenchInfo.iPerl.Component).MaxTestIndex);
|
||||
Color commonBackColor = wMtr.GetColorOfResults(maxRepeatsExceeded, out message);
|
||||
OneWMResultsCtrl lview = GetListView(commonBackColor, wMtr);
|
||||
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
Color commonBackColor = wMtr.GetColorOfResults(false, out message);
|
||||
OneWMResultsCtrl lview = GetListView(commonBackColor, wMtr);
|
||||
lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
|
||||
|
||||
if (items == null || items.Count == 0) return lview;
|
||||
|
||||
// Header
|
||||
TBF.LocalSettings ls = Program.LocalSettings;
|
||||
lview.Columns.Add(printedWMNr.ToString(), (ls.RsltsClmnCount > 0) ? ls.RsltsClmnWidths[0] : 40);
|
||||
int col = 1;
|
||||
foreach (var item in items)
|
||||
{
|
||||
lview.Columns.Add(item.Caption, (ls.RsltsClmnCount > col) ? ls.RsltsClmnWidths[col] : 70);
|
||||
col++;
|
||||
}
|
||||
|
||||
|
||||
IList<string> testNames = wMtr.GetAllDecoratedTestNames();
|
||||
int ix = 0;
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
{
|
||||
if (mtr != null &&
|
||||
(mtr.CompoundMeterId == (byte)CompoundMeterId.Single ||
|
||||
mtr.CompoundMeterId == (byte)CompoundMeterId.Compound ||
|
||||
mtr.CompoundMeterId == (byte)CompoundMeterId.HeatMeterEnergy) &&
|
||||
mtr.TestDone &&
|
||||
mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(testNames[ix++]);
|
||||
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
string str = items[i].Print(wMtr, mtr.Name());
|
||||
|
||||
/// Extract and use color information
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : commonBackColor);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
lview.Items.Add(lvi);
|
||||
}
|
||||
}
|
||||
|
||||
return lview;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a ListView control filled with results of the meter 'mtr'
|
||||
/// </summary>
|
||||
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
|
||||
/// <returns>ListView object</returns>
|
||||
OneWMResultsCtrl GetResultsTestsAreColumns(Results.Entities.WaterMeter wMtr, int printedWMNr)
|
||||
{
|
||||
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
|
||||
|
||||
string message;
|
||||
#if ORACLE_DB
|
||||
bool maxRepeatsExceeded = ((TBF.BenchControl.Sequences.ProcessData.BenchInfo is TBF.BenchControl.BenchInfo.iPerl.Component) &&
|
||||
(wMtr.Pruefindex % 100) >= (TBF.BenchControl.Sequences.ProcessData.BenchInfo as TBF.BenchControl.BenchInfo.iPerl.Component).MaxTestIndex);
|
||||
Color commonBackColor = wMtr.GetColorOfResults(maxRepeatsExceeded, out message);
|
||||
OneWMResultsCtrl lview = GetListView(commonBackColor, wMtr);
|
||||
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
|
||||
#else
|
||||
Color commonBackColor = wMtr.GetColorOfResults(false, out message);
|
||||
OneWMResultsCtrl lview = GetListView(commonBackColor, wMtr);
|
||||
lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
|
||||
#endif
|
||||
|
||||
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
|
||||
|
||||
if (items == null || items.Count == 0) return lview;
|
||||
|
||||
// Header
|
||||
TBF.LocalSettings ls = Program.LocalSettings;
|
||||
lview.Columns.Add(printedWMNr.ToString(), (ls.RsltsClmnCount > 0) ? ls.RsltsClmnWidths[0] : 40);
|
||||
int i = 1;
|
||||
foreach (var str in wMtr.GetAllDecoratedTestNames())
|
||||
{
|
||||
lview.Columns.Add(str, (ls.RsltsClmnCount > i) ? ls.RsltsClmnWidths[i] : 70);
|
||||
i++;
|
||||
}
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(item.Caption);
|
||||
|
||||
foreach (var mtr in wMtr.MeterTestRslts)
|
||||
if ((TBF.BenchControl.Sequences.ProcessData.BatchRslts != null) && (Program.LocalSettings != null))
|
||||
{
|
||||
if (mtr != null &&
|
||||
(mtr.CompoundMeterId == (byte)CompoundMeterId.Single ||
|
||||
mtr.CompoundMeterId == (byte)CompoundMeterId.Compound ||
|
||||
mtr.CompoundMeterId == (byte)CompoundMeterId.HeatMeterEnergy) &&
|
||||
mtr.TestDone &&
|
||||
mtr.Publish() != Config.Entities.Publish.Never &&
|
||||
mtr.Publish() != Config.Entities.Publish.Internal)
|
||||
{
|
||||
string str = item.Print(wMtr, mtr.Name());
|
||||
|
||||
string[] texts = str.Split(new char[] { '|' });
|
||||
if (texts.Length == 1)
|
||||
{
|
||||
lvi.SubItems.Add(str);
|
||||
}
|
||||
else if (texts.Length == 2)
|
||||
{
|
||||
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : commonBackColor);
|
||||
lvi.UseItemStyleForSubItems = false;
|
||||
lvi.SubItems.Add(texts[0]);
|
||||
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvi.SubItems.Add(string.Empty);
|
||||
}
|
||||
}
|
||||
Results.Utils.GetCounterStates(TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch, Program.LocalSettings.Counters);
|
||||
}
|
||||
|
||||
lview.Items.Add(lvi);
|
||||
}
|
||||
if (isLayoutChangedDueToConfig)
|
||||
{
|
||||
CreateControlsAndFillPanel(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
|
||||
}
|
||||
|
||||
return lview;
|
||||
UpdateResults(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Redraw
|
||||
|
||||
/// <summary>
|
||||
/// Handle button at the top of this form: Propagate column widths
|
||||
/// </summary>
|
||||
private void columnWidthsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (firstListView == null) return;
|
||||
if (firstEnabledControl == null) return;
|
||||
|
||||
/// Update the column widths
|
||||
Program.LocalSettings.RsltsClmnWidths = new int[firstListView.Columns.Count];
|
||||
for (int i = 0; i < firstListView.Columns.Count; i++)
|
||||
/// Get column widths from the first control
|
||||
Program.LocalSettings.RsltsClmnWidths = new int[firstEnabledControl.Columns.Count];
|
||||
for (int i = 0; i < firstEnabledControl.Columns.Count; i++)
|
||||
{
|
||||
Program.LocalSettings.RsltsClmnWidths[i] = firstListView.Columns[i].Width;
|
||||
Program.LocalSettings.RsltsClmnWidths[i] = firstEnabledControl.Columns[i].Width;
|
||||
}
|
||||
Program.LocalSettings.Save();
|
||||
|
||||
@@ -532,30 +303,262 @@ namespace TBF.Screens
|
||||
{
|
||||
Results.Utils.GetCounterStates(TBF.BenchControl.Sequences.ProcessData.BatchRslts.Batch, Program.LocalSettings.Counters);
|
||||
}
|
||||
RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
|
||||
|
||||
UpdateColumnWidths(Program.LocalSettings.RsltsClmnWidths);
|
||||
}
|
||||
|
||||
///
|
||||
/// Handle other buttons at the top of this form
|
||||
///
|
||||
private void showPreviousResultsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
new TBF.Forms.PreviousResultsDlg().ShowDialog();
|
||||
}
|
||||
private void reloadPreviousResultsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
new TBF.Forms.PreviousResultsDlg(TBF.Forms.PreviousResultsMode.Reload).ShowDialog();
|
||||
}
|
||||
private void fixPreviousResultsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
new TBF.Forms.PreviousResultsDlg(TBF.Forms.PreviousResultsMode.Fix).ShowDialog();
|
||||
}
|
||||
|
||||
///
|
||||
/// Handle double-click inside a water meter results control
|
||||
///
|
||||
void OnDoubleClick(object sender, Results.Forms.WaterMeterEventArgs args)
|
||||
{
|
||||
if (args.WM == null || args.WM.Disabled)
|
||||
int waterMetersCount = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters.Length;
|
||||
|
||||
Results.Entities.WaterMeter wm;
|
||||
if ((args.WMPosition <= 0) || (args.WMPosition > waterMetersCount) ||
|
||||
((wm = TBF.BenchControl.Sequences.ProcessData.BatchRslts.WaterMeters[args.WMPosition - 1]) == null))
|
||||
{
|
||||
MessageBox.Show(Strings.No_water_meter);
|
||||
return;
|
||||
}
|
||||
else if ((TracingDB.DB.SessionFactory == null) || string.IsNullOrEmpty(args.WM.SerialNr))
|
||||
|
||||
ShowMoreWMResults(wm);
|
||||
}
|
||||
|
||||
|
||||
void UpdateColumnWidths(int[] columnWidths)
|
||||
{
|
||||
foreach (var ctrl in wmRsltsCtrl) ctrl.Update(columnWidths);
|
||||
}
|
||||
|
||||
void UpdateScrollpositions(int scrollStart)
|
||||
{
|
||||
/// TODO
|
||||
}
|
||||
|
||||
|
||||
void UpdateItems(IList<Results.WMeterRsltItemSpec> items)
|
||||
{
|
||||
bool updateItems = false;
|
||||
if (currentItems.Count != items.Count)
|
||||
{
|
||||
new Results.Forms.MoreWMResultsDlg(args.WM, null).ShowDialog();
|
||||
/// Current and new item counts are different
|
||||
updateItems = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Current and new item counts are the same
|
||||
for (int i = 0; i < currentItems.Count; i++)
|
||||
{
|
||||
if (currentItems[i] != items[i])
|
||||
{
|
||||
updateItems = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (updateItems)
|
||||
{
|
||||
/// Update items in all controls
|
||||
currentItems = items;
|
||||
foreach (var oneCtrl in wmRsltsCtrl) oneCtrl.Update(items);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool IsLayoutChangedDueToData(Results.BatchResults results)
|
||||
{
|
||||
if (results == null || results.WaterMeters == null || results.WaterMeters.Length == 0)
|
||||
{
|
||||
/// 'results' contain no water meters, wmRsltsCtrl.Lenght == 0 expected
|
||||
return (wmRsltsCtrl.Length != 0); /// true when there are currently water meters on screen
|
||||
}
|
||||
|
||||
///
|
||||
/// Determine water meter positions count
|
||||
///
|
||||
int displayedWatermetersCount = 0;
|
||||
for (int i = 0; i < results.WaterMeters.Length; i++)
|
||||
{
|
||||
if (results.WaterMeters[i] != null)
|
||||
{
|
||||
if (ShowDisabledPositions || !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
displayedWatermetersCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (displayedWatermetersCount != wmRsltsCtrl.Length);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Re-draw the results. Apply new settings if they changed.
|
||||
/// </summary>
|
||||
void CreateControlsAndFillPanel(Results.BatchResults results)
|
||||
{
|
||||
if ((results == null) || (results.WMPositionsCount == 0))
|
||||
{
|
||||
/// There are no water meters at all
|
||||
DeleteHandlers();
|
||||
flowLayoutPanel.Controls.Clear();
|
||||
wmRsltsCtrl = new OneWMResultsRowsCtrl[0];
|
||||
firstEnabledControl = null;
|
||||
return;
|
||||
}
|
||||
|
||||
///
|
||||
/// Determine water meter positions count
|
||||
///
|
||||
int displayedControlsCount = 0;
|
||||
for (int i = 0; i < results.WaterMeters.Length; i++)
|
||||
{
|
||||
if (results.WaterMeters[i] != null)
|
||||
{
|
||||
if (ShowDisabledPositions || !results.WaterMeters[i].Disabled)
|
||||
{
|
||||
displayedControlsCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Calculate geometry
|
||||
///
|
||||
metersInOneGroup = Math.Max(1, Math.Min(displayedControlsCount, NrMetersInOneGroup));
|
||||
nrGroups = Math.Max(1, (displayedControlsCount + metersInOneGroup - 1) / metersInOneGroup);
|
||||
|
||||
int oneWidth;
|
||||
int oneHeight;
|
||||
///
|
||||
if (MetersArrangement == MetersArrangement.Horizontally)
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / metersInOneGroup - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / nrGroups - 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / nrGroups - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
|
||||
}
|
||||
|
||||
///
|
||||
/// Create controls and fill the FlowLayoutPanel
|
||||
///
|
||||
flowLayoutPanel.SuspendLayout();
|
||||
DeleteHandlers();
|
||||
flowLayoutPanel.Controls.Clear();
|
||||
flowLayoutPanel.WrapContents = true;
|
||||
flowLayoutPanel.AutoScroll = true;
|
||||
|
||||
wmRsltsCtrl = new IOneWMResultsCtrl[displayedControlsCount];
|
||||
int ix = 0;
|
||||
firstEnabledControl = null;
|
||||
for (int i = 0; i < results.WaterMeters.Length; i++)
|
||||
{
|
||||
if (results.WaterMeters[i] != null)
|
||||
{
|
||||
if (!results.WaterMeters[i].Disabled || ShowDisabledPositions)
|
||||
{
|
||||
/// Create one water meter position / control
|
||||
wmRsltsCtrl[ix] = (TestsArrangement == TestsArrangement.Rows)
|
||||
? new OneWMResultsRowsCtrl() as IOneWMResultsCtrl
|
||||
: new OneWMResultsColumnsCtrl() as IOneWMResultsCtrl;
|
||||
wmRsltsCtrl[ix].Width = oneWidth;
|
||||
wmRsltsCtrl[ix].Height = oneHeight;
|
||||
wmRsltsCtrl[ix].Update(currentItems);
|
||||
wmRsltsCtrl[ix].WMResultsClickedHandler += HandleDoubleClick;
|
||||
|
||||
flowLayoutPanel.Controls.Add(wmRsltsCtrl[ix] as UserControl);
|
||||
if ((firstEnabledControl == null) && !results.WaterMeters[i].Disabled) firstEnabledControl = wmRsltsCtrl[ix];
|
||||
ix++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpdateColumnWidths(Program.LocalSettings.RsltsClmnWidths);
|
||||
|
||||
flowLayoutPanel.ResumeLayout();
|
||||
}
|
||||
|
||||
void HandleDoubleClick(object s, WaterMeterEventArgs args)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
{
|
||||
Invoke(new EventHandler<Results.Forms.WaterMeterEventArgs>(OnDoubleClick), s, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnDoubleClick(s, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete handler subscriptions from controls (memory leak if not done???).
|
||||
/// To be done before flowLayoutPanel.Controls.Clear().
|
||||
/// </summary>
|
||||
void DeleteHandlers()
|
||||
{
|
||||
foreach (var ctrl in flowLayoutPanel.Controls)
|
||||
{
|
||||
if (ctrl is IOneWMResultsCtrl)
|
||||
{
|
||||
(ctrl as IOneWMResultsCtrl).WMResultsClickedHandler -= HandleDoubleClick;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UpdateResults(Results.BatchResults batchResults)
|
||||
{
|
||||
if ((batchResults != null) && (batchResults.WaterMeters != null))
|
||||
{
|
||||
int ctrlIx = 0;
|
||||
for (int i = 0; i < batchResults.WaterMeters.Length; i++)
|
||||
{
|
||||
if (!batchResults.WaterMeters[i].Disabled || ShowDisabledPositions)
|
||||
{
|
||||
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(batchResults.WaterMeters[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ShowMoreWMResults(Results.Entities.WaterMeter wm)
|
||||
{
|
||||
if ((TracingDB.DB.SessionFactory == null) || string.IsNullOrEmpty(wm.SerialNr))
|
||||
{
|
||||
new Results.Forms.MoreWMResultsDlg(wm, null).ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
IList<ReferenceRecord> refRecords = null;
|
||||
using (ISession session = TracingDB.DB.SessionFactory.OpenSession())
|
||||
{
|
||||
refRecords = session.QueryOver<ReferenceRecord>()
|
||||
.Where(x => (x.Code == args.WM.SerialNr))
|
||||
.OrderBy(x => x.TimeStamp).Desc
|
||||
.List();
|
||||
IList<ReferenceRecord> refRecords = session.QueryOver<ReferenceRecord>()
|
||||
.Where(x => (x.Code == wm.SerialNr))
|
||||
.OrderBy(x => x.TimeStamp).Desc
|
||||
.List();
|
||||
for (int i = 0; i < refRecords.Count; i++)
|
||||
{
|
||||
ReferenceRecord refR = refRecords[i];
|
||||
@@ -579,7 +582,55 @@ namespace TBF.Screens
|
||||
}
|
||||
}
|
||||
|
||||
new Results.Forms.MoreWMResultsDlg(args.WM, refRecords).ShowDialog();
|
||||
new Results.Forms.MoreWMResultsDlg(wm, refRecords).ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void flowLayoutPanel_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
lastSizeChange = DateTime.Now;
|
||||
}
|
||||
|
||||
private void OnTimer(object source, EventArgs e)
|
||||
{
|
||||
if (DateTime.Compare(lastSizeChange, lastRedraw) > 0)
|
||||
{
|
||||
/// The last size change was more recent then the last redraw
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
if (DateTime.Compare(lastSizeChange + new TimeSpan(0, 0, 1), now) < 0)
|
||||
{
|
||||
/// More then 1 second since the last panel size change
|
||||
|
||||
/// Calculate geometry
|
||||
int oneWidth;
|
||||
int oneHeight;
|
||||
///
|
||||
if (MetersArrangement == MetersArrangement.Horizontally)
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / metersInOneGroup - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / nrGroups - 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
|
||||
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / nrGroups - 6);
|
||||
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
|
||||
}
|
||||
|
||||
/// Update size of controls
|
||||
flowLayoutPanel.SuspendLayout();
|
||||
///
|
||||
foreach (var oneCtrl in wmRsltsCtrl)
|
||||
{
|
||||
oneCtrl.Width = oneWidth;
|
||||
oneCtrl.Height = oneHeight;
|
||||
}
|
||||
///
|
||||
flowLayoutPanel.ResumeLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+15
-5
@@ -39,7 +39,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;FILIPINY_50;STABLE_MASS_EXTRAS</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;PETERSBURG_50;LANG_RU;STABLE_MASS_EXTRAS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
@@ -49,7 +49,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;FILIPINY_50;STABLE_MASS_EXTRAS</DefineConstants>
|
||||
<DefineConstants>TRACE;PETERSBURG_50;LANG_RU;STABLE_MASS_EXTRAS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -58,7 +58,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;FILIPINY_50;STABLE_MASS_EXTRAS</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;PETERSBURG_50;LANG_RU;STABLE_MASS_EXTRAS</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
@@ -67,7 +67,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;FILIPINY_50;STABLE_MASS_EXTRAS</DefineConstants>
|
||||
<DefineConstants>TRACE;PETERSBURG_50;LANG_RU;STABLE_MASS_EXTRAS</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -98,7 +98,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ControlComponent3U">
|
||||
<HintPath>..\packages\ControlBoard\Filipiny50\ControlComponent3U.dll</HintPath>
|
||||
<HintPath>..\packages\ControlBoard\Peterburg50\ControlComponent3U.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FluentNHibernate">
|
||||
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
|
||||
@@ -1467,6 +1467,13 @@
|
||||
<Compile Include="BenchControl\TestMethods\PulsesTest\WMPulsesForm24.designer.cs">
|
||||
<DependentUpon>WMPulsesForm24.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\TestMethods\Q2CorrectionFromHistory\Component.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\Q2CorrectionFromHistory\Factory.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\Q2CorrectionFromHistory\FromHistoryCfg.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\Q2CorrectionFromHistory\FromHistoryCfgCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\TestMethods\Q2CorrectionFromHistory\FromHistorySeq.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\SensitivityTest\SensitivityTestSeq.cs" />
|
||||
<Compile Include="BenchControl\TestMethods\SensitivityTest\TestMethodCfgCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
@@ -2897,6 +2904,9 @@
|
||||
<EmbeddedResource Include="BenchControl\TestMethods\PulsesTest\WMPulsesForm24.resx">
|
||||
<DependentUpon>WMPulsesForm24.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="BenchControl\TestMethods\Q2CorrectionFromHistory\FromHistoryCfgCtrl.resx">
|
||||
<DependentUpon>FromHistoryCfgCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="BenchControl\TestMethods\RoiDetection\RoiDetectionCfgCtrl.resx">
|
||||
<DependentUpon>RoiDetectionCfgCtrl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@@ -235,9 +235,8 @@ namespace TBF.UiControls
|
||||
private void startCycleBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.StartCycle); }
|
||||
private void stopBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.Stop); }
|
||||
private void purgeBeginBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.PurgeBegin); }
|
||||
private void purgeEndBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.PurgeEnd); }
|
||||
private void breakBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.Break); }
|
||||
private void resetResultsBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.ResetResults); }
|
||||
private void purgeEndBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.PurgeEnd); }
|
||||
private void resetResultsBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.ResetResults); }
|
||||
private void acceptResultsBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.AcceptResults); }
|
||||
private void cameraTestBtn_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.CameraTest); }
|
||||
private void sensitivityTestBtn_Click(object sender, EventArgs e){ Bridge.Ui2Bench(UI2BenchCmd.SensitivityTest); }
|
||||
@@ -245,6 +244,17 @@ namespace TBF.UiControls
|
||||
private void button2_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.B2); }
|
||||
private void nextButton_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.Next); }
|
||||
private void customButton_Click(object sender, EventArgs e) { Bridge.Ui2Bench(UI2BenchCmd.Custom); }
|
||||
|
||||
private void breakBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show(Strings.Do_you_really_want_to_abort_this_session + Environment.NewLine + Strings.Test_results_will_be_lost,
|
||||
Strings.Warning,
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Exclamation) == DialogResult.Yes)
|
||||
{
|
||||
Bridge.Ui2Bench(UI2BenchCmd.Break);
|
||||
}
|
||||
}
|
||||
|
||||
private void emptyTank1Btn_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -33,6 +33,10 @@ namespace Users
|
||||
Administrators, // application / network / database administrator
|
||||
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
|
||||
TraceabilityManagement,
|
||||
#endif
|
||||
#if KEMPNO_50
|
||||
MetrologicalAuthority,
|
||||
WaterMeterAuthority,
|
||||
#endif
|
||||
NrOfGroups, // Number of groups (this is not a GroupID)
|
||||
None, // Not a GroupID, can be used to indicate no group membership is required
|
||||
@@ -57,6 +61,10 @@ namespace Users
|
||||
case GID.Administrators: return Strings.administrator;
|
||||
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
|
||||
case GID.TraceabilityManagement: return Strings.production_tracing_administrator;
|
||||
#endif
|
||||
#if KEMPNO_50
|
||||
case GID.MetrologicalAuthority: return Strings.metrological_authority;
|
||||
case GID.WaterMeterAuthority: return Strings.water_meter_authority;
|
||||
#endif
|
||||
default: return Strings.invalid;
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.18.1280.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1280.0")]
|
||||
[assembly: AssemblyVersion("2.18.1302.0")]
|
||||
[assembly: AssemblyFileVersion("2.18.1302.0")]
|
||||
|
||||
Generated
+18
@@ -240,6 +240,15 @@ namespace Users.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to metrological authority.
|
||||
/// </summary>
|
||||
internal static string metrological_authority {
|
||||
get {
|
||||
return ResourceManager.GetString("metrological_authority", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to metrologist.
|
||||
/// </summary>
|
||||
@@ -419,5 +428,14 @@ namespace Users.Resources {
|
||||
return ResourceManager.GetString("Warning", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to water meter authority.
|
||||
/// </summary>
|
||||
internal static string water_meter_authority {
|
||||
get {
|
||||
return ResourceManager.GetString("water_meter_authority", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,4 +237,10 @@
|
||||
<data name="production_tracing_administrator" xml:space="preserve">
|
||||
<value>production tracing administrator</value>
|
||||
</data>
|
||||
<data name="metrological_authority" xml:space="preserve">
|
||||
<value>metrological authority</value>
|
||||
</data>
|
||||
<data name="water_meter_authority" xml:space="preserve">
|
||||
<value>water meter authority</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user