Results, ResultsBrowser: iPerl specific results added, Passed item fixed for a water meter (it was correct only for a test).
This commit is contained in:
parent
d756af52d8
commit
d2c21bcca4
@ -88,6 +88,17 @@ namespace Results.Entities
|
||||
return passed;
|
||||
}
|
||||
|
||||
|
||||
public virtual string PassedColorStr()
|
||||
{
|
||||
#if PUCHONG_PT200
|
||||
return Passed ? "OK|Green" : "NG|Red";
|
||||
#else
|
||||
return Passed ? "OK|Green" : "NOK|Red";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Not mapped to the database
|
||||
///
|
||||
|
||||
@ -111,6 +111,14 @@ namespace Results
|
||||
End_state_aux, /// 101
|
||||
Q_rise, /// 102
|
||||
Q_fall, /// 103
|
||||
|
||||
OrigCalibFactor, /// 104
|
||||
CalibFactor, /// 105
|
||||
Q2ErrWOCorrection, /// 106
|
||||
Q2CorrectionDone, /// 107
|
||||
Q2CorrRFlow, /// 108
|
||||
Q2CorrLFlow, /// 109
|
||||
Q2CorrFlowRight, /// 110
|
||||
|
||||
Count,
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ namespace Results
|
||||
#else
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, Strings.Error + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetMeterTestRslt(t).Error).ToString(string.IsNullOrEmpty(p) ? "F2" : p)));
|
||||
#endif
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result + "()", Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr()));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result + "()", Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr() : ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr())));
|
||||
|
||||
/// Water meter info
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Watermeter_type, Strings.WM_Type, Quantity.String, ItemCategory.MeterData, (w, t, u, f, p) => w.WaterMeterData.ProductName));
|
||||
@ -269,7 +269,17 @@ namespace Results
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TempLoEnd, "T lo en", Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, w.GetTestRslt(t).Custom8).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.TempLoAve, "T lo av", Quantity.Temperature, ItemCategory.Other, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : Config.Units.ConvertTo(u, (w.GetTestRslt(t).Custom7 + w.GetTestRslt(t).Custom8) / 2).ToString(string.IsNullOrEmpty(p) ? "F3" : p)));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if IPERL
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.OrigCalibFactor, "iPerl OrigCalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.OrigCalibFactor.ToString())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactor, "iPerl CalibFactor", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.CalibFactor.ToString())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2ErrWOCorrection.ToString(string.IsNullOrEmpty(p) ? "F2" : p))));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? "yes" : "no")));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2CorrRFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrRFlow.ToString())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2CorrLFlow", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrLFlow.ToString())));
|
||||
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrFlowRight.ToString())));
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a list of 'Output item specifications' to a string array
|
||||
|
||||
@ -5,6 +5,7 @@ using NHibernate;
|
||||
using Results.Entities;
|
||||
using ResultsBrowser.Filters;
|
||||
using ResultsBrowser.Resources;
|
||||
using System.IO;
|
||||
|
||||
namespace ResultsBrowser
|
||||
{
|
||||
@ -259,8 +260,15 @@ namespace ResultsBrowser
|
||||
ListViewItem lvi = null;
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (lvi == null) lvi = new ListViewItem(item.Print(wm));
|
||||
else lvi.SubItems.Add(item.Print(wm));
|
||||
/// Get text and strip color information
|
||||
string itemText = item.Print(wm);
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2) { itemText = texts[0]; }
|
||||
|
||||
if (lvi == null)
|
||||
lvi = new ListViewItem(itemText);
|
||||
else
|
||||
lvi.SubItems.Add(itemText);
|
||||
}
|
||||
if (lvi != null) resultsListView.Items.Add(lvi);
|
||||
}
|
||||
@ -288,8 +296,52 @@ namespace ResultsBrowser
|
||||
|
||||
private void exportQueryResultsBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (waterMeters == null || waterMeters.Count == 0) return;
|
||||
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
|
||||
|
||||
if (waterMeters == null || waterMeters.Count == 0 || items.Count == 0) return;
|
||||
|
||||
SaveFileDialog dlg = new SaveFileDialog();
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
using (TextWriter writer = new StreamWriter(dlg.FileName))
|
||||
{
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
writer.Write(items[i].Caption);
|
||||
|
||||
if (i == items.Count - 1)
|
||||
writer.WriteLine(); /// New line after the last item
|
||||
else
|
||||
writer.Write(";"); /// Semicolon between two items
|
||||
}
|
||||
|
||||
foreach (var wm in waterMeters)
|
||||
{
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
/// Get text and strip color information
|
||||
string itemText = items[i].Print(wm);
|
||||
string[] texts = itemText.Split(new char[] { '|' });
|
||||
if (texts.Length == 2) { itemText = texts[0]; }
|
||||
|
||||
writer.Write(itemText);
|
||||
|
||||
if (i == items.Count - 1)
|
||||
writer.WriteLine(); /// New line after the last item
|
||||
else
|
||||
writer.Write(";"); /// Semicolon between two items
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
MessageBox.Show(exc.Message, Strings.Error_displaying_results, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void printQueryResultsBtn_Click(object sender, EventArgs e)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user