DataEntry.Uni component added, DEUni column items in summary results, ver. 2.33.2064
This commit is contained in:
parent
66b463c468
commit
d2631c8c88
@ -24,6 +24,8 @@ namespace Results.Entities
|
|||||||
public virtual int UserNumber { get; set; }
|
public virtual int UserNumber { get; set; }
|
||||||
public virtual string ProcedureName { get; set; }
|
public virtual string ProcedureName { get; set; }
|
||||||
public virtual bool IsRemoteProcedure { get; set; } /// Stara Tura, not mapped to DB
|
public virtual bool IsRemoteProcedure { get; set; } /// Stara Tura, not mapped to DB
|
||||||
|
public virtual string PurchaseOrder { get; set; } /// Stara Tura, Nanjing, not mapped to DB
|
||||||
|
public virtual string Workflow { get; set; } /// Stara Tura, Nanjing, not mapped to DB
|
||||||
public virtual string ProcedureDescription { get; set; } /// CEVAK, not mapped to DB
|
public virtual string ProcedureDescription { get; set; } /// CEVAK, not mapped to DB
|
||||||
public virtual int ProcedureRevision { get; set; }
|
public virtual int ProcedureRevision { get; set; }
|
||||||
public virtual string WatermetersStr { get; set; } /// CEVAK, not mapped to DB
|
public virtual string WatermetersStr { get; set; } /// CEVAK, not mapped to DB
|
||||||
|
|||||||
@ -109,6 +109,12 @@ namespace Results.Entities
|
|||||||
///
|
///
|
||||||
/// Wrappers
|
/// Wrappers
|
||||||
///
|
///
|
||||||
|
public virtual string GetEndStateAux() { return Compound() ? EndStateAux : string.Empty; }
|
||||||
|
public virtual void SetEndStateAux(string s) { if (Compound()) EndStateAux = s; }
|
||||||
|
|
||||||
|
public virtual string GetStartState() { return Compound() ? string.Empty : EndStateAux; }
|
||||||
|
public virtual void SetStartState(string s) { if (!Compound()) EndStateAux = s; }
|
||||||
|
|
||||||
public virtual string ProductName() { return WaterMeterData.ProductName; }
|
public virtual string ProductName() { return WaterMeterData.ProductName; }
|
||||||
public virtual string Producer() { return WaterMeterData.Producer; }
|
public virtual string Producer() { return WaterMeterData.Producer; }
|
||||||
public virtual string MetrologicalClass() { return WaterMeterData.MetrologicalClass; }
|
public virtual string MetrologicalClass() { return WaterMeterData.MetrologicalClass; }
|
||||||
|
|||||||
@ -231,6 +231,27 @@ namespace TBF
|
|||||||
public string LastText3;
|
public string LastText3;
|
||||||
public string LastRemark;
|
public string LastRemark;
|
||||||
|
|
||||||
|
/// DataEntry.Uni history
|
||||||
|
public string[] LastBgComm1;
|
||||||
|
public string[] LastBgComm2;
|
||||||
|
public string[] LastBgComm3;
|
||||||
|
///
|
||||||
|
public string[] LastBgColA;
|
||||||
|
public string[] LastBgColB;
|
||||||
|
public string[] LastBgColC;
|
||||||
|
public string[] LastBgColD;
|
||||||
|
public string[] LastBgColE;
|
||||||
|
///
|
||||||
|
public string[] LastEnComm1;
|
||||||
|
public string[] LastEnComm2;
|
||||||
|
public string[] LastEnComm3;
|
||||||
|
///
|
||||||
|
public string[] LastEnColA;
|
||||||
|
public string[] LastEnColB;
|
||||||
|
public string[] LastEnColC;
|
||||||
|
public string[] LastEnColD;
|
||||||
|
public string[] LastEnColE;
|
||||||
|
|
||||||
/// Purchase order history
|
/// Purchase order history
|
||||||
public string[] PurchaseOrderHistory;
|
public string[] PurchaseOrderHistory;
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
|
|||||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("2.33.2061.0")]
|
[assembly: AssemblyVersion("2.33.2064.0")]
|
||||||
[assembly: AssemblyFileVersion("2.33.2061.0")]
|
[assembly: AssemblyFileVersion("2.33.2064.0")]
|
||||||
|
|||||||
95
TBF/Rig/DataEntry/DEItem.cs
Normal file
95
TBF/Rig/DataEntry/DEItem.cs
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Common;
|
||||||
|
|
||||||
|
namespace TBF.Rig.DataEntry
|
||||||
|
{
|
||||||
|
///
|
||||||
|
/// Ac = Action
|
||||||
|
///
|
||||||
|
public enum Ac
|
||||||
|
{
|
||||||
|
[Description("Clear")] Clear, /// Clear when the form is open, save on OK
|
||||||
|
[Description("Last from history")] HistoryLast,
|
||||||
|
[Description("Load")] Load, /// Load from water meters when the form is open, save on OK
|
||||||
|
[Description("Load (readonly)")] LoadReadOnly, /// Load from water meters when the form is open, prevent changes, do not save
|
||||||
|
Count,
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Ct = Content
|
||||||
|
///
|
||||||
|
public enum Ct
|
||||||
|
{
|
||||||
|
[Description("None")] None,
|
||||||
|
[Description("Serial nr.")] SerialNr,
|
||||||
|
[Description("Serial nr. aux")] SerialNrAux,
|
||||||
|
[Description("Radio address")] RadioAddress,
|
||||||
|
[Description("Year of calibration")] YearOfCalibration,
|
||||||
|
[Description("Start state")] StartState,
|
||||||
|
[Description("End state")] EndState,
|
||||||
|
[Description("Archive path")] ArchivePath,
|
||||||
|
[Description("WM Order")] WmOrder,
|
||||||
|
[Description("Batch order")] BatchOrder,
|
||||||
|
[Description("Batch and WM order")] BatchAndWmOrder,
|
||||||
|
[Description("WM Remark")] WmRemark,
|
||||||
|
[Description("Batch remark")] BatchRemark,
|
||||||
|
[Description("Batch and WM remark")] BatchAndWmRemark,
|
||||||
|
#if ORACLE_DB
|
||||||
|
[Description("Prefix")] Prefix,
|
||||||
|
[Description("Suffix")] Suffix,
|
||||||
|
#endif
|
||||||
|
Count
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DEItem
|
||||||
|
{
|
||||||
|
public readonly Ct Content;
|
||||||
|
public readonly string Caption;
|
||||||
|
public readonly Ac Action;
|
||||||
|
public readonly int Width;
|
||||||
|
|
||||||
|
public DEItem(Ct content, string caption, Ac action, int width)
|
||||||
|
{
|
||||||
|
Content = content;
|
||||||
|
Caption = caption;
|
||||||
|
Action = action;
|
||||||
|
Width = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static IList<DEItem> items = new List<DEItem>();
|
||||||
|
///
|
||||||
|
public static void ClearItems() { items.Clear(); }
|
||||||
|
public static void AddItem(DEItem item) { items.Add(item); }
|
||||||
|
public static void AddItem(Ct content, string caption, Ac action, int width)
|
||||||
|
{
|
||||||
|
items.Add(new DEItem(content, caption, action, width));
|
||||||
|
}
|
||||||
|
public static IList<DEItem> GetItems() { return items; }
|
||||||
|
|
||||||
|
|
||||||
|
static IList<DEItem> columns = new List<DEItem>();
|
||||||
|
///
|
||||||
|
public static void ClearColumns() { columns.Clear(); }
|
||||||
|
public static void AddColumn(DEItem column) { columns.Add(column); }
|
||||||
|
public static void AddColumn(Ct content, string caption, Ac action, int width)
|
||||||
|
{
|
||||||
|
columns.Add(new DEItem(content, caption, action, width));
|
||||||
|
}
|
||||||
|
public static IList<DEItem> GetColumns() { return columns; }
|
||||||
|
|
||||||
|
|
||||||
|
static IList<DEItem> summaryColumns = new List<DEItem>();
|
||||||
|
///
|
||||||
|
public static void ClearSummaryColumns() { summaryColumns.Clear(); }
|
||||||
|
public static void AddSummaryColumn(DEItem column) { summaryColumns.Add(column); }
|
||||||
|
public static void AddSummaryColumn(Ct content, string caption, Ac action, int width)
|
||||||
|
{
|
||||||
|
summaryColumns.Add(new DEItem(content, caption, action, width));
|
||||||
|
}
|
||||||
|
public static IList<DEItem> GetSummaryColumns() { return summaryColumns; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,13 +1,85 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2018 Sensus Slovensko a.s.
|
/// Copyright (c) 2018-2023 Sensus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using System;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Results.Entities;
|
||||||
|
|
||||||
namespace TBF.Rig.DataEntry
|
namespace TBF.Rig.DataEntry
|
||||||
{
|
{
|
||||||
public class DEUtils
|
public class DEUtils
|
||||||
{
|
{
|
||||||
|
public static string GetContent(Ct content, WaterMeter wm)
|
||||||
|
{
|
||||||
|
if (wm == null) return string.Empty;
|
||||||
|
|
||||||
|
switch (content)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case Ct.None: return string.Empty;
|
||||||
|
case Ct.SerialNr: return (!wm.Disabled && wm.SerialNr != null) ? wm.SerialNr : string.Empty;
|
||||||
|
case Ct.SerialNrAux: return (!wm.Disabled && wm.SerialNrAux != null) ? wm.SerialNrAux : string.Empty;
|
||||||
|
case Ct.RadioAddress: return (!wm.Disabled && wm.RadioAddress != null) ? wm.RadioAddress : string.Empty;
|
||||||
|
case Ct.YearOfCalibration: return (!wm.Disabled) ? wm.YearOfProduction.ToString() : string.Empty;
|
||||||
|
case Ct.StartState: return (!wm.Disabled && wm.GetStartState() != null) ? wm.GetStartState() : string.Empty;
|
||||||
|
case Ct.EndState: return (!wm.Disabled && wm.EndState != null) ? wm.EndState : string.Empty;
|
||||||
|
case Ct.ArchivePath: return (!wm.Disabled && wm.ArchivePath != null) ? wm.ArchivePath : string.Empty;
|
||||||
|
|
||||||
|
case Ct.WmOrder: return (!wm.Disabled && wm.PurchaseOrder != null) ? wm.PurchaseOrder : string.Empty;
|
||||||
|
case Ct.BatchOrder: return (wm.Batch != null && wm.Batch.PurchaseOrder != null) ? wm.Batch.PurchaseOrder : string.Empty;
|
||||||
|
case Ct.BatchAndWmOrder: return (wm.Batch != null && wm.Batch.PurchaseOrder != null) ? wm.Batch.PurchaseOrder : string.Empty;
|
||||||
|
|
||||||
|
case Ct.WmRemark: return (!wm.Disabled && wm.Remark != null) ? wm.Remark : string.Empty;
|
||||||
|
case Ct.BatchRemark: return (wm.Batch != null && wm.Batch.Remark != null) ? wm.Batch.Remark : string.Empty;
|
||||||
|
case Ct.BatchAndWmRemark: return (wm.Batch != null && wm.Batch.Remark != null) ? wm.Batch.Remark : string.Empty;
|
||||||
|
#if ORACLE_DB
|
||||||
|
case Ct.Prefix: return (!wm.Disabled && wm.Prefix != null) ? wm.Prefix : string.Empty;
|
||||||
|
case Ct.Suffix: return (!wm.Disabled && wm.Suffix != null) ? wm.Suffix : string.Empty;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void PutContent(Ct content, WaterMeter wm, string value)
|
||||||
|
{
|
||||||
|
if (wm == null || wm.Disabled) return;
|
||||||
|
|
||||||
|
int year;
|
||||||
|
|
||||||
|
switch (content)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case Ct.None: return;
|
||||||
|
case Ct.SerialNr: wm.SerialNr = value; return;
|
||||||
|
case Ct.SerialNrAux: wm.SerialNrAux = value; return;
|
||||||
|
case Ct.RadioAddress: wm.RadioAddress = value; return;
|
||||||
|
case Ct.YearOfCalibration: if (int.TryParse(value, out year)) wm.YearOfProduction = year; return;
|
||||||
|
case Ct.StartState: wm.SetStartState(value); return;
|
||||||
|
case Ct.EndState: wm.EndState = value; return;
|
||||||
|
case Ct.ArchivePath: wm.ArchivePath = value; return;
|
||||||
|
|
||||||
|
case Ct.WmOrder:
|
||||||
|
wm.PurchaseOrder = value;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case Ct.BatchOrder:
|
||||||
|
case Ct.BatchAndWmOrder:
|
||||||
|
if (wm.Batch != null) wm.Batch.PurchaseOrder = value;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case Ct.WmRemark:
|
||||||
|
wm.Remark = value;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case Ct.BatchRemark:
|
||||||
|
case Ct.BatchAndWmRemark:
|
||||||
|
if (wm.Batch != null) wm.Batch.Remark = value;
|
||||||
|
return;
|
||||||
|
#if ORACLE_DB
|
||||||
|
case Ct.Prefix: wm.Prefix = value; return;
|
||||||
|
case Ct.Suffix: wm.Suffix = value; return;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
|
/// Load Purchase order combo box items from the LocalSettings PurchaseOrderHistory array
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
736
TBF/Rig/DataEntry/Uni/CycleBgEnForm.cs
Normal file
736
TBF/Rig/DataEntry/Uni/CycleBgEnForm.cs
Normal file
@ -0,0 +1,736 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using log4net;
|
||||||
|
using Results.Entities;
|
||||||
|
using TBF.Resources;
|
||||||
|
|
||||||
|
namespace TBF.Rig.DataEntry.Uni
|
||||||
|
{
|
||||||
|
public partial class CycleBgEnForm : Form, GenericDevices.IHasCompleted
|
||||||
|
{
|
||||||
|
private static readonly ILog log = LogManager.GetLogger(typeof(CycleBgEnForm));
|
||||||
|
|
||||||
|
/// Arguments
|
||||||
|
public readonly IList<WaterMeter> WaterMeters;
|
||||||
|
readonly int lineSize;
|
||||||
|
readonly Sz sz;
|
||||||
|
readonly bool isLrOrder; /// true = controls obtain focus after ENTER key in left-right order, false = top-down order
|
||||||
|
readonly IList<DEItem> commonItems;
|
||||||
|
readonly IList<DEItem> colItems;
|
||||||
|
readonly bool isEnd;
|
||||||
|
readonly string formCloseKeys;
|
||||||
|
|
||||||
|
/// Derived from arguments in the constructor
|
||||||
|
readonly WaterMeter firstValidWM;
|
||||||
|
readonly int wmsCount;
|
||||||
|
readonly int linesCount;
|
||||||
|
readonly int commonItemsCount;
|
||||||
|
|
||||||
|
/// Size and layout related values
|
||||||
|
readonly Font font;
|
||||||
|
readonly int meterHeight;
|
||||||
|
readonly int meterWidth;
|
||||||
|
readonly int margin;
|
||||||
|
readonly int spacing;
|
||||||
|
readonly int buttonsWidth;
|
||||||
|
readonly int hdrHeight;
|
||||||
|
readonly int labelWid;
|
||||||
|
readonly int checkBoxWid;
|
||||||
|
|
||||||
|
/// UI elements
|
||||||
|
readonly Label[] commonLabels;
|
||||||
|
readonly ComboBox[] commonComboBoxes;
|
||||||
|
readonly Label[] labels; /// Labels for water meter numbers
|
||||||
|
readonly ComboBox[,] comboBoxes; /// Combo boxes for values in columns
|
||||||
|
readonly CheckBox[] checkBoxes; /// Check boxes for water meter enable/disable
|
||||||
|
|
||||||
|
readonly LocalSettings ls;
|
||||||
|
|
||||||
|
bool isHandlersEnabled; /// Initially false, set to true after ComboBoxes are filled with data
|
||||||
|
|
||||||
|
/// Set to 'true' when the form closes
|
||||||
|
public bool Completed { get { return completed; } }
|
||||||
|
bool completed;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parameterless constructor for common functionality
|
||||||
|
/// </summary>
|
||||||
|
public CycleBgEnForm()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
ControlBox = false;
|
||||||
|
completed = false;
|
||||||
|
StartForceCloseHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="waterMeters">Water meters</param>
|
||||||
|
/// <param name="lineSize">Number of water meters in one (test bencch) line</param>
|
||||||
|
/// <param name="title">Form title</param>
|
||||||
|
/// <param name="sz">Font size</param>
|
||||||
|
/// <param name="isLrOrder">true = controls obtain focus in left-right order, forls = top-down order</param>
|
||||||
|
/// <param name="formCloseKeys">String containing keys to close this form</param>
|
||||||
|
/// <param name="commonItems">Common items displayed in the upper part of the form</param>
|
||||||
|
/// <param name="colItems">Water meter items displayed in columns (in the matrix in the main part of the form)</param>
|
||||||
|
/// <param name="isEnd">true = This form is displayed at the end of cycle</param>
|
||||||
|
public CycleBgEnForm(IList<WaterMeter> waterMeters, int lineSize, string title, Sz sz, bool isLrOrder, string formCloseKeys,
|
||||||
|
IList<DEItem> commonItems, IList<DEItem> colItems, bool isEnd = false)
|
||||||
|
: this()
|
||||||
|
{
|
||||||
|
/// Arguments
|
||||||
|
this.WaterMeters = waterMeters;
|
||||||
|
this.lineSize = lineSize;
|
||||||
|
this.Text = !string.IsNullOrEmpty(title) ? title : string.Empty;
|
||||||
|
this.sz = sz;
|
||||||
|
this.isLrOrder = isLrOrder;
|
||||||
|
this.formCloseKeys = !string.IsNullOrEmpty(formCloseKeys) ? formCloseKeys : string.Empty;
|
||||||
|
this.commonItems = commonItems;
|
||||||
|
this.colItems = colItems;
|
||||||
|
this.isEnd = isEnd;
|
||||||
|
|
||||||
|
/// Preserve column items for use in SummaryResults
|
||||||
|
if (!isEnd)
|
||||||
|
{
|
||||||
|
/// cycle beginning
|
||||||
|
DEItem.ClearSummaryColumns();
|
||||||
|
foreach (var it in colItems) if (it.Content != Ct.SerialNr) DEItem.AddSummaryColumn(it);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/// cycle end
|
||||||
|
foreach (var it in colItems) if (it.Content != Ct.SerialNr) DEItem.AddSummaryColumn(it);
|
||||||
|
}
|
||||||
|
|
||||||
|
ls = Program.LocalSettings;
|
||||||
|
|
||||||
|
/// Readonly variables derived from arguments
|
||||||
|
commonItemsCount = (commonItems == null) ? 0 : commonItems.Count;
|
||||||
|
wmsCount = (waterMeters == null) ? 0 : waterMeters.Count;
|
||||||
|
linesCount = (wmsCount + Math.Max(1, lineSize) - 1) / Math.Max(1, lineSize);
|
||||||
|
firstValidWM = (waterMeters != null) ? waterMeters.FirstOrDefault(x => (x != null && !x.Disabled)) : null;
|
||||||
|
///
|
||||||
|
commonLabels = new Label[commonItemsCount];
|
||||||
|
commonComboBoxes = new ComboBox[commonItemsCount];
|
||||||
|
labels = new Label[wmsCount];
|
||||||
|
comboBoxes = new ComboBox[colItems.Count, wmsCount];
|
||||||
|
checkBoxes = new CheckBox[wmsCount];
|
||||||
|
|
||||||
|
/// Layout related readonly variables derived from argument 'sz'
|
||||||
|
switch (sz)
|
||||||
|
{
|
||||||
|
case Sz.S:
|
||||||
|
font = new Font("Verdana", 12, FontStyle.Regular);
|
||||||
|
meterHeight = 26; /// Height of a ComboBox control
|
||||||
|
margin = 20;
|
||||||
|
spacing = 8;
|
||||||
|
buttonsWidth = 350;
|
||||||
|
hdrHeight = 120;
|
||||||
|
labelWid = 31;
|
||||||
|
checkBoxWid = 23;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
case Sz.M:
|
||||||
|
font = new Font("Verdana", 14, FontStyle.Regular);
|
||||||
|
meterHeight = 31; /// Height of a ComboBox control
|
||||||
|
margin = 25;
|
||||||
|
spacing = 10;
|
||||||
|
buttonsWidth = 350;
|
||||||
|
hdrHeight = 140;
|
||||||
|
labelWid = 34;
|
||||||
|
checkBoxWid = 23;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Sz.L:
|
||||||
|
font = new Font("Verdana", 18, FontStyle.Regular);
|
||||||
|
meterHeight = 37; /// Height of a ComboBox control
|
||||||
|
margin = 30;
|
||||||
|
spacing = 12;
|
||||||
|
buttonsWidth = 350;
|
||||||
|
hdrHeight = 160;
|
||||||
|
labelWid = 40;
|
||||||
|
checkBoxWid = 23;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
meterWidth = labelWid + checkBoxWid + spacing;
|
||||||
|
foreach (var ci in colItems) { meterWidth += ci.Width + spacing; }
|
||||||
|
|
||||||
|
int tabIndex = 1;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Group box with common items
|
||||||
|
///
|
||||||
|
int groupBoxWidth = 0;
|
||||||
|
int groupBoxHeight = 0;
|
||||||
|
if (commonItemsCount > 0)
|
||||||
|
{
|
||||||
|
var groupBox = new GroupBox();
|
||||||
|
|
||||||
|
int labelsWidth = 0;
|
||||||
|
for (int ix = 0; ix < commonItemsCount; ix++)
|
||||||
|
{
|
||||||
|
int oneLabelWidth = Convert.ToInt32(Graphics.FromImage(new Bitmap(1, 1)).MeasureString(commonItems[ix].Caption, font).Width);
|
||||||
|
var oneLabel = new Label
|
||||||
|
{
|
||||||
|
Text = commonItems[ix].Caption,
|
||||||
|
Font = font,
|
||||||
|
Location = new Point(margin, (ix + 2) * spacing + ix * meterHeight),
|
||||||
|
Size = new Size(oneLabelWidth + spacing, meterHeight),
|
||||||
|
TextAlign = ContentAlignment.MiddleLeft,
|
||||||
|
TabIndex = tabIndex++,
|
||||||
|
Parent = groupBox,
|
||||||
|
};
|
||||||
|
groupBox.Controls.Add(oneLabel);
|
||||||
|
labelsWidth = Math.Max(labelsWidth, oneLabelWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
int combosWidth = 0;
|
||||||
|
for (int ix = 0; ix < commonItemsCount; ix++)
|
||||||
|
{
|
||||||
|
var cb = new ComboBox
|
||||||
|
{
|
||||||
|
Name = string.Format("-1~{0}", ix + 1),
|
||||||
|
Location = new Point(margin + spacing + labelsWidth, (ix + 2) * spacing + ix * meterHeight),
|
||||||
|
Size = new Size(commonItems[ix].Width, meterHeight),
|
||||||
|
Enabled = (commonItems[ix].Action != Ac.LoadReadOnly),
|
||||||
|
Font = font,
|
||||||
|
TabIndex = tabIndex++,
|
||||||
|
Parent = groupBox,
|
||||||
|
};
|
||||||
|
|
||||||
|
cb.SelectedIndexChanged += new System.EventHandler(comboBox_SelectedIndexChanged);
|
||||||
|
cb.TextChanged += new System.EventHandler(comboBox_TextChanged);
|
||||||
|
cb.KeyPress += new System.Windows.Forms.KeyPressEventHandler(comboBox_KeyPress);
|
||||||
|
|
||||||
|
switch (ix)
|
||||||
|
{
|
||||||
|
case 0: AddHistoryToCombo(cb, isEnd ? ls.LastEnComm1 : ls.LastBgComm1); break;
|
||||||
|
case 1: AddHistoryToCombo(cb, isEnd ? ls.LastEnComm2 : ls.LastBgComm2); break;
|
||||||
|
case 2: AddHistoryToCombo(cb, isEnd ? ls.LastEnComm3 : ls.LastBgComm3); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
commonComboBoxes[ix] = cb;
|
||||||
|
groupBox.Controls.Add(cb);
|
||||||
|
combosWidth = Math.Max(combosWidth, commonItems[ix].Width);
|
||||||
|
}
|
||||||
|
///
|
||||||
|
groupBox.Location = new Point(margin, margin - spacing);
|
||||||
|
groupBoxWidth = labelsWidth + combosWidth + 2 * margin + spacing;
|
||||||
|
groupBoxHeight = commonItemsCount * meterHeight + (commonItemsCount + 2) * spacing;
|
||||||
|
groupBox.Size = new Size(groupBoxWidth, groupBoxHeight);
|
||||||
|
groupBox.Font = font;
|
||||||
|
groupBox.TabIndex = tabIndex++;
|
||||||
|
groupBox.Parent = this;
|
||||||
|
this.Controls.Add(groupBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Table
|
||||||
|
///
|
||||||
|
int columnsTop = Math.Max(hdrHeight, groupBoxHeight + 2 * margin + spacing);
|
||||||
|
for (int j = 0; j < linesCount; j++)
|
||||||
|
{
|
||||||
|
/// Captions
|
||||||
|
int capX = margin + j * (meterWidth + margin / 2) + labelWid + spacing;
|
||||||
|
int capY = columnsTop - meterHeight;
|
||||||
|
for (int k = 0; k < colItems.Count; k++)
|
||||||
|
{
|
||||||
|
int labelWidth = Convert.ToInt32(Graphics.FromImage(new Bitmap(1, 1)).MeasureString(colItems[k].Caption, font).Width);
|
||||||
|
var label = new Label
|
||||||
|
{
|
||||||
|
Text = colItems[k].Caption,
|
||||||
|
Location = new Point(capX, capY),
|
||||||
|
Size = new Size(labelWidth + spacing, meterHeight),
|
||||||
|
Font = font,
|
||||||
|
TabIndex = tabIndex++,
|
||||||
|
Parent = this,
|
||||||
|
};
|
||||||
|
capX += colItems[k].Width + spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Water meters
|
||||||
|
for (int i = 0; i < lineSize; i++)
|
||||||
|
{
|
||||||
|
int wmPos0 = i + lineSize * j;
|
||||||
|
if (wmPos0 > wmsCount) continue;
|
||||||
|
|
||||||
|
int left = margin + j * (meterWidth + margin / 2);
|
||||||
|
int top = columnsTop + i * (meterHeight + spacing);
|
||||||
|
|
||||||
|
var label = new Label
|
||||||
|
{
|
||||||
|
Text = (wmPos0 + 1).ToString(),
|
||||||
|
Location = new Point(left, top),
|
||||||
|
Size = new Size(labelWid, meterHeight),
|
||||||
|
Font = font,
|
||||||
|
TextAlign = ContentAlignment.MiddleLeft,
|
||||||
|
TabIndex = tabIndex++,
|
||||||
|
Parent = this,
|
||||||
|
};
|
||||||
|
left += labelWid + spacing / 2;
|
||||||
|
labels[wmPos0] = label;
|
||||||
|
this.Controls.Add(label);
|
||||||
|
|
||||||
|
/// Columns
|
||||||
|
for (int k = 0; k < colItems.Count; k++)
|
||||||
|
{
|
||||||
|
DEItem ci = colItems[k];
|
||||||
|
var comboBox = new ComboBox
|
||||||
|
{
|
||||||
|
Name = string.Format("{0}~{1}", k, wmPos0),
|
||||||
|
Location = new Point(left, top),
|
||||||
|
Size = new Size(ci.Width, meterHeight),
|
||||||
|
Enabled = (ci.Action != Ac.LoadReadOnly && !waterMeters[wmPos0].Disabled),
|
||||||
|
Font = font,
|
||||||
|
TabIndex = tabIndex++,
|
||||||
|
Parent = this,
|
||||||
|
};
|
||||||
|
|
||||||
|
comboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedIndexChanged);
|
||||||
|
comboBox.TextChanged += new System.EventHandler(this.comboBox_TextChanged);
|
||||||
|
comboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox_KeyPress);
|
||||||
|
|
||||||
|
var lastVals = GetHistoryFromLS(isEnd, k);
|
||||||
|
comboBox.Items.Add(lastVals.Length > wmPos0 ? lastVals[wmPos0] : string.Empty); /// History in drop-down menu
|
||||||
|
|
||||||
|
left += ci.Width + spacing;
|
||||||
|
comboBoxes[k, wmPos0] = comboBox;
|
||||||
|
this.Controls.Add(comboBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
var checkBox = new CheckBox
|
||||||
|
{
|
||||||
|
Location = new Point(left, top + 6),
|
||||||
|
Size = new Size(checkBoxWid, 23),
|
||||||
|
TabIndex = tabIndex++,
|
||||||
|
Parent = this,
|
||||||
|
};
|
||||||
|
checkBoxes[wmPos0] = checkBox;
|
||||||
|
this.Controls.Add(checkBox);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Adjust window size
|
||||||
|
///
|
||||||
|
Rectangle screenRectangle = this.RectangleToScreen(this.ClientRectangle);
|
||||||
|
int titleBarHeight = screenRectangle.Top - this.Top;
|
||||||
|
Size = new Size(Math.Max(meterWidth * linesCount + margin * (linesCount + 1), margin + groupBoxWidth + buttonsWidth),
|
||||||
|
titleBarHeight + columnsTop + lineSize * (meterHeight + spacing) + margin);
|
||||||
|
|
||||||
|
Localize();
|
||||||
|
InitializeBoxes();
|
||||||
|
|
||||||
|
/// Set focus to the first enabled ComboBox
|
||||||
|
bool activeControlFound = false;
|
||||||
|
for (int ix = 0; ix < commonItemsCount; ix++)
|
||||||
|
{
|
||||||
|
if (commonComboBoxes[ix].Enabled)
|
||||||
|
{
|
||||||
|
ActiveControl = commonComboBoxes[ix];
|
||||||
|
activeControlFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!activeControlFound)
|
||||||
|
{
|
||||||
|
/// Initialize k,j so that after the 1st increment k = 0 and j = 0
|
||||||
|
int k, j;
|
||||||
|
if (isLrOrder) { k = -1; j = 0; }
|
||||||
|
else { k = 0; j = -1; }
|
||||||
|
|
||||||
|
/// Change focus
|
||||||
|
if (FindNextEnabledCombo(comboBoxes, ref k, ref j, isLrOrder))
|
||||||
|
{
|
||||||
|
ActiveControl = okButton;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ActiveControl = comboBoxes[k, j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add combo box items from a history stored in a string array (obtained usually from LocalSettings)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comboBox">ComboBox to prepare</param>
|
||||||
|
/// <param name="history">String array with a history</param>
|
||||||
|
void AddHistoryToCombo(ComboBox comboBox, string[] history)
|
||||||
|
{
|
||||||
|
if (history != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < history.Length; i++) comboBox.Items.Add(history[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns an array of strings from ls.
|
||||||
|
/// Never returns null, null is converted to new string[0].
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="isEnd">false = Beginning of cycle, true = End of cycle</param>
|
||||||
|
/// <param name="k">Column number (0-based)</param>
|
||||||
|
/// <returns>Array of strings</returns>
|
||||||
|
string[] GetHistoryFromLS(bool isEnd, int k)
|
||||||
|
{
|
||||||
|
if (isEnd)
|
||||||
|
{
|
||||||
|
switch (k)
|
||||||
|
{
|
||||||
|
case 0: if (ls.LastEnColA == null) ls.LastEnColA = new string[0]; return ls.LastEnColA;
|
||||||
|
case 1: if (ls.LastEnColB == null) ls.LastEnColB = new string[0]; return ls.LastEnColB;
|
||||||
|
case 2: if (ls.LastEnColC == null) ls.LastEnColC = new string[0]; return ls.LastEnColC;
|
||||||
|
case 3: if (ls.LastEnColD == null) ls.LastEnColD = new string[0]; return ls.LastEnColD;
|
||||||
|
case 4: if (ls.LastEnColE == null) ls.LastEnColE = new string[0]; return ls.LastEnColE;
|
||||||
|
default: return new string[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (k)
|
||||||
|
{
|
||||||
|
case 0: if (ls.LastBgColA == null) ls.LastBgColA = new string[0]; return ls.LastBgColA;
|
||||||
|
case 1: if (ls.LastBgColB == null) ls.LastBgColB = new string[0]; return ls.LastBgColB;
|
||||||
|
case 2: if (ls.LastBgColC == null) ls.LastBgColC = new string[0]; return ls.LastBgColC;
|
||||||
|
case 3: if (ls.LastBgColD == null) ls.LastBgColD = new string[0]; return ls.LastBgColD;
|
||||||
|
case 4: if (ls.LastBgColE == null) ls.LastBgColE = new string[0]; return ls.LastBgColE;
|
||||||
|
default: return new string[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Localize()
|
||||||
|
{
|
||||||
|
okButton.Text = Strings.OkBtnText;
|
||||||
|
clearButton.Text = Strings.ClearBtnText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize combo boxes state defined by related 'Action'.
|
||||||
|
/// Clear check boxes.
|
||||||
|
/// </summary>
|
||||||
|
void InitializeBoxes()
|
||||||
|
{
|
||||||
|
isHandlersEnabled = false;
|
||||||
|
|
||||||
|
/// Common combo boxes
|
||||||
|
for (int ix = 0; ix < commonItemsCount; ix++)
|
||||||
|
{
|
||||||
|
switch (commonItems[ix].Action)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case Ac.Clear:
|
||||||
|
commonComboBoxes[ix].Text = string.Empty;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Ac.HistoryLast:
|
||||||
|
commonComboBoxes[ix].Text = (commonComboBoxes[ix].Items.Count > 0)
|
||||||
|
? commonComboBoxes[ix].Items[0].ToString()
|
||||||
|
: string.Empty;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Ac.Load:
|
||||||
|
case Ac.LoadReadOnly:
|
||||||
|
commonComboBoxes[ix].Text = DEUtils.GetContent(commonItems[ix].Content, firstValidWM);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Table
|
||||||
|
for (int k = 0; k < colItems.Count; k++)
|
||||||
|
{
|
||||||
|
switch (colItems[k].Action)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case Ac.Clear:
|
||||||
|
for (int i = 0; i < wmsCount; i++) comboBoxes[k, i].Text = string.Empty;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Ac.HistoryLast:
|
||||||
|
for (int i = 0; i < wmsCount; i++)
|
||||||
|
{
|
||||||
|
comboBoxes[k, i].Text = comboBoxes[k, i].Items.Count > 0 ? comboBoxes[k, i].Items[0].ToString() : string.Empty;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Ac.Load:
|
||||||
|
case Ac.LoadReadOnly:
|
||||||
|
for (int i = 0; i < wmsCount; i++)
|
||||||
|
{
|
||||||
|
comboBoxes[k, i].Text = DEUtils.GetContent(colItems[k].Content, WaterMeters[i]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < wmsCount; i++)
|
||||||
|
{
|
||||||
|
checkBoxes[i].Checked = isEnd ? (WaterMeters[i] != null && !WaterMeters[i].Disabled) : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
isHandlersEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When one combo box is updated using drop-down menu, all combo boxes
|
||||||
|
/// are updated by this function.
|
||||||
|
/// </summary>
|
||||||
|
void UpdateWMsFromBoxes()
|
||||||
|
{
|
||||||
|
for (int ix = 0; ix < commonItemsCount; ix++ )
|
||||||
|
{
|
||||||
|
DEUtils.PutContent(commonItems[ix].Content, firstValidWM, commonComboBoxes[ix].Text);
|
||||||
|
if (commonItems[ix].Action != Ac.LoadReadOnly)
|
||||||
|
{
|
||||||
|
if (isEnd)
|
||||||
|
{
|
||||||
|
switch (ix)
|
||||||
|
{
|
||||||
|
case 0: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastEnComm1); break;
|
||||||
|
case 1: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastEnComm2); break;
|
||||||
|
case 2: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastEnComm3); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (ix)
|
||||||
|
{
|
||||||
|
case 0: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastBgComm1); break;
|
||||||
|
case 1: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastBgComm2); break;
|
||||||
|
case 2: ls.UpdateHistory(commonComboBoxes[ix].Text, ref ls.LastBgComm3); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Propagate common (batch) values to water meters in case of
|
||||||
|
/// Content.BatchAndWmOrder, Content.BatchAndWmRemark, Content.YearOfCalibration and Content.ArchivePath
|
||||||
|
///
|
||||||
|
foreach (var wm in WaterMeters)
|
||||||
|
{
|
||||||
|
if (wm != null && !wm.Disabled)
|
||||||
|
{
|
||||||
|
switch (commonItems[ix].Content)
|
||||||
|
{
|
||||||
|
case Ct.BatchAndWmOrder: wm.PurchaseOrder = firstValidWM.Batch.PurchaseOrder; break;
|
||||||
|
case Ct.BatchAndWmRemark: wm.Remark = firstValidWM.Batch.Remark; break;
|
||||||
|
case Ct.YearOfCalibration: wm.YearOfProduction = firstValidWM.YearOfProduction; break;
|
||||||
|
case Ct.ArchivePath: wm.ArchivePath = firstValidWM.ArchivePath; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int k = 0; k < colItems.Count; k++)
|
||||||
|
{
|
||||||
|
/// Store values to water meters and prepare an array for a history in the LocalSettings
|
||||||
|
var currentVals = new string[wmsCount];
|
||||||
|
for (int i = 0; i < wmsCount; i++)
|
||||||
|
{
|
||||||
|
DEUtils.PutContent(colItems[k].Content, WaterMeters[i], comboBoxes[k, i].Text);
|
||||||
|
currentVals[i] = comboBoxes[k, i].Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Update history
|
||||||
|
if (colItems[k].Action != Ac.LoadReadOnly)
|
||||||
|
{
|
||||||
|
if (isEnd)
|
||||||
|
{
|
||||||
|
switch (k)
|
||||||
|
{
|
||||||
|
case 0: ls.LastEnColA = currentVals; break;
|
||||||
|
case 1: ls.LastEnColB = currentVals; break;
|
||||||
|
case 2: ls.LastEnColC = currentVals; break;
|
||||||
|
case 3: ls.LastEnColD = currentVals; break;
|
||||||
|
case 4: ls.LastEnColE = currentVals; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (k)
|
||||||
|
{
|
||||||
|
case 0: ls.LastBgColA = currentVals; break;
|
||||||
|
case 1: ls.LastBgColB = currentVals; break;
|
||||||
|
case 2: ls.LastBgColC = currentVals; break;
|
||||||
|
case 3: ls.LastBgColD = currentVals; break;
|
||||||
|
case 4: ls.LastBgColE = currentVals; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < wmsCount; i++)
|
||||||
|
{
|
||||||
|
if (WaterMeters[i] != null) WaterMeters[i].Disabled = !checkBoxes[i].Checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
InitializeBoxes();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void okButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UpdateWMsFromBoxes();
|
||||||
|
|
||||||
|
completed = true;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
private void comboBox_SelectedIndexChanged(object sndr, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!isHandlersEnabled) return;
|
||||||
|
|
||||||
|
string[] kj = (sndr as ComboBox).Name.Split(new char[] { '~' });
|
||||||
|
int k = int.Parse(kj[0]);
|
||||||
|
int j = int.Parse(kj[1]);
|
||||||
|
|
||||||
|
isHandlersEnabled = false;
|
||||||
|
|
||||||
|
if (k >= 0 && comboBoxes[k, j].Text == comboBoxes[k, j].Items[0].ToString())
|
||||||
|
{
|
||||||
|
for (int i = 0; i < wmsCount; i++)
|
||||||
|
{
|
||||||
|
comboBoxes[k, i].Text = comboBoxes[k, i].Items[0].ToString();
|
||||||
|
if (!string.IsNullOrEmpty(comboBoxes[k, i].Text)) checkBoxes[i].Checked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isHandlersEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void comboBox_KeyPress(object sndr, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
if (!isHandlersEnabled) return;
|
||||||
|
|
||||||
|
string[] kj = (sndr as ComboBox).Name.Split(new char[] { '~' });
|
||||||
|
int k = int.Parse(kj[0]);
|
||||||
|
int j = int.Parse(kj[1]);
|
||||||
|
|
||||||
|
/// Close the form if any 'form close key' was pressed
|
||||||
|
for (int ix = 0; ix < formCloseKeys.Length; ix++)
|
||||||
|
{
|
||||||
|
if (e.KeyChar == formCloseKeys[ix])
|
||||||
|
{
|
||||||
|
okButton_Click(sndr, e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.KeyChar == '\r')
|
||||||
|
{
|
||||||
|
if (k < 0)
|
||||||
|
{
|
||||||
|
for (int ix = j; ix < commonItemsCount; ix++)
|
||||||
|
{
|
||||||
|
if (commonComboBoxes[ix].Enabled)
|
||||||
|
{
|
||||||
|
commonComboBoxes[ix].Focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// No next enabled common item found:
|
||||||
|
/// Initialize k,j so that after the 1st increment k = 0 and j = 0
|
||||||
|
if (isLrOrder) { k = -1; j = 0; }
|
||||||
|
else { k = 0; j = -1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Change focus
|
||||||
|
if (FindNextEnabledCombo(comboBoxes, ref k, ref j, isLrOrder))
|
||||||
|
{
|
||||||
|
okButton.Focus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
comboBoxes[k, j].Focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void comboBox_TextChanged(object sndr, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!isHandlersEnabled) return;
|
||||||
|
|
||||||
|
string[] kj = (sndr as ComboBox).Name.Split(new char[] { '~' });
|
||||||
|
int k = int.Parse(kj[0]);
|
||||||
|
int j = int.Parse(kj[1]);
|
||||||
|
|
||||||
|
if (k >= 0) checkBoxes[j].Checked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find the next enabled combo box, update k and i.
|
||||||
|
/// Return true (=pastTheEndOfArray) when there is no such next combo box.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="comboBoxes">2-dimensional array of combo boxes</param>
|
||||||
|
/// <param name="k">0-nased column </param>
|
||||||
|
/// <param name="i">0-based row</param>
|
||||||
|
/// <param name="isLrOrder">Order of progress to the next combo: true = left-right, false = top-down</param>
|
||||||
|
/// <returns>true (=pastTheEndOfArray) when there is no such next combo box, otherwise false</returns>
|
||||||
|
bool FindNextEnabledCombo(ComboBox[,] comboBoxes, ref int k, ref int i, bool isLrOrder)
|
||||||
|
{
|
||||||
|
bool pastTheEndOfArray = false;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (isLrOrder)
|
||||||
|
{
|
||||||
|
if (++k == comboBoxes.GetLength(0))
|
||||||
|
{
|
||||||
|
k = 0;
|
||||||
|
if (++i == comboBoxes.GetLength(1))
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
pastTheEndOfArray = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (++i == comboBoxes.GetLength(1))
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
if (++k == comboBoxes.GetLength(0))
|
||||||
|
{
|
||||||
|
k = 0;
|
||||||
|
pastTheEndOfArray = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (!comboBoxes[k, i].Enabled);
|
||||||
|
|
||||||
|
return pastTheEndOfArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Forced close handling
|
||||||
|
|
||||||
|
public void StartForceCloseHandler()
|
||||||
|
{
|
||||||
|
UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args); }
|
||||||
|
else OnForceClose(sender, args);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnForceClose(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
75
TBF/Rig/DataEntry/Uni/CycleBgEnForm.designer.cs
generated
Normal file
75
TBF/Rig/DataEntry/Uni/CycleBgEnForm.designer.cs
generated
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
namespace TBF.Rig.DataEntry.Uni
|
||||||
|
{
|
||||||
|
partial class CycleBgEnForm
|
||||||
|
{
|
||||||
|
/// <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 Windows Form 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()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBgEnForm));
|
||||||
|
this.okButton = new System.Windows.Forms.Button();
|
||||||
|
this.clearButton = new System.Windows.Forms.Button();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// okButton
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.okButton, "okButton");
|
||||||
|
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||||
|
this.okButton.Name = "okButton";
|
||||||
|
this.okButton.UseVisualStyleBackColor = true;
|
||||||
|
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||||
|
//
|
||||||
|
// clearButton
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.clearButton, "clearButton");
|
||||||
|
this.clearButton.ForeColor = System.Drawing.Color.Black;
|
||||||
|
this.clearButton.Name = "clearButton";
|
||||||
|
this.clearButton.UseVisualStyleBackColor = true;
|
||||||
|
this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
|
||||||
|
//
|
||||||
|
// CycleBgEnForm
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this, "$this");
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.BackColor = System.Drawing.Color.DarkGray;
|
||||||
|
this.Controls.Add(this.clearButton);
|
||||||
|
this.Controls.Add(this.okButton);
|
||||||
|
this.ForeColor = System.Drawing.Color.Black;
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||||
|
this.Name = "CycleBgEnForm";
|
||||||
|
this.TopMost = true;
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Button okButton;
|
||||||
|
private System.Windows.Forms.Button clearButton;
|
||||||
|
}
|
||||||
|
}
|
||||||
210
TBF/Rig/DataEntry/Uni/CycleBgEnForm.resx
Normal file
210
TBF/Rig/DataEntry/Uni/CycleBgEnForm.resx
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
<?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>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="okButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||||
|
<value>Top, Right</value>
|
||||||
|
</data>
|
||||||
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<data name="okButton.Font" type="System.Drawing.Font, System.Drawing">
|
||||||
|
<value>Verdana, 14.25pt</value>
|
||||||
|
</data>
|
||||||
|
<data name="okButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>942, 26</value>
|
||||||
|
</data>
|
||||||
|
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>112, 63</value>
|
||||||
|
</data>
|
||||||
|
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="okButton.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>7</value>
|
||||||
|
</data>
|
||||||
|
<data name="okButton.Text" xml:space="preserve">
|
||||||
|
<value>OK</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>okButton.Name" xml:space="preserve">
|
||||||
|
<value>okButton</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>okButton.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>okButton.Parent" xml:space="preserve">
|
||||||
|
<value>$this</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>okButton.ZOrder" xml:space="preserve">
|
||||||
|
<value>1</value>
|
||||||
|
</data>
|
||||||
|
<data name="clearButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||||
|
<value>Top, Right</value>
|
||||||
|
</data>
|
||||||
|
<data name="clearButton.Font" type="System.Drawing.Font, System.Drawing">
|
||||||
|
<value>Verdana, 14.25pt</value>
|
||||||
|
</data>
|
||||||
|
<data name="clearButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||||
|
<value>NoControl</value>
|
||||||
|
</data>
|
||||||
|
<data name="clearButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>795, 26</value>
|
||||||
|
</data>
|
||||||
|
<data name="clearButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>112, 63</value>
|
||||||
|
</data>
|
||||||
|
<data name="clearButton.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>8</value>
|
||||||
|
</data>
|
||||||
|
<data name="clearButton.Text" xml:space="preserve">
|
||||||
|
<value>Clear</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>clearButton.Name" xml:space="preserve">
|
||||||
|
<value>clearButton</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>clearButton.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>clearButton.Parent" xml:space="preserve">
|
||||||
|
<value>$this</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>clearButton.ZOrder" xml:space="preserve">
|
||||||
|
<value>0</value>
|
||||||
|
</data>
|
||||||
|
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||||
|
<value>6, 13</value>
|
||||||
|
</data>
|
||||||
|
<data name="$this.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
|
||||||
|
<value>GrowAndShrink</value>
|
||||||
|
</data>
|
||||||
|
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>1094, 561</value>
|
||||||
|
</data>
|
||||||
|
<data name="$this.MaximumSize" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>10000, 10000</value>
|
||||||
|
</data>
|
||||||
|
<data name="$this.Text" xml:space="preserve">
|
||||||
|
<value>Batch data</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>$this.Name" xml:space="preserve">
|
||||||
|
<value>CycleBgEnForm</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>$this.Type" xml:space="preserve">
|
||||||
|
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
20
TBF/Rig/DataEntry/Uni/EntryForm.cs
Normal file
20
TBF/Rig/DataEntry/Uni/EntryForm.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
using TBF.Rig.GenericDevices;
|
||||||
|
|
||||||
|
namespace TBF.Rig.DataEntry.Uni
|
||||||
|
{
|
||||||
|
public class EntryForm : EntryFormNoStartEnd, IHasWMStatesForm
|
||||||
|
{
|
||||||
|
public EntryForm()
|
||||||
|
: base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntryForm(Generic.IComponentCfg cfg)
|
||||||
|
: base(cfg)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1012
TBF/Rig/DataEntry/Uni/EntryFormCfg.cs
Normal file
1012
TBF/Rig/DataEntry/Uni/EntryFormCfg.cs
Normal file
File diff suppressed because it is too large
Load Diff
305
TBF/Rig/DataEntry/Uni/EntryFormNoStartEnd.cs
Normal file
305
TBF/Rig/DataEntry/Uni/EntryFormNoStartEnd.cs
Normal file
@ -0,0 +1,305 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using log4net;
|
||||||
|
using TBF.Rig.GenericDevices;
|
||||||
|
|
||||||
|
namespace TBF.Rig.DataEntry.Uni
|
||||||
|
{
|
||||||
|
public class EntryFormNoStartEnd : ComponentBase, IOperation, IDataEntry, IHasCycleBeginForm, IHasCycleEndForm
|
||||||
|
{
|
||||||
|
private static readonly ILog log = LogManager.GetLogger(typeof(EntryFormNoStartEnd));
|
||||||
|
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
|
||||||
|
|
||||||
|
public bool UsesCameras() { return false; }
|
||||||
|
|
||||||
|
readonly EntryFormCfg myCfg;
|
||||||
|
IRegReader[] regReaders;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Properties set by the Begin, End and WMStates form
|
||||||
|
/// </summary>
|
||||||
|
bool[] disabled; /// This array is shared between forms
|
||||||
|
|
||||||
|
string[] wmCycleEndState;
|
||||||
|
public string WMCycleEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmCycleEndState.Length) ? wmCycleEndState[wmNr] : string.Empty; }
|
||||||
|
|
||||||
|
double[] wmStartState;
|
||||||
|
public double WMStartState(int wmNr) { return (wmNr >= 0 && wmNr < wmStartState.Length) ? wmStartState[wmNr] : 0; }
|
||||||
|
|
||||||
|
double[] wmEndState;
|
||||||
|
public double WMEndState(int wmNr) { return (wmNr >= 0 && wmNr < wmEndState.Length) ? wmEndState[wmNr] : 0; }
|
||||||
|
|
||||||
|
string[] wmStartStateStr;
|
||||||
|
|
||||||
|
|
||||||
|
System.Windows.Forms.Form modelessDlg;
|
||||||
|
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
|
||||||
|
|
||||||
|
Common.Unit volumeUnit;
|
||||||
|
double refVolume;
|
||||||
|
double errLimLo;
|
||||||
|
double errLimHi;
|
||||||
|
|
||||||
|
bool resultSaved; /// Set in Run() when results are saved
|
||||||
|
|
||||||
|
IList<Results.Entities.WaterMeter> waterMeters; /// Reference to ...ProcessData.BatchRslts.WaterMeters[]
|
||||||
|
|
||||||
|
public enum CurrentOp
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
ShowFormAtCycleBeginning,
|
||||||
|
ShowFormAtCycleEnd,
|
||||||
|
EnterTestStartStates,
|
||||||
|
EnterTestEndStates,
|
||||||
|
}
|
||||||
|
|
||||||
|
CurrentOp currentOp;
|
||||||
|
|
||||||
|
|
||||||
|
public EntryFormNoStartEnd() { }
|
||||||
|
|
||||||
|
public EntryFormNoStartEnd(Generic.IComponentCfg cfg)
|
||||||
|
: base(cfg)
|
||||||
|
{
|
||||||
|
myCfg = cfg as EntryFormCfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
disabled = new bool[TBF.Data.WMsCount];
|
||||||
|
wmStartState = new double[TBF.Data.WMsCount];
|
||||||
|
wmStartStateStr = new string[TBF.Data.WMsCount];
|
||||||
|
wmEndState = new double[TBF.Data.WMsCount];
|
||||||
|
wmCycleEndState = new string[TBF.Data.WMsCount];
|
||||||
|
volumeUnit = (TBF.Rig.Sequences.ProcessData.BenchInfo != null) ? TBF.Rig.Sequences.ProcessData.BenchInfo.VolumeUnit : Common.Unit.l;
|
||||||
|
currentOp = CurrentOp.None;
|
||||||
|
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <returns>Reference to the operation</returns>
|
||||||
|
public IOperation ShowCycleBeginFormOp()
|
||||||
|
{
|
||||||
|
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||||
|
currentOp = CurrentOp.ShowFormAtCycleBeginning;
|
||||||
|
waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <returns>Reference to the operation</returns>
|
||||||
|
public IOperation ShowCycleEndFormOp()
|
||||||
|
{
|
||||||
|
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||||
|
currentOp = CurrentOp.ShowFormAtCycleEnd;
|
||||||
|
waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <returns>Reference to the operation</returns>
|
||||||
|
public IOperation ShowTestStartFormOp(IRegReader[] regReaders)
|
||||||
|
{
|
||||||
|
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||||
|
currentOp = CurrentOp.EnterTestStartStates;
|
||||||
|
this.waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||||
|
this.regReaders = regReaders;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <returns>Reference to the operation</returns>
|
||||||
|
public IOperation ShowTestEndFormOp(IRegReader[] regReaders, double refVolume, double errLimLo, double errLimHi)
|
||||||
|
{
|
||||||
|
if (currentOp != CurrentOp.None) throw new Exception("Sequence error");
|
||||||
|
currentOp = CurrentOp.EnterTestEndStates;
|
||||||
|
this.waterMeters = TBF.Rig.Sequences.ProcessData.BatchRslts.Batch.WaterMeters;
|
||||||
|
this.regReaders = regReaders;
|
||||||
|
this.refVolume = refVolume;
|
||||||
|
this.errLimLo = errLimLo;
|
||||||
|
this.errLimHi = errLimHi;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IOperation ShowAdvancedTestStartFormOp(IRegReader[] regReaders, IList<Results.Entities.WaterMeter> waterMeters, bool isCondOp = false)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
delegate void EntryFormDlgt(EntryFormNoStartEnd myRef);
|
||||||
|
///
|
||||||
|
void OpenBeginningDlg(EntryFormNoStartEnd myRef)
|
||||||
|
{
|
||||||
|
DEItem.ClearItems();
|
||||||
|
for (int i = 0; i < myCfg.GetBgItemsCount(); i++)
|
||||||
|
{
|
||||||
|
if (myCfg.BgItemContent[i] != Ct.None)
|
||||||
|
{
|
||||||
|
DEItem.AddItem(myCfg.BgItemContent[i], myCfg.BgItemCaption[i], myCfg.BgItemAction[i], myCfg.BgItemWidth[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DEItem.ClearColumns();
|
||||||
|
for (int i = 0; i < myCfg.GetBgColumnsCount(); i++)
|
||||||
|
{
|
||||||
|
if (myCfg.BgColumnContent[i] != Ct.None)
|
||||||
|
{
|
||||||
|
DEItem.AddColumn(myCfg.BgColumnContent[i], myCfg.BgColumnCaption[i], myCfg.BgColumnAction[i], myCfg.BgColumnWidth[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
modelessDlg = new CycleBgEnForm(waterMeters, TBF.Data.LineSize, myCfg.BgTitle, myCfg.BgSize, myCfg.BgIsLrOrder, myCfg.BgFormCloseKeys,
|
||||||
|
DEItem.GetItems(), DEItem.GetColumns(), false);
|
||||||
|
modelessDlg.Show();
|
||||||
|
}
|
||||||
|
///
|
||||||
|
void OpenEndDlg(EntryFormNoStartEnd myRef)
|
||||||
|
{
|
||||||
|
DEItem.ClearItems();
|
||||||
|
for (int i = 0; i < myCfg.GetEnItemsCount(); i++)
|
||||||
|
{
|
||||||
|
if (myCfg.EnItemContent[i] != Ct.None)
|
||||||
|
{
|
||||||
|
DEItem.AddItem(myCfg.EnItemContent[i], myCfg.EnItemCaption[i], myCfg.EnItemAction[i], myCfg.EnItemWidth[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DEItem.ClearColumns();
|
||||||
|
for (int i = 0; i < myCfg.GetEnColumnsCount(); i++)
|
||||||
|
{
|
||||||
|
if (myCfg.EnColumnContent[i] != Ct.None)
|
||||||
|
{
|
||||||
|
DEItem.AddColumn(myCfg.EnColumnContent[i], myCfg.EnColumnCaption[i], myCfg.EnColumnAction[i], myCfg.EnColumnWidth[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
modelessDlg = new CycleBgEnForm(waterMeters, TBF.Data.LineSize, myCfg.EnTitle, myCfg.EnSize, myCfg.EnIsLrOrder, myCfg.EnFormCloseKeys,
|
||||||
|
DEItem.GetItems(), DEItem.GetColumns(), true);
|
||||||
|
modelessDlg.Show();
|
||||||
|
}
|
||||||
|
///
|
||||||
|
void OpenTestStartStatesDlg(EntryFormNoStartEnd myRef)
|
||||||
|
{
|
||||||
|
DEItem.ClearColumns();
|
||||||
|
for (int i = 0; i < myCfg.GetTestColumnsCount(); i++)
|
||||||
|
{
|
||||||
|
if (myCfg.TestColumnContent[i] != Ct.None)
|
||||||
|
{
|
||||||
|
DEItem.AddColumn(myCfg.TestColumnContent[i], myCfg.TestColumnCaption[i], myCfg.TestColumnAction[i], myCfg.TestColumnWidth[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
modelessDlg = new TestStartEndForm(waterMeters, myRef.regReaders, TBF.Data.LineSize, myCfg.TestTitle, myCfg.TestSize,
|
||||||
|
myCfg.TestStartBoxAlwaysEn, myCfg.TestIsLrOrder, myCfg.TestFormCloseKeys, DEItem.GetColumns(),
|
||||||
|
volumeUnit);
|
||||||
|
modelessDlg.Show();
|
||||||
|
}
|
||||||
|
///
|
||||||
|
void OpenTestEndStatesDlg(EntryFormNoStartEnd myRef)
|
||||||
|
{
|
||||||
|
DEItem.ClearColumns();
|
||||||
|
for (int i = 0; i < myCfg.GetTestColumnsCount(); i++)
|
||||||
|
{
|
||||||
|
if (myCfg.TestColumnContent[i] != Ct.None)
|
||||||
|
{
|
||||||
|
DEItem.AddColumn(myCfg.TestColumnContent[i], myCfg.TestColumnCaption[i], myCfg.TestColumnAction[i], myCfg.TestColumnWidth[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
modelessDlg = new TestStartEndForm(waterMeters, myRef.regReaders, TBF.Data.LineSize, myCfg.TestTitle, myCfg.TestSize,
|
||||||
|
myCfg.TestStartBoxAlwaysEn, myCfg.TestIsLrOrder, myCfg.TestFormCloseKeys, DEItem.GetColumns(),
|
||||||
|
volumeUnit, wmStartStateStr, refVolume, errLimLo, errLimHi);
|
||||||
|
modelessDlg.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Start this operation</summary>
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
resultSaved = false;
|
||||||
|
switch (currentOp)
|
||||||
|
{
|
||||||
|
case CurrentOp.ShowFormAtCycleBeginning:
|
||||||
|
if (myCfg.BgShowForm)
|
||||||
|
{
|
||||||
|
Program.MainWnd.Invoke(new EntryFormDlgt(OpenBeginningDlg), this);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CurrentOp.ShowFormAtCycleEnd:
|
||||||
|
if (myCfg.EnShowForm)
|
||||||
|
{
|
||||||
|
Program.MainWnd.Invoke(new EntryFormDlgt(OpenEndDlg), this);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CurrentOp.EnterTestStartStates:
|
||||||
|
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestStartStatesDlg), this);
|
||||||
|
break;
|
||||||
|
case CurrentOp.EnterTestEndStates:
|
||||||
|
Program.MainWnd.Invoke(new EntryFormDlgt(OpenTestEndStatesDlg), this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Run this operation</summary>
|
||||||
|
/// <returns>Event.ResultsPrinted</returns>
|
||||||
|
public Event Run()
|
||||||
|
{
|
||||||
|
if ((modelessDlg is IHasCompleted) && !(modelessDlg as IHasCompleted).Completed)
|
||||||
|
{
|
||||||
|
return Event.ModelessFormIsOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!resultSaved) /// This is to save the result only once
|
||||||
|
{
|
||||||
|
if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestStartStates)
|
||||||
|
{
|
||||||
|
/// Fixed start test - start
|
||||||
|
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||||
|
if (dlg != null)
|
||||||
|
{
|
||||||
|
volumeUnit = dlg.VolumeUnit;
|
||||||
|
for (int i = 0; i < waterMeters.Count; i++)
|
||||||
|
{
|
||||||
|
if (!((i < waterMeters.Count && waterMeters[i].Disabled) || (i < regReaders.Length && regReaders[i] == null)))
|
||||||
|
{
|
||||||
|
wmStartState[i] = dlg.WMStartState[i];
|
||||||
|
wmStartStateStr[i] = dlg.WMStartStateStr[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (modelessDlg is TestStartEndForm && currentOp == CurrentOp.EnterTestEndStates)
|
||||||
|
{
|
||||||
|
/// Fixed start test - end
|
||||||
|
TestStartEndForm dlg = (modelessDlg as TestStartEndForm);
|
||||||
|
if (dlg != null)
|
||||||
|
{
|
||||||
|
volumeUnit = dlg.VolumeUnit;
|
||||||
|
for (int i = 0; i < waterMeters.Count; i++)
|
||||||
|
{
|
||||||
|
if (!((i < waterMeters.Count && waterMeters[i].Disabled) || (i < regReaders.Length && regReaders[i] == null)))
|
||||||
|
{
|
||||||
|
wmEndState[i] = dlg.WMEndState[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resultSaved = true;
|
||||||
|
modelessDlg = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Event.ModelessFormClosed; /// Form closed
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Stop this operation</summary>
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
if (modelessDlg is IHasCompleted)
|
||||||
|
{
|
||||||
|
UiBridge.Bridge.OnCloseModelessForm(this, null);
|
||||||
|
modelessDlg = null;
|
||||||
|
}
|
||||||
|
currentOp = CurrentOp.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
TBF/Rig/DataEntry/Uni/Factory.cs
Normal file
25
TBF/Rig/DataEntry/Uni/Factory.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using TBF.Rig.Generic;
|
||||||
|
|
||||||
|
namespace TBF.Rig.DataEntry.Uni
|
||||||
|
{
|
||||||
|
public class Factory : IComponentFactory
|
||||||
|
{
|
||||||
|
public string ClassName { get { return GetType().Namespace.Substring(8); } }
|
||||||
|
public override string ToString() { return ClassName; }
|
||||||
|
|
||||||
|
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
|
||||||
|
|
||||||
|
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryForm(cfg); }
|
||||||
|
|
||||||
|
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this, GetType().Namespace.Substring(8)); }
|
||||||
|
|
||||||
|
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||||
|
{
|
||||||
|
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
TBF/Rig/DataEntry/Uni/FactoryNoStartEnd.cs
Normal file
24
TBF/Rig/DataEntry/Uni/FactoryNoStartEnd.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using TBF.Rig.Generic;
|
||||||
|
|
||||||
|
namespace TBF.Rig.DataEntry.Uni
|
||||||
|
{
|
||||||
|
public class FactoryNoStartEnd : IComponentFactory
|
||||||
|
{
|
||||||
|
public string ClassName { get { return GetType().Namespace.Substring(8) + "-NoStartEnd"; } }
|
||||||
|
|
||||||
|
public IComponent DummyComponent() { return new EntryFormNoStartEnd(); }
|
||||||
|
|
||||||
|
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryFormNoStartEnd(cfg); }
|
||||||
|
|
||||||
|
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this, GetType().Namespace.Substring(8) + "-NoStartEnd"); }
|
||||||
|
|
||||||
|
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||||
|
{
|
||||||
|
return ComponentCfgBase.CreateFromDbEntity(EntryFormCfg.Serializer, component, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
600
TBF/Rig/DataEntry/Uni/TestStartEndForm.cs
Normal file
600
TBF/Rig/DataEntry/Uni/TestStartEndForm.cs
Normal file
@ -0,0 +1,600 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using log4net;
|
||||||
|
using Common;
|
||||||
|
using Results.Entities;
|
||||||
|
using TBF.Rig.GenericDevices;
|
||||||
|
using TBF.Resources;
|
||||||
|
|
||||||
|
namespace TBF.Rig.DataEntry.Uni
|
||||||
|
{
|
||||||
|
public partial class TestStartEndForm : Form, GenericDevices.IHasCompleted
|
||||||
|
{
|
||||||
|
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
|
||||||
|
|
||||||
|
/// Arguments
|
||||||
|
public readonly IList<WaterMeter> waterMeters;
|
||||||
|
readonly IRegReader[] regReaders;
|
||||||
|
readonly int lineSize;
|
||||||
|
readonly Sz sz;
|
||||||
|
readonly bool isStartBoxAlwaysEn;
|
||||||
|
readonly bool isLrOrder; /// true = controls obtain focus after ENTER key in left-right order, false = top-down order
|
||||||
|
readonly IList<DEItem> colItems;
|
||||||
|
readonly string formCloseKeys;
|
||||||
|
public readonly string[] WMStartStateStr;
|
||||||
|
readonly double refVolume;
|
||||||
|
readonly double warningLimLo; /// limit to display exclamation mark, typically 2x errLimLo
|
||||||
|
readonly double warningLimHi; /// limit to display exclamation mark, typically 2x errLimHi
|
||||||
|
|
||||||
|
/// Derived from arguments in the constructor
|
||||||
|
readonly bool isEnd;
|
||||||
|
readonly WaterMeter firstValidWM;
|
||||||
|
readonly int wmsCount;
|
||||||
|
readonly int linesCount;
|
||||||
|
readonly bool fixedErrorLimits; /// false in case of calculated error limits
|
||||||
|
|
||||||
|
/// To be retrieved after the form closes
|
||||||
|
public double[] WMStartState;
|
||||||
|
public double[] WMEndState;
|
||||||
|
public Unit VolumeUnit;
|
||||||
|
int startStateColumn;
|
||||||
|
int endStateColumn;
|
||||||
|
|
||||||
|
/// Size and layout related values
|
||||||
|
readonly int meterHeight;
|
||||||
|
readonly int meterWidth;
|
||||||
|
readonly int margin;
|
||||||
|
readonly int spacing;
|
||||||
|
readonly int hdrHeight;
|
||||||
|
readonly int labelWid;
|
||||||
|
readonly int checkBoxWid;
|
||||||
|
|
||||||
|
/// UI elements
|
||||||
|
readonly Label[] labels; /// Labels for water meter numbers
|
||||||
|
readonly TextBox[,] textBoxes; /// Text boxes for values in columns
|
||||||
|
readonly Label[] exclamations;
|
||||||
|
|
||||||
|
readonly LocalSettings ls;
|
||||||
|
|
||||||
|
bool isHandlersEnabled; /// Initially false, set to true after ComboBoxes are filled with data
|
||||||
|
|
||||||
|
// Set to 'true' when the form closes
|
||||||
|
public bool Completed { get { return completed; } }
|
||||||
|
bool completed;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parameterless constructor for common functionality
|
||||||
|
/// </summary>
|
||||||
|
public TestStartEndForm()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
ControlBox = false;
|
||||||
|
completed = false;
|
||||||
|
StartForceCloseHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="waterMeters">Water meters</param>
|
||||||
|
/// <param name="regReaders">Array of register readers</param>
|
||||||
|
/// <param name="lineSize">Number of water meters in one (test bencch) line</param>
|
||||||
|
/// <param name="title">Form title</param>
|
||||||
|
/// <param name="sz">Font size</param>
|
||||||
|
/// <param name="isLrOrder">true = controls obtain focus in left-right order, forls = top-down order</param>
|
||||||
|
/// <param name="formCloseKeys">String containing keys to close this form</param>
|
||||||
|
/// <param name="colItems">Water meter items displayed in columns (in the matrix in the main part of the form)</param>
|
||||||
|
/// <param name="initialVolumeUnit">Volume unit preset initially</param>
|
||||||
|
/// <param name="wmStartStateStr">Information entered on test start</param>
|
||||||
|
/// <param name="refVolume">Reference volume, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||||
|
/// <param name="errLimLo">Error limit low, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||||
|
/// <param name="errLimHi">Error limit high, it is used to verify the end state, show/hide exclamation if necessary</param>
|
||||||
|
public TestStartEndForm(IList<WaterMeter> waterMeters, IRegReader[] regReaders, int lineSize, string title, Sz sz,
|
||||||
|
bool isStartBoxAlwaysEn, bool isLrOrder, string formCloseKeys, IList<DEItem> colItems,
|
||||||
|
Unit initialVolumeUnit, string[] wmStartStateStr = null,
|
||||||
|
double refVolume = 0, double errLimLo = 0, double errLimHi = 0)
|
||||||
|
: this()
|
||||||
|
{
|
||||||
|
this.waterMeters = waterMeters;
|
||||||
|
this.regReaders = regReaders;
|
||||||
|
this.lineSize = lineSize;
|
||||||
|
this.Text = !string.IsNullOrEmpty(title) ? title : string.Empty;
|
||||||
|
this.sz = sz;
|
||||||
|
this.isStartBoxAlwaysEn = isStartBoxAlwaysEn;
|
||||||
|
this.isLrOrder = isLrOrder;
|
||||||
|
this.formCloseKeys = !string.IsNullOrEmpty(formCloseKeys) ? formCloseKeys : string.Empty;
|
||||||
|
this.colItems = colItems;
|
||||||
|
this.VolumeUnit = initialVolumeUnit;
|
||||||
|
this.WMStartStateStr = wmStartStateStr;
|
||||||
|
this.refVolume = refVolume;
|
||||||
|
this.warningLimLo = 2 * errLimLo;
|
||||||
|
this.warningLimHi = 2 * errLimHi;
|
||||||
|
|
||||||
|
if (waterMeters == null || regReaders == null ||
|
||||||
|
(wmStartStateStr != null && wmStartStateStr.Length != waterMeters.Count))
|
||||||
|
{
|
||||||
|
throw new Exception("Invalid argument");
|
||||||
|
}
|
||||||
|
|
||||||
|
ls = Program.LocalSettings;
|
||||||
|
|
||||||
|
/// Readonly variables derived from arguments
|
||||||
|
isEnd = (wmStartStateStr != null);
|
||||||
|
wmsCount = waterMeters.Count;
|
||||||
|
if (WMStartStateStr == null) WMStartStateStr = new string[wmsCount];
|
||||||
|
fixedErrorLimits = (errLimHi > errLimLo);
|
||||||
|
linesCount = (wmsCount + Math.Max(1, lineSize) - 1) / Math.Max(1, lineSize);
|
||||||
|
firstValidWM = waterMeters.FirstOrDefault(x => (x != null && !x.Disabled));
|
||||||
|
WMStartState = new double[wmsCount];
|
||||||
|
WMEndState = new double[wmsCount];
|
||||||
|
///
|
||||||
|
unitComboBox.Text = VolumeUnit.ToDescription();
|
||||||
|
labels = new Label[wmsCount];
|
||||||
|
textBoxes = new TextBox[colItems.Count, wmsCount];
|
||||||
|
exclamations = new Label[wmsCount];
|
||||||
|
|
||||||
|
/// Layout related readonly variables derived from argument 'sz'
|
||||||
|
Font font;
|
||||||
|
Font exclamationFont;
|
||||||
|
switch (sz)
|
||||||
|
{
|
||||||
|
case Sz.S:
|
||||||
|
font = new Font("Verdana", 12, FontStyle.Regular);
|
||||||
|
//exclamationFont = new Font("Verdana", 24F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(238)));
|
||||||
|
exclamationFont = new Font("Verdana", 18, FontStyle.Bold);
|
||||||
|
meterHeight = 26; /// Height of a ComboBox control
|
||||||
|
margin = 20;
|
||||||
|
spacing = 8;
|
||||||
|
hdrHeight = 160;
|
||||||
|
labelWid = 31;
|
||||||
|
checkBoxWid = 23;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
case Sz.M:
|
||||||
|
font = new Font("Verdana", 14, FontStyle.Regular);
|
||||||
|
exclamationFont = new Font("Verdana", 20, FontStyle.Bold);
|
||||||
|
meterHeight = 31; /// Height of a ComboBox control
|
||||||
|
margin = 25;
|
||||||
|
spacing = 10;
|
||||||
|
hdrHeight = 160;
|
||||||
|
labelWid = 34;
|
||||||
|
checkBoxWid = 23;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Sz.L:
|
||||||
|
font = new Font("Verdana", 18, FontStyle.Regular);
|
||||||
|
exclamationFont = new Font("Verdana", 24, FontStyle.Bold);
|
||||||
|
meterHeight = 37; /// Height of a ComboBox control
|
||||||
|
margin = 30;
|
||||||
|
spacing = 12;
|
||||||
|
hdrHeight = 160;
|
||||||
|
labelWid = 40;
|
||||||
|
checkBoxWid = 23;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
meterWidth = labelWid + checkBoxWid + spacing;
|
||||||
|
foreach (var ci in colItems) { meterWidth += ci.Width + spacing; }
|
||||||
|
|
||||||
|
int tabIndex = 1;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Table
|
||||||
|
///
|
||||||
|
int columnsTop = hdrHeight;
|
||||||
|
for (int j = 0; j < linesCount; j++)
|
||||||
|
{
|
||||||
|
/// Captions
|
||||||
|
int capX = margin + j * (meterWidth + margin / 2) + labelWid + spacing;
|
||||||
|
int capY = columnsTop - meterHeight;
|
||||||
|
for (int k = 0; k < colItems.Count; k++)
|
||||||
|
{
|
||||||
|
int labelWidth = Convert.ToInt32(Graphics.FromImage(new Bitmap(1, 1)).MeasureString(colItems[k].Caption, font).Width);
|
||||||
|
var label = new Label
|
||||||
|
{
|
||||||
|
Text = colItems[k].Caption,
|
||||||
|
Location = new Point(capX, capY),
|
||||||
|
Size = new Size(labelWidth + spacing, meterHeight),
|
||||||
|
Font = font,
|
||||||
|
TabIndex = tabIndex++,
|
||||||
|
Parent = this,
|
||||||
|
};
|
||||||
|
capX += colItems[k].Width + spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Water meters
|
||||||
|
for (int i = 0; i < lineSize; i++)
|
||||||
|
{
|
||||||
|
int wmPos0 = i + lineSize * j;
|
||||||
|
if (wmPos0 > wmsCount) continue;
|
||||||
|
|
||||||
|
int left = margin + j * (meterWidth + margin / 2);
|
||||||
|
int top = columnsTop + i * (meterHeight + spacing);
|
||||||
|
|
||||||
|
var label = new Label
|
||||||
|
{
|
||||||
|
Text = (wmPos0 + 1).ToString(),
|
||||||
|
Location = new Point(left, top),
|
||||||
|
Size = new Size(labelWid, meterHeight),
|
||||||
|
Font = font,
|
||||||
|
TextAlign = ContentAlignment.MiddleLeft,
|
||||||
|
TabIndex = tabIndex++,
|
||||||
|
Parent = this,
|
||||||
|
};
|
||||||
|
left += labelWid + spacing / 2;
|
||||||
|
labels[wmPos0] = label;
|
||||||
|
this.Controls.Add(label);
|
||||||
|
|
||||||
|
/// Columns
|
||||||
|
for (int k = 0; k < colItems.Count; k++)
|
||||||
|
{
|
||||||
|
DEItem ci = colItems[k];
|
||||||
|
var textBox = new TextBox
|
||||||
|
{
|
||||||
|
Name = string.Format("{0}~{1}", k, wmPos0),
|
||||||
|
Location = new Point(left, top),
|
||||||
|
Size = new Size(ci.Width, meterHeight),
|
||||||
|
Enabled = (ci.Action != Ac.LoadReadOnly && !waterMeters[wmPos0].Disabled),
|
||||||
|
Font = font,
|
||||||
|
TabIndex = tabIndex++,
|
||||||
|
Parent = this,
|
||||||
|
};
|
||||||
|
|
||||||
|
textBox.TextChanged += new System.EventHandler(textBox_TextChanged);
|
||||||
|
textBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(textBox_KeyPress);
|
||||||
|
textBox.MouseClick += new System.Windows.Forms.MouseEventHandler(textBox_MouseClick);
|
||||||
|
|
||||||
|
left += ci.Width + spacing;
|
||||||
|
textBoxes[k, wmPos0] = textBox;
|
||||||
|
this.Controls.Add(textBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
var exclamation = new Label
|
||||||
|
{
|
||||||
|
AutoSize = true,
|
||||||
|
Font = exclamationFont,
|
||||||
|
ForeColor = System.Drawing.Color.Red,
|
||||||
|
Location = new Point(left, top),
|
||||||
|
Parent = this,
|
||||||
|
TabIndex = tabIndex++,
|
||||||
|
Text = "!",
|
||||||
|
Visible = false,
|
||||||
|
};
|
||||||
|
exclamations[wmPos0] = exclamation;
|
||||||
|
this.Controls.Add(exclamation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Adjust window size
|
||||||
|
///
|
||||||
|
Rectangle screenRectangle = this.RectangleToScreen(this.ClientRectangle);
|
||||||
|
int titleBarHeight = screenRectangle.Top - this.Top;
|
||||||
|
Size = new Size(Math.Max(meterWidth * linesCount + margin * (linesCount + 1), 1300),
|
||||||
|
titleBarHeight + columnsTop + lineSize * (meterHeight + spacing) + margin);
|
||||||
|
|
||||||
|
Localize();
|
||||||
|
InitializeBoxes();
|
||||||
|
|
||||||
|
/// Set focus to the first enabled ComboBox
|
||||||
|
}
|
||||||
|
|
||||||
|
void Localize()
|
||||||
|
{
|
||||||
|
okButton.Text = Strings.OkBtnText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize combo boxes state defined by related 'Action'.
|
||||||
|
/// Clear check boxes.
|
||||||
|
/// </summary>
|
||||||
|
void InitializeBoxes()
|
||||||
|
{
|
||||||
|
isHandlersEnabled = false;
|
||||||
|
|
||||||
|
/// Table
|
||||||
|
startStateColumn = -1;
|
||||||
|
endStateColumn = -1;
|
||||||
|
for (int k = 0; k < colItems.Count; k++)
|
||||||
|
{
|
||||||
|
if (colItems[k].Content == Ct.StartState)
|
||||||
|
{
|
||||||
|
startStateColumn = k;
|
||||||
|
for (int i = 0; i < wmsCount; i++)
|
||||||
|
{
|
||||||
|
textBoxes[k, i].Text = (!isEnd || waterMeters[i] == null
|
||||||
|
|| waterMeters[i].Disabled
|
||||||
|
|| i >= regReaders.Length
|
||||||
|
|| regReaders[i] == null
|
||||||
|
|| string.IsNullOrEmpty(WMStartStateStr[i])) ? string.Empty : WMStartStateStr[i];
|
||||||
|
|
||||||
|
textBoxes[k, i].Enabled = (isStartBoxAlwaysEn || !isEnd) && waterMeters[i] != null && !waterMeters[i].Disabled
|
||||||
|
&& i < regReaders.Length && regReaders[i] != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (colItems[k].Content == Ct.EndState)
|
||||||
|
{
|
||||||
|
endStateColumn = k;
|
||||||
|
for (int i = 0; i < wmsCount; i++)
|
||||||
|
{
|
||||||
|
textBoxes[k, i].Text = string.Empty;
|
||||||
|
textBoxes[k, i].Enabled = isEnd && waterMeters[i] != null && !waterMeters[i].Disabled
|
||||||
|
&& i < regReaders.Length && regReaders[i] != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (colItems[k].Action)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case Ac.Clear:
|
||||||
|
case Ac.HistoryLast:
|
||||||
|
for (int i = 0; i < wmsCount; i++) textBoxes[k, i].Text = string.Empty;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Ac.Load:
|
||||||
|
case Ac.LoadReadOnly:
|
||||||
|
for (int i = 0; i < wmsCount; i++)
|
||||||
|
{
|
||||||
|
textBoxes[k, i].Text = DEUtils.GetContent(colItems[k].Content, waterMeters[i]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEnd && isStartBoxAlwaysEn)
|
||||||
|
{
|
||||||
|
int k = 0;
|
||||||
|
int j = 0;
|
||||||
|
if (!FindNextEnabledTextBox(textBoxes, ref k, ref j, isLrOrder, true))
|
||||||
|
{
|
||||||
|
ActiveControl = textBoxes[k, j];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
isHandlersEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When one combo box is updated using drop-down menu, all combo boxes
|
||||||
|
/// are updated by this function.
|
||||||
|
/// </summary>
|
||||||
|
void UpdateWMsFromBoxes()
|
||||||
|
{
|
||||||
|
for (int k = 0; k < colItems.Count; k++)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < wmsCount; i++)
|
||||||
|
{
|
||||||
|
if (colItems[k].Content == Ct.StartState)
|
||||||
|
{
|
||||||
|
/// Water meter start state
|
||||||
|
double startVol;
|
||||||
|
if (textBoxes[k, i].Enabled && Utils.TryParseUDouble(textBoxes[k, i].Text, out startVol))
|
||||||
|
{
|
||||||
|
WMStartStateStr[i] = textBoxes[k, i].Text;
|
||||||
|
WMStartState[i] = Units.ConvertFrom(VolumeUnit, startVol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (colItems[k].Content == Ct.EndState)
|
||||||
|
{
|
||||||
|
/// Water meter end state
|
||||||
|
double endVol;
|
||||||
|
if (textBoxes[k, i].Enabled && Utils.TryParseUDouble(textBoxes[k, i].Text, out endVol))
|
||||||
|
{
|
||||||
|
WMEndState[i] = Units.ConvertFrom(VolumeUnit, endVol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/// Other value - store values to a water meter structure
|
||||||
|
DEUtils.PutContent(colItems[k].Content, waterMeters[i], textBoxes[k, i].Text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void okButton_Click(object sender, EventArgs eArgs)
|
||||||
|
{
|
||||||
|
UpdateWMsFromBoxes();
|
||||||
|
|
||||||
|
completed = true;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unitComboBox_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
unitComboBox_SelectedIndexChanged(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unitComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var newUnit = Units.FromDescription(unitComboBox.Text);
|
||||||
|
|
||||||
|
if (Units.IsVolume(newUnit))
|
||||||
|
{
|
||||||
|
VolumeUnit = newUnit;
|
||||||
|
|
||||||
|
if (!isHandlersEnabled) return;
|
||||||
|
|
||||||
|
/// Update exclamation marks
|
||||||
|
if (isEnd && startStateColumn >= 0 && endStateColumn >= 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < wmsCount; i++)
|
||||||
|
{
|
||||||
|
double startVol, endVol;
|
||||||
|
|
||||||
|
if (Utils.TryParseUDouble(textBoxes[startStateColumn, i].Text, out startVol) &&
|
||||||
|
Utils.TryParseUDouble(textBoxes[endStateColumn, i].Text, out endVol))
|
||||||
|
{
|
||||||
|
double startState = Units.ConvertFrom(VolumeUnit, startVol);
|
||||||
|
double endState = Units.ConvertFrom(VolumeUnit, endVol);
|
||||||
|
double err = (refVolume != 0) ? 100.0 * (endState - startState - refVolume) / refVolume : 1000.0;
|
||||||
|
exclamations[i].Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
exclamations[i].Visible = !string.IsNullOrEmpty(textBoxes[endStateColumn, i].Text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
largeTextBox.Text = string.Empty;
|
||||||
|
largeExclamationLabel.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void textBox_KeyPress(object sndr, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
if (!isHandlersEnabled) return;
|
||||||
|
|
||||||
|
string[] kj = (sndr as TextBox).Name.Split(new char[] { '~' });
|
||||||
|
int k = int.Parse(kj[0]);
|
||||||
|
int j = int.Parse(kj[1]);
|
||||||
|
|
||||||
|
/// Close the form if any 'form close key' was pressed
|
||||||
|
if (!string.IsNullOrEmpty(formCloseKeys))
|
||||||
|
{
|
||||||
|
/// Close the form if any 'close form key' was pressed
|
||||||
|
for (int ix = 0; ix < formCloseKeys.Length; ix++)
|
||||||
|
{
|
||||||
|
if (e.KeyChar == formCloseKeys[ix])
|
||||||
|
{
|
||||||
|
okButton_Click(sndr, e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.KeyChar == '\r')
|
||||||
|
{
|
||||||
|
/// Change focus
|
||||||
|
if (FindNextEnabledTextBox(textBoxes, ref k, ref j, isLrOrder))
|
||||||
|
{
|
||||||
|
okButton.Focus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textBoxes[k, j].Focus();
|
||||||
|
largeTextBox.Text = string.Format("{0}: {1}", j + 1, textBoxes[k, j].Text);
|
||||||
|
largeExclamationLabel.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Handle mouse clicks so that the large text box and the large exclamation mark are updated
|
||||||
|
private void textBox_MouseClick(object sndr, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
textBox_TextChanged(sndr, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void textBox_TextChanged(object sndr, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!isHandlersEnabled) return;
|
||||||
|
|
||||||
|
string[] kj = (sndr as TextBox).Name.Split(new char[] { '~' });
|
||||||
|
int k = int.Parse(kj[0]);
|
||||||
|
int j = int.Parse(kj[1]);
|
||||||
|
|
||||||
|
largeTextBox.Text = string.Format("{0}: {1}", j + 1, textBoxes[k, j].Text);
|
||||||
|
|
||||||
|
if (isEnd && (k == startStateColumn || k == endStateColumn))
|
||||||
|
{
|
||||||
|
double startVol, endVol;
|
||||||
|
|
||||||
|
if (startStateColumn >= 0 && Utils.TryParseUDouble(textBoxes[startStateColumn, j].Text, out startVol) &&
|
||||||
|
endStateColumn >= 0 && Utils.TryParseUDouble(textBoxes[endStateColumn, j].Text, out endVol))
|
||||||
|
{
|
||||||
|
double startState = Units.ConvertFrom(VolumeUnit, startVol);
|
||||||
|
double endState = Units.ConvertFrom(VolumeUnit, endVol);
|
||||||
|
double err = (refVolume != 0) ? 100.0 * (endState - startState - refVolume) / refVolume : 1000.0;
|
||||||
|
largeExclamationLabel.Visible =
|
||||||
|
exclamations[j].Visible = fixedErrorLimits ? ((err < warningLimLo) || (warningLimHi < err)) : ((err < -6) || (+6 < err));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
largeExclamationLabel.Visible =
|
||||||
|
exclamations[j].Visible = !string.IsNullOrEmpty(textBoxes[endStateColumn, j].Text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
largeExclamationLabel.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find the next enabled combo box, update k and i.
|
||||||
|
/// Return true (=pastTheEndOfArray) when there is no such next combo box.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="textBoxes">2-dimensional array of combo boxes</param>
|
||||||
|
/// <param name="k">0-nased column </param>
|
||||||
|
/// <param name="i">0-based row</param>
|
||||||
|
/// <param name="isLrOrder">Order of progress to the next combo: true = left-right, false = top-down</param>
|
||||||
|
/// <returns>true (=pastTheEndOfArray) when there is no such next combo box, otherwise false</returns>
|
||||||
|
bool FindNextEnabledTextBox(TextBox[,] textBoxes, ref int k, ref int i, bool isLrOrder, bool skipStartColumn = false)
|
||||||
|
{
|
||||||
|
bool pastTheEndOfArray = false;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (isLrOrder)
|
||||||
|
{
|
||||||
|
if (++k == textBoxes.GetLength(0))
|
||||||
|
{
|
||||||
|
k = 0;
|
||||||
|
if (++i == textBoxes.GetLength(1))
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
pastTheEndOfArray = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (++i == textBoxes.GetLength(1))
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
if (++k == textBoxes.GetLength(0))
|
||||||
|
{
|
||||||
|
k = 0;
|
||||||
|
pastTheEndOfArray = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (!textBoxes[k, i].Enabled || (skipStartColumn && k == startStateColumn));
|
||||||
|
|
||||||
|
return pastTheEndOfArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Forced close handling
|
||||||
|
|
||||||
|
public void StartForceCloseHandler()
|
||||||
|
{
|
||||||
|
UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args); }
|
||||||
|
else OnForceClose(sender, args);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnForceClose(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
DialogResult = DialogResult.Cancel;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
114
TBF/Rig/DataEntry/Uni/TestStartEndForm.designer.cs
generated
Normal file
114
TBF/Rig/DataEntry/Uni/TestStartEndForm.designer.cs
generated
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
namespace TBF.Rig.DataEntry.Uni
|
||||||
|
{
|
||||||
|
partial class TestStartEndForm
|
||||||
|
{
|
||||||
|
/// <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 Windows Form 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.okButton = new System.Windows.Forms.Button();
|
||||||
|
this.largeTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.largeExclamationLabel = new System.Windows.Forms.Label();
|
||||||
|
this.unitComboBox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// okButton
|
||||||
|
//
|
||||||
|
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||||
|
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||||
|
this.okButton.Location = new System.Drawing.Point(1120, 29);
|
||||||
|
this.okButton.Name = "okButton";
|
||||||
|
this.okButton.Size = new System.Drawing.Size(123, 63);
|
||||||
|
this.okButton.TabIndex = 100;
|
||||||
|
this.okButton.Text = "OK";
|
||||||
|
this.okButton.UseVisualStyleBackColor = true;
|
||||||
|
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||||
|
//
|
||||||
|
// largeTextBox
|
||||||
|
//
|
||||||
|
this.largeTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||||
|
this.largeTextBox.Location = new System.Drawing.Point(35, 29);
|
||||||
|
this.largeTextBox.Name = "largeTextBox";
|
||||||
|
this.largeTextBox.Size = new System.Drawing.Size(849, 80);
|
||||||
|
this.largeTextBox.TabIndex = 101;
|
||||||
|
//
|
||||||
|
// largeExclamationLabel
|
||||||
|
//
|
||||||
|
this.largeExclamationLabel.AutoSize = true;
|
||||||
|
this.largeExclamationLabel.Font = new System.Drawing.Font("Verdana", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||||
|
this.largeExclamationLabel.ForeColor = System.Drawing.Color.Red;
|
||||||
|
this.largeExclamationLabel.Location = new System.Drawing.Point(890, 28);
|
||||||
|
this.largeExclamationLabel.Name = "largeExclamationLabel";
|
||||||
|
this.largeExclamationLabel.Size = new System.Drawing.Size(59, 78);
|
||||||
|
this.largeExclamationLabel.TabIndex = 102;
|
||||||
|
this.largeExclamationLabel.Text = "!";
|
||||||
|
this.largeExclamationLabel.Visible = false;
|
||||||
|
//
|
||||||
|
// unitComboBox
|
||||||
|
//
|
||||||
|
this.unitComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.unitComboBox.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||||
|
this.unitComboBox.FormattingEnabled = true;
|
||||||
|
this.unitComboBox.Location = new System.Drawing.Point(962, 46);
|
||||||
|
this.unitComboBox.Name = "unitComboBox";
|
||||||
|
this.unitComboBox.Size = new System.Drawing.Size(123, 31);
|
||||||
|
this.unitComboBox.TabIndex = 103;
|
||||||
|
this.unitComboBox.SelectedIndexChanged += new System.EventHandler(this.unitComboBox_SelectedIndexChanged);
|
||||||
|
this.unitComboBox.TextChanged += new System.EventHandler(this.unitComboBox_TextChanged);
|
||||||
|
//
|
||||||
|
// TestStartEndForm
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.BackColor = System.Drawing.Color.DarkGray;
|
||||||
|
this.ClientSize = new System.Drawing.Size(1284, 676);
|
||||||
|
this.Controls.Add(this.unitComboBox);
|
||||||
|
this.Controls.Add(this.largeExclamationLabel);
|
||||||
|
this.Controls.Add(this.largeTextBox);
|
||||||
|
this.Controls.Add(this.okButton);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||||
|
this.Name = "TestStartEndForm";
|
||||||
|
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
|
this.Text = "End States";
|
||||||
|
this.TopMost = true;
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Button okButton;
|
||||||
|
private System.Windows.Forms.TextBox largeTextBox;
|
||||||
|
private System.Windows.Forms.Label largeExclamationLabel;
|
||||||
|
private System.Windows.Forms.ComboBox unitComboBox;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
120
TBF/Rig/DataEntry/Uni/TestStartEndForm.resx
Normal file
120
TBF/Rig/DataEntry/Uni/TestStartEndForm.resx
Normal file
@ -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>
|
||||||
@ -273,6 +273,8 @@ namespace TBF.Rig.Sequences
|
|||||||
if (cmpnt is ISessionDataMngmnt) (cmpnt as ISessionDataMngmnt).StartSession();
|
if (cmpnt is ISessionDataMngmnt) (cmpnt as ISessionDataMngmnt).StartSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataEntry.DEItem.ClearSummaryColumns();
|
||||||
|
|
||||||
IsQ2PreCorrectionCalculated = false;
|
IsQ2PreCorrectionCalculated = false;
|
||||||
CalculatedQ2PreCorrectionLR = 0;
|
CalculatedQ2PreCorrectionLR = 0;
|
||||||
CalculatedQ2PreCorrectionRL = 0;
|
CalculatedQ2PreCorrectionRL = 0;
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using log4net;
|
|||||||
using Common;
|
using Common;
|
||||||
using Config;
|
using Config;
|
||||||
using Config.Entities;
|
using Config.Entities;
|
||||||
|
using TBF.Rig.DataEntry;
|
||||||
using TBF.Rig.GenericDevices;
|
using TBF.Rig.GenericDevices;
|
||||||
using TBF.Rig.Operations;
|
using TBF.Rig.Operations;
|
||||||
using TBF.Boxes;
|
using TBF.Boxes;
|
||||||
@ -1352,31 +1353,35 @@ namespace TBF.Rig.Sequences
|
|||||||
//sb.Append(";"); sb.Append((tstRslt.TotalPulsesMstr != 0) ? tstRslt.TotalPulsesMstr.ToString() : " "); /// CD - '' - pre druhy (Prolonged : celkovy pocet)
|
//sb.Append(";"); sb.Append((tstRslt.TotalPulsesMstr != 0) ? tstRslt.TotalPulsesMstr.ToString() : " "); /// CD - '' - pre druhy (Prolonged : celkovy pocet)
|
||||||
sb.Append(";"); sb.Append(1000 * tstRslt.TestTimeCorrection); /// CD [ms] Diverter test time correction
|
sb.Append(";"); sb.Append(1000 * tstRslt.TestTimeCorrection); /// CD [ms] Diverter test time correction
|
||||||
|
|
||||||
for (int i = 0; i < ProcessData.BatchRslts.WMPositionsCount; i++)
|
var smryItems = DEItem.GetSummaryColumns();
|
||||||
|
|
||||||
|
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||||
{
|
{
|
||||||
if (ProcessData.BatchRslts.Batch.WaterMeters != null &&
|
if (BatchRslts.Batch.WaterMeters != null &&
|
||||||
ProcessData.BatchRslts.Batch.WaterMeters.Count > i &&
|
BatchRslts.Batch.WaterMeters.Count > i &&
|
||||||
ProcessData.BatchRslts.Batch.WaterMeters[i] != null &&
|
BatchRslts.Batch.WaterMeters[i] != null &&
|
||||||
!ProcessData.BatchRslts.Batch.WaterMeters[i].Disabled)
|
!BatchRslts.Batch.WaterMeters[i].Disabled)
|
||||||
{
|
{
|
||||||
if (!ProcessData.BatchRslts.Batch.WaterMeters[i].Compound() && !ProcessData.BatchRslts.Batch.WaterMeters[i].HeatMeter())
|
var wm = BatchRslts.Batch.WaterMeters[i];
|
||||||
|
|
||||||
|
if (!wm.Compound() && !wm.HeatMeter())
|
||||||
{
|
{
|
||||||
/// If this is a single meter
|
/// If this is a single meter
|
||||||
|
|
||||||
Results.Entities.MeterTestRslt mtrRslt = ProcessData.BatchRslts.GetMeterTestRslt(tstRslt.Name(), i, CompoundMeterId.Single);
|
Results.Entities.MeterTestRslt mtrRslt = BatchRslts.GetMeterTestRslt(tstRslt.Name(), i, CompoundMeterId.Single);
|
||||||
|
|
||||||
if (mtrRslt != null)
|
if (mtrRslt != null)
|
||||||
{
|
{
|
||||||
bool isCamera = (mtrRslt.RegReaderType == (int)RegisterReaderType.Camera);
|
bool isCamera = (mtrRslt.RegReaderType == (int)RegisterReaderType.Camera);
|
||||||
|
|
||||||
sb.Append(";"); sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].SerialNr);/// CE WM Ser.No.
|
sb.Append(";"); sb.Append(wm.SerialNr);/// CE WM Ser.No.
|
||||||
sb.Append(";"); sb.Append(mtrRslt.VolumeStart); /// CF WM Vstart - pociatocny stav pri pevnom starte alebo zachyteny pri data streame
|
sb.Append(";"); sb.Append(mtrRslt.VolumeStart); /// CF WM Vstart - pociatocny stav pri pevnom starte alebo zachyteny pri data streame
|
||||||
sb.Append(";"); sb.Append(mtrRslt.VolumeEnd); /// CG WM Vend - konecny stav pri pevnom starte alebo zachyteny pri data streame
|
sb.Append(";"); sb.Append(mtrRslt.VolumeEnd); /// CG WM Vend - konecny stav pri pevnom starte alebo zachyteny pri data streame
|
||||||
sb.Append(";"); sb.Append(mtrRslt.VolumeMeter); /// CH WM Vmer - objem namerany vodomerom
|
sb.Append(";"); sb.Append(mtrRslt.VolumeMeter); /// CH WM Vmer - objem namerany vodomerom
|
||||||
sb.Append(";"); sb.Append(mtrRslt.VolumeRef); /// CI WM Vref - objem namerany stanicou
|
sb.Append(";"); sb.Append(mtrRslt.VolumeRef); /// CI WM Vref - objem namerany stanicou
|
||||||
sb.Append(";"); sb.Append(mtrRslt.Error); /// CJ WM Emt - chyba vodomerom nameraneho objemu
|
sb.Append(";"); sb.Append(mtrRslt.Error); /// CJ WM Emt - chyba vodomerom nameraneho objemu
|
||||||
#if IPERL
|
#if IPERL
|
||||||
sb.Append(";"); sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].CalibFactor); /// CK iPerl calibration factor used during the test / ...
|
sb.Append(";"); sb.Append(wm.CalibFactor); /// CK iPerl calibration factor used during the test / ...
|
||||||
#else
|
#else
|
||||||
sb.Append(";"); sb.Append(" "); /// CK nechat prazdne
|
sb.Append(";"); sb.Append(" "); /// CK nechat prazdne
|
||||||
#endif
|
#endif
|
||||||
@ -1391,7 +1396,7 @@ namespace TBF.Rig.Sequences
|
|||||||
#endif
|
#endif
|
||||||
sb.Append(";"); sb.Append(isCamera
|
sb.Append(";"); sb.Append(isCamera
|
||||||
? mtrRslt.VolumeStart * mtrRslt.PulsesPerLiter /// CQ WM Phi_start (pri hodnotach z kamery)
|
? mtrRslt.VolumeStart * mtrRslt.PulsesPerLiter /// CQ WM Phi_start (pri hodnotach z kamery)
|
||||||
: ProcessData.BatchRslts.Batch.WaterMeters[i].WMPosition); /// CQ WMPosition (normalne)
|
: wm.WMPosition); /// CQ WMPosition (normalne)
|
||||||
sb.Append(";"); sb.Append(isCamera
|
sb.Append(";"); sb.Append(isCamera
|
||||||
? mtrRslt.VolumeEnd * mtrRslt.PulsesPerLiter /// CR WM Phi_end (pri hodnotach z kamery)
|
? mtrRslt.VolumeEnd * mtrRslt.PulsesPerLiter /// CR WM Phi_end (pri hodnotach z kamery)
|
||||||
: 0); /// CR not used/spare (normalne)
|
: 0); /// CR not used/spare (normalne)
|
||||||
@ -1399,15 +1404,15 @@ namespace TBF.Rig.Sequences
|
|||||||
sb.Append(";"); sb.Append(mtrRslt.TimestampStart); /// CS WM Time_start - ' ' -
|
sb.Append(";"); sb.Append(mtrRslt.TimestampStart); /// CS WM Time_start - ' ' -
|
||||||
sb.Append(";"); sb.Append(mtrRslt.TimestampEnd); /// CT WM Time_end - ' ' -
|
sb.Append(";"); sb.Append(mtrRslt.TimestampEnd); /// CT WM Time_end - ' ' -
|
||||||
|
|
||||||
sb.Append(";"); sb.Append(isCamera ? mtrRslt.PulsesPerLiter : 0); /// CU WM Degree per liter
|
//sb.Append(";"); sb.Append(isCamera ? mtrRslt.PulsesPerLiter : 0); /// CU camera: WM Degree per liter
|
||||||
|
sb.Append(";"); sb.Append(smryItems.Count < 1 ? "0" : DEUtils.GetContent(smryItems[0].Content, wm)); /// CU
|
||||||
sb.Append(";"); sb.Append(0); /// CV Analog out 1 (max mA)
|
sb.Append(";"); sb.Append(smryItems.Count < 2 ? "0" : DEUtils.GetContent(smryItems[1].Content, wm)); /// CV
|
||||||
sb.Append(";"); sb.Append(0); /// CW Analog out 2 (V)
|
sb.Append(";"); sb.Append(smryItems.Count < 3 ? "0" : DEUtils.GetContent(smryItems[2].Content, wm)); /// CW
|
||||||
sb.Append(";"); sb.Append(0); /// CX Analog out 3 (min mA)
|
sb.Append(";"); sb.Append(smryItems.Count < 4 ? "0" : DEUtils.GetContent(smryItems[3].Content, wm)); /// CX
|
||||||
sb.Append(";"); sb.Append(0); /// CY Analog out 4 (max Q)
|
sb.Append(";"); sb.Append(smryItems.Count < 5 ? "0" : DEUtils.GetContent(smryItems[4].Content, wm)); /// CY
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ProcessData.BatchRslts.Batch.WaterMeters[i].Compound())
|
else if (wm.Compound())
|
||||||
{
|
{
|
||||||
/// Else if this is a compound meter
|
/// Else if this is a compound meter
|
||||||
|
|
||||||
@ -1421,13 +1426,13 @@ namespace TBF.Rig.Sequences
|
|||||||
switch ((CompoundMeterId)b)
|
switch ((CompoundMeterId)b)
|
||||||
{
|
{
|
||||||
case CompoundMeterId.CompoundMain:
|
case CompoundMeterId.CompoundMain:
|
||||||
sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].SerialNr); /// CE
|
sb.Append(wm.SerialNr); /// CE
|
||||||
break;
|
break;
|
||||||
case CompoundMeterId.CompoundAux:
|
case CompoundMeterId.CompoundAux:
|
||||||
sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].SerialNrAux); /// CE
|
sb.Append(wm.SerialNrAux); /// CE
|
||||||
break;
|
break;
|
||||||
case CompoundMeterId.Compound:
|
case CompoundMeterId.Compound:
|
||||||
sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].SerialNr); /// CE
|
sb.Append(wm.SerialNr); /// CE
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sb.Append(";"); sb.Append(mtrRslt.VolumeStart); /// CF WM Vinit - pri pevnom starte pociatocny stav natukany alebo cez inteligentny system
|
sb.Append(";"); sb.Append(mtrRslt.VolumeStart); /// CF WM Vinit - pri pevnom starte pociatocny stav natukany alebo cez inteligentny system
|
||||||
@ -1456,7 +1461,7 @@ namespace TBF.Rig.Sequences
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /// if (ProcessData.BatchRslts.WaterMeters[i].HeatMeter())
|
else /// if (wm.HeatMeter())
|
||||||
{
|
{
|
||||||
/// Else this is a heat meter
|
/// Else this is a heat meter
|
||||||
|
|
||||||
@ -1465,14 +1470,14 @@ namespace TBF.Rig.Sequences
|
|||||||
|
|
||||||
if (volumeMtr != null)
|
if (volumeMtr != null)
|
||||||
{
|
{
|
||||||
sb.Append(";"); sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].SerialNr); /// WM Ser.No.
|
sb.Append(";"); sb.Append(wm.SerialNr); /// WM Ser.No.
|
||||||
sb.Append(";"); sb.Append(volumeMtr.VolumeStart); /// WM Vstart - pociatocny stav pri pevnom starte alebo zachyteny pri data streame
|
sb.Append(";"); sb.Append(volumeMtr.VolumeStart); /// WM Vstart - pociatocny stav pri pevnom starte alebo zachyteny pri data streame
|
||||||
sb.Append(";"); sb.Append(volumeMtr.VolumeEnd); /// WM Vend - konecny stav pri pevnom starte alebo zachyteny pri data streame
|
sb.Append(";"); sb.Append(volumeMtr.VolumeEnd); /// WM Vend - konecny stav pri pevnom starte alebo zachyteny pri data streame
|
||||||
sb.Append(";"); sb.Append(volumeMtr.VolumeMeter); /// WM Vmer - objem namerany vodomerom
|
sb.Append(";"); sb.Append(volumeMtr.VolumeMeter); /// WM Vmer - objem namerany vodomerom
|
||||||
sb.Append(";"); sb.Append(volumeMtr.VolumeRef); /// WM Vref - objem namerany stanicou
|
sb.Append(";"); sb.Append(volumeMtr.VolumeRef); /// WM Vref - objem namerany stanicou
|
||||||
sb.Append(";"); sb.Append(volumeMtr.Error); /// WM Emt - chyba vodomerom nameraneho objemu
|
sb.Append(";"); sb.Append(volumeMtr.Error); /// WM Emt - chyba vodomerom nameraneho objemu
|
||||||
#if IPERL
|
#if IPERL
|
||||||
sb.Append(";"); sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].CalibFactor); /// iPerl calibration factor used during the test / ...
|
sb.Append(";"); sb.Append(wm.CalibFactor); /// iPerl calibration factor used during the test / ...
|
||||||
#else
|
#else
|
||||||
sb.Append(";"); sb.Append(" "); /// nechat prazdne
|
sb.Append(";"); sb.Append(" "); /// nechat prazdne
|
||||||
#endif
|
#endif
|
||||||
@ -1500,7 +1505,7 @@ namespace TBF.Rig.Sequences
|
|||||||
sb.Append(";"); sb.Append(energyMtr.VolumeRef); /// WM Vref - objem namerany stanicou
|
sb.Append(";"); sb.Append(energyMtr.VolumeRef); /// WM Vref - objem namerany stanicou
|
||||||
sb.Append(";"); sb.Append(energyMtr.Error); /// WM Emt - chyba vodomerom nameraneho objemu
|
sb.Append(";"); sb.Append(energyMtr.Error); /// WM Emt - chyba vodomerom nameraneho objemu
|
||||||
#if IPERL
|
#if IPERL
|
||||||
sb.Append(";"); sb.Append(ProcessData.BatchRslts.Batch.WaterMeters[i].CalibFactor); /// iPerl calibration factor used during the test / ...
|
sb.Append(";"); sb.Append(wm.CalibFactor); /// iPerl calibration factor used during the test / ...
|
||||||
#else
|
#else
|
||||||
sb.Append(";"); sb.Append(" "); /// nechat prazdne
|
sb.Append(";"); sb.Append(" "); /// nechat prazdne
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -44,6 +44,7 @@ namespace TBF.Rig
|
|||||||
Factories.Add(new DataEntry.Standard48.Factory());
|
Factories.Add(new DataEntry.Standard48.Factory());
|
||||||
Factories.Add(new DataEntry.Standard48.FactoryNoStartEnd());
|
Factories.Add(new DataEntry.Standard48.FactoryNoStartEnd());
|
||||||
Factories.Add(new DataEntry.StandardCamera.Factory());
|
Factories.Add(new DataEntry.StandardCamera.Factory());
|
||||||
|
Factories.Add(new DataEntry.Uni.Factory());
|
||||||
Factories.Add(new DataEntry.WMStates.EntryFormFactory());
|
Factories.Add(new DataEntry.WMStates.EntryFormFactory());
|
||||||
Factories.Add(new RegisterReaders.KPackE.DataEntryForRadio.Factory()); /// DataEntry for KPackE radio
|
Factories.Add(new RegisterReaders.KPackE.DataEntryForRadio.Factory()); /// DataEntry for KPackE radio
|
||||||
Factories.Add(new Dummy.Balance.Factory());
|
Factories.Add(new Dummy.Balance.Factory());
|
||||||
|
|||||||
@ -242,6 +242,7 @@
|
|||||||
<Compile Include="Rig\DataEntry\DataStream\TestStartEndForm.designer.cs">
|
<Compile Include="Rig\DataEntry\DataStream\TestStartEndForm.designer.cs">
|
||||||
<DependentUpon>TestStartEndForm.cs</DependentUpon>
|
<DependentUpon>TestStartEndForm.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Rig\DataEntry\DEItem.cs" />
|
||||||
<Compile Include="Rig\DataEntry\Double24\CycleBeginningForm.cs">
|
<Compile Include="Rig\DataEntry\Double24\CycleBeginningForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -557,6 +558,23 @@
|
|||||||
<DependentUpon>TestStartEndForm.cs</DependentUpon>
|
<DependentUpon>TestStartEndForm.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Rig\DataEntry\DEUtils.cs" />
|
<Compile Include="Rig\DataEntry\DEUtils.cs" />
|
||||||
|
<Compile Include="Rig\DataEntry\Uni\CycleBgEnForm.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Rig\DataEntry\Uni\CycleBgEnForm.designer.cs">
|
||||||
|
<DependentUpon>CycleBgEnForm.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Rig\DataEntry\Uni\EntryForm.cs" />
|
||||||
|
<Compile Include="Rig\DataEntry\Uni\EntryFormCfg.cs" />
|
||||||
|
<Compile Include="Rig\DataEntry\Uni\EntryFormNoStartEnd.cs" />
|
||||||
|
<Compile Include="Rig\DataEntry\Uni\Factory.cs" />
|
||||||
|
<Compile Include="Rig\DataEntry\Uni\FactoryNoStartEnd.cs" />
|
||||||
|
<Compile Include="Rig\DataEntry\Uni\TestStartEndForm.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Rig\DataEntry\Uni\TestStartEndForm.designer.cs">
|
||||||
|
<DependentUpon>TestStartEndForm.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Rig\DataEntry\WMStates\EntryForm.cs" />
|
<Compile Include="Rig\DataEntry\WMStates\EntryForm.cs" />
|
||||||
<Compile Include="Rig\DataEntry\WMStates\EntryFormCfg.cs" />
|
<Compile Include="Rig\DataEntry\WMStates\EntryFormCfg.cs" />
|
||||||
<Compile Include="Rig\DataEntry\WMStates\EntryFormCfgCtrl.cs">
|
<Compile Include="Rig\DataEntry\WMStates\EntryFormCfgCtrl.cs">
|
||||||
@ -2981,6 +2999,12 @@
|
|||||||
<EmbeddedResource Include="Rig\DataEntry\StandardCamera\TestStartEndForm.resx">
|
<EmbeddedResource Include="Rig\DataEntry\StandardCamera\TestStartEndForm.resx">
|
||||||
<DependentUpon>TestStartEndForm.cs</DependentUpon>
|
<DependentUpon>TestStartEndForm.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Rig\DataEntry\Uni\CycleBgEnForm.resx">
|
||||||
|
<DependentUpon>CycleBgEnForm.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Rig\DataEntry\Uni\TestStartEndForm.resx">
|
||||||
|
<DependentUpon>TestStartEndForm.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Rig\DataEntry\WMStates\EntryFormCfgCtrl.resx">
|
<EmbeddedResource Include="Rig\DataEntry\WMStates\EntryFormCfgCtrl.resx">
|
||||||
<DependentUpon>EntryFormCfgCtrl.cs</DependentUpon>
|
<DependentUpon>EntryFormCfgCtrl.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user