Profiles: Method added, imp./exp. fixed, Procedures: Selection by profile, Create from profile button, etc, ver. 3.5.1992

This commit is contained in:
Milan Hanajik
2022-11-25 13:59:35 +01:00
parent b54de856af
commit 6dcd40c640
20 changed files with 667 additions and 265 deletions
+29 -22
View File
@@ -1,6 +1,10 @@
///
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
///
#if KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_50 || WARSAW_END
#define SHOW_Q_TG
#endif
using System;
using System.Collections.Generic;
using System.Linq;
@@ -84,7 +88,7 @@ namespace TBF.UI.Procedures
/// SharedDlgButtons configuration
sharedButtons.ParentForm = parentForm;
#if KEMPNO_50 || KRAKOW_50
#if KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_50 || WARSAW_END
sharedButtons.RequiredGroupMembership = procedure.Protected ? new GID[] { GID.WaterMeterAuthority }
: new GID[] { GID.TestingSpecialists, GID.WaterMeterAuthority };
#else
@@ -328,11 +332,10 @@ namespace TBF.UI.Procedures
IList<IComponent> other = new List<IComponent>();
foreach (var cmpnt in TbfComponents)
{
if (cmpnt is TBF.Rig.Output.DB.SensusOracle.Database) other.Add(cmpnt);
if (cmpnt is TBF.Rig.TestMethods.S640Communication.S640Start) other.Add(cmpnt);
if (cmpnt is TBF.Rig.TestMethods.S640Communication.S640End) other.Add(cmpnt);
if (cmpnt is TBF.Rig.Modbus.TempControl.Easytherm.TControl) other.Add(cmpnt);
if (cmpnt is TBF.Rig.Modbus.TempControl.Novus.TControl) other.Add(cmpnt);
if (!(cmpnt is IRegReader) && !(cmpnt is IWaterMeter) && cmpnt.Cfg.CreateProcParamsProvider() != null)
{
other.Add(cmpnt);
}
}
if (other.Count > 0)
@@ -356,7 +359,7 @@ namespace TBF.UI.Procedures
LoadUISettings();
/// Enable/disable/show/hide controls in General tab
#if KEMPNO_50 || KRAKOW_50
#if KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_50 || WARSAW_END
altProcNameLabel.Visible = true;
altProcNameTextBox.Visible = true;
//altProcPeriodLabel.Visible = true;
@@ -777,7 +780,7 @@ namespace TBF.UI.Procedures
{
Name,
Part,
#if TEST_PROFILES
#if SHOW_Q_TG
Qtg,
#endif
Qfrom,
@@ -799,7 +802,7 @@ namespace TBF.UI.Procedures
ListViewEx lv = metrology1ListViewEx;
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_chdr, Width = 70 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Part, Width = 40 });
#if TEST_PROFILES
#if SHOW_Q_TG
lv.Columns.Add(new ColumnHeader { Text = Strings.Q_tg, Width = 80 });
#endif
lv.Columns.Add(new ColumnHeader { Text = Strings.Q_from, Width = 80 });
@@ -819,7 +822,7 @@ namespace TBF.UI.Procedures
var flowUnitBox = new ComboBox();
var volUnitBox = new ComboBox();
for (Common.Unit u = 0; u < Common.Unit.Count; u++)
for (Unit u = 0; u < Unit.Count; u++)
{
if (Units.IsFlow(u)) flowUnitBox.Items.Add(u.ToDescription());
if (Units.IsVolume(u)) volUnitBox.Items.Add(u.ToDescription());
@@ -829,7 +832,7 @@ namespace TBF.UI.Procedures
{
new TextBox(), /// Name
new TextBox(), /// Part
#if TEST_PROFILES
#if SHOW_Q_TG
new TextBox(), /// Qtg
#endif
new TextBox(), /// Qfrom
@@ -874,7 +877,7 @@ namespace TBF.UI.Procedures
ListViewItem lvi = new ListViewItem(test.Name); /// Name
lvi.Tag = test;
lvi.SubItems.Add((test.Part == 0) ? "-" : test.Part.ToString()); /// Part
#if TEST_PROFILES
#if SHOW_Q_TG
lvi.SubItems.Add(Units.ConvertTo(test.FlowUnit, test.Qtg).ToString()); /// Q_tg (target flow)
#endif
lvi.SubItems.Add(Units.ConvertTo(test.FlowUnit, test.Qfrom).ToString()); /// Q_from
@@ -917,7 +920,7 @@ namespace TBF.UI.Procedures
int itmp;
float tmp;
double dtmp;
#if TEST_PROFILES
#if SHOW_Q_TG
if (test.QtgTextChngd && Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.Qtg].Text, out dtmp))
test.Qtg = (float)Units.ConvertFrom(test.FlowUnit, dtmp);
#endif
@@ -949,7 +952,7 @@ namespace TBF.UI.Procedures
{
MtrlgyClmn column = (MtrlgyClmn)e.SubItem;
#if TEST_PROFILES
#if SHOW_Q_TG
if (e.SubItem == (int)MtrlgyClmn.Qtg) return;
#endif
/// Unit change is allowed when locked
@@ -972,7 +975,7 @@ namespace TBF.UI.Procedures
void metrology1ListViewEx_SubItemRightClicked(object sender, SubItemEventArgs e)
{
#if TEST_PROFILES
#if SHOW_Q_TG
if (e.SubItem == (int)MtrlgyClmn.Qtg) return;
#endif
if (!unlocked || e.SubItem >= (int)MtrlgyClmn.ColumnsCount) return;
@@ -1027,7 +1030,7 @@ namespace TBF.UI.Procedures
if (int.TryParse(e.DisplayText, out dummy) && Data.IsGoodPartNr(dummy)) return; /// OK
break;
#if TEST_PROFILES
#if SHOW_Q_TG
case MtrlgyClmn.Qtg:
if (Utils.TryParseUFloat(e.DisplayText, out fdummy))
{
@@ -1163,7 +1166,7 @@ namespace TBF.UI.Procedures
ix = (int)MtrlgyClmn.Qto;
flowM3ph = Units.ConvertFrom(oriUnit, Utils.ParseUDouble(item.SubItems[ix].Text));
item.SubItems[ix].Text = Units.ConvertTo(newUnit, test.QtoTextChngd ? flowM3ph : test.Qto).ToString();
#if TEST_PROFILES
#if SHOW_Q_TG
ix = (int)MtrlgyClmn.Qtg;
flowM3ph = Units.ConvertFrom(oriUnit, Utils.ParseUDouble(item.SubItems[ix].Text));
item.SubItems[ix].Text = Units.ConvertTo(newUnit, test.QtgTextChngd ? flowM3ph : test.Qtg).ToString();
@@ -1238,7 +1241,7 @@ namespace TBF.UI.Procedures
}
ComboBox tempUnitBox = new ComboBox();
for (Common.Unit u = 0; u < Common.Unit.Count; u++)
for (Unit u = 0; u < Unit.Count; u++)
{
if (Units.IsTemperature(u)) tempUnitBox.Items.Add(u.ToDescription());
}
@@ -2382,7 +2385,8 @@ namespace TBF.UI.Procedures
if (notUsed) break;
}
/// Find possible selector values
/// Find possible selector values.
/// Empty string or null (which is permitted) is not part of list 'selectorValues'
IList<string> selectorValues = new List<string>();
foreach (var fp in feedingPaths)
{
@@ -2496,7 +2500,8 @@ namespace TBF.UI.Procedures
double Qaver = (test.Qfrom + test.Qto) / 2.0;
foreach (var path in feedingPaths)
{
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto) && (string.IsNullOrEmpty(selector) || path.Selector == selector))
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto) &&
(string.IsNullOrEmpty(selector) || string.IsNullOrEmpty(path.Selector) || path.Selector == selector))
{
test.FeedingPath = path.Name;
break;
@@ -2504,7 +2509,8 @@ namespace TBF.UI.Procedures
}
foreach (var path in benchPaths)
{
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto) && (string.IsNullOrEmpty(selector) || path.Selector == selector))
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto) &&
(string.IsNullOrEmpty(selector) || string.IsNullOrEmpty(path.Selector) || path.Selector == selector))
{
test.BenchPath = path.Name;
break;
@@ -2512,7 +2518,8 @@ namespace TBF.UI.Procedures
}
foreach (var path in outputPaths)
{
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto) && (string.IsNullOrEmpty(selector) || path.Selector == selector))
if ((path.Qfrom <= Qaver) && (Qaver <= path.Qto) &&
(string.IsNullOrEmpty(selector) || string.IsNullOrEmpty(path.Selector) || path.Selector == selector))
{
test.OutputPath = path.Name;
break;