Column Message added to transition steps, DB format changed, not displayed during purging yet
This commit is contained in:
parent
d1cb0a4f43
commit
766a3cb2b2
@ -8,6 +8,7 @@ namespace TBF.Entities
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual int ItemNr { get; set; } /// Order of the preparation step
|
||||
public virtual int Duration { get; set; } /// Duration in seconds
|
||||
public virtual string Message { get; set; } /// Message
|
||||
public virtual string ValvesOpen { get; set; } /// List of valves to be opened
|
||||
public virtual string ValvesClose { get; set; } /// List of valves to be closed
|
||||
public virtual string RegulValvesPct { get; set; } /// Positions of regulation valves in % separated by ';'
|
||||
@ -33,6 +34,7 @@ namespace TBF.Entities
|
||||
{
|
||||
TransitionStep result = new TransitionStep(ItemNr, TransitionSequence);
|
||||
result.Duration = Duration;
|
||||
result.Message = Message;
|
||||
result.ValvesOpen = ValvesOpen;
|
||||
result.ValvesClose = ValvesClose;
|
||||
result.RegulValvesPct = RegulValvesPct;
|
||||
@ -45,6 +47,7 @@ namespace TBF.Entities
|
||||
string result = "";
|
||||
result += indent + "ItemNr = " + ItemNr.ToString() + ", ";
|
||||
result += indent + "Duration = " + Duration.ToString() + ", ";
|
||||
result += indent + "Message = " + Message + ", ";
|
||||
result += indent + "ValvesOpen = " + ValvesOpen.ToString() + ", ";
|
||||
result += indent + "ValvesClose = " + ValvesClose.ToString() + ", ";
|
||||
result += indent + "RegulValvesPct = " + RegulValvesPct.ToString() + ", ";
|
||||
|
||||
@ -10,6 +10,7 @@ namespace TBF.Mappings
|
||||
Id(x => x.Id);
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Duration);
|
||||
Map(x => x.Message);
|
||||
Map(x => x.ValvesOpen)
|
||||
.CustomType("StringClob")
|
||||
.CustomSqlType("varchar(8000)");
|
||||
|
||||
@ -17,6 +17,7 @@ namespace TBF.UiControls
|
||||
enum Column
|
||||
{
|
||||
Duration,
|
||||
Message,
|
||||
FixedColumnsCount,
|
||||
}
|
||||
readonly int fixedCount = (int)Column.FixedColumnsCount;
|
||||
@ -55,7 +56,8 @@ namespace TBF.UiControls
|
||||
/// ListViewEx columns
|
||||
///
|
||||
Columns.Add(Strings.Duration_s, 70 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
foreach (var vlv in parent.Valves)
|
||||
Columns.Add(Strings.Message, 100 * parent.Dpi / PathsDlg.Dpi100pct);
|
||||
foreach (var vlv in parent.Valves)
|
||||
{
|
||||
if (vlv is BenchControl.GenericDevices.IPumpFM)
|
||||
{
|
||||
@ -81,9 +83,14 @@ namespace TBF.UiControls
|
||||
///
|
||||
editors = new Control[fixedCount + vCount + fmPumpCount + regvCount];
|
||||
|
||||
editors[0] = new TextBox(); /// Duration
|
||||
/// Duration
|
||||
editors[0] = new TextBox();
|
||||
parent.Controls.Add(editors[0]);
|
||||
|
||||
/// Message
|
||||
editors[1] = new TextBox();
|
||||
parent.Controls.Add(editors[1]);
|
||||
|
||||
for (int i = fixedCount; i < fixedCount + fmPumpCount; i++)
|
||||
{
|
||||
ComboBox cb = new ComboBox();
|
||||
@ -141,7 +148,16 @@ namespace TBF.UiControls
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
else if ((e.SubItem >= fixedCount) && (e.SubItem < fixedCount + fmPumpCount))
|
||||
else if (e.SubItem == (int)Column.Message)
|
||||
{
|
||||
if (e.DisplayText.Length >= 255)
|
||||
{
|
||||
// Message too long
|
||||
e.DisplayText = e.Item.Text;
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
else if ((e.SubItem >= fixedCount) && (e.SubItem < fixedCount + fmPumpCount))
|
||||
{
|
||||
float pct;
|
||||
if (!e.DisplayText.Equals("---") &&
|
||||
@ -191,6 +207,7 @@ namespace TBF.UiControls
|
||||
}
|
||||
|
||||
ListViewItem lvi = new ListViewItem(step.Duration.ToString());
|
||||
lvi.SubItems.Add(string.IsNullOrEmpty(step.Message) ? string.Empty : step.Message);
|
||||
|
||||
string[] fmPumpsStr = (step.PumpWithFMPcts != null) ? step.PumpWithFMPcts.Split(new char[] { ';' })
|
||||
: new string[0];
|
||||
@ -234,92 +251,102 @@ namespace TBF.UiControls
|
||||
{
|
||||
Entities.TransitionStep step = (Entities.TransitionStep)myItem;
|
||||
|
||||
/// Duration
|
||||
/// Duration
|
||||
try
|
||||
{
|
||||
step.Duration = int.Parse(lvi.Text);
|
||||
if (step.Duration < 2) throw (new System.Exception());
|
||||
}
|
||||
catch
|
||||
{
|
||||
lvi.Text = step.Duration.ToString();
|
||||
}
|
||||
{
|
||||
lvi.Text = step.Duration.ToString();
|
||||
}
|
||||
|
||||
string valvesOpen = string.Empty;
|
||||
string valvesClose = string.Empty;
|
||||
string regulValvesPct = string.Empty;
|
||||
string fmPumpsPcts = string.Empty;
|
||||
/// Message
|
||||
if (lvi.SubItems[(int)Column.Message].Text.Length == 0)
|
||||
{
|
||||
step.Message = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
step.Message = lvi.SubItems[(int)Column.Message].Text;
|
||||
}
|
||||
|
||||
/// Pumps with FM control
|
||||
int i = 0;
|
||||
foreach (var valve in parent.Valves)
|
||||
{
|
||||
if (valve is BenchControl.GenericDevices.IPumpFM)
|
||||
{
|
||||
string lviSubitText = lvi.SubItems[fixedCount + i++].Text;
|
||||
if (fmPumpsPcts.Length > 0) fmPumpsPcts += ";";
|
||||
float fdummy;
|
||||
if (lviSubitText.Equals("---"))
|
||||
{
|
||||
fmPumpsPcts += lviSubitText;
|
||||
}
|
||||
else if (lviSubitText.Equals(Strings.dflt))
|
||||
{
|
||||
fmPumpsPcts += lviSubitText;
|
||||
if (valvesOpen != string.Empty) valvesOpen += ";";
|
||||
valvesOpen += valve.Cfg.Name;
|
||||
}
|
||||
else if (Utils.TryParseUFloat(lviSubitText, out fdummy) && (fdummy >= 0) && (fdummy <= 100.0f))
|
||||
{
|
||||
fmPumpsPcts += lviSubitText;
|
||||
if (fdummy > 0)
|
||||
{
|
||||
if (valvesOpen != string.Empty) valvesOpen += ";";
|
||||
valvesOpen += valve.Cfg.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (valvesClose != string.Empty) valvesClose += ";";
|
||||
valvesClose += valve.Cfg.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
string valvesOpen = string.Empty;
|
||||
string valvesClose = string.Empty;
|
||||
string regulValvesPct = string.Empty;
|
||||
string fmPumpsPcts = string.Empty;
|
||||
|
||||
/// Regulation valves
|
||||
for (int k = fixedCount + fmPumpCount; k < fixedCount + fmPumpCount + regvCount; k++)
|
||||
{
|
||||
if (regulValvesPct.Length > 0) regulValvesPct += ";";
|
||||
float fdummy;
|
||||
if (lvi.SubItems[k].Text.Equals("---") ||
|
||||
(Utils.TryParseUFloat(lvi.SubItems[k].Text, out fdummy) && (fdummy >= 0) && (fdummy <= 100.0f)))
|
||||
{
|
||||
regulValvesPct += lvi.SubItems[k].Text;
|
||||
}
|
||||
}
|
||||
/// Pumps with FM control
|
||||
int i = 0;
|
||||
foreach (var valve in parent.Valves)
|
||||
{
|
||||
if (valve is BenchControl.GenericDevices.IPumpFM)
|
||||
{
|
||||
string lviSubitText = lvi.SubItems[fixedCount + i++].Text;
|
||||
if (fmPumpsPcts.Length > 0) fmPumpsPcts += ";";
|
||||
float fdummy;
|
||||
if (lviSubitText.Equals("---"))
|
||||
{
|
||||
fmPumpsPcts += lviSubitText;
|
||||
}
|
||||
else if (lviSubitText.Equals(Strings.dflt))
|
||||
{
|
||||
fmPumpsPcts += lviSubitText;
|
||||
if (valvesOpen != string.Empty) valvesOpen += ";";
|
||||
valvesOpen += valve.Cfg.Name;
|
||||
}
|
||||
else if (Utils.TryParseUFloat(lviSubitText, out fdummy) && (fdummy >= 0) && (fdummy <= 100.0f))
|
||||
{
|
||||
fmPumpsPcts += lviSubitText;
|
||||
if (fdummy > 0)
|
||||
{
|
||||
if (valvesOpen != string.Empty) valvesOpen += ";";
|
||||
valvesOpen += valve.Cfg.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (valvesClose != string.Empty) valvesClose += ";";
|
||||
valvesClose += valve.Cfg.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Regulation valves
|
||||
for (int k = fixedCount + fmPumpCount; k < fixedCount + fmPumpCount + regvCount; k++)
|
||||
{
|
||||
if (regulValvesPct.Length > 0) regulValvesPct += ";";
|
||||
float fdummy;
|
||||
if (lvi.SubItems[k].Text.Equals("---") ||
|
||||
(Utils.TryParseUFloat(lvi.SubItems[k].Text, out fdummy) && (fdummy >= 0) && (fdummy <= 100.0f)))
|
||||
{
|
||||
regulValvesPct += lvi.SubItems[k].Text;
|
||||
}
|
||||
}
|
||||
|
||||
/// Valves
|
||||
for (int j = 0, k = 0; j < vCount; j++)
|
||||
{
|
||||
if (!(parent.Valves[j] is BenchControl.GenericDevices.IPumpFM))
|
||||
{
|
||||
string lviSubitText = lvi.SubItems[fixedCount + fmPumpCount + regvCount + k++].Text;
|
||||
if (lviSubitText.Equals(Strings.open))
|
||||
{
|
||||
if (valvesOpen != string.Empty) valvesOpen += ";";
|
||||
valvesOpen += parent.Valves[j].Cfg.Name;
|
||||
}
|
||||
if (lviSubitText.Equals(Strings.close))
|
||||
{
|
||||
if (valvesClose != string.Empty) valvesClose += ";";
|
||||
valvesClose += parent.Valves[j].Cfg.Name;
|
||||
}
|
||||
}
|
||||
if (!(parent.Valves[j] is BenchControl.GenericDevices.IPumpFM))
|
||||
{
|
||||
string lviSubitText = lvi.SubItems[fixedCount + fmPumpCount + regvCount + k++].Text;
|
||||
if (lviSubitText.Equals(Strings.open))
|
||||
{
|
||||
if (valvesOpen != string.Empty) valvesOpen += ";";
|
||||
valvesOpen += parent.Valves[j].Cfg.Name;
|
||||
}
|
||||
if (lviSubitText.Equals(Strings.close))
|
||||
{
|
||||
if (valvesClose != string.Empty) valvesClose += ";";
|
||||
valvesClose += parent.Valves[j].Cfg.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
step.PumpWithFMPcts = fmPumpsPcts;
|
||||
step.RegulValvesPct = regulValvesPct;
|
||||
step.ValvesOpen = valvesOpen;
|
||||
step.PumpWithFMPcts = fmPumpsPcts;
|
||||
step.RegulValvesPct = regulValvesPct;
|
||||
step.ValvesOpen = valvesOpen;
|
||||
step.ValvesClose = valvesClose;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user