Compare commits

...
Author SHA1 Message Date
Milan Hanajik 28e3ba3b32 Reconfigured fro SLM-50 2019-03-17 12:30:40 +01:00
Milan Hanajik 77c26abc02 TBF.Screens.ProcessTabPageHeatMetersCtrl completed. 2019-03-17 12:29:04 +01:00
Milan Hanajik 0c964fdb5b ComponentsManagerDlg : Copying to subsequent cells via right-click implemented, ver. 2.18.1168 2019-03-16 10:19:57 +01:00
Milan Hanajik 84322476d6 SensusOracle and IperlLogger write only data of iPerls without any production issues. 2019-03-15 10:55:12 +01:00
Milan Hanajik f1278dd9a5 IperLogger : (1) Logging of TestInfo-s, (2) using (TextWriter logger = new ... ) { try {...} catch { } } construction. 2019-03-15 10:37:35 +01:00
Milan Hanajik e7164b98ff (1) TBF.Screens.ResultsTabPageCtrl fixes, (2) Results.Forms.BatchResultsDlg fixes : Show previous results displays colors, ver. 2.18.1167 2019-03-15 10:37:20 +01:00
Milan Hanajik 26d49eb4b7 DEWA300 component upgraded (13.3.2019), ver. 2.18.1165 2019-03-14 08:15:42 +01:00
Milan Hanajik b410f473e2 TempMeter zero-based index range extended to 0..15, ver. 2.18.1164 2019-03-13 09:39:10 +01:00
Milan Hanajik 3e54204a17 ResultsTabPageCtrl : iPerl is rejected also when proefindex==limit and it failed the test, ver. 2.18.1163 2019-03-13 08:50:43 +01:00
Milan Hanajik 70cba76ffd (1) iperl_check with Continue/Abort (2) MeterTestRslt.ErrorIndicators (not in DB) (3) ErrorFlags.Errors modif. (4) ResultsTabPage commonBackColor, etc. 2019-03-12 11:15:59 +01:00
Milan Hanajik d45c3f96d6 TBF : (1) flow setting timeout = 300 s = 5 min., (2) stable mass msrmnt. timeout = 300 s = 5 min., ver. 2.18.1162 2019-03-11 08:36:02 +01:00
Milan Hanajik 684fed8fc0 IDataEntry supports bool Completed property. 2019-03-08 10:20:58 +01:00
Milan Hanajik 99bb0cec57 LargeMessageBoxForm : (1) is red, (2) OK button is always visible, (3) auto scroll bar. 2019-03-08 10:20:57 +01:00
Milan Hanajik 263d990be4 Output.DB.ProductionTracing : Checking previous records at the beginning of the cycle. 2019-03-08 10:13:37 +01:00
Milan Hanajik 5f6c1fe70a Output.DB.SensusOracle cleaned up : CheckBarcodeScanningOp removed, ver. 2.18.1161 2019-03-08 07:24:51 +01:00
Milan Hanajik 2e76d595c0 Quido RS 4-4 support added, ver. 2.18.1160. 2019-03-06 10:45:58 +01:00
Milan Hanajik 75e5b75d4d DEWA_300 : (1) component upgraded (6.3.2019), (2) Diverter: flowMtrNr4Cmd fixed, ver. 2.18.1159 2019-03-06 09:42:25 +01:00
Milan Hanajik b47f5e32d4 DEWA_300 symbol usage fixed, ver. 2.18.1158 2019-03-05 15:12:24 +01:00
Milan Hanajik 771af696ae (1) TBF program shutdown modifications, (2) Obligatory tank draining before TBF exit, (3) Shutdown PC after TBF exit option, ver. 2.18.1156 2019-03-05 12:28:58 +01:00
Milan Hanajik b10ab44fa9 (1) MetrologyDlg displays corrections for all pressure meters, (2) Elde.PressureMeter and Modbus.PressureMeter.Meret use corrections. 2019-03-04 09:20:16 +01:00
Milan Hanajik 13eb7138a3 TracingDB : Cleaned-up and upgraded to current version, TBF : Workplace registered for approx. 2 weeks. 2019-03-01 14:16:04 +01:00
Milan Hanajik 02f6c9264a MID Statistics is data driven, no MidId enum, ver. 2.18.1154 2019-02-28 15:13:44 +01:00
Milan Hanajik edb26ccf6e ver. 2.18.1154 2019-02-28 10:03:52 +01:00
Milan Hanajik 2574ce1aee ver. 2.18.1153 2019-02-27 08:11:50 +01:00
Milan Hanajik 5586f58c6e iPerlCommunicationForm : Better try/catch, more logging, ver. 2.18.1152 2019-02-25 16:15:41 +01:00
Milan Hanajik 138e436645 (1) DEWA_300 component added, (2) DEWA_300 symbol added, (3) IZRAEL_200 symbol bug fix, ver. 2.18.1151 2019-02-25 12:49:04 +01:00
Milan Hanajik ea7e727798 (1) Modbus.QuidoRS.ConfirmationForm added, (2) Use of QuidoRS in iPerlCommForm fixed - uses QuidoRS.Variant, ver. 2.18.1149 2019-02-25 11:05:21 +01:00
Milan Hanajik 7a40cfb1f2 More logging in ShowBenchWaitingOp and ShowBenchErrorOp. 2019-02-22 12:48:51 +01:00
Milan Hanajik b2226ad779 iPerlCommunication : TestModeConfig value verified after switching to a test mode. 2019-02-21 16:00:01 +01:00
Milan Hanajik ebf96f655c Output.DB.SaveFlowmeterCorrections : Corrections calculated differently, from FlowVolume, not FlowMean. 2019-02-20 15:11:58 +01:00
Milan Hanajik 4134bf8875 ProcessTabPageHeatMetersCtrl modifications, language resources, etc. 2019-02-20 14:21:18 +01:00
Milan Hanajik fd7149e263 Screens.ProcessTabPageHeatmetersCtrl added, ver. 2.18.1148 2019-02-20 11:35:57 +01:00
Milan Hanajik a40b4ff606 Added: (1) IParallelOutput, (2) StateMachine.BenchWaitingOp/BenchErrorOp, (3) Modbus.QuidoRS support for Quido RS 8/8 (4) etc., ver. 2.18.1147 2019-02-20 08:34:03 +01:00
Milan Hanajik 86c063caee ReasultsBrowser : Histograms added, ver. 2.18.1146 2019-02-19 14:42:46 +01:00
Milan Hanajik bea3c04eb7 Output.DB.SensusOracle.Database : Writing results more robust, preventing program crash. 2019-02-18 09:04:00 +01:00
Milan Hanajik c5644d6999 iPerlCommunication cleanup, ver. 2.18.1144 2019-02-15 15:36:08 +01:00
Milan Hanajik 29c4c869f2 iPerlCommunication 'iPerlCheck' fixed : Writes correct WMPositions (not wmNr0), ver. 2.18.1143 2019-02-14 08:16:16 +01:00
Milan Hanajik 707c093f0c Heat meter results, ver. 2.18.1142 2019-02-13 15:39:44 +01:00
Milan Hanajik abaf756980 (1) Reading Q2 corrections form iPerl fixed (was unsigned), (2) Displaying ProdQ2CorrRL/LR fixed, ver. 2.18.1141 2019-02-13 13:12:52 +01:00
Milan Hanajik 32873ee2b0 (1) Auto. wmTypeRev (2) IperlCheck t.meth. (3) Pruefindex, Q2corr. read from Ora.on start (4) VolStart/VolEnd written to Ora. bounded, (5) iPerlCommForm.ReadQ2Corr() bug fix (6) LU logging cleanup, etc, ver. 2.18.1140 2019-02-13 09:27:22 +01:00
Milan Hanajik dd8273798a TestMethod.Adjustment : Bug fix for the case Publish==Never (Izrael) 2019-02-06 14:05:49 +01:00
Milan Hanajik 0dae18e5e8 Output.DB.SensusOracle cleanup. 2019-02-05 14:13:37 +01:00
Milan Hanajik 17063518ce Bug fix : Saving to Oracle failed due to large VolumeStart/VolumeEnd values, ver. 2.18.1131 2019-02-05 12:36:17 +01:00
Milan Hanajik a4998521f5 ver. 2.18.1131 2019-02-05 12:20:38 +01:00
Milan Hanajik d2df1a678f (1) Writing both Q2 corr. factors fixed, (2) Q2 corr. factors for std. R800 meters calculated differently, (3) Writing WMPosition to iPerlLog, (4) OptoTelegram start/end label. 2019-02-04 13:55:13 +01:00
Milan Hanajik f6aa6ba2d6 ResultsTabPage layout modifications 2019-01-30 15:38:51 +01:00
Milan Hanajik 82743bac05 Results : TestPartStr item added, ver. 2.18.1127 2019-01-30 15:35:25 +01:00
Milan Hanajik 30df663634 iPerlSpecial : Bug fixes in results DB changes, reading from Oracle and new result items, ver. 2.18.1126 2019-01-30 10:14:24 +01:00
211 changed files with 9131 additions and 3713 deletions
+2
View File
@@ -0,0 +1,2 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;SLM_50;HEAT_METERS;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -28,7 +28,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;SLM_50;HEAT_METERS;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+1 -1
View File
@@ -20,7 +20,7 @@ namespace Config
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || PUCHONG_200 || GENESIS || SLM_150 || PETERSBURG_200
#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || PUCHONG_200 || GENESIS || SLM_150 || PETERSBURG_200 || DEWA_300
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 3;
+71
View File
@@ -498,4 +498,75 @@ namespace Config.Entities
#endif
Count
}
public enum ErrorFlagShift
{
E1 = 0,
E2,
E3,
E4,
E5,
E6,
E7,
E8,
E9,
E10,
E11,
E12,
E13,
E14,
E15,
E16,
E17,
E18,
E19,
E20,
E21,
E22,
E23,
E24,
E25,
E26,
E27,
E28,
E29,
E30,
E31,
}
public enum ErrorFlagMask
{
E1 = (1 << (int)ErrorFlagShift.E1),
E2 = (1 << (int)ErrorFlagShift.E2),
E3 = (1 << (int)ErrorFlagShift.E3),
E4 = (1 << (int)ErrorFlagShift.E4),
E5 = (1 << (int)ErrorFlagShift.E5),
E6 = (1 << (int)ErrorFlagShift.E6),
E7 = (1 << (int)ErrorFlagShift.E7),
E8 = (1 << (int)ErrorFlagShift.E8),
E9 = (1 << (int)ErrorFlagShift.E9),
E10 = (1 << (int)ErrorFlagShift.E10),
E11 = (1 << (int)ErrorFlagShift.E11),
E12 = (1 << (int)ErrorFlagShift.E12),
E13 = (1 << (int)ErrorFlagShift.E13),
E14 = (1 << (int)ErrorFlagShift.E14),
E15 = (1 << (int)ErrorFlagShift.E15),
E16 = (1 << (int)ErrorFlagShift.E16),
E17 = (1 << (int)ErrorFlagShift.E17),
E18 = (1 << (int)ErrorFlagShift.E18),
E19 = (1 << (int)ErrorFlagShift.E19),
E20 = (1 << (int)ErrorFlagShift.E20),
E21 = (1 << (int)ErrorFlagShift.E21),
E22 = (1 << (int)ErrorFlagShift.E22),
E23 = (1 << (int)ErrorFlagShift.E23),
E24 = (1 << (int)ErrorFlagShift.E24),
E25 = (1 << (int)ErrorFlagShift.E25),
E26 = (1 << (int)ErrorFlagShift.E26),
E27 = (1 << (int)ErrorFlagShift.E27),
E28 = (1 << (int)ErrorFlagShift.E28),
E29 = (1 << (int)ErrorFlagShift.E29),
E30 = (1 << (int)ErrorFlagShift.E30),
E31 = (1 << (int)ErrorFlagShift.E31),
}
}
+8
View File
@@ -25,6 +25,14 @@ namespace Config.Entities
Count
}
public enum Counting
{
Arbitrary,
Positive,
Negative,
Count
}
public enum OptoHeadState
{
Disabled,
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1122.0")]
[assembly: AssemblyFileVersion("2.18.1122.0")]
[assembly: AssemblyVersion("2.18.1151.0")]
[assembly: AssemblyFileVersion("2.18.1151.0")]
+45 -3
View File
@@ -276,7 +276,14 @@ namespace DeviceTest
radioButton3.Text = "SelectTank 3";
radioButton4.Text = "SelectTank -";
}
else radioButton1.Text = "spare";
else if (className == "Modbus.QuidoRS")
{
radioButton1.Text = "Close relay 1";
radioButton2.Text = "Close relay 2";
radioButton3.Text = "Close relay 3";
radioButton4.Text = "Open all relays";
}
else radioButton1.Text = "spare";
}
///
void UpdateOperations2(string className)
@@ -296,7 +303,14 @@ namespace DeviceTest
radioButton23.Text = "SelectTank 3";
radioButton24.Text = "SelectTank -";
}
else radioButton21.Text = "spare";
else if (className == "Modbus.QuidoRS")
{
radioButton21.Text = "Close relay 1";
radioButton22.Text = "Close relay 2";
radioButton23.Text = "Close relay 3";
radioButton24.Text = "Open all relays";
}
else radioButton21.Text = "spare";
}
///
void UpdateOperations3(string className)
@@ -316,7 +330,14 @@ namespace DeviceTest
radioButton33.Text = "SelectTank 3";
radioButton34.Text = "SelectTank -";
}
else radioButton31.Text = "spare";
else if (className == "Modbus.QuidoRS")
{
radioButton31.Text = "Close relay 1";
radioButton32.Text = "Close relay 2";
radioButton33.Text = "Close relay 3";
radioButton34.Text = "Open all relays";
}
else radioButton31.Text = "spare";
}
@@ -672,6 +693,13 @@ namespace DeviceTest
//operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation4 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation1 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation2 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation3 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation4 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
if (tbfComponent2forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
@@ -704,6 +732,13 @@ namespace DeviceTest
//operation23 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation24 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation21 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation22 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation23 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation24 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
if (tbfComponent3forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
@@ -736,6 +771,13 @@ namespace DeviceTest
//operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
int time = 0;
+1
View File
@@ -25,6 +25,7 @@ namespace Results.Entities
/// Main result
public virtual double Error { get; set; } /// [%]
public virtual int ErrorIndicators { get; set; } /// Not mapped to DB !!!, bit24=E25, bit25=E26, bit26=E27, bit27=E28
public virtual double KorrErrQ { get; set; } /// [%] not mapped to results DB, saved to Oracle DB
public virtual bool TestDone { get; set; } /// true = test was completed
public virtual bool Passed { get; set; } /// true = test passed, water meter is OK
+45 -8
View File
@@ -91,10 +91,15 @@ namespace Results.Entities
public virtual int ProdQ2CorrLR { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
#endif
#if ORACLE_DB
public virtual int Pruefindex { get; set; } /// Not mapped to DB !!! 0=unknown (saving to Oracle failed), >=1 ... pruefindex
public virtual int HydrPruefung { get; set; } /// Not mapped to DB !!!
public virtual int Pruefindex { get; set; } /// >= 1 ... pruefindex
public virtual int HydrPruefung { get; set; }
public virtual int WMTypeRevision { get; set; } /// Not mapped to DB !!!
public virtual object TestInfos { get; set; } /// SensusTestInfo[] array fetched at the beginning of the cycle, not mapped to DB !!!
#endif
public virtual WaterMeterData WaterMeterData { get; set; }
public virtual int ProcessId { get; set; } /// Not mapped to DB !!! Tracing DB Process ID
public virtual bool IsLastRecordOk { get; set; } /// Not mapped to DB !!! Previous record verification result
public virtual WaterMeterData WaterMeterData { get; set; }
public virtual Batch Batch { get; set; }
public virtual IList<MeterTestRslt> MeterTestRslts { get; set; }
@@ -279,7 +284,12 @@ namespace Results.Entities
{
return mtr;
}
}
else if (meterId == Config.Entities.CompoundMeterId.SingleOrCompound &&
mtr.CompoundMeterId == (byte)Config.Entities.CompoundMeterId.HeatMeterEnergy)
{
return mtr;
}
}
}
return null;
}
@@ -341,6 +351,14 @@ namespace Results.Entities
public WaterMeter()
{
MeterTestRslts = new List<MeterTestRslt>();
#if ORACLE_DB
Pruefindex = 1;
HydrPruefung = 0;
WMTypeRevision = 0;
TestInfos = null;
#endif
ProcessId = 0;
IsLastRecordOk = false;
}
@@ -374,13 +392,32 @@ namespace Results.Entities
Diff2Hz8Hz = src.Diff2Hz8Hz;
Hz2CorrectionDone = src.Hz2CorrectionDone;
Hz2Correction = src.Hz2Correction;
RadioAddress = src.RadioAddress;
FWVersion = src.FWVersion;
#endif
#if ORACLE_DB
Pruefindex = src.Pruefindex;
HydrPruefung = src.HydrPruefung;
#if TURA_SPECIAL
AssignedSerialNr = src.AssignedSerialNr;
CompleteSerialNr = src.CompleteSerialNr;
RadioAddress = src.RadioAddress;
PaletteNr = src.PaletteNr;
UmkartonNr = src.UmkartonNr;
ProdTestBench = src.ProdTestBench;
ProdWMPosition = src.ProdWMPosition;
ProdUserName = src.ProdUserName;
ProdPurchaseOrder = src.ProdPurchaseOrder;
ProdPassed = src.ProdPassed;
ProdResultCode = src.ProdResultCode;
ProdQ2CorrRL = src.ProdQ2CorrRL;
ProdQ2CorrLR = src.ProdQ2CorrLR;
#endif
#if ORACLE_DB
Pruefindex = src.Pruefindex;
HydrPruefung = src.HydrPruefung;
WMTypeRevision = src.WMTypeRevision;
TestInfos = src.TestInfos;
#endif
ProcessId = src.ProcessId;
IsLastRecordOk = src.IsLastRecordOk;
foreach (var mtr in MeterTestRslts)
{
MeterTestRslt srcMtr = src.GetMeterTestRslt(mtr.Name(), (Config.Entities.CompoundMeterId)mtr.CompoundMeterId);
-2
View File
@@ -54,7 +54,6 @@ namespace Results.Entities
#if ORACLE_DB
public virtual int WMTypeId { get; set; }
public virtual int WMTypeRev { get; set; }
#endif
public WaterMeterData()
@@ -111,7 +110,6 @@ namespace Results.Entities
#if ORACLE_DB
if (WMTypeId != wmd.WMTypeId) return false;
if (WMTypeRev != wmd.WMTypeRev) return false;
#endif
return true;
}
+91 -22
View File
@@ -16,6 +16,16 @@ namespace Results.Forms
{
static readonly ILog log = LogManager.GetLogger(typeof(BatchResultsDlg));
static readonly Color NotCompletedColor = Color.White;
static readonly Color OkColor = Color.LightGreen;
static readonly Color NokColor = Color.LightPink;
static readonly Color RejectColor = Color.Magenta;
static readonly Color ProductionTracing = Color.RoyalBlue;
static readonly Color WrongDirection = Color.Gold;
static readonly Color WrongQ2FactorsColor = Color.Red;
DateTime lastRedraw;
DateTime lastSizeChange;
bool loaded;
@@ -45,7 +55,7 @@ namespace Results.Forms
Results.BatchResults results;
MetersKind metersKind;
ListView firstListView;
OneWMResultsCtrl firstListView;
public int[] rsltsClmnWidths;
int rsltsClmnCount { get { return (rsltsClmnWidths != null) ? rsltsClmnWidths.Length : 0; } }
@@ -150,9 +160,9 @@ namespace Results.Forms
{
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
{
ListView lview = (TestsArrangement == TestsArrangement.Rows)
? GetResultsTestsAreRows(results.WaterMeters[i], i + 1)
: GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
OneWMResultsCtrl lview = (TestsArrangement == TestsArrangement.Rows)
? GetResultsTestsAreRows(results.WaterMeters[i], i + 1)
: GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
if (lview != null)
{
flowLayoutPanel.Controls.Add(lview);
@@ -178,24 +188,16 @@ namespace Results.Forms
this.ResumeLayout(false);
}
/// <summary>
/// Get an empty ListView control with appropriate parameters.
/// </summary>
/// <returns>ListView control</returns>
ListView GetListView()
OneWMResultsCtrl GetListView(Color backColor)
{
ListView lview = new ListView();
lview.AllowColumnReorder = false;
lview.Dock = System.Windows.Forms.DockStyle.None;
lview.FullRowSelect = true;
lview.GridLines = true;
lview.Location = new System.Drawing.Point(0, 0);
lview.Size = new System.Drawing.Size(lvWidth, lvHeight);
lview.TabIndex = 0;
lview.UseCompatibleStateImageBehavior = false;
lview.View = System.Windows.Forms.View.Details;
return lview;
return new OneWMResultsCtrl(backColor, lvWidth, lvHeight);
}
OneWMResultsCtrl GetListView() { return GetListView(Color.White); }
/// <summary>
@@ -209,8 +211,10 @@ namespace Results.Forms
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr.IsPilotRslt() && mtr.TestDone && (mtr.Publish() != Config.Entities.Publish.Never)
&& (mtr.Publish() != Config.Entities.Publish.Internal))
if ((mtr.CompoundMeterId == (byte)CompoundMeterId.Single || mtr.CompoundMeterId == (byte)CompoundMeterId.Compound || mtr.CompoundMeterId == (byte)CompoundMeterId.HeatMeterEnergy)
&& mtr.TestDone
&& (mtr.Publish() != Config.Entities.Publish.Never)
&& (mtr.Publish() != Config.Entities.Publish.Internal))
{
testNames.Add(mtr.Name());
}
@@ -219,17 +223,75 @@ namespace Results.Forms
return testNames;
}
/// <summary>
/// Get color for highlighting results and an apporpriate text message.
/// </summary>
/// <param name="wMtr">Water meter results entity</param>
/// <param name="message">Appropriate message</param>
/// <returns>Color for results</returns>
Color GetColorOfResults(Results.Entities.WaterMeter wMtr, out string message)
{
bool wmtrCompleted = wMtr.CompletedFromTests();
bool wmtrPassed = wMtr.PassedFromTests();
if ((wMtr.ErrorFlags & (int)ErrorFlagMask.E28) != 0)
{
message = Strings.Previous_step_is_missing_or_NOK;
return ProductionTracing;
}
else if ((wMtr.ErrorFlags & (int)ErrorFlagMask.E27) != 0)
{
message = Strings.Wrong_iPerl_counting_direction;
return WrongDirection;
}
else if ((wMtr.ErrorFlags & (int)ErrorFlagMask.E26) != 0)
{
message = Strings.Invalid_Q2_correction_factors;
return WrongQ2FactorsColor;
}
else if ((wMtr.ErrorFlags & (int)ErrorFlagMask.E25) != 0)
{
message = Strings.Test_repetition_count_exceeded_upper_limit;
return RejectColor;
}
else if (wmtrPassed)
{
/// Water meter passed (therefore is was also completed)
message = Strings.Passed;
return OkColor;
}
else if (wmtrCompleted)
{
/// Water meter was completed but did not pass => Failed
message = Strings.Failed;
return NokColor;
}
else
{
/// Water meter was not completed yet => did not pass, did not fail
message = Strings.Test_in_progress;
return NotCompletedColor;
}
}
/// <summary>
/// Get a ListView control filled with results of the meter 'mtr'
/// </summary>
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
/// <returns>ListView object</returns>
ListView GetResultsTestsAreRows(Results.Entities.WaterMeter wMtr, int printedWMNr)
OneWMResultsCtrl GetResultsTestsAreRows(Results.Entities.WaterMeter wMtr, int printedWMNr)
{
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
ListView lview = GetListView();
string message = string.Empty;
Color commonBackColor = GetColorOfResults(wMtr, out message);
OneWMResultsCtrl lview = GetListView(commonBackColor);
#if ORACLE_DB
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
#endif
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
@@ -290,11 +352,18 @@ namespace Results.Forms
/// </summary>
/// <param name="mtr">Water meter number (1-based): 1 .. Config.Data.WMsCount</param>
/// <returns>ListView object</returns>
ListView GetResultsTestsAreColumns(Results.Entities.WaterMeter wMtr, int printedWMNr)
OneWMResultsCtrl GetResultsTestsAreColumns(Results.Entities.WaterMeter wMtr, int printedWMNr)
{
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
ListView lview = GetListView();
string message;
Color commonBackColor = GetColorOfResults(wMtr, out message);
OneWMResultsCtrl lview = GetListView(commonBackColor);
#if ORACLE_DB
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
#endif
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
+102
View File
@@ -0,0 +1,102 @@
namespace Results.Forms
{
partial class OneWMResultsCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tBox = new System.Windows.Forms.TextBox();
this.lView = new System.Windows.Forms.ListView();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.tBox);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.lView);
this.splitContainer1.Size = new System.Drawing.Size(352, 318);
this.splitContainer1.SplitterDistance = 25;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 0;
//
// tBox
//
this.tBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.tBox.Location = new System.Drawing.Point(0, 0);
this.tBox.Name = "tBox";
this.tBox.Size = new System.Drawing.Size(352, 20);
this.tBox.TabIndex = 0;
//
// lView
//
this.lView.Dock = System.Windows.Forms.DockStyle.Fill;
this.lView.FullRowSelect = true;
this.lView.GridLines = true;
this.lView.Location = new System.Drawing.Point(0, 0);
this.lView.Name = "lView";
this.lView.Size = new System.Drawing.Size(352, 292);
this.lView.TabIndex = 0;
this.lView.UseCompatibleStateImageBehavior = false;
this.lView.View = System.Windows.Forms.View.Details;
//
// OneWMResultsCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "OneWMResultsCtrl";
this.Size = new System.Drawing.Size(352, 318);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TextBox tBox;
private System.Windows.Forms.ListView lView;
}
}
+26
View File
@@ -0,0 +1,26 @@
using System.Drawing;
using System.Windows.Forms;
namespace Results.Forms
{
public partial class OneWMResultsCtrl : UserControl
{
public OneWMResultsCtrl()
{
InitializeComponent();
}
public OneWMResultsCtrl(Color backColor, int lvWidth, int lvHeight)
: this()
{
lView.BackColor = backColor;
tBox.BackColor = backColor;
Size = new System.Drawing.Size(lvWidth, lvHeight);
}
public string Caption { get { return tBox.Text; } set { tBox.Text = value; } }
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } }
public ListView.ListViewItemCollection Items { get { return lView.Items; } }
public Color BColor { set { lView.BackColor = value; tBox.BackColor = value; } }
}
}
+77 -71
View File
@@ -91,85 +91,85 @@ namespace Results
T_Lo_start, /// 81
T_Lo_end, /// 82
T_Lo_avg, /// 83
P_delta_mean, /// 84
P_delta_start, /// 85
P_delta_end, /// 86
Meter_type, /// 87 Single, Compound or HeatMeter
Volume_main, /// 88
Volume_aux, /// 89
Start_volume, /// 90
Start_volume_main, /// 91
Start_volume_aux, /// 92
End_volume, /// 93
End_volume_main, /// 94
End_volume_aux, /// 95
Error_main, /// 96
Error_aux, /// 97
Serial_Nr_main, /// 98
Serial_Nr_aux, /// 99
End_state_main, /// 100
End_state_aux, /// 101
Q_rise, /// 102
Q_fall, /// 103
P_delta_mean, /// 84
P_delta_start, /// 85
P_delta_end, /// 86
Meter_type, /// 87 Single, Compound or HeatMeter
Volume_main, /// 88
Volume_aux, /// 89
Start_volume, /// 90
Start_volume_main, /// 91
Start_volume_aux, /// 92
End_volume, /// 93
End_volume_main, /// 94
End_volume_aux, /// 95
Error_main, /// 96
Error_aux, /// 97
Serial_Nr_main, /// 98
Serial_Nr_aux, /// 99
End_state_main, /// 100
End_state_aux, /// 101
Q_rise, /// 102
Q_fall, /// 103
/// iPerl
/// iPerl
OrigCalibFactor, /// 104
CalibFactor, /// 105
Q2ErrWOCorrection, /// 106
Q2CorrectionDone, /// 107
CalibFactor, /// 105
Q2ErrWOCorrection, /// 106
Q2CorrectionDone, /// 107
Q2CorrRFlow, /// 108
Q2CorrLFlow, /// 109
Q2CorrFlowRight, /// 110
Q_ref_mean, /// 111
T_up_start, /// 112
T_up_end, /// 113
T_up_avg, /// 114
T_down_start, /// 115
T_down_end, /// 116
T_down_avg, /// 117
T_div_start, /// 118
T_div_end, /// 119
T_div_avg, /// 120
P_up_avg, /// 121
P_down_avg, /// 122
P_delta_avg, /// 123
TestDone, /// 124
TestPassed, /// 125
Q_ref_mean, /// 111
T_up_start, /// 112
T_up_end, /// 113
T_up_avg, /// 114
T_down_start, /// 115
T_down_end, /// 116
T_down_avg, /// 117
T_div_start, /// 118
T_div_end, /// 119
T_div_avg, /// 120
P_up_avg, /// 121
P_down_avg, /// 122
P_delta_avg, /// 123
TestDone, /// 124
TestPassed, /// 125
/// iPerl
FW_Version, /// 126
Mass_start_raw, /// 127
Mass_start, /// 128
Mass_end_raw, /// 129
Mass_end, /// 130
Mass, /// 131
Buoyancy, /// 132
Density_correction, /// 133
Mass_start_raw, /// 127
Mass_start, /// 128
Mass_end_raw, /// 129
Mass_end, /// 130
Mass, /// 131
Buoyancy, /// 132
Density_correction, /// 133
ErrorFlags, /// 134
E1, /// 135
E2, /// 136
E3, /// 137
E4, /// 138
E5, /// 139
E6, /// 140
E7, /// 141
E8, /// 142
E9, /// 143
E10, /// 144
E11, /// 145
E12, /// 146
E13, /// 147
E14, /// 148
E15, /// 149
E16, /// 150
ErrorFlags, /// 134
E1, /// 135
E2, /// 136
E3, /// 137
E4, /// 138
E5, /// 139
E6, /// 140
E7, /// 141
E8, /// 142
E9, /// 143
E10, /// 144
E11, /// 145
E12, /// 146
E13, /// 147
E14, /// 148
E15, /// 149
E16, /// 150
Table_row_nr, /// 151
Table_column_nr, /// 152
WMRemark, /// 153
Table_row_nr, /// 151
Table_column_nr, /// 152
WMRemark, /// 153
User_description, /// 154
Legalizator, /// 155
@@ -181,7 +181,7 @@ namespace Results
Diverter_start_time, /// 159
Diverter_end_time, /// 160
Q_sensitivity, /// 161
Q_ref_min, /// 162
Q_ref_max, /// 163
Q_ref_start, /// 164
@@ -210,7 +210,7 @@ namespace Results
Rho_Wa_calc, /// 183
Formatted_WM_ID, /// 184, Formated WM ID string:
/// {0}=start DateTime {1}-end DateTime, {2}=batch nr., {3}=wm pos.(1..max), {4}=s/n string
/// {0}=start DateTime {1}-end DateTime, {2}=batch nr., {3}=wm pos.(1..max), {4}=s/n string
E21, /// 185
T_line_mean, /// 186
@@ -262,7 +262,7 @@ namespace Results
Bench_address5, /// 227 'Address 5' from IBenchInfo
Max_test_index, /// 228 MaxPruefindex % 100
VolumeCTV, /// 229
VolumeCTV, /// 229
/// iPerl
LastError, /// 230 For iPerl previous test result (test with Proefindex-1)
@@ -285,7 +285,13 @@ namespace Results
Prod_ResultCode, /// 244
Prod_Q2CorrRL, /// 245
Prod_Q2CorrLR, /// 246
TestPartStr, /// 247
Error_heat_mtr_vol, /// 248
Energy_start,
Energy_end,
Count,
}
}
-1
View File
@@ -54,7 +54,6 @@ namespace Results.Mappings
#endif
#if ORACLE_DB
Map(x => x.WMTypeId);
Map(x => x.WMTypeRev);
#endif
}
}
+3 -3
View File
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sensus")]
[assembly: AssemblyProduct("Results")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2018 Sensus Slovensko, a.s.")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2019 Sensus Slovensko, a.s.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1125.0")]
[assembly: AssemblyFileVersion("2.18.1125.0")]
[assembly: AssemblyVersion("2.18.1166.0")]
[assembly: AssemblyFileVersion("2.18.1166.0")]
+72
View File
@@ -384,6 +384,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to NOK.
/// </summary>
internal static string Failed {
get {
return ResourceManager.GetString("Failed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Failed meters count.
/// </summary>
@@ -447,6 +456,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Invalid Q2 correction factors.
/// </summary>
internal static string Invalid_Q2_correction_factors {
get {
return ResourceManager.GetString("Invalid_Q2_correction_factors", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Item.
/// </summary>
@@ -627,6 +645,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to OK.
/// </summary>
internal static string Passed {
get {
return ResourceManager.GetString("Passed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Passed meters count.
/// </summary>
@@ -663,6 +690,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Previous step is missing or NOK.
/// </summary>
internal static string Previous_step_is_missing_or_NOK {
get {
return ResourceManager.GetString("Previous_step_is_missing_or_NOK", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Procedure.
/// </summary>
@@ -798,6 +834,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to repetition.
/// </summary>
internal static string repetition {
get {
return ResourceManager.GetString("repetition", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Result.
/// </summary>
@@ -1023,6 +1068,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Test in progress.
/// </summary>
internal static string Test_in_progress {
get {
return ResourceManager.GetString("Test_in_progress", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Test method.
/// </summary>
@@ -1041,6 +1095,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Test repetition count exceeded upper limit.
/// </summary>
internal static string Test_repetition_count_exceeded_upper_limit {
get {
return ResourceManager.GetString("Test_repetition_count_exceeded_upper_limit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Test vol..
/// </summary>
@@ -1914,6 +1977,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Wrong iPerl counting direction.
/// </summary>
internal static string Wrong_iPerl_counting_direction {
get {
return ResourceManager.GetString("Wrong_iPerl_counting_direction", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Year.
/// </summary>
+24
View File
@@ -255,4 +255,28 @@
<data name="Batch" xml:space="preserve">
<value>Dávka</value>
</data>
<data name="repetition" xml:space="preserve">
<value>opakování</value>
</data>
<data name="Invalid_Q2_correction_factors" xml:space="preserve">
<value>Nesprávne Q2 korekčné faktory</value>
</data>
<data name="Previous_step_is_missing_or_NOK" xml:space="preserve">
<value>Predchádzajúci krok chýba alebo neprešiel</value>
</data>
<data name="Test_repetition_count_exceeded_upper_limit" xml:space="preserve">
<value>Počet opakovaní testu prekročil dovolené maximum</value>
</data>
<data name="Wrong_iPerl_counting_direction" xml:space="preserve">
<value>Nesprávny smer počítania iPerlu</value>
</data>
<data name="Failed" xml:space="preserve">
<value>NOK</value>
</data>
<data name="Passed" xml:space="preserve">
<value>OK</value>
</data>
<data name="Test_in_progress" xml:space="preserve">
<value>Probíhá test</value>
</data>
</root>
+24
View File
@@ -741,4 +741,28 @@
<data name="Batch" xml:space="preserve">
<value>Batch</value>
</data>
<data name="repetition" xml:space="preserve">
<value>repetition</value>
</data>
<data name="Invalid_Q2_correction_factors" xml:space="preserve">
<value>Invalid Q2 correction factors</value>
</data>
<data name="Previous_step_is_missing_or_NOK" xml:space="preserve">
<value>Previous step is missing or NOK</value>
</data>
<data name="Test_repetition_count_exceeded_upper_limit" xml:space="preserve">
<value>Test repetition count exceeded upper limit</value>
</data>
<data name="Wrong_iPerl_counting_direction" xml:space="preserve">
<value>Wrong iPerl counting direction</value>
</data>
<data name="Failed" xml:space="preserve">
<value>NOK</value>
</data>
<data name="Passed" xml:space="preserve">
<value>OK</value>
</data>
<data name="Test_in_progress" xml:space="preserve">
<value>Test in progress</value>
</data>
</root>
+11 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;SLM_50;HEAT_METERS;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -27,7 +27,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;SLM_50;HEAT_METERS;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -80,6 +80,12 @@
<Compile Include="Forms\ListViewExtensions.cs" />
<Compile Include="Forms\LviIntColumnComparer.cs" />
<Compile Include="Forms\LviTextColumnComparer.cs" />
<Compile Include="Forms\OneWMResultsCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\OneWMResultsCtrl.Designer.cs">
<DependentUpon>OneWMResultsCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Forms\ResultsConfigCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -159,6 +165,9 @@
<EmbeddedResource Include="Forms\ListViewEx.resx">
<DependentUpon>ListViewEx.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\OneWMResultsCtrl.resx">
<DependentUpon>OneWMResultsCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ResultsConfigCtrl.resx">
<DependentUpon>ResultsConfigCtrl.cs</DependentUpon>
</EmbeddedResource>
+2 -2
View File
@@ -48,14 +48,14 @@ namespace Results
/// <summary>
/// Converts ErrorFlags integer to string. Supports up to 31 flags (E1..E31).
/// Converts ErrorFlags integer to string. Supports up to 31 flags (E1..E31, i.e. bit0..bit30).
/// </summary>
/// <param name="errorFlags">Input</param>
/// <returns>Output string</returns>
public static string ErrorFlagsStr(int errorFlags)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 30; i++)
for (int i = 0; i < 31; i++)
{
if ((errorFlags & (1 << i)) != 0)
{
+40 -19
View File
@@ -155,16 +155,16 @@ namespace Results
///
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_volume, Strings.Test_vol + "()", Quantity.Volume, ItemCategory.TestData, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetTestRslt(t).TargetVolume())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.VolumeCTV, string.Format("{0} CTV ()", Strings.VName_Vol), Quantity.Volume, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetTestRslt(t).VolumeCTV)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, string.Format("{0} Mt. ()", Strings.VName_Vol), Strings.Tooltip_Vol_Mt, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, string.Format("{0} rm ()", Strings.VName_Vol), Strings.Tooltip_Vol_rm, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeRef)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_main, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.main), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_aux, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.aux), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume, Strings.Start_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_main, Strings.Start_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_aux, Strings.Start_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume, Strings.End_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_main, Strings.End_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_aux, Strings.End_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume, string.Format("{0} Mt. ()", Strings.VName_Vol), Strings.Tooltip_Vol_Mt, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume).VolumeMeter) : ((w.GetMeterTestRslt(t) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeMeter) : string.Empty)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_volume, string.Format("{0} rm ()", Strings.VName_Vol), Strings.Tooltip_Vol_rm, Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume).VolumeRef) : ((w.GetMeterTestRslt(t) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeRef) : string.Empty)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_main, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.main), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).VolumeMeter) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Volume_aux, string.Format("{0} {1} ()", Strings.VName_Vol, Strings.aux), Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).VolumeMeter) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume, Strings.Start_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume).VolumeStart) : ((w.GetMeterTestRslt(t) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeStart) : string.Empty)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_main, Strings.Start_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).VolumeStart) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Start_volume_aux, Strings.Start_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).VolumeStart) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume, Strings.End_volume + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume).VolumeEnd) : ((w.GetMeterTestRslt(t) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).VolumeEnd) : string.Empty)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_main, Strings.End_volume_main + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).VolumeEnd) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_volume_aux, Strings.End_volume_aux + "()", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) != null) ? FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).VolumeEnd) : string.Empty));
///
/// Mass
@@ -314,7 +314,8 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.LastError, string.Format("{0} rel. last ()", Strings.VName_Error), Strings.Tooltip_E_rel_last, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "0" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).LastError)));
#else
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error, string.Format("{0} rel. ()", Strings.VName_Error), Strings.Tooltip_E_rel, Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) != null) ? FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t).Error) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_heat_mtr_vol, string.Format("{0} rel.hm.vol. ()", Strings.VName_Error), Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume) != null) ? FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.HeatMeterVolume).Error) : string.Empty));
#endif
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr(f)
: ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr(f))));
@@ -371,8 +372,8 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Degree__liter, "Degree per liter ()", Quantity.PulsePerLtr, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t) == null) ? "" : FormatDbl(u, f, p, "V4", w.GetMeterTestRslt(t).IsCamera() ? w.GetMeterTestRslt(t).PulsesPerLiter : 0)));
/// Water meters results (combined)
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_main, Strings.Err_main + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).Error)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_aux, Strings.Err_aux + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) == null) ? "" : FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).Error)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_main, Strings.Err_main + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain) != null) ? FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.CompoundMain).Error) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Error_aux, Strings.Err_aux + "()", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => (w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux) != null) ? FormatDbl(u, f, p, "V2", w.GetMeterTestRslt(t, CompoundMeterId.CompoundAux).Error) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr_main, string.Format("{0} {1}", Strings.sn, Strings.main), Strings.Tooltip_sn_main, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.SerialNr)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Serial_Nr_aux, string.Format("{0} {1}", Strings.sn, Strings.aux), Strings.Tooltip_sn_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.SerialNrAux)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_main, Strings.EndState_main, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.EndState)));
@@ -407,8 +408,10 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Meter_type, Strings.Meter_type, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.WaterMeterData.Compound ? Strings.Compound : (w.WaterMeterData.HeatMeter ? Strings.Heat_meter : Strings.Single))));
#if HEAT_METERS
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy, Strings.Energy + "()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) == null) ? "" : FormatDbl(u, f, p, "F1", (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeMeter))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_energy, Strings.Energy_ref + "()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) == null) ? "" : FormatDbl(u, f, p, "F1", (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeRef))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy, Strings.Energy + " ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeMeter) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy_start, Strings.Energy + " start ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeStart) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Energy_end, Strings.Energy + " end ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeEnd) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Reference_energy, Strings.Energy_ref + " ()", Quantity.Energy, ItemCategory.Other, (w, t, u, f, p) => (w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy) != null) ? FormatDbl(u, f, p, "F1", w.GetMeterTestRslt(t, Config.Entities.CompoundMeterId.HeatMeterEnergy).VolumeRef) : string.Empty));
#endif
#if IPERL
@@ -418,8 +421,8 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.CalibFactorLNA, "iPerl CalibFactorLNA", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.CalibFactorLNA)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2ErrWOCorrection, "iPerl Q2ErrWOCorrection", Quantity.Error, ItemCategory.MeterResult, (w, t, u, f, p) => FormatDbl(u, f, p, "V3", w.Q2ErrWOCorrection)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrectionDone, "iPerl Q2CorrectionDone", Quantity.Boolean,ItemCategory.MeterResult, (w, t, u, f, p) => (w.Q2CorrectionDone ? Strings.Yes : Strings.No)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2Corr R-L", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRL)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2Corr L-R", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLR)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrRFlow, "iPerl Q2Corr RL", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRL)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrLFlow, "iPerl Q2Corr LR", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLR)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Q2CorrFlowRight, "iPerl Q2CorrFlowRight", Quantity.Volume, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrFlowRight)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.FW_Version, "iPerl FW version", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.FWVersion)));
#if ORACLE_DB
@@ -439,8 +442,8 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_PurchaseOrder, "Prod iPerl purchase order", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.ProdPurchaseOrder)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_Passed, "Prod iPerl passed", Quantity.Boolean,ItemCategory.MeterResult, (w, t, u, f, p) => FormatBool(f,w.ProdPassed)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_ResultCode, "Prod iPerl result code", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.ProdResultCode)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_Q2CorrRL, "Prod iPerl Q2Corr R-L", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrRL)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_Q2CorrLR, "Prod iPerl Q2Corr L-R", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.Q2CorrLR)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_Q2CorrRL, "Prod iPerl Q2Corr RL", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.ProdQ2CorrRL)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Prod_Q2CorrLR, "Prod iPerl Q2Corr LR", Quantity.Number, ItemCategory.MeterResult, (w, t, u, f, p) => FormatInt(f, w.ProdQ2CorrLR)));
#endif
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestDone, Strings.Test_done + "()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => FormatBool(f, (w.GetMeterTestRslt(t) != null) && w.GetMeterTestRslt(t).TestDone)));
@@ -464,6 +467,7 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.E15, "E15 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x4000) != 0) ? Strings.Yes : Strings.No));
AllItems.Add(new WMeterRsltItemSpec(ItemID.E16, "E16 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x8000) != 0) ? Strings.Yes : Strings.No));
AllItems.Add(new WMeterRsltItemSpec(ItemID.E21, "E21 ()", Quantity.Boolean, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null && (w.GetTestRslt(t).ErrorFlags & 0x100000) != 0) ? Strings.Yes : Strings.No));
AllItems.Add(new WMeterRsltItemSpec(ItemID.TestPartStr, "Test part str.", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => FormatEnum(f, (w.GetMeterTestRslt(t) != null) ? w.GetMeterTestRslt(t).TestRslt.Part : 0)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Table_row_nr, "Table row #", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? TableRowNr.ToString() : string.Format(f, TableRowNr)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Table_column_nr, "Table column #", Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => string.IsNullOrEmpty(f) ? TableColumnNr.ToString() : string.Format(f, TableColumnNr)));
@@ -494,6 +498,23 @@ namespace Results
}
}
public static string FormatEnum(string format, int value)
{
if (string.IsNullOrEmpty(format))
{
return value.ToString();
}
else
{
string[] texts = format.Split(new char[] { '~' });
if (value >= 0 && value < texts.Length)
return texts[value];
else
return value.ToString();
}
}
public static string FormatInt(string format, int value)
{
return string.IsNullOrEmpty(format) ? value.ToString() : string.Format(format, value);
+76
View File
@@ -0,0 +1,76 @@
namespace ResultsBrowser.Forms
{
partial class HistogramCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
System.Windows.Forms.DataVisualization.Charting.Title title1 = new System.Windows.Forms.DataVisualization.Charting.Title();
this.myChart = new System.Windows.Forms.DataVisualization.Charting.Chart();
((System.ComponentModel.ISupportInitialize)(this.myChart)).BeginInit();
this.SuspendLayout();
//
// myChart
//
chartArea1.Name = "ChartArea1";
this.myChart.ChartAreas.Add(chartArea1);
this.myChart.Dock = System.Windows.Forms.DockStyle.Fill;
legend1.Name = "Legend1";
this.myChart.Legends.Add(legend1);
this.myChart.Location = new System.Drawing.Point(0, 0);
this.myChart.Name = "myChart";
this.myChart.Palette = System.Windows.Forms.DataVisualization.Charting.ChartColorPalette.Bright;
series1.ChartArea = "ChartArea1";
series1.Legend = "Legend1";
series1.Name = "Series1";
this.myChart.Series.Add(series1);
this.myChart.Size = new System.Drawing.Size(400, 300);
this.myChart.TabIndex = 0;
this.myChart.Text = "chart1";
title1.Name = "Title1";
title1.Text = "Title1";
this.myChart.Titles.Add(title1);
//
// HistogramCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.myChart);
this.Name = "HistogramCtrl";
this.Size = new System.Drawing.Size(400, 300);
((System.ComponentModel.ISupportInitialize)(this.myChart)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataVisualization.Charting.Chart myChart;
}
}
+42
View File
@@ -0,0 +1,42 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
namespace ResultsBrowser.Forms
{
public partial class HistogramCtrl : UserControl
{
/// <summary>
/// Create user control that displays a bar chart iwth custom X-axis labels.
/// </summary>
/// <param name="title">Title of the chart displayed at the top</param>
/// <param name="values">Values = bar lengths</param>
/// <param name="labels">Labels for the X-axis</param>
public HistogramCtrl(string title, double[] values, string[] labels)
{
InitializeComponent();
if (myChart.Titles.Count > 0) myChart.Titles[0].Text = title;
if ((myChart.Series.Count > 0) && (values != null))
{
int startOffset = -1;
int endOffset = 1;
for (int i = 0; i < Math.Min(values.Length + 1, labels.Length); i++)
{
if (i < values.Length) myChart.Series[0].Points.Add(values[i]);
if (!string.IsNullOrEmpty(labels[i]))
{
myChart.ChartAreas[0].AxisX.CustomLabels.Add(new System.Windows.Forms.DataVisualization.Charting.CustomLabel(startOffset, endOffset, labels[i], 0, LabelMarkStyle.None));
}
startOffset = startOffset + 1;
endOffset = endOffset + 1;
}
}
}
}
}
+150
View File
@@ -0,0 +1,150 @@
namespace ResultsBrowser.Forms
{
partial class HistogramDlg
{
/// <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.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.exportButton = new System.Windows.Forms.Button();
this.printButton = new System.Windows.Forms.Button();
this.closeButton = new System.Windows.Forms.Button();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.flowLayoutPanel1);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(572, 409);
this.splitContainer1.SplitterDistance = 320;
this.splitContainer1.TabIndex = 0;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.exportButton);
this.splitContainer2.Panel2.Controls.Add(this.printButton);
this.splitContainer2.Panel2.Controls.Add(this.closeButton);
this.splitContainer2.Size = new System.Drawing.Size(572, 85);
this.splitContainer2.SplitterDistance = 249;
this.splitContainer2.TabIndex = 0;
//
// exportButton
//
this.exportButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.exportButton.Location = new System.Drawing.Point(103, 21);
this.exportButton.Name = "exportButton";
this.exportButton.Size = new System.Drawing.Size(94, 41);
this.exportButton.TabIndex = 1;
this.exportButton.Text = "Export";
this.exportButton.UseVisualStyleBackColor = true;
//
// printButton
//
this.printButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.printButton.Location = new System.Drawing.Point(4, 21);
this.printButton.Name = "printButton";
this.printButton.Size = new System.Drawing.Size(94, 41);
this.printButton.TabIndex = 0;
this.printButton.Text = "Print";
this.printButton.UseVisualStyleBackColor = true;
//
// closeButton
//
this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.closeButton.Location = new System.Drawing.Point(203, 21);
this.closeButton.Name = "closeButton";
this.closeButton.Size = new System.Drawing.Size(94, 41);
this.closeButton.TabIndex = 2;
this.closeButton.Text = "Close";
this.closeButton.UseVisualStyleBackColor = true;
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(572, 320);
this.flowLayoutPanel1.TabIndex = 0;
//
// HistogramDlg
//
this.AcceptButton = this.closeButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(572, 409);
this.Controls.Add(this.splitContainer1);
this.Name = "HistogramDlg";
this.Text = "HistogramDlg";
this.Load += new System.EventHandler(this.HistogramDlg_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.Button closeButton;
private System.Windows.Forms.Button printButton;
private System.Windows.Forms.Button exportButton;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
}
}
+152
View File
@@ -0,0 +1,152 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using Results.Entities;
using ResultsBrowser.Resources;
using ResultsBrowser.Output.Printers.Statistics;
namespace ResultsBrowser.Forms
{
public partial class HistogramDlg : Form
{
const int NrBins = 11;
IList<WaterMeter> waterMeters;
HistogramOptionsDlg options;
public HistogramDlg(IList<WaterMeter> waterMeters, HistogramOptionsDlg options, string title)
{
InitializeComponent();
this.waterMeters = waterMeters;
this.options = options;
Text = title;
closeButton.Text = Strings.OkBtnText;
printButton.Text = Strings.Print;
}
private void HistogramDlg_Load(object sender, EventArgs e)
{
CalculateAndDraw();
}
void CalculateAndDraw()
{
for (int i = 0; i < options.SelectedItems.Count; i++)
{
Results.WMeterRsltItemSpec item = options.SelectedItems[i];
try
{
/// Find minimum and maximum
double min = Double.MaxValue;
double max = Double.MinValue;
double sum = 0;
int count = 0;
foreach (var wm in waterMeters)
{
string strValue = item.Print(wm);
double value;
if (!double.TryParse(strValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.CurrentCulture, out value) &&
!double.TryParse(strValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out value))
{
throw new Exception(string.Format("{0} is not a number, cannot calculate histogram", item.Caption));
}
sum += value;
count++;
if (min > value) min = value;
if (max < value) max = value;
}
double mean = (count != 0) ? (sum / count) : 0; /// Prevent division by zero
///
/// Determine limits for bins
///
double[] binHiLim;
string[] labels;
if ((-0.55 <= min) && (max <= 0.55))
{
labels = new string[] { "-0.6", "", "-0.4", "", "-0.2", "", "0", "", "0.2", "", "0.4", "", "0.6" };
binHiLim = new double[] { -0.45, -0.35, -0.25, -0.15, -0.05, 0.05, 0.15, 0.25, 0.35, 0.45, 0.55 };
}
else if ((-1.1 <= min) && (max <= 1.1))
{
labels = new string[] { "-1.2", "", "-0.8", "", "-0.4", "", "0", "", "0.4", "", "0.8", "", "1.2" };
binHiLim = new double[] { -0.9, -0.7, -0.5, -0.3, -0.1, 0.1, 0.3, 0.5, 0.7, 0.9, 1.1 };
}
else if ((-2.2 <= min) && (max <= 2.2))
{
labels = new string[] { "-2.4", "", "-1.6", "", "-0.8", "", "0", "", "0.8", "", "1.6", "", "2.4" };
binHiLim = new double[] { -1.8, -1.4, -1.0, -0.6, -0.2, 0.2, 0.6, 1.0, 1.4, 1.8, 2.2 };
}
else if ((-4.4 <= min) && (max <= 4.4))
{
labels = new string[] { "-4.8", "", "-3.2", "", "-1.6", "", "0", "", "1.6", "", "3.2", "", "4.8" };
binHiLim = new double[] { -3.6, -2.8, -2.0, -1.2, -0.4, 0.4, 1.2, 2.0, 2.8, 3.6, 4.4 };
}
else
{
labels = new string[] { "-9.6", "", "-6.4", "", "-3.2", "", "0", "", "3.2", "", "6.4", "", "9.6" };
binHiLim = new double[] { -7.2, -5.6, -4.0, -2.4, -0.8, 0.8, 2.4, 4.0, 5.6, 7.2, 8.8 };
}
int nrBins = Math.Min(labels.Length - 1, binHiLim.Length + 1);
double[] bins = new double[nrBins];
for (int j = 0; j < nrBins; j++) bins[j] = 0;
/// Calculate bins
foreach (var wm in waterMeters)
{
string strValue = item.Print(wm);
double value;
if (!double.TryParse(strValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.CurrentCulture, out value) &&
!double.TryParse(strValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out value))
{
throw new Exception(string.Format("{0} is not a number, cannot calculate histogram", item.Caption));
}
for (int j = 0; j < nrBins - 1; j++)
{
if (value < binHiLim[j])
{
bins[j] += 1.0;
break;
}
}
if (value >= binHiLim[nrBins - 2])
{
bins[nrBins - 1] += 1.0;
}
}
///
/// Draw
///
HistogramCtrl histo = new HistogramCtrl(string.Format("{0} mean = {1}", item.Caption, mean.ToString("F3")), bins, labels);
flowLayoutPanel1.Controls.Add(histo);
}
catch (Exception exc)
{
string msg = exc.Message;
}
}
}
private void closeButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
Close();
}
}
}
+120
View 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>
+91
View File
@@ -0,0 +1,91 @@
namespace ResultsBrowser.Forms
{
partial class HistogramOptionsDlg
{
/// <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.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(380, 302);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(95, 38);
this.cancelButton.TabIndex = 9;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.Location = new System.Drawing.Point(269, 302);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(95, 38);
this.okButton.TabIndex = 8;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(12, 12);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(479, 271);
this.flowLayoutPanel1.TabIndex = 10;
//
// HistogramOptionsDlg
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(503, 355);
this.Controls.Add(this.flowLayoutPanel1);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Name = "HistogramOptionsDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "HistogramOptionsDlg";
this.Load += new System.EventHandler(this.HistogramOptionsDlg_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
}
}
@@ -0,0 +1,67 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ResultsBrowser.Resources;
namespace ResultsBrowser.Forms
{
public partial class HistogramOptionsDlg : Form
{
IList<Results.WMeterRsltItemSpec> items;
public IList<Results.WMeterRsltItemSpec> SelectedItems;
IList<CheckBox> checkBoxes;
public HistogramOptionsDlg(IList<Results.WMeterRsltItemSpec> items)
{
InitializeComponent();
this.items = items;
checkBoxes = new List<CheckBox>();
}
private void HistogramOptionsDlg_Load(object sender, EventArgs e)
{
Localize();
foreach (var item in items)
{
CheckBox cb = new CheckBox();
cb.Text = item.Caption;
cb.Checked = false;
flowLayoutPanel1.Controls.Add(cb);
checkBoxes.Add(cb);
}
}
void Localize()
{
Text = Strings.Statistics;
okButton.Text = Strings.OkBtnText;
cancelButton.Text = Strings.CancelBtnText;
}
private void okButton_Click(object sender, EventArgs e)
{
SelectedItems = new List<Results.WMeterRsltItemSpec>();
for (int i = 0; i < items.Count; i++)
{
if (checkBoxes[i].Checked) SelectedItems.Add(items[i]);
}
//Program.LocalSettings.RowItemCaption = RowItem.Caption;
// ...
//Program.LocalSettings.Save();
DialogResult = DialogResult.OK;
Close();
}
private void cancelButton_Click(object sender, EventArgs e)
{
}
}
}
@@ -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>
+27 -68
View File
@@ -1,4 +1,7 @@
using System;
///
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Results.Entities;
@@ -11,22 +14,7 @@ namespace ResultsBrowser.Forms
public partial class StatisticsDlg : Form
{
IList<WaterMeter> waterMeters;
bool twoDim;
Results.WMeterRsltItemSpec rowItem;
Results.WMeterRsltItemSpec rowItem2;
Results.WMeterRsltItemSpec rowItem3;
Results.WMeterRsltItemSpec columnItem;
Results.WMeterRsltItemSpec columnItem2;
Results.WMeterRsltItemSpec columnItem3;
string rowTestSpec;
string rowTestSpec2;
string rowTestSpec3;
string columnTestSpec;
string columnTestSpec2;
string columnTestSpec3;
StatisticsOptionsDlg options;
IList<string> rowValues;
IList<string> columnValues;
@@ -36,23 +24,14 @@ namespace ResultsBrowser.Forms
string title;
public StatisticsDlg(IList<WaterMeter> waterMeters, bool twoDim,
Results.WMeterRsltItemSpec rowItem,
Results.WMeterRsltItemSpec rowItem2,
Results.WMeterRsltItemSpec rowItem3,
Results.WMeterRsltItemSpec columnItem,
Results.WMeterRsltItemSpec columnItem2,
Results.WMeterRsltItemSpec columnItem3,
string rowTestSpec,
string rowTestSpec2,
string rowTestSpec3,
string columnTestSpec,
string columnTestSpec2,
string columnTestSpec3,
public StatisticsDlg(IList<WaterMeter> waterMeters, StatisticsOptionsDlg options,
DateTime startDate, DateTime endDate)
{
InitializeComponent();
this.waterMeters = waterMeters;
this.options = options;
if (!string.IsNullOrEmpty(Program.LocalSettings.TimePeriodFormat) && (startDate != new DateTime(0)) && (endDate != new DateTime(0)))
{
title = string.Format(Program.LocalSettings.TimePeriodFormat, startDate, endDate);
@@ -66,26 +45,6 @@ namespace ResultsBrowser.Forms
closeButton.Text = Strings.OkBtnText;
printButton.Text = Strings.Print;
this.waterMeters = waterMeters;
this.twoDim = twoDim;
this.rowItem = rowItem;
this.rowItem2 = rowItem2;
this.rowItem3 = rowItem3;
this.columnItem = columnItem;
this.columnItem2 = columnItem2;
this.columnItem3 = columnItem3;
this.rowTestSpec = rowTestSpec;
this.rowTestSpec2 = rowTestSpec2;
this.rowTestSpec3 = rowTestSpec3;
this.columnTestSpec = columnTestSpec;
this.columnTestSpec2 = columnTestSpec2;
this.columnTestSpec3 = columnTestSpec3;
}
private void StatisticsDlg_Load(object sender, EventArgs e)
@@ -105,16 +64,16 @@ namespace ResultsBrowser.Forms
///
foreach (var wm in waterMeters)
{
string value = rowItem.Print(wm);
if (rowItem2 != null) value = value + " | " + rowItem2.Print(wm);
if (rowItem3 != null) value = value + " | " + rowItem3.Print(wm);
string value = options.RowItem.Print(wm);
if (options.RowItem2 != null) value = value + " | " + options.RowItem2.Print(wm);
if (options.RowItem3 != null) value = value + " | " + options.RowItem3.Print(wm);
if (!rowValues.Contains(value)) rowValues.Add(value);
if (twoDim)
if (options.TwoDim)
{
value = columnItem.Print(wm);
if (columnItem2 != null) value = value + " | " + columnItem2.Print(wm);
if (columnItem3 != null) value = value + " | " + columnItem3.Print(wm);
value = options.ColumnItem.Print(wm);
if (options.ColumnItem2 != null) value = value + " | " + options.ColumnItem2.Print(wm);
if (options.ColumnItem3 != null) value = value + " | " + options.ColumnItem3.Print(wm);
if (!columnValues.Contains(value)) columnValues.Add(value);
}
}
@@ -129,17 +88,17 @@ namespace ResultsBrowser.Forms
{
for (int row = 0; row < rowValues.Count; row++)
{
string rowValue = rowItem.Print(wm);
if (rowItem2 != null) rowValue = rowValue + " | " + rowItem2.Print(wm);
if (rowItem3 != null) rowValue = rowValue + " | " + rowItem3.Print(wm);
string rowValue = options.RowItem.Print(wm);
if (options.RowItem2 != null) rowValue = rowValue + " | " + options.RowItem2.Print(wm);
if (options.RowItem3 != null) rowValue = rowValue + " | " + options.RowItem3.Print(wm);
if (twoDim)
if (options.TwoDim)
{
for (int column = 0; column < columnsCount; column++)
{
string columnValue = columnItem.Print(wm);
if (columnItem2 != null) columnValue = columnValue + " | " + columnItem2.Print(wm);
if (columnItem3 != null) columnValue = columnValue + " | " + columnItem3.Print(wm);
string columnValue = options.ColumnItem.Print(wm);
if (options.ColumnItem2 != null) columnValue = columnValue + " | " + options.ColumnItem2.Print(wm);
if (options.ColumnItem3 != null) columnValue = columnValue + " | " + options.ColumnItem3.Print(wm);
if (rowValue == rowValues[row] && columnValue == columnValues[column])
{
@@ -164,7 +123,7 @@ namespace ResultsBrowser.Forms
statisticsListView.Columns.Add(" ", 200);
for (int column = 0; column < columnsCount; column++)
{
statisticsListView.Columns.Add((twoDim ? columnValues[column] : Strings.Count), 70);
statisticsListView.Columns.Add((options.TwoDim ? columnValues[column] : Strings.Count), 70);
}
for (int row = 0; row < rowValues.Count; row++)
@@ -197,7 +156,7 @@ namespace ResultsBrowser.Forms
table[0, 0] = string.Empty;
for (int column = 0; column < columnsCount; column++)
{
table[0, column + 1] = (twoDim ? columnValues[column] : Strings.Count);
table[0, column + 1] = (options.TwoDim ? columnValues[column] : Strings.Count);
}
for (int row = 0; row < rowValues.Count; row++)
@@ -234,7 +193,7 @@ namespace ResultsBrowser.Forms
{
using (TextWriter writer = new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8))
{
if (twoDim)
if (options.TwoDim)
{
/// Write column headers
for (int i = 0; i < columnValues.Count; i++)
@@ -245,7 +204,7 @@ namespace ResultsBrowser.Forms
}
else
{
writer.WriteLine(string.Format("\"{0}\";\"{1}\"", rowItem.Caption, Strings.Count));
writer.WriteLine(string.Format("\"{0}\";\"{1}\"", options.RowItem.Caption, Strings.Count));
}
int nrColumns = Math.Max(1, columnValues.Count);
+4 -1
View File
@@ -1,4 +1,7 @@
using System;
///
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ResultsBrowser.Resources;
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1122.0")]
[assembly: AssemblyFileVersion("2.18.1122.0")]
[assembly: AssemblyVersion("2.18.1146.0")]
[assembly: AssemblyFileVersion("2.18.1146.0")]
+3
View File
@@ -240,4 +240,7 @@
<data name="Add_data_from_Oracle" xml:space="preserve">
<value>Dohledej údaje z Oracle</value>
</data>
<data name="Histograms" xml:space="preserve">
<value>Histogramy</value>
</data>
</root>
+3
View File
@@ -828,4 +828,7 @@
<data name="Add_data_from_Oracle" xml:space="preserve">
<value>Add data from Oracle</value>
</data>
<data name="Histograms" xml:space="preserve">
<value>Histograms</value>
</data>
</root>
+9
View File
@@ -1257,6 +1257,15 @@ namespace ResultsBrowser.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Histograms.
/// </summary>
internal static string Histograms {
get {
return ResourceManager.GetString("Histograms", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Horizontally.
/// </summary>
+30 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;SLM_50;HEAT_METERS;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -31,7 +31,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;SLM_50;HEAT_METERS;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -60,6 +60,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -133,6 +134,24 @@
<Compile Include="Forms\DatabaseSettingsDlg.Designer.cs">
<DependentUpon>DatabaseSettingsDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\HistogramCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\HistogramCtrl.Designer.cs">
<DependentUpon>HistogramCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Forms\HistogramDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\HistogramDlg.Designer.cs">
<DependentUpon>HistogramDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\HistogramOptionsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\HistogramOptionsDlg.Designer.cs">
<DependentUpon>HistogramOptionsDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\NoBenchOrDatabaseDlg.cs">
<SubType>Form</SubType>
</Compile>
@@ -202,6 +221,15 @@
<EmbeddedResource Include="Forms\DatabaseSettingsDlg.resx">
<DependentUpon>DatabaseSettingsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\HistogramCtrl.resx">
<DependentUpon>HistogramCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\HistogramDlg.resx">
<DependentUpon>HistogramDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\HistogramOptionsDlg.resx">
<DependentUpon>HistogramOptionsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\NoBenchOrDatabaseDlg.resx">
<DependentUpon>NoBenchOrDatabaseDlg.cs</DependentUpon>
</EmbeddedResource>
+76 -35
View File
@@ -34,10 +34,13 @@
this.filtersFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.resultsGroupBox = new System.Windows.Forms.GroupBox();
this.resultsListView = new System.Windows.Forms.ListView();
this.printerConfigBtn = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.histogramBtn = new System.Windows.Forms.Button();
this.statisticsBtn = new System.Windows.Forms.Button();
this.printQueryResultsBtn = new System.Windows.Forms.Button();
this.outputGroupBox = new System.Windows.Forms.GroupBox();
this.exportQueryResultsBtn = new System.Windows.Forms.Button();
this.printQueryResultsBtn = new System.Windows.Forms.Button();
this.printerConfigBtn = new System.Windows.Forms.Button();
this.formatOfResultsBtn = new System.Windows.Forms.Button();
this.clearFiltersBtn = new System.Windows.Forms.Button();
this.settingsBtn = new System.Windows.Forms.Button();
@@ -62,6 +65,8 @@
this.hSplitContainer.SuspendLayout();
this.filtersGroupBox.SuspendLayout();
this.resultsGroupBox.SuspendLayout();
this.groupBox1.SuspendLayout();
this.outputGroupBox.SuspendLayout();
this.testBenchesGroupBox.SuspendLayout();
this.SuspendLayout();
//
@@ -79,10 +84,9 @@
//
// vSplitContainer.Panel2
//
this.vSplitContainer.Panel2.Controls.Add(this.groupBox1);
this.vSplitContainer.Panel2.Controls.Add(this.outputGroupBox);
this.vSplitContainer.Panel2.Controls.Add(this.printerConfigBtn);
this.vSplitContainer.Panel2.Controls.Add(this.statisticsBtn);
this.vSplitContainer.Panel2.Controls.Add(this.printQueryResultsBtn);
this.vSplitContainer.Panel2.Controls.Add(this.exportQueryResultsBtn);
this.vSplitContainer.Panel2.Controls.Add(this.formatOfResultsBtn);
this.vSplitContainer.Panel2.Controls.Add(this.clearFiltersBtn);
this.vSplitContainer.Panel2.Controls.Add(this.settingsBtn);
@@ -154,6 +158,68 @@
this.resultsListView.UseCompatibleStateImageBehavior = false;
this.resultsListView.View = System.Windows.Forms.View.Details;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.histogramBtn);
this.groupBox1.Controls.Add(this.statisticsBtn);
this.groupBox1.Location = new System.Drawing.Point(8, 608);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(125, 93);
this.groupBox1.TabIndex = 13;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Analysis";
//
// histogramBtn
//
this.histogramBtn.Location = new System.Drawing.Point(5, 55);
this.histogramBtn.Name = "histogramBtn";
this.histogramBtn.Size = new System.Drawing.Size(114, 32);
this.histogramBtn.TabIndex = 11;
this.histogramBtn.Text = "Histograms";
this.histogramBtn.UseVisualStyleBackColor = true;
this.histogramBtn.Click += new System.EventHandler(this.histogramBtn_Click);
//
// statisticsBtn
//
this.statisticsBtn.Location = new System.Drawing.Point(5, 18);
this.statisticsBtn.Name = "statisticsBtn";
this.statisticsBtn.Size = new System.Drawing.Size(114, 32);
this.statisticsBtn.TabIndex = 10;
this.statisticsBtn.Text = "Statistics";
this.statisticsBtn.UseVisualStyleBackColor = true;
this.statisticsBtn.Click += new System.EventHandler(this.statisticsBtn_Click);
//
// outputGroupBox
//
this.outputGroupBox.Controls.Add(this.exportQueryResultsBtn);
this.outputGroupBox.Controls.Add(this.printQueryResultsBtn);
this.outputGroupBox.Location = new System.Drawing.Point(8, 509);
this.outputGroupBox.Name = "outputGroupBox";
this.outputGroupBox.Size = new System.Drawing.Size(125, 93);
this.outputGroupBox.TabIndex = 12;
this.outputGroupBox.TabStop = false;
this.outputGroupBox.Text = "Output";
//
// exportQueryResultsBtn
//
this.exportQueryResultsBtn.Location = new System.Drawing.Point(5, 18);
this.exportQueryResultsBtn.Name = "exportQueryResultsBtn";
this.exportQueryResultsBtn.Size = new System.Drawing.Size(114, 32);
this.exportQueryResultsBtn.TabIndex = 8;
this.exportQueryResultsBtn.Text = "Export query results";
this.exportQueryResultsBtn.UseVisualStyleBackColor = true;
this.exportQueryResultsBtn.Click += new System.EventHandler(this.exportQueryResultsBtn_Click);
//
// printQueryResultsBtn
//
this.printQueryResultsBtn.Location = new System.Drawing.Point(5, 55);
this.printQueryResultsBtn.Name = "printQueryResultsBtn";
this.printQueryResultsBtn.Size = new System.Drawing.Size(113, 32);
this.printQueryResultsBtn.TabIndex = 9;
this.printQueryResultsBtn.Text = "Print query results";
this.printQueryResultsBtn.UseVisualStyleBackColor = true;
this.printQueryResultsBtn.Click += new System.EventHandler(this.printQueryResultsBtn_Click);
//
// printerConfigBtn
//
this.printerConfigBtn.Location = new System.Drawing.Point(8, 316);
@@ -164,36 +230,6 @@
this.printerConfigBtn.UseVisualStyleBackColor = true;
this.printerConfigBtn.Click += new System.EventHandler(this.printerConfigBtn_Click);
//
// statisticsBtn
//
this.statisticsBtn.Location = new System.Drawing.Point(8, 621);
this.statisticsBtn.Name = "statisticsBtn";
this.statisticsBtn.Size = new System.Drawing.Size(125, 35);
this.statisticsBtn.TabIndex = 10;
this.statisticsBtn.Text = "Statistics";
this.statisticsBtn.UseVisualStyleBackColor = true;
this.statisticsBtn.Click += new System.EventHandler(this.statisticsBtn_Click);
//
// printQueryResultsBtn
//
this.printQueryResultsBtn.Location = new System.Drawing.Point(8, 548);
this.printQueryResultsBtn.Name = "printQueryResultsBtn";
this.printQueryResultsBtn.Size = new System.Drawing.Size(125, 35);
this.printQueryResultsBtn.TabIndex = 9;
this.printQueryResultsBtn.Text = "Print query results";
this.printQueryResultsBtn.UseVisualStyleBackColor = true;
this.printQueryResultsBtn.Click += new System.EventHandler(this.printQueryResultsBtn_Click);
//
// exportQueryResultsBtn
//
this.exportQueryResultsBtn.Location = new System.Drawing.Point(8, 508);
this.exportQueryResultsBtn.Name = "exportQueryResultsBtn";
this.exportQueryResultsBtn.Size = new System.Drawing.Size(125, 35);
this.exportQueryResultsBtn.TabIndex = 8;
this.exportQueryResultsBtn.Text = "Export query results";
this.exportQueryResultsBtn.UseVisualStyleBackColor = true;
this.exportQueryResultsBtn.Click += new System.EventHandler(this.exportQueryResultsBtn_Click);
//
// formatOfResultsBtn
//
this.formatOfResultsBtn.Location = new System.Drawing.Point(8, 276);
@@ -370,6 +406,8 @@
this.hSplitContainer.ResumeLayout(false);
this.filtersGroupBox.ResumeLayout(false);
this.resultsGroupBox.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.outputGroupBox.ResumeLayout(false);
this.testBenchesGroupBox.ResumeLayout(false);
this.testBenchesGroupBox.PerformLayout();
this.ResumeLayout(false);
@@ -402,5 +440,8 @@
private System.Windows.Forms.RadioButton checkBox4;
private System.Windows.Forms.Button printerConfigBtn;
private System.Windows.Forms.RadioButton checkBox6;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox outputGroupBox;
private System.Windows.Forms.Button histogramBtn;
}
}
+26 -8
View File
@@ -1,4 +1,7 @@
using System;
///
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
@@ -489,7 +492,7 @@ namespace ResultsBrowser
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
///
/// Enter options
/// Statistics options
///
Forms.StatisticsOptionsDlg optionsDlg = new Forms.StatisticsOptionsDlg(items);
if (optionsDlg.ShowDialog() != DialogResult.OK) return;
@@ -497,16 +500,31 @@ namespace ResultsBrowser
///
/// Calculate statistics
///
Forms.StatisticsDlg statisticsDlg = new Forms.StatisticsDlg(waterMeters, optionsDlg.TwoDim,
optionsDlg.RowItem, optionsDlg.RowItem2, optionsDlg.RowItem3,
optionsDlg.ColumnItem, optionsDlg.ColumnItem2, optionsDlg.ColumnItem3,
optionsDlg.RowTestSpecifier, optionsDlg.RowTestSpecifier2, optionsDlg.RowTestSpecifier3,
optionsDlg.ColumnTestSpecifier, optionsDlg.ColumnTestSpecifier2, optionsDlg.ColumnTestSpecifier3,
timePeriodStart, timePeriodEnd);
Forms.StatisticsDlg statisticsDlg = new Forms.StatisticsDlg(waterMeters, optionsDlg, timePeriodStart, timePeriodEnd);
statisticsDlg.ShowDialog();
}
private void histogramBtn_Click(object sender, EventArgs e)
{
if (waterMeters == null || waterMeters.Count == 0) return;
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
///
/// Histogram options
///
Forms.HistogramOptionsDlg optionsDlg = new Forms.HistogramOptionsDlg(items);
if (optionsDlg.ShowDialog() != DialogResult.OK) return;
///
/// Calculate and display histograms
///
Forms.HistogramDlg histogramDlg = new Forms.HistogramDlg(waterMeters, optionsDlg, "Histogramy");
histogramDlg.ShowDialog();
}
/// <summary>
/// Updates component factory
/// </summary>
+128 -58
View File
@@ -18,7 +18,6 @@ namespace Statistics
[XmlRootAttribute("Statistics")]
public class LocalSettings
{
public const int BenchesCount = 6;
public const int FlowsCount = 5;
@@ -47,115 +46,166 @@ namespace Statistics
return ((ConnectionStrings != null) && (i >= 0) && (i < ConnectionStrings.Length)) ? ConnectionStrings[i] : string.Empty;
}
///
/// MID-s
///
public string[] MidNames;
///
/// Flow settings
///
public bool[] FlowEnabledWMs;
public bool[] FlowEnabledI1;
public bool[] FlowEnabledI2;
public bool[] FlowEnabledI3;
public bool[] FlowEnabledI4;
///
public bool GetFlowEnabled(UserControls.MidId midId, int i)
public bool[] FlowEnabledI5;
public bool[] FlowEnabledI6;
public bool[] FlowEnabledI7;
/// <summary>
/// Get flow enabled info
/// </summary>
/// <param name="midId">1-based MID id</param>
/// <param name="i">0-based flow id</param>
/// <returns>true = enabled</returns>
public bool GetFlowEnabled(int midId, int i)
{
switch (midId)
{
case UserControls.MidId.WaterMeters:
return ((FlowEnabledWMs != null) && (i >= 0) && (i < FlowEnabledWMs.Length)) ? FlowEnabledWMs[i] : false;
case UserControls.MidId.I1: return ((FlowEnabledI1 != null) && (i >= 0) && (i < FlowEnabledI1.Length)) ? FlowEnabledI1[i] : false;
case UserControls.MidId.I2: return ((FlowEnabledI2 != null) && (i >= 0) && (i < FlowEnabledI2.Length)) ? FlowEnabledI2[i] : false;
case UserControls.MidId.I3: return ((FlowEnabledI3 != null) && (i >= 0) && (i < FlowEnabledI3.Length)) ? FlowEnabledI3[i] : false;
case UserControls.MidId.I4: return ((FlowEnabledI4 != null) && (i >= 0) && (i < FlowEnabledI4.Length)) ? FlowEnabledI4[i] : false;
case 1: return ((FlowEnabledI1 != null) && (i >= 0) && (i < FlowEnabledI1.Length)) ? FlowEnabledI1[i] : false;
case 2: return ((FlowEnabledI2 != null) && (i >= 0) && (i < FlowEnabledI2.Length)) ? FlowEnabledI2[i] : false;
case 3: return ((FlowEnabledI3 != null) && (i >= 0) && (i < FlowEnabledI3.Length)) ? FlowEnabledI3[i] : false;
case 4: return ((FlowEnabledI4 != null) && (i >= 0) && (i < FlowEnabledI4.Length)) ? FlowEnabledI4[i] : false;
case 5: return ((FlowEnabledI5 != null) && (i >= 0) && (i < FlowEnabledI5.Length)) ? FlowEnabledI5[i] : false;
case 6: return ((FlowEnabledI6 != null) && (i >= 0) && (i < FlowEnabledI6.Length)) ? FlowEnabledI6[i] : false;
case 7: return ((FlowEnabledI7 != null) && (i >= 0) && (i < FlowEnabledI7.Length)) ? FlowEnabledI7[i] : false;
default:
return false;
}
}
///
public void SetFlowEnabled(UserControls.MidId midId, int i, bool value)
/// <summary>
/// Set flow enabled info
/// </summary>
/// <param name="midId">1-based MID id</param>
/// <param name="i">0-based flow id</param>
/// <param name="value">true = enabled</param>
public void SetFlowEnabled(int midId, int i, bool value)
{
switch (midId)
{
case UserControls.MidId.WaterMeters:
if ((FlowEnabledWMs != null) && (i >= 0) && (i < FlowEnabledWMs.Length)) { FlowEnabledWMs[i] = value; };
break;
case UserControls.MidId.I1: if ((FlowEnabledI1 != null) && (i >= 0) && (i < FlowEnabledI1.Length)) { FlowEnabledI1[i] = value; }; break;
case UserControls.MidId.I2: if ((FlowEnabledI2 != null) && (i >= 0) && (i < FlowEnabledI2.Length)) { FlowEnabledI2[i] = value; }; break;
case UserControls.MidId.I3: if ((FlowEnabledI3 != null) && (i >= 0) && (i < FlowEnabledI3.Length)) { FlowEnabledI3[i] = value; }; break;
case UserControls.MidId.I4: if ((FlowEnabledI4 != null) && (i >= 0) && (i < FlowEnabledI4.Length)) { FlowEnabledI4[i] = value; }; break;
case 1: if ((FlowEnabledI1 != null) && (i >= 0) && (i < FlowEnabledI1.Length)) { FlowEnabledI1[i] = value; }; break;
case 2: if ((FlowEnabledI2 != null) && (i >= 0) && (i < FlowEnabledI2.Length)) { FlowEnabledI2[i] = value; }; break;
case 3: if ((FlowEnabledI3 != null) && (i >= 0) && (i < FlowEnabledI3.Length)) { FlowEnabledI3[i] = value; }; break;
case 4: if ((FlowEnabledI4 != null) && (i >= 0) && (i < FlowEnabledI4.Length)) { FlowEnabledI4[i] = value; }; break;
case 5: if ((FlowEnabledI5 != null) && (i >= 0) && (i < FlowEnabledI5.Length)) { FlowEnabledI5[i] = value; }; break;
case 6: if ((FlowEnabledI6 != null) && (i >= 0) && (i < FlowEnabledI6.Length)) { FlowEnabledI6[i] = value; }; break;
case 7: if ((FlowEnabledI7 != null) && (i >= 0) && (i < FlowEnabledI7.Length)) { FlowEnabledI7[i] = value; }; break;
default:
break;
}
}
public double[] FlowFromWMs;
public double[] FlowFromI1;
public double[] FlowFromI2;
public double[] FlowFromI3;
public double[] FlowFromI4;
///
public double GetFlowFrom(UserControls.MidId midId, int i)
public double[] FlowFromI5;
public double[] FlowFromI6;
public double[] FlowFromI7;
/// <summary>
/// Get lower limit of the flow
/// </summary>
/// <param name="midId">1-based MID id</param>
/// <param name="i">0-based flow id</param>
/// <returns>Flow in m3/h</returns>
public double GetFlowFrom(int midId, int i)
{
switch (midId)
{
case UserControls.MidId.WaterMeters:
return ((FlowFromWMs != null) && (i >= 0) && (i < FlowFromWMs.Length)) ? FlowFromWMs[i] : 0;
case UserControls.MidId.I1: return ((FlowFromI1 != null) && (i >= 0) && (i < FlowFromI1.Length)) ? FlowFromI1[i] : 0;
case UserControls.MidId.I2: return ((FlowFromI2 != null) && (i >= 0) && (i < FlowFromI2.Length)) ? FlowFromI2[i] : 0;
case UserControls.MidId.I3: return ((FlowFromI3 != null) && (i >= 0) && (i < FlowFromI3.Length)) ? FlowFromI3[i] : 0;
case UserControls.MidId.I4: return ((FlowFromI4 != null) && (i >= 0) && (i < FlowFromI4.Length)) ? FlowFromI4[i] : 0;
case 1: return ((FlowFromI1 != null) && (i >= 0) && (i < FlowFromI1.Length)) ? FlowFromI1[i] : 0;
case 2: return ((FlowFromI2 != null) && (i >= 0) && (i < FlowFromI2.Length)) ? FlowFromI2[i] : 0;
case 3: return ((FlowFromI3 != null) && (i >= 0) && (i < FlowFromI3.Length)) ? FlowFromI3[i] : 0;
case 4: return ((FlowFromI4 != null) && (i >= 0) && (i < FlowFromI4.Length)) ? FlowFromI4[i] : 0;
case 5: return ((FlowFromI5 != null) && (i >= 0) && (i < FlowFromI5.Length)) ? FlowFromI5[i] : 0;
case 6: return ((FlowFromI6 != null) && (i >= 0) && (i < FlowFromI6.Length)) ? FlowFromI6[i] : 0;
case 7: return ((FlowFromI7 != null) && (i >= 0) && (i < FlowFromI7.Length)) ? FlowFromI7[i] : 0;
default:
return 0;
}
}
///
public void SetFlowFrom(UserControls.MidId midId, int i, double value)
/// <summary>
/// Set lower limit of the flow
/// </summary>
/// <param name="midId">1-based MID id</param>
/// <param name="i">0-based flow id</param>
/// <param name="value">Flow in m3/h</param>
public void SetFlowFrom(int midId, int i, double value)
{
switch (midId)
{
case UserControls.MidId.WaterMeters:
if ((FlowFromWMs != null) && (i >= 0) && (i < FlowFromWMs.Length)) { FlowFromWMs[i] = value; };
break;
case UserControls.MidId.I1: if ((FlowFromI1 != null) && (i >= 0) && (i < FlowFromI1.Length)) { FlowFromI1[i] = value; }; break;
case UserControls.MidId.I2: if ((FlowFromI2 != null) && (i >= 0) && (i < FlowFromI2.Length)) { FlowFromI2[i] = value; }; break;
case UserControls.MidId.I3: if ((FlowFromI3 != null) && (i >= 0) && (i < FlowFromI3.Length)) { FlowFromI3[i] = value; }; break;
case UserControls.MidId.I4: if ((FlowFromI4 != null) && (i >= 0) && (i < FlowFromI4.Length)) { FlowFromI4[i] = value; }; break;
case 1: if ((FlowFromI1 != null) && (i >= 0) && (i < FlowFromI1.Length)) { FlowFromI1[i] = value; }; break;
case 2: if ((FlowFromI2 != null) && (i >= 0) && (i < FlowFromI2.Length)) { FlowFromI2[i] = value; }; break;
case 3: if ((FlowFromI3 != null) && (i >= 0) && (i < FlowFromI3.Length)) { FlowFromI3[i] = value; }; break;
case 4: if ((FlowFromI4 != null) && (i >= 0) && (i < FlowFromI4.Length)) { FlowFromI4[i] = value; }; break;
case 5: if ((FlowFromI5 != null) && (i >= 0) && (i < FlowFromI5.Length)) { FlowFromI5[i] = value; }; break;
case 6: if ((FlowFromI6 != null) && (i >= 0) && (i < FlowFromI6.Length)) { FlowFromI6[i] = value; }; break;
case 7: if ((FlowFromI7 != null) && (i >= 0) && (i < FlowFromI7.Length)) { FlowFromI7[i] = value; }; break;
default:
break;
}
}
public double[] FlowToWMs;
public double[] FlowToI1;
public double[] FlowToI2;
public double[] FlowToI3;
public double[] FlowToI4;
///
public double GetFlowTo(UserControls.MidId midId, int i)
public double[] FlowToI5;
public double[] FlowToI6;
public double[] FlowToI7;
/// <summary>
/// Get upper limit of the flow
/// </summary>
/// <param name="midId">1-based MID id</param>
/// <param name="i">0-based flow id</param>
/// <returns>Flow in m3/h</returns>
public double GetFlowTo(int midId, int i)
{
switch (midId)
{
case UserControls.MidId.WaterMeters:
return ((FlowToWMs != null) && (i >= 0) && (i < FlowToWMs.Length)) ? FlowToWMs[i] : 0;
case UserControls.MidId.I1: return ((FlowToI1 != null) && (i >= 0) && (i < FlowToI1.Length)) ? FlowToI1[i] : 0;
case UserControls.MidId.I2: return ((FlowToI2 != null) && (i >= 0) && (i < FlowToI2.Length)) ? FlowToI2[i] : 0;
case UserControls.MidId.I3: return ((FlowToI3 != null) && (i >= 0) && (i < FlowToI3.Length)) ? FlowToI3[i] : 0;
case UserControls.MidId.I4: return ((FlowToI4 != null) && (i >= 0) && (i < FlowToI4.Length)) ? FlowToI4[i] : 0;
case 1: return ((FlowToI1 != null) && (i >= 0) && (i < FlowToI1.Length)) ? FlowToI1[i] : 0;
case 2: return ((FlowToI2 != null) && (i >= 0) && (i < FlowToI2.Length)) ? FlowToI2[i] : 0;
case 3: return ((FlowToI3 != null) && (i >= 0) && (i < FlowToI3.Length)) ? FlowToI3[i] : 0;
case 4: return ((FlowToI4 != null) && (i >= 0) && (i < FlowToI4.Length)) ? FlowToI4[i] : 0;
case 5: return ((FlowToI5 != null) && (i >= 0) && (i < FlowToI5.Length)) ? FlowToI5[i] : 0;
case 6: return ((FlowToI6 != null) && (i >= 0) && (i < FlowToI6.Length)) ? FlowToI6[i] : 0;
case 7: return ((FlowToI7 != null) && (i >= 0) && (i < FlowToI7.Length)) ? FlowToI7[i] : 0;
default:
return 0;
}
}
///
public void SetFlowTo(UserControls.MidId midId, int i, double value)
/// <summary>
/// Set upper limit of the flow
/// </summary>
/// <param name="midId">1-based MID id</param>
/// <param name="i">0-based flow id</param>
/// <param name="value">Flow in m3/h</param>
public void SetFlowTo(int midId, int i, double value)
{
switch (midId)
{
case UserControls.MidId.WaterMeters:
if ((FlowToWMs != null) && (i >= 0) && (i < FlowToWMs.Length)) { FlowToWMs[i] = value; };
break;
case UserControls.MidId.I1: if ((FlowToI1 != null) && (i >= 0) && (i < FlowToI1.Length)) { FlowToI1[i] = value; }; break;
case UserControls.MidId.I2: if ((FlowToI2 != null) && (i >= 0) && (i < FlowToI2.Length)) { FlowToI2[i] = value; }; break;
case UserControls.MidId.I3: if ((FlowToI3 != null) && (i >= 0) && (i < FlowToI3.Length)) { FlowToI3[i] = value; }; break;
case UserControls.MidId.I4: if ((FlowToI4 != null) && (i >= 0) && (i < FlowToI4.Length)) { FlowToI4[i] = value; }; break;
case 1: if ((FlowToI1 != null) && (i >= 0) && (i < FlowToI1.Length)) { FlowToI1[i] = value; }; break;
case 2: if ((FlowToI2 != null) && (i >= 0) && (i < FlowToI2.Length)) { FlowToI2[i] = value; }; break;
case 3: if ((FlowToI3 != null) && (i >= 0) && (i < FlowToI3.Length)) { FlowToI3[i] = value; }; break;
case 4: if ((FlowToI4 != null) && (i >= 0) && (i < FlowToI4.Length)) { FlowToI4[i] = value; }; break;
case 5: if ((FlowToI5 != null) && (i >= 0) && (i < FlowToI5.Length)) { FlowToI5[i] = value; }; break;
case 6: if ((FlowToI6 != null) && (i >= 0) && (i < FlowToI6.Length)) { FlowToI6[i] = value; }; break;
case 7: if ((FlowToI7 != null) && (i >= 0) && (i < FlowToI7.Length)) { FlowToI7[i] = value; }; break;
default:
break;
}
@@ -180,6 +230,18 @@ namespace Statistics
/// </summary>
public LocalSettings()
{
#if GENESIS
Language = "DE";
BenchNames = new string[] { "Genesis" };
ConnectionStrings = new string[]
{
"SERVER=localhost; DATABASE=genesis-r; UID=root; PASSWORD=; CHARSET=utf8;",
};
MidNames = new string[] { string.Empty, "I11", "I12", "I2", "I3", "I4", "I5" }; /// Index is MID-id
#else
Language = "SK";
BenchNames = new string[] { "WR10", "WR11", "WR13", "WR14", "WR15", "PT7" };
@@ -194,23 +256,31 @@ namespace Statistics
"SERVER=10.42.129.26; DATABASE=iperlspecial-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;",
};
FlowEnabledWMs = new bool[FlowsCount];
MidNames = new string[] { string.Empty, "I1", "I2", "I3", "I4" }; /// Index is MID-id
#endif
FlowEnabledI1 = new bool[FlowsCount];
FlowEnabledI2 = new bool[FlowsCount];
FlowEnabledI3 = new bool[FlowsCount];
FlowEnabledI4 = new bool[FlowsCount];
FlowEnabledI5 = new bool[FlowsCount];
FlowEnabledI6 = new bool[FlowsCount];
FlowEnabledI7 = new bool[FlowsCount];
FlowFromWMs = new double[FlowsCount];
FlowFromI1 = new double[FlowsCount];
FlowFromI2 = new double[FlowsCount];
FlowFromI3 = new double[FlowsCount];
FlowFromI4 = new double[FlowsCount];
FlowFromI5 = new double[FlowsCount];
FlowFromI6 = new double[FlowsCount];
FlowFromI7 = new double[FlowsCount];
FlowToWMs = new double[FlowsCount];
FlowToI1 = new double[FlowsCount];
FlowToI2 = new double[FlowsCount];
FlowToI3 = new double[FlowsCount];
FlowToI4 = new double[FlowsCount];
FlowToI5 = new double[FlowsCount];
FlowToI6 = new double[FlowsCount];
FlowToI7 = new double[FlowsCount];
SelectedRadioButtonNumber = 1;
}
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1108.0")]
[assembly: AssemblyFileVersion("2.18.1108.0")]
[assembly: AssemblyVersion("2.18.1154.0")]
[assembly: AssemblyFileVersion("2.18.1154.0")]
-1
View File
@@ -80,7 +80,6 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UserControls\Enums.cs" />
<Compile Include="UserControls\MidOrWaterMetersCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
+2 -134
View File
@@ -39,27 +39,11 @@
this.dateTimeFromPicker = new System.Windows.Forms.DateTimePicker();
this.dateTimeToPicker = new System.Windows.Forms.DateTimePicker();
this.midsTabControl = new System.Windows.Forms.TabControl();
this.wr10TabPage = new System.Windows.Forms.TabPage();
this.wmsBenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl();
this.wr11TabPage = new System.Windows.Forms.TabPage();
this.i1BenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl();
this.wr13TabPage = new System.Windows.Forms.TabPage();
this.i2BbenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl();
this.wr14TabPage = new System.Windows.Forms.TabPage();
this.i3BenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl();
this.wr15TabPage = new System.Windows.Forms.TabPage();
this.i4BenchesControl = new Statistics.UserControls.MidOrWaterMetersCtrl();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.timePeriodGroupBox.SuspendLayout();
this.midsTabControl.SuspendLayout();
this.wr10TabPage.SuspendLayout();
this.wr11TabPage.SuspendLayout();
this.wr13TabPage.SuspendLayout();
this.wr14TabPage.SuspendLayout();
this.wr15TabPage.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
@@ -177,11 +161,6 @@
//
// midsTabControl
//
this.midsTabControl.Controls.Add(this.wr10TabPage);
this.midsTabControl.Controls.Add(this.wr11TabPage);
this.midsTabControl.Controls.Add(this.wr13TabPage);
this.midsTabControl.Controls.Add(this.wr14TabPage);
this.midsTabControl.Controls.Add(this.wr15TabPage);
this.midsTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.midsTabControl.Location = new System.Drawing.Point(0, 0);
this.midsTabControl.Name = "midsTabControl";
@@ -189,101 +168,6 @@
this.midsTabControl.Size = new System.Drawing.Size(1368, 732);
this.midsTabControl.TabIndex = 0;
//
// wr10TabPage
//
this.wr10TabPage.Controls.Add(this.wmsBenchesControl);
this.wr10TabPage.Location = new System.Drawing.Point(4, 22);
this.wr10TabPage.Name = "wr10TabPage";
this.wr10TabPage.Padding = new System.Windows.Forms.Padding(3);
this.wr10TabPage.Size = new System.Drawing.Size(1360, 706);
this.wr10TabPage.TabIndex = 0;
this.wr10TabPage.Text = "Water meters";
this.wr10TabPage.UseVisualStyleBackColor = true;
//
// wmsBenchesControl
//
this.wmsBenchesControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.wmsBenchesControl.Location = new System.Drawing.Point(3, 3);
this.wmsBenchesControl.Name = "wmsBenchesControl";
this.wmsBenchesControl.Size = new System.Drawing.Size(1354, 700);
this.wmsBenchesControl.TabIndex = 0;
//
// wr11TabPage
//
this.wr11TabPage.Controls.Add(this.i1BenchesControl);
this.wr11TabPage.Location = new System.Drawing.Point(4, 22);
this.wr11TabPage.Name = "wr11TabPage";
this.wr11TabPage.Padding = new System.Windows.Forms.Padding(3);
this.wr11TabPage.Size = new System.Drawing.Size(1360, 706);
this.wr11TabPage.TabIndex = 1;
this.wr11TabPage.Text = "I1";
this.wr11TabPage.UseVisualStyleBackColor = true;
//
// i1BenchesControl
//
this.i1BenchesControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.i1BenchesControl.Location = new System.Drawing.Point(3, 3);
this.i1BenchesControl.Name = "i1BenchesControl";
this.i1BenchesControl.Size = new System.Drawing.Size(1354, 700);
this.i1BenchesControl.TabIndex = 0;
//
// wr13TabPage
//
this.wr13TabPage.Controls.Add(this.i2BbenchesControl);
this.wr13TabPage.Location = new System.Drawing.Point(4, 22);
this.wr13TabPage.Name = "wr13TabPage";
this.wr13TabPage.Padding = new System.Windows.Forms.Padding(3);
this.wr13TabPage.Size = new System.Drawing.Size(1360, 706);
this.wr13TabPage.TabIndex = 2;
this.wr13TabPage.Text = "I2";
this.wr13TabPage.UseVisualStyleBackColor = true;
//
// i2BbenchesControl
//
this.i2BbenchesControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.i2BbenchesControl.Location = new System.Drawing.Point(3, 3);
this.i2BbenchesControl.Name = "i2BbenchesControl";
this.i2BbenchesControl.Size = new System.Drawing.Size(1354, 700);
this.i2BbenchesControl.TabIndex = 0;
//
// wr14TabPage
//
this.wr14TabPage.Controls.Add(this.i3BenchesControl);
this.wr14TabPage.Location = new System.Drawing.Point(4, 22);
this.wr14TabPage.Name = "wr14TabPage";
this.wr14TabPage.Padding = new System.Windows.Forms.Padding(3);
this.wr14TabPage.Size = new System.Drawing.Size(1360, 706);
this.wr14TabPage.TabIndex = 3;
this.wr14TabPage.Text = "I3";
this.wr14TabPage.UseVisualStyleBackColor = true;
//
// i3BenchesControl
//
this.i3BenchesControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.i3BenchesControl.Location = new System.Drawing.Point(3, 3);
this.i3BenchesControl.Name = "i3BenchesControl";
this.i3BenchesControl.Size = new System.Drawing.Size(1354, 700);
this.i3BenchesControl.TabIndex = 0;
//
// wr15TabPage
//
this.wr15TabPage.Controls.Add(this.i4BenchesControl);
this.wr15TabPage.Location = new System.Drawing.Point(4, 22);
this.wr15TabPage.Name = "wr15TabPage";
this.wr15TabPage.Padding = new System.Windows.Forms.Padding(3);
this.wr15TabPage.Size = new System.Drawing.Size(1360, 706);
this.wr15TabPage.TabIndex = 4;
this.wr15TabPage.Text = "I4";
this.wr15TabPage.UseVisualStyleBackColor = true;
//
// i4BenchesControl
//
this.i4BenchesControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.i4BenchesControl.Location = new System.Drawing.Point(3, 3);
this.i4BenchesControl.Name = "i4BenchesControl";
this.i4BenchesControl.Size = new System.Drawing.Size(1354, 700);
this.i4BenchesControl.TabIndex = 0;
//
// StatisticsDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -291,7 +175,7 @@
this.ClientSize = new System.Drawing.Size(1368, 826);
this.Controls.Add(this.splitContainer1);
this.Name = "StatisticsDlg";
this.Text = "Statistics";
this.Text = "MID Statistics";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.StatisticsDlg_FormClosing);
this.Load += new System.EventHandler(this.StatisticsDlg_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
@@ -301,12 +185,6 @@
this.splitContainer1.ResumeLayout(false);
this.timePeriodGroupBox.ResumeLayout(false);
this.timePeriodGroupBox.PerformLayout();
this.midsTabControl.ResumeLayout(false);
this.wr10TabPage.ResumeLayout(false);
this.wr11TabPage.ResumeLayout(false);
this.wr13TabPage.ResumeLayout(false);
this.wr14TabPage.ResumeLayout(false);
this.wr15TabPage.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -314,26 +192,16 @@
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TabControl midsTabControl;
private System.Windows.Forms.TabPage wr10TabPage;
private System.Windows.Forms.TabPage wr11TabPage;
private System.Windows.Forms.TabPage wr13TabPage;
private System.Windows.Forms.TabPage wr14TabPage;
private System.Windows.Forms.TabPage wr15TabPage;
private System.Windows.Forms.GroupBox timePeriodGroupBox;
private System.Windows.Forms.DateTimePicker dateTimeFromPicker;
private System.Windows.Forms.DateTimePicker dateTimeToPicker;
private System.Windows.Forms.Label toLabel1;
private System.Windows.Forms.Label fromLabel1;
private UserControls.MidOrWaterMetersCtrl wmsBenchesControl;
private UserControls.MidOrWaterMetersCtrl i1BenchesControl;
private UserControls.MidOrWaterMetersCtrl i2BbenchesControl;
private UserControls.MidOrWaterMetersCtrl i3BenchesControl;
private UserControls.MidOrWaterMetersCtrl i4BenchesControl;
private System.Windows.Forms.RadioButton radioButton3;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton4;
private System.Windows.Forms.TabControl midsTabControl;
}
}
+32 -24
View File
@@ -24,7 +24,7 @@ namespace Statistics
{
public partial class StatisticsDlg : Form
{
static ISessionFactory[] sessionFactories = new ISessionFactory[LocalSettings.BenchesCount];
static ISessionFactory[] sessionFactories = new ISessionFactory[Program.LocalSettings.ConnectionStrings.Length];
public StatisticsDlg()
@@ -33,14 +33,19 @@ namespace Statistics
///ManageCheckGroupBox(timePeriodCheckBox, timePeriodGroupBox);
for (MidId midId = 0; midId < MidId.Count; midId++)
for (int midId = 1; midId < Program.LocalSettings.MidNames.Length; midId++)
{
int i = (int)midId;
midsTabControl.TabPages[i].Text = midId.ToString();
(midsTabControl.TabPages[i].Controls[0] as MidOrWaterMetersCtrl).MidId = midId;
(midsTabControl.TabPages[i].Controls[0] as MidOrWaterMetersCtrl).Parent = this;
TabPage tp = new TabPage();
tp.Text = Program.LocalSettings.MidNames[midId];
MidOrWaterMetersCtrl ctrl = new MidOrWaterMetersCtrl();
ctrl.MidId = midId;
ctrl.Parent = this;
ctrl.Dock = DockStyle.Fill;
tp.Controls.Add(ctrl);
midsTabControl.TabPages.Add(tp);
}
midsTabControl.TabPages[0].Text = Strings.Water_meters;
radioButton1.Checked = true;
timePeriodGroupBox.Enabled = false;
@@ -50,7 +55,7 @@ namespace Statistics
void Localize()
{
Text = Strings.Statistics;
Text = string.Format("MID {0}", Strings.Statistics);
//timePeriodCheckBox.Text = Strings.Time_period;
fromLabel1.Text = Strings.From;
toLabel1.Text = Strings.To;
@@ -76,12 +81,12 @@ namespace Statistics
case 4: radioButton4.Checked = true; break;
}
for (int i = 0; i < (int)MidId.Count; i++)
for (int i = 1; i < Program.LocalSettings.MidNames.Length; i++)
{
(midsTabControl.TabPages[i].Controls[0] as MidOrWaterMetersCtrl).Data2UI();
(midsTabControl.TabPages[i - 1].Controls[0] as MidOrWaterMetersCtrl).Data2UI();
}
for (int i = 0; i < LocalSettings.BenchesCount; i++)
for (int i = 0; i < Program.LocalSettings.ConnectionStrings.Length; i++)
{
if (!string.IsNullOrEmpty(Program.LocalSettings.GetConnectionString(i)))
{
@@ -128,18 +133,18 @@ namespace Statistics
//}
public IList<TestRslt> UpdateRequest(int benchId, MidId midId)
/// <summary>
/// Called by a child form.
/// Reads and returns results from DB required by the child form to update it's content.
/// </summary>
/// <param name="benchId">0-based bench Id.</param>
/// <param name="midId">1-based MID Id.</param>
/// <returns>Required test results</returns>
public IList<TestRslt> UpdateRequest(int benchId, int midId)
{
if ((benchId < 0) || (benchId >= LocalSettings.BenchesCount) || (sessionFactories[benchId] == null) || (midId == MidId.WaterMeters))
if ((benchId < 0) || (benchId >= Program.LocalSettings.BenchNames.Length) || (sessionFactories[benchId] == null))
{
if (midId == MidId.WaterMeters)
{
MessageBox.Show("Loading statistics of water meters is not implemented yet");
}
else
{
MessageBox.Show(string.Format("Cannot load statistics of {0}", Program.LocalSettings.GetBenchName(benchId)));
}
MessageBox.Show(string.Format("Cannot load statistics of {0}", Program.LocalSettings.GetBenchName(benchId)));
return null;
}
@@ -164,7 +169,7 @@ namespace Statistics
{
ISession session = sessionFactories[benchId].OpenSession();
var listOfComponentsWithFlowmeter = session.QueryOver<Components>()
.Where(x => (x.Flowmeter == midId.ToString()))
.Where(x => (x.Flowmeter == Program.LocalSettings.MidNames[midId]))
.List();
IList<TestRslt> testRslts = new List<TestRslt>();
foreach (var cmpnts in listOfComponentsWithFlowmeter)
@@ -248,9 +253,12 @@ namespace Statistics
else if (radioButton4.Checked) ls.SelectedRadioButtonNumber = 4;
else ls.SelectedRadioButtonNumber = 0;
for (int i = 0; i < (int)MidId.Count; i++)
for (int i = 1; i < Math.Min(Program.LocalSettings.MidNames.Length, midsTabControl.TabPages.Count + 1); i++)
{
(midsTabControl.TabPages[i].Controls[0] as MidOrWaterMetersCtrl).UI2Data();
if (midsTabControl.TabPages[i - 1].Controls.Count > 0 && midsTabControl.TabPages[i - 1].Controls[0] is MidOrWaterMetersCtrl)
{
(midsTabControl.TabPages[i - 1].Controls[0] as MidOrWaterMetersCtrl).UI2Data();
}
}
ls.Save();
-18
View File
@@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Statistics.UserControls
{
public enum MidId
{
/// When converted to 'int' it's the MID number, 0 = water meters
WaterMeters,
I1,
I2,
I3,
I4,
Count
}
}
+230 -384
View File
@@ -29,6 +29,26 @@
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.flow5GroupBox = new System.Windows.Forms.GroupBox();
this.flow5ToExclamation = new System.Windows.Forms.Label();
this.flow5FromExclamation = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.toLabel6 = new System.Windows.Forms.Label();
this.fromLabel6 = new System.Windows.Forms.Label();
this.flow5ToTextBox = new System.Windows.Forms.TextBox();
this.flow5FromTextBox = new System.Windows.Forms.TextBox();
this.flow5CheckBox = new System.Windows.Forms.CheckBox();
this.flow4GroupBox = new System.Windows.Forms.GroupBox();
this.flow4ToExclamation = new System.Windows.Forms.Label();
this.flow4FromExclamation = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.toLabel5 = new System.Windows.Forms.Label();
this.fromLabel5 = new System.Windows.Forms.Label();
this.flow4ToTextBox = new System.Windows.Forms.TextBox();
this.flow4FromTextBox = new System.Windows.Forms.TextBox();
this.flow4CheckBox = new System.Windows.Forms.CheckBox();
this.flow3GroupBox = new System.Windows.Forms.GroupBox();
this.flow3ToExclamation = new System.Windows.Forms.Label();
this.flow3FromExclamation = new System.Windows.Forms.Label();
@@ -60,54 +80,15 @@
this.flow1FromTextBox = new System.Windows.Forms.TextBox();
this.flow1CheckBox = new System.Windows.Forms.CheckBox();
this.benchesTabControl = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.tabPage6 = new System.Windows.Forms.TabPage();
this.flow4GroupBox = new System.Windows.Forms.GroupBox();
this.flow4ToExclamation = new System.Windows.Forms.Label();
this.flow4FromExclamation = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.toLabel5 = new System.Windows.Forms.Label();
this.fromLabel5 = new System.Windows.Forms.Label();
this.flow4ToTextBox = new System.Windows.Forms.TextBox();
this.flow4FromTextBox = new System.Windows.Forms.TextBox();
this.flow4CheckBox = new System.Windows.Forms.CheckBox();
this.flow5GroupBox = new System.Windows.Forms.GroupBox();
this.flow5ToExclamation = new System.Windows.Forms.Label();
this.flow5FromExclamation = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.toLabel6 = new System.Windows.Forms.Label();
this.fromLabel6 = new System.Windows.Forms.Label();
this.flow5ToTextBox = new System.Windows.Forms.TextBox();
this.flow5FromTextBox = new System.Windows.Forms.TextBox();
this.flow5CheckBox = new System.Windows.Forms.CheckBox();
this.wr10StatisticsCtrl1 = new Statistics.UserControls.StatisticsCtrl();
this.wr11StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl();
this.wr13StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl();
this.wr14StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl();
this.wr15StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl();
this.pt7StatisticsCtrl = new Statistics.UserControls.StatisticsCtrl();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.flow5GroupBox.SuspendLayout();
this.flow4GroupBox.SuspendLayout();
this.flow3GroupBox.SuspendLayout();
this.flow2GroupBox.SuspendLayout();
this.flow1GroupBox.SuspendLayout();
this.benchesTabControl.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabPage4.SuspendLayout();
this.tabPage5.SuspendLayout();
this.tabPage6.SuspendLayout();
this.flow4GroupBox.SuspendLayout();
this.flow5GroupBox.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
@@ -134,6 +115,210 @@
this.splitContainer1.SplitterDistance = 90;
this.splitContainer1.TabIndex = 0;
//
// flow5GroupBox
//
this.flow5GroupBox.Controls.Add(this.flow5ToExclamation);
this.flow5GroupBox.Controls.Add(this.flow5FromExclamation);
this.flow5GroupBox.Controls.Add(this.label9);
this.flow5GroupBox.Controls.Add(this.label10);
this.flow5GroupBox.Controls.Add(this.toLabel6);
this.flow5GroupBox.Controls.Add(this.fromLabel6);
this.flow5GroupBox.Controls.Add(this.flow5ToTextBox);
this.flow5GroupBox.Controls.Add(this.flow5FromTextBox);
this.flow5GroupBox.Controls.Add(this.flow5CheckBox);
this.flow5GroupBox.Location = new System.Drawing.Point(939, 7);
this.flow5GroupBox.Name = "flow5GroupBox";
this.flow5GroupBox.Size = new System.Drawing.Size(221, 77);
this.flow5GroupBox.TabIndex = 8;
this.flow5GroupBox.TabStop = false;
//
// flow5ToExclamation
//
this.flow5ToExclamation.AutoSize = true;
this.flow5ToExclamation.ForeColor = System.Drawing.Color.Red;
this.flow5ToExclamation.Location = new System.Drawing.Point(167, 48);
this.flow5ToExclamation.Name = "flow5ToExclamation";
this.flow5ToExclamation.Size = new System.Drawing.Size(10, 13);
this.flow5ToExclamation.TabIndex = 9;
this.flow5ToExclamation.Text = "!";
this.flow5ToExclamation.Visible = false;
//
// flow5FromExclamation
//
this.flow5FromExclamation.AutoSize = true;
this.flow5FromExclamation.ForeColor = System.Drawing.Color.Red;
this.flow5FromExclamation.Location = new System.Drawing.Point(167, 24);
this.flow5FromExclamation.Name = "flow5FromExclamation";
this.flow5FromExclamation.Size = new System.Drawing.Size(10, 13);
this.flow5FromExclamation.TabIndex = 8;
this.flow5FromExclamation.Text = "!";
this.flow5FromExclamation.Visible = false;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(178, 48);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(32, 13);
this.label9.TabIndex = 6;
this.label9.Text = "m3/h";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(177, 23);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(32, 13);
this.label10.TabIndex = 5;
this.label10.Text = "m3/h";
//
// toLabel6
//
this.toLabel6.AutoSize = true;
this.toLabel6.Location = new System.Drawing.Point(14, 48);
this.toLabel6.Name = "toLabel6";
this.toLabel6.Size = new System.Drawing.Size(20, 13);
this.toLabel6.TabIndex = 4;
this.toLabel6.Text = "To";
//
// fromLabel6
//
this.fromLabel6.AutoSize = true;
this.fromLabel6.Location = new System.Drawing.Point(14, 23);
this.fromLabel6.Name = "fromLabel6";
this.fromLabel6.Size = new System.Drawing.Size(30, 13);
this.fromLabel6.TabIndex = 3;
this.fromLabel6.Text = "From";
//
// flow5ToTextBox
//
this.flow5ToTextBox.Location = new System.Drawing.Point(65, 45);
this.flow5ToTextBox.Name = "flow5ToTextBox";
this.flow5ToTextBox.Size = new System.Drawing.Size(100, 20);
this.flow5ToTextBox.TabIndex = 2;
this.flow5ToTextBox.TextChanged += new System.EventHandler(this.flow5ToTextBox_TextChanged);
//
// flow5FromTextBox
//
this.flow5FromTextBox.Location = new System.Drawing.Point(65, 20);
this.flow5FromTextBox.Name = "flow5FromTextBox";
this.flow5FromTextBox.Size = new System.Drawing.Size(100, 20);
this.flow5FromTextBox.TabIndex = 1;
this.flow5FromTextBox.TextChanged += new System.EventHandler(this.flow5FromTextBox_TextChanged);
//
// flow5CheckBox
//
this.flow5CheckBox.AutoSize = true;
this.flow5CheckBox.Location = new System.Drawing.Point(10, 0);
this.flow5CheckBox.Name = "flow5CheckBox";
this.flow5CheckBox.Size = new System.Drawing.Size(57, 17);
this.flow5CheckBox.TabIndex = 0;
this.flow5CheckBox.Text = "Flow 5";
this.flow5CheckBox.UseVisualStyleBackColor = true;
this.flow5CheckBox.CheckedChanged += new System.EventHandler(this.flow5CheckBox_CheckedChanged);
//
// flow4GroupBox
//
this.flow4GroupBox.Controls.Add(this.flow4ToExclamation);
this.flow4GroupBox.Controls.Add(this.flow4FromExclamation);
this.flow4GroupBox.Controls.Add(this.label7);
this.flow4GroupBox.Controls.Add(this.label8);
this.flow4GroupBox.Controls.Add(this.toLabel5);
this.flow4GroupBox.Controls.Add(this.fromLabel5);
this.flow4GroupBox.Controls.Add(this.flow4ToTextBox);
this.flow4GroupBox.Controls.Add(this.flow4FromTextBox);
this.flow4GroupBox.Controls.Add(this.flow4CheckBox);
this.flow4GroupBox.Location = new System.Drawing.Point(706, 7);
this.flow4GroupBox.Name = "flow4GroupBox";
this.flow4GroupBox.Size = new System.Drawing.Size(221, 77);
this.flow4GroupBox.TabIndex = 7;
this.flow4GroupBox.TabStop = false;
//
// flow4ToExclamation
//
this.flow4ToExclamation.AutoSize = true;
this.flow4ToExclamation.ForeColor = System.Drawing.Color.Red;
this.flow4ToExclamation.Location = new System.Drawing.Point(167, 48);
this.flow4ToExclamation.Name = "flow4ToExclamation";
this.flow4ToExclamation.Size = new System.Drawing.Size(10, 13);
this.flow4ToExclamation.TabIndex = 9;
this.flow4ToExclamation.Text = "!";
this.flow4ToExclamation.Visible = false;
//
// flow4FromExclamation
//
this.flow4FromExclamation.AutoSize = true;
this.flow4FromExclamation.ForeColor = System.Drawing.Color.Red;
this.flow4FromExclamation.Location = new System.Drawing.Point(167, 24);
this.flow4FromExclamation.Name = "flow4FromExclamation";
this.flow4FromExclamation.Size = new System.Drawing.Size(10, 13);
this.flow4FromExclamation.TabIndex = 8;
this.flow4FromExclamation.Text = "!";
this.flow4FromExclamation.Visible = false;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(178, 48);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(32, 13);
this.label7.TabIndex = 6;
this.label7.Text = "m3/h";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(177, 23);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(32, 13);
this.label8.TabIndex = 5;
this.label8.Text = "m3/h";
//
// toLabel5
//
this.toLabel5.AutoSize = true;
this.toLabel5.Location = new System.Drawing.Point(14, 48);
this.toLabel5.Name = "toLabel5";
this.toLabel5.Size = new System.Drawing.Size(20, 13);
this.toLabel5.TabIndex = 4;
this.toLabel5.Text = "To";
//
// fromLabel5
//
this.fromLabel5.AutoSize = true;
this.fromLabel5.Location = new System.Drawing.Point(14, 23);
this.fromLabel5.Name = "fromLabel5";
this.fromLabel5.Size = new System.Drawing.Size(30, 13);
this.fromLabel5.TabIndex = 3;
this.fromLabel5.Text = "From";
//
// flow4ToTextBox
//
this.flow4ToTextBox.Location = new System.Drawing.Point(65, 45);
this.flow4ToTextBox.Name = "flow4ToTextBox";
this.flow4ToTextBox.Size = new System.Drawing.Size(100, 20);
this.flow4ToTextBox.TabIndex = 2;
this.flow4ToTextBox.TextChanged += new System.EventHandler(this.flow4ToTextBox_TextChanged);
//
// flow4FromTextBox
//
this.flow4FromTextBox.Location = new System.Drawing.Point(65, 20);
this.flow4FromTextBox.Name = "flow4FromTextBox";
this.flow4FromTextBox.Size = new System.Drawing.Size(100, 20);
this.flow4FromTextBox.TabIndex = 1;
this.flow4FromTextBox.TextChanged += new System.EventHandler(this.flow4FromTextBox_TextChanged);
//
// flow4CheckBox
//
this.flow4CheckBox.AutoSize = true;
this.flow4CheckBox.Location = new System.Drawing.Point(10, 0);
this.flow4CheckBox.Name = "flow4CheckBox";
this.flow4CheckBox.Size = new System.Drawing.Size(57, 17);
this.flow4CheckBox.TabIndex = 0;
this.flow4CheckBox.Text = "Flow 4";
this.flow4CheckBox.UseVisualStyleBackColor = true;
this.flow4CheckBox.CheckedChanged += new System.EventHandler(this.flow4CheckBox_CheckedChanged);
//
// flow3GroupBox
//
this.flow3GroupBox.Controls.Add(this.flow3ToExclamation);
@@ -442,12 +627,6 @@
//
// benchesTabControl
//
this.benchesTabControl.Controls.Add(this.tabPage1);
this.benchesTabControl.Controls.Add(this.tabPage2);
this.benchesTabControl.Controls.Add(this.tabPage3);
this.benchesTabControl.Controls.Add(this.tabPage4);
this.benchesTabControl.Controls.Add(this.tabPage5);
this.benchesTabControl.Controls.Add(this.tabPage6);
this.benchesTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.benchesTabControl.Location = new System.Drawing.Point(0, 0);
this.benchesTabControl.Name = "benchesTabControl";
@@ -455,320 +634,6 @@
this.benchesTabControl.Size = new System.Drawing.Size(1202, 356);
this.benchesTabControl.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.wr10StatisticsCtrl1);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(1194, 330);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "WR10";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.wr11StatisticsCtrl);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1194, 330);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "WR11";
this.tabPage2.UseVisualStyleBackColor = true;
//
// tabPage3
//
this.tabPage3.Controls.Add(this.wr13StatisticsCtrl);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(1194, 330);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "WR13";
this.tabPage3.UseVisualStyleBackColor = true;
//
// tabPage4
//
this.tabPage4.Controls.Add(this.wr14StatisticsCtrl);
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(1194, 330);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "WR14";
this.tabPage4.UseVisualStyleBackColor = true;
//
// tabPage5
//
this.tabPage5.Controls.Add(this.wr15StatisticsCtrl);
this.tabPage5.Location = new System.Drawing.Point(4, 22);
this.tabPage5.Name = "tabPage5";
this.tabPage5.Size = new System.Drawing.Size(1194, 330);
this.tabPage5.TabIndex = 4;
this.tabPage5.Text = "WR15";
this.tabPage5.UseVisualStyleBackColor = true;
//
// tabPage6
//
this.tabPage6.Controls.Add(this.pt7StatisticsCtrl);
this.tabPage6.Location = new System.Drawing.Point(4, 22);
this.tabPage6.Name = "tabPage6";
this.tabPage6.Size = new System.Drawing.Size(1194, 330);
this.tabPage6.TabIndex = 5;
this.tabPage6.Text = "PT7";
this.tabPage6.UseVisualStyleBackColor = true;
//
// flow4GroupBox
//
this.flow4GroupBox.Controls.Add(this.flow4ToExclamation);
this.flow4GroupBox.Controls.Add(this.flow4FromExclamation);
this.flow4GroupBox.Controls.Add(this.label7);
this.flow4GroupBox.Controls.Add(this.label8);
this.flow4GroupBox.Controls.Add(this.toLabel5);
this.flow4GroupBox.Controls.Add(this.fromLabel5);
this.flow4GroupBox.Controls.Add(this.flow4ToTextBox);
this.flow4GroupBox.Controls.Add(this.flow4FromTextBox);
this.flow4GroupBox.Controls.Add(this.flow4CheckBox);
this.flow4GroupBox.Location = new System.Drawing.Point(706, 7);
this.flow4GroupBox.Name = "flow4GroupBox";
this.flow4GroupBox.Size = new System.Drawing.Size(221, 77);
this.flow4GroupBox.TabIndex = 7;
this.flow4GroupBox.TabStop = false;
//
// flow4ToExclamation
//
this.flow4ToExclamation.AutoSize = true;
this.flow4ToExclamation.ForeColor = System.Drawing.Color.Red;
this.flow4ToExclamation.Location = new System.Drawing.Point(167, 48);
this.flow4ToExclamation.Name = "flow4ToExclamation";
this.flow4ToExclamation.Size = new System.Drawing.Size(10, 13);
this.flow4ToExclamation.TabIndex = 9;
this.flow4ToExclamation.Text = "!";
this.flow4ToExclamation.Visible = false;
//
// flow4FromExclamation
//
this.flow4FromExclamation.AutoSize = true;
this.flow4FromExclamation.ForeColor = System.Drawing.Color.Red;
this.flow4FromExclamation.Location = new System.Drawing.Point(167, 24);
this.flow4FromExclamation.Name = "flow4FromExclamation";
this.flow4FromExclamation.Size = new System.Drawing.Size(10, 13);
this.flow4FromExclamation.TabIndex = 8;
this.flow4FromExclamation.Text = "!";
this.flow4FromExclamation.Visible = false;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(178, 48);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(32, 13);
this.label7.TabIndex = 6;
this.label7.Text = "m3/h";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(177, 23);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(32, 13);
this.label8.TabIndex = 5;
this.label8.Text = "m3/h";
//
// toLabel5
//
this.toLabel5.AutoSize = true;
this.toLabel5.Location = new System.Drawing.Point(14, 48);
this.toLabel5.Name = "toLabel5";
this.toLabel5.Size = new System.Drawing.Size(20, 13);
this.toLabel5.TabIndex = 4;
this.toLabel5.Text = "To";
//
// fromLabel5
//
this.fromLabel5.AutoSize = true;
this.fromLabel5.Location = new System.Drawing.Point(14, 23);
this.fromLabel5.Name = "fromLabel5";
this.fromLabel5.Size = new System.Drawing.Size(30, 13);
this.fromLabel5.TabIndex = 3;
this.fromLabel5.Text = "From";
//
// flow4ToTextBox
//
this.flow4ToTextBox.Location = new System.Drawing.Point(65, 45);
this.flow4ToTextBox.Name = "flow4ToTextBox";
this.flow4ToTextBox.Size = new System.Drawing.Size(100, 20);
this.flow4ToTextBox.TabIndex = 2;
this.flow4ToTextBox.TextChanged += new System.EventHandler(this.flow4ToTextBox_TextChanged);
//
// flow4FromTextBox
//
this.flow4FromTextBox.Location = new System.Drawing.Point(65, 20);
this.flow4FromTextBox.Name = "flow4FromTextBox";
this.flow4FromTextBox.Size = new System.Drawing.Size(100, 20);
this.flow4FromTextBox.TabIndex = 1;
this.flow4FromTextBox.TextChanged += new System.EventHandler(this.flow4FromTextBox_TextChanged);
//
// flow4CheckBox
//
this.flow4CheckBox.AutoSize = true;
this.flow4CheckBox.Location = new System.Drawing.Point(10, 0);
this.flow4CheckBox.Name = "flow4CheckBox";
this.flow4CheckBox.Size = new System.Drawing.Size(57, 17);
this.flow4CheckBox.TabIndex = 0;
this.flow4CheckBox.Text = "Flow 4";
this.flow4CheckBox.UseVisualStyleBackColor = true;
this.flow4CheckBox.CheckedChanged += new System.EventHandler(this.flow4CheckBox_CheckedChanged);
//
// flow5GroupBox
//
this.flow5GroupBox.Controls.Add(this.flow5ToExclamation);
this.flow5GroupBox.Controls.Add(this.flow5FromExclamation);
this.flow5GroupBox.Controls.Add(this.label9);
this.flow5GroupBox.Controls.Add(this.label10);
this.flow5GroupBox.Controls.Add(this.toLabel6);
this.flow5GroupBox.Controls.Add(this.fromLabel6);
this.flow5GroupBox.Controls.Add(this.flow5ToTextBox);
this.flow5GroupBox.Controls.Add(this.flow5FromTextBox);
this.flow5GroupBox.Controls.Add(this.flow5CheckBox);
this.flow5GroupBox.Location = new System.Drawing.Point(939, 7);
this.flow5GroupBox.Name = "flow5GroupBox";
this.flow5GroupBox.Size = new System.Drawing.Size(221, 77);
this.flow5GroupBox.TabIndex = 8;
this.flow5GroupBox.TabStop = false;
//
// flow5ToExclamation
//
this.flow5ToExclamation.AutoSize = true;
this.flow5ToExclamation.ForeColor = System.Drawing.Color.Red;
this.flow5ToExclamation.Location = new System.Drawing.Point(167, 48);
this.flow5ToExclamation.Name = "flow5ToExclamation";
this.flow5ToExclamation.Size = new System.Drawing.Size(10, 13);
this.flow5ToExclamation.TabIndex = 9;
this.flow5ToExclamation.Text = "!";
this.flow5ToExclamation.Visible = false;
//
// flow5FromExclamation
//
this.flow5FromExclamation.AutoSize = true;
this.flow5FromExclamation.ForeColor = System.Drawing.Color.Red;
this.flow5FromExclamation.Location = new System.Drawing.Point(167, 24);
this.flow5FromExclamation.Name = "flow5FromExclamation";
this.flow5FromExclamation.Size = new System.Drawing.Size(10, 13);
this.flow5FromExclamation.TabIndex = 8;
this.flow5FromExclamation.Text = "!";
this.flow5FromExclamation.Visible = false;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(178, 48);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(32, 13);
this.label9.TabIndex = 6;
this.label9.Text = "m3/h";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(177, 23);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(32, 13);
this.label10.TabIndex = 5;
this.label10.Text = "m3/h";
//
// toLabel6
//
this.toLabel6.AutoSize = true;
this.toLabel6.Location = new System.Drawing.Point(14, 48);
this.toLabel6.Name = "toLabel6";
this.toLabel6.Size = new System.Drawing.Size(20, 13);
this.toLabel6.TabIndex = 4;
this.toLabel6.Text = "To";
//
// fromLabel6
//
this.fromLabel6.AutoSize = true;
this.fromLabel6.Location = new System.Drawing.Point(14, 23);
this.fromLabel6.Name = "fromLabel6";
this.fromLabel6.Size = new System.Drawing.Size(30, 13);
this.fromLabel6.TabIndex = 3;
this.fromLabel6.Text = "From";
//
// flow5ToTextBox
//
this.flow5ToTextBox.Location = new System.Drawing.Point(65, 45);
this.flow5ToTextBox.Name = "flow5ToTextBox";
this.flow5ToTextBox.Size = new System.Drawing.Size(100, 20);
this.flow5ToTextBox.TabIndex = 2;
this.flow5ToTextBox.TextChanged += new System.EventHandler(this.flow5ToTextBox_TextChanged);
//
// flow5FromTextBox
//
this.flow5FromTextBox.Location = new System.Drawing.Point(65, 20);
this.flow5FromTextBox.Name = "flow5FromTextBox";
this.flow5FromTextBox.Size = new System.Drawing.Size(100, 20);
this.flow5FromTextBox.TabIndex = 1;
this.flow5FromTextBox.TextChanged += new System.EventHandler(this.flow5FromTextBox_TextChanged);
//
// flow5CheckBox
//
this.flow5CheckBox.AutoSize = true;
this.flow5CheckBox.Location = new System.Drawing.Point(10, 0);
this.flow5CheckBox.Name = "flow5CheckBox";
this.flow5CheckBox.Size = new System.Drawing.Size(57, 17);
this.flow5CheckBox.TabIndex = 0;
this.flow5CheckBox.Text = "Flow 5";
this.flow5CheckBox.UseVisualStyleBackColor = true;
this.flow5CheckBox.CheckedChanged += new System.EventHandler(this.flow5CheckBox_CheckedChanged);
//
// wr10StatisticsCtrl1
//
this.wr10StatisticsCtrl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.wr10StatisticsCtrl1.Location = new System.Drawing.Point(3, 3);
this.wr10StatisticsCtrl1.Name = "wr10StatisticsCtrl1";
this.wr10StatisticsCtrl1.Size = new System.Drawing.Size(1188, 324);
this.wr10StatisticsCtrl1.TabIndex = 0;
//
// wr11StatisticsCtrl
//
this.wr11StatisticsCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
this.wr11StatisticsCtrl.Location = new System.Drawing.Point(3, 3);
this.wr11StatisticsCtrl.Name = "wr11StatisticsCtrl";
this.wr11StatisticsCtrl.Size = new System.Drawing.Size(1188, 324);
this.wr11StatisticsCtrl.TabIndex = 0;
//
// wr13StatisticsCtrl
//
this.wr13StatisticsCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
this.wr13StatisticsCtrl.Location = new System.Drawing.Point(0, 0);
this.wr13StatisticsCtrl.Name = "wr13StatisticsCtrl";
this.wr13StatisticsCtrl.Size = new System.Drawing.Size(1194, 330);
this.wr13StatisticsCtrl.TabIndex = 0;
//
// wr14StatisticsCtrl
//
this.wr14StatisticsCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
this.wr14StatisticsCtrl.Location = new System.Drawing.Point(0, 0);
this.wr14StatisticsCtrl.Name = "wr14StatisticsCtrl";
this.wr14StatisticsCtrl.Size = new System.Drawing.Size(1194, 330);
this.wr14StatisticsCtrl.TabIndex = 0;
//
// wr15StatisticsCtrl
//
this.wr15StatisticsCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
this.wr15StatisticsCtrl.Location = new System.Drawing.Point(0, 0);
this.wr15StatisticsCtrl.Name = "wr15StatisticsCtrl";
this.wr15StatisticsCtrl.Size = new System.Drawing.Size(1194, 330);
this.wr15StatisticsCtrl.TabIndex = 0;
//
// pt7StatisticsCtrl
//
this.pt7StatisticsCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
this.pt7StatisticsCtrl.Location = new System.Drawing.Point(0, 0);
this.pt7StatisticsCtrl.Name = "pt7StatisticsCtrl";
this.pt7StatisticsCtrl.Size = new System.Drawing.Size(1194, 330);
this.pt7StatisticsCtrl.TabIndex = 0;
//
// MidOrWaterMetersCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -780,23 +645,16 @@
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.flow5GroupBox.ResumeLayout(false);
this.flow5GroupBox.PerformLayout();
this.flow4GroupBox.ResumeLayout(false);
this.flow4GroupBox.PerformLayout();
this.flow3GroupBox.ResumeLayout(false);
this.flow3GroupBox.PerformLayout();
this.flow2GroupBox.ResumeLayout(false);
this.flow2GroupBox.PerformLayout();
this.flow1GroupBox.ResumeLayout(false);
this.flow1GroupBox.PerformLayout();
this.benchesTabControl.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
this.tabPage5.ResumeLayout(false);
this.tabPage6.ResumeLayout(false);
this.flow4GroupBox.ResumeLayout(false);
this.flow4GroupBox.PerformLayout();
this.flow5GroupBox.ResumeLayout(false);
this.flow5GroupBox.PerformLayout();
this.ResumeLayout(false);
}
@@ -805,18 +663,6 @@
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TabControl benchesTabControl;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.TabPage tabPage6;
private StatisticsCtrl wr10StatisticsCtrl1;
private StatisticsCtrl wr11StatisticsCtrl;
private StatisticsCtrl wr13StatisticsCtrl;
private StatisticsCtrl wr14StatisticsCtrl;
private StatisticsCtrl wr15StatisticsCtrl;
private StatisticsCtrl pt7StatisticsCtrl;
private System.Windows.Forms.GroupBox flow3GroupBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
@@ -13,7 +13,7 @@ namespace Statistics.UserControls
{
public partial class MidOrWaterMetersCtrl : UserControl
{
public MidId MidId;
public int MidId; /// 1-based MID Id.
public StatisticsDlg Parent;
@@ -96,14 +96,16 @@ namespace Statistics.UserControls
ManageCheckGroupBox(flow4CheckBox, flow4GroupBox);
ManageCheckGroupBox(flow5CheckBox, flow5GroupBox);
for (int i = 0; i < benchesTabControl.TabPages.Count; i++ )
for (int i = 0; i < Program.LocalSettings.BenchNames.Length; i++)
{
TabPage tp = benchesTabControl.TabPages[i];
if ((tp.Controls.Count > 0) && (tp.Controls[0] is StatisticsCtrl))
{
(tp.Controls[0] as StatisticsCtrl).Id = i;
(tp.Controls[0] as StatisticsCtrl).MidCtrl = this;
}
TabPage tp = new TabPage();
tp.Text = Program.LocalSettings.BenchNames[i];
StatisticsCtrl statistics = new StatisticsCtrl();
statistics.Id = i;
statistics.MidCtrl = this;
statistics.Dock = DockStyle.Fill;
tp.Controls.Add(statistics);
benchesTabControl.TabPages.Add(tp);
}
}
@@ -41,6 +41,7 @@ namespace TBF.BenchControl.DataEntry.Combined
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
double refVolume;
double errLimLo;
@@ -52,6 +52,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters12
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
double refVolume;
double errLimLo;
@@ -52,6 +52,7 @@ namespace TBF.BenchControl.DataEntry.HeatMeters6
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
double refVolume;
double errLimLo;
@@ -41,6 +41,7 @@ namespace TBF.BenchControl.DataEntry.Munich
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
bool resultSaved; /// Set in Run() when results are saved
@@ -44,6 +44,7 @@ namespace TBF.BenchControl.DataEntry.Munich3
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
double refVolume;
double errLimLo;
@@ -41,6 +41,7 @@ namespace TBF.BenchControl.DataEntry.Single
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
double refVolume;
double errLimLo;
@@ -41,6 +41,7 @@ namespace TBF.BenchControl.DataEntry.Standard12
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
double refVolume;
double errLimLo;
@@ -41,6 +41,7 @@ namespace TBF.BenchControl.DataEntry.Standard24
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
double refVolume;
double errLimLo;
@@ -41,6 +41,7 @@ namespace TBF.BenchControl.DataEntry.Standard48
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
double refVolume;
double errLimLo;
@@ -40,6 +40,7 @@ namespace TBF.BenchControl.DataEntry.Standard6
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
double refVolume;
double errLimLo;
@@ -90,6 +90,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
double refVolume;
double errLimLo;
@@ -47,6 +47,7 @@ namespace TBF.BenchControl.DataEntry.WMStates
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
bool resultSaved;
@@ -41,6 +41,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
System.Windows.Forms.Form modelessDlg;
public bool Completed { get { return (modelessDlg is IHasCompleted) ? (modelessDlg as IHasCompleted).Completed : true; } }
double refVolume;
double errLimLo;
+1 -1
View File
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde
EnduranceCycleStop = 13,
}
#if FUZHOU_300 || IZRAEL_200 || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TURA_IPERL || TURA_SPECIAL || BADGER_VELKA_TRAT || PUCHONG_200 || SLM_50 || GENESIS || MALTA_WSD25 || SLM_END || WARSAW_END || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
#if FUZHOU_300 || IZRAEL_200 || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TURA_IPERL || TURA_SPECIAL || BADGER_VELKA_TRAT || PUCHONG_200 || SLM_50 || GENESIS || MALTA_WSD25 || SLM_END || WARSAW_END || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || DEWA_300 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
public enum StatusP : ulong
{
RefFlowMeterMask = 0x7, /// bits 0,1,2
+12 -1
View File
@@ -122,8 +122,12 @@ namespace TBF.BenchControl.Elde
/// Initialization data updated by constructors of children components
/// and sent to 'controlCom2panel' by SendCalibData() method.
///
#if DEWA_300
public float[,] TempCalibData = new float[16, 5];
#else
public float[,] TempCalibData = new float[8, 5];
public uint[] DiverterEdge; /// Created and initialized in this.Initialize()
#endif
public uint[] DiverterEdge; /// Created and initialized in this.Initialize()
public byte MeretProtocol = 0;
// Array length is the reference flowmeters count plus one
@@ -138,6 +142,13 @@ namespace TBF.BenchControl.Elde
{100,500}, {100,500}, {100,500}, {100,500} };
public byte[] MeretRS485Address = new byte[4];
public float[] EtCalib = new float[7] { 1, 1, 1, 1, 1, 1, 1 };
#elif DEWA_300
public uint[,] RegValveCalib = new uint[16, 2] { {100,500}, {100,500}, {100,500}, {100,500},
{100,500}, {100,500}, {100,500}, {100,500},
{100,500}, {100,500}, {100,500}, {100,500},
{100,500}, {100,500}, {100,500}, {100,500} };
public byte[] MeretRS485Address = new byte[4];
public float[] EtCalib = new float[8] { 1, 1, 1, 1, 1, 1, 1, 1 };
#elif MUNICH || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TORUN_50 || CEVAK_40 || TURA_IPERL || TURA_SPECIAL || MURES_40 || FUZHOU_50 || SLM_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FUZHOU_100
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
public byte[] MeretRS485Address = new byte[4];
+7 -7
View File
@@ -56,13 +56,13 @@ namespace TBF.BenchControl.Elde
public float Pressure(int prsNr0) { return ctrlBrdComponent.pressure[prsNr0]; }
public float Temperature(int tmpNr0) { return ctrlBrdComponent.temperature[tmpNr0]; }
public RegulValveState RegulValveState(int rvNr1) { return (RegulValveState)ctrlBrdComponent.rValveStatus[rvNr1 - 1]; }
#if GENESIS || BERLIN || PETERSBURG_200
#if GENESIS || BERLIN || PETERSBURG_200 || DEWA_300
public UInt128 RRoute { get { return ((UInt128)ctrlBrdComponent.rRouteH << 64) | (UInt128)ctrlBrdComponent.rRoute; } }
#else
public UInt128 RRoute { get { return ctrlBrdComponent.rRoute; } }
#endif
#if GENESIS || KEMPNO_50 || KRAKOW_50 || BAHRAIN_50 || BADGER_STREDNA_TRAT || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
#if GENESIS || KEMPNO_50 || KRAKOW_50 || BAHRAIN_50 || BADGER_STREDNA_TRAT || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50 || DEWA_300
public uint DivTime(int id) { return ctrlBrdComponent.divTime[id]; }
public void SetDivLimit(int divNo, uint limLoPct, uint limHiPct)
{
@@ -94,9 +94,9 @@ namespace TBF.BenchControl.Elde
return ctrlBrdComponent.Analogy[rvNr1 - 1]; /// Fixes bug: RValvePosition returns 0 all the time
}
public float DivSamples(int time, int divIx0)
{
#if MUNICH
return ctrlBrdComponent.DIVSamples[time, 0];
{
#if MUNICH || IZRAEL_200
return ctrlBrdComponent.DIVSamples[time, 0];
#else
return ctrlBrdComponent.DIVSamples[time, divIx0];
#endif
@@ -353,7 +353,7 @@ namespace TBF.BenchControl.Elde
bool bit39 = (route & 0x00FC000000000000) != 0; /// true if any of bits 50 through 55 is set
route = route & 0xFF03FFFFFFFFFFFF;
if (bit39) route = route | 0x0000008000000000;
#elif PETERSBURG_200
#elif PETERSBURG_200 || DEWA_300
///
/// The following code deals with the situation that all pumps share bit #80.
/// In settings the bits of pumps should be sent as follows: P1=64, P2=65, P3=66, P4=67 and P5=68
@@ -388,7 +388,7 @@ namespace TBF.BenchControl.Elde
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF), (ulong)(route >> 64), pulsesArr, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
#elif GENESIS
#elif GENESIS || DEWA_300
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF), (ulong)(route >> 64), pulsesArr, (uint)testMethods,
filterConstants, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
@@ -74,6 +74,7 @@ namespace TBF.BenchControl.Elde.Diverter
if (divertersSoFar != null)
{
for (int i = 0; i < divertersSoFar.Length; i++) Diverters[i] = divertersSoFar[i];
}
Diverters[nextIdx - 1] = this;
@@ -107,6 +108,8 @@ namespace TBF.BenchControl.Elde.Diverter
flowMtrNr4Cmd = divNrFromName;
#elif CEVAK_200
flowMtrNr4Cmd = (divNrFromName == 4) ? 5 : divNrFromName;
#elif DEWA_300
flowMtrNr4Cmd = divNrFromName + 2; /// Div1: 1,2,3, Div2: 4, Div3: 5, Div4: 6, Div5: 7
#else
flowMtrNr4Cmd = (divNrFromName == 1) ? 1 : 3;
#endif
+2 -2
View File
@@ -16,13 +16,13 @@ namespace TBF.BenchControl.Elde.FlowMeter
readonly FlowMeterCfg flowMeterCfg;
readonly ControlBoardDev controlBoard;
public int Idx1 { get { return flowMeterCfg.Idx1; } }
public int Idx1 { get { return flowMeterCfg.Idx1; } }
public float NominalFlow { get { return flowMeterCfg.NominalFlow; } }
public float LtrPerPulse { get { return flowMeterCfg.NominalFlow / 7200.0f; } } /// Nominal frequency is 2000 Hz
public float LtrPerPulseCorrected(double flow, int rangeIx)
{
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
/// Apply correction
var rangeCorrections = new List<Config.Entities.MeasurementCorrection>();
@@ -58,7 +58,9 @@ namespace TBF.BenchControl.Elde.PressureMeter
/// <returns>Pressure in mBar</returns>
public float ReadPressure()
{
return (float)Config.Units.ConvertFrom(Config.Unit.kPa, ControlBoard.Pressure(Idx0));
double rawPressure = Config.Units.ConvertFrom(Config.Unit.kPa, ControlBoard.Pressure(Idx0));
double correctedPressure = Config.Formulas.CorrectedValue(rawPressure, Corrections);
return (float)correctedPressure;
}
@@ -58,6 +58,7 @@ namespace TBF.BenchControl.Elde.RegulValve
float targetPositionLo;
float targetPositionHi;
int startTime;
int expireTime;
DoubleBox flowBox;
int flowWithinBoundsTime;
@@ -165,6 +166,10 @@ namespace TBF.BenchControl.Elde.RegulValve
/// <summary>Start this operation</summary>
public void Start()
{
startTime = StateMachine.Time;
expireTime = StateMachine.Time + timeout;
if (expireTime < 0) expireTime = int.MaxValue;
double flowMtrFreq = flowMeter.ReadFrequency();
double flow = flowMeter.ReadFlow();
@@ -194,9 +199,6 @@ namespace TBF.BenchControl.Elde.RegulValve
opState = OpState.ValveMoveToFlow1;
}
expireTime = StateMachine.Time + timeout;
if (expireTime < 0) expireTime = int.MaxValue;
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
@@ -221,7 +223,7 @@ namespace TBF.BenchControl.Elde.RegulValve
}
log.InfoFormat("SetFlowOp:Run(T={0}) rv#={1} pos={2}% freq={3} flow={4} opState={5}",
StateMachine.Time - expireTime + timeout, regulValveNr, rvPosition.ToString("F1"), flowMtrFreq, flow, opState);
StateMachine.Time - startTime, regulValveNr, rvPosition.ToString("F1"), flowMtrFreq, flow, opState);
if (StateMachine.Time > expireTime)
{
+1 -1
View File
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.Elde.TempMeter
public readonly ControlBoardDev ControlBoard;
public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..7
public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..15
public double A1 { get { return tempMtrCfg.A1; } }
public double A2 { get { return tempMtrCfg.A2; } }
public double A3 { get { return tempMtrCfg.A3; } }
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde.TempMeter
///
/// Serialized parameters
///
public int Idx0; /// 0..7
public int Idx0; /// 0 .. 15
public double A1;
public double A2;
public double A3;
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.IO;
@@ -96,10 +96,10 @@ namespace TBF.BenchControl.Elde.TempMeter
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Parent Name'";
}
if (!int.TryParse(positionTextBox.Text, out dummy) || dummy < 0 || dummy > 7)
if (!int.TryParse(positionTextBox.Text, out dummy) || dummy < 0 || dummy > 15)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Position' should be between 0 and 7";
message += Environment.NewLine + "'Position' should be between 0 and 15";
}
double fdummy;
@@ -167,36 +167,46 @@ namespace TBF.BenchControl.Elde.TempMeter
if (!string.IsNullOrEmpty(lastImportFileName)) dlg.FileName = lastImportFileName;
if (dlg.ShowDialog() == DialogResult.OK)
{
try
using (TextReader reader = new StreamReader(dlg.FileName))
{
using (TextReader reader = new StreamReader(dlg.FileName))
{
double tmp;
string lineID = string.Format("Calch{0} =", positionTextBox.Text);
do
try
{
string startOfLine = string.Format("Calch{0} =", positionTextBox.Text);
bool channelFound = false;
string line;
do
{
string line = reader.ReadLine();
if (line != null && line.IndexOf(lineID) == 0)
line = reader.ReadLine();
if (!string.IsNullOrEmpty(line) && (line.IndexOf(startOfLine) == 0))
{
string[] factors = line.Substring(lineID.Length).Split(new char[] { ',' });
string[] factors = line.Substring(startOfLine.Length).Split(new char[] { ',' });
int count = factors.Length;
if (count >= 1 && Utils.TryParseEDouble(factors[0].Trim(), out tmp)) a1TextBox.Text = factors[0].Trim();
double tmp;
if (count >= 1 && Utils.TryParseEDouble(factors[0].Trim(), out tmp)) a1TextBox.Text = factors[0].Trim();
if (count >= 2 && Utils.TryParseEDouble(factors[1].Trim(), out tmp)) a2TextBox.Text = factors[1].Trim();
if (count >= 3 && Utils.TryParseEDouble(factors[2].Trim(), out tmp)) a3TextBox.Text = factors[2].Trim();
if (count >= 4 && Utils.TryParseEDouble(factors[3].Trim(), out tmp)) a4TextBox.Text = factors[3].Trim();
if (count >= 5 && Utils.TryParseEDouble(factors[4].Trim(), out tmp)) a5TextBox.Text = factors[4].Trim();
channelFound = true;
lastImportFileName = dlg.FileName;
break;
}
}
while (lineID != null);
}
}
catch
{
MessageBox.Show("Import failed", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
while (line != null);
if (!channelFound)
{
MessageBox.Show(string.Format("Calibration factors for channel {0} not found.", positionTextBox.Text),
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
catch
{
MessageBox.Show("Wrong file format, import failed.",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
}
}
+1
View File
@@ -169,6 +169,7 @@ namespace TBF.BenchControl
Next, /// To move to the next state when debugging
OK,
Retry,
Continue,
Abort,
TimerBusy,
SetOutputsDone,
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using Config.Entities;
@@ -9,6 +9,11 @@ namespace TBF.BenchControl.GenericDevices
{
public interface IDataEntry : IComponent
{
/// <summary>
/// true when DataEntry dialog was completed or when it does not support IHasCompleted (to avoid TBF freeze).
/// </summary>
bool Completed { get; }
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
@@ -5,8 +5,11 @@ using System;
namespace TBF.BenchControl.GenericDevices
{
interface IHasCompleted
public interface IHasCompleted
{
/// <summary>
/// true when a dialog was completed
/// </summary>
bool Completed { get; }
}
}
@@ -0,0 +1,15 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface IParallelOutput : IComponent
{
IOperation SetOutputsOp(ushort outValue);
IOperation ShowBenchWaitingOp();
IOperation ShowBenchErrorOp();
}
}
@@ -63,8 +63,8 @@ namespace TBF.BenchControl.Keithley.Multimeter_2010_RS232
}
/// <summary>
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
/// Keithley mulltimeter connected via serial interface (RS232)
/// Connection settings: 9600Bd 8-bits no-parity 1-stop-bit flow control: none
/// </summary>
public Multimeter(Generic.IComponentCfg cfg)
: base(cfg)
+40 -15
View File
@@ -28,6 +28,7 @@ namespace TBF.BenchControl.Modbus.Common
/// Private fields
SerialPort serialPort;
DateTime lastSerialPortWrite;
bool initialRunDeviceCommComplete;
public Queue<byte[]>[] ReceivedTelegrams
{
@@ -82,6 +83,8 @@ namespace TBF.BenchControl.Modbus.Common
//workerThread = new Thread(Worker);
//workerThread.Start();
initialRunDeviceCommComplete = false; /// Causes search for Quido RS modules in the first RunDeviceAfter() call
log.FatalFormat("{0} - Device successfully initialized", Name);
}
@@ -99,7 +102,7 @@ namespace TBF.BenchControl.Modbus.Common
Telegram.UpdateTelegramCRC(message);
if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 100))
if ((DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 100) && initialRunDeviceCommComplete)
{
/// More then 100 ms since last 'send' --> do not enqueue the message
SendMessageNow(message);
@@ -174,12 +177,12 @@ namespace TBF.BenchControl.Modbus.Common
Debug.WriteLine(s);
log.Debug(s);
}
else
{
string s = Telegram.LogTelegram(string.Format("{0} - Invalid data received ", Name), buffer);
Debug.WriteLine(s);
log.Debug(s);
}
else
{
string s = Telegram.LogTelegram(string.Format("{0} - Invalid data received ", Name), buffer);
Debug.WriteLine(s);
log.Debug(s);
}
}
}
@@ -188,6 +191,16 @@ namespace TBF.BenchControl.Modbus.Common
{
if (serialPort == null) return;
if (!initialRunDeviceCommComplete)
{
initialRunDeviceCommComplete = true; /// Prevent 2nd invocation of the subsequent code
/// Search Quido RS modules
byte[] searchTelegram = new byte[] { 0xF8, 0x11, 0, 0 };
Telegram.UpdateTelegramCRC(searchTelegram);
SendMessageNow(searchTelegram);
}
if (telegramsToSend.Count > 0 && (DateTime.Now - lastSerialPortWrite) > new TimeSpan(0, 0, 0, 0, 500))
{
SendMessageNow(telegramsToSend.Dequeue());
@@ -197,15 +210,27 @@ namespace TBF.BenchControl.Modbus.Common
/// <summary>Stop this device</summary>
public void StopDevice()
{
if (serialPort != null)
{
//stopWorkerThread = true;
//workerThread.Join(2000);
serialPort.Close();
serialPort = null;
}
}
public void StopDevice2() { }
public void StopDevice2()
{
if (serialPort != null)
{
/// Send telegrams currently in the queue
while (telegramsToSend.Count > 0)
{
while ((DateTime.Now - lastSerialPortWrite) <= new TimeSpan(0, 0, 0, 0, 200))
{
Thread.Sleep(100);
}
SendMessageNow(telegramsToSend.Dequeue());
}
//stopWorkerThread = true;
//workerThread.Join(2000);
serialPort.Close();
serialPort = null;
}
}
}
}
@@ -33,9 +33,6 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
modbus = (GenericDevices.IModbus)TbfComponents.FindComponent(cfg.ParentName, components);
if (modbus == null) throw new Exception("Cannot find " + Name + " parent");
/// Connect to handler
//ModbusAddress.MeretRS485Address[Idx0] = ModbusAddress;
log.Debug(this.ToString());
}
@@ -51,7 +48,9 @@ namespace TBF.BenchControl.Modbus.PressureMeter.Meret
/// <returns>Pressure in mBar</returns>
public float ReadPressure()
{
return (float)Config.Units.ConvertFrom(Config.Unit.kPa, receivedPressure);
double rawPressure = Config.Units.ConvertFrom(Config.Unit.kPa, receivedPressure);
double correctedPressure = Config.Formulas.CorrectedValue(rawPressure, Corrections);
return (float)correctedPressure;
}
/// <summary>
@@ -0,0 +1,98 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Windows.Forms;
using log4net;
using TBF.Resources;
namespace TBF.BenchControl.Modbus.QuidoRS
{
public partial class ConfirmationForm : Form
{
static readonly ILog log = LogManager.GetLogger(typeof(ConfirmationForm));
/// Set to 'true' when the form closes
public bool Completed { get { return completed; } }
bool completed;
public ConfirmationForm(string message, Color backgroundColor)
{
InitializeComponent();
Localize();
messageLabel.Text = message;
BackColor = backgroundColor;
float textWidth = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(messageLabel.Text, messageLabel.Font).Width;
int rqrdFormWidth = (int)textWidth + 80; /// Form width calculated from the text width
if (rqrdFormWidth > Width)
{
int shift = (rqrdFormWidth - Width) / 2;
Width = rqrdFormWidth;
okButton.Left += shift;
}
completed = false;
StartForceCloseHandler();
}
void Localize()
{
okButton.Text = Strings.OkBtnText;
}
private void okButton_Click(object sender, EventArgs e)
{
completed = true;
Close();
}
private void MessageBoxForm_FormClosing(object sender, FormClosingEventArgs e)
{
completed = true;
}
#region Forced close handling
/// <summary>
/// Used by CoverTest, AskYesNoOp and MessageBoxOp.
/// </summary>
public void OnCloseThisForm(object sender, EventArgs args)
{
if (CloseThisFormHandler == null) return;
try
{
CloseThisFormHandler(sender, null);
}
catch (Exception e)
{
log.Error("CloseThisFormHandler(...) failed", e);
}
}
public event EventHandler<EventArgs> CloseThisFormHandler;
public void StartForceCloseHandler()
{
CloseThisFormHandler += 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
}
}
@@ -0,0 +1,85 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.Modbus.QuidoRS
{
partial class ConfirmationForm
{
/// <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.messageLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// okButton
//
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(177, 99);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(98, 63);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// messageLabel
//
this.messageLabel.AutoSize = true;
this.messageLabel.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.messageLabel.Location = new System.Drawing.Point(34, 39);
this.messageLabel.Name = "messageLabel";
this.messageLabel.Size = new System.Drawing.Size(91, 23);
this.messageLabel.TabIndex = 4;
this.messageLabel.Text = "Message";
//
// ConfirmationForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Goldenrod;
this.ClientSize = new System.Drawing.Size(454, 201);
this.Controls.Add(this.messageLabel);
this.Controls.Add(this.okButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ConfirmationForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MessageBoxForm_FormClosing);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Label messageLabel;
}
}
@@ -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>
+1 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2015-2016 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
+50 -25
View File
@@ -1,15 +1,17 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using TBF.BenchControl.Generic;
using TBF.Boxes;
using System.Text;
using System.Diagnostics;
namespace TBF.BenchControl.Modbus.QuidoRS
{
public class QuidoRS : ComponentBase, IDevice
public class QuidoRS : ComponentBase, IDevice, GenericDevices.IParallelOutput
{
private static readonly ILog log = LogManager.GetLogger(typeof(QuidoRS));
public override string ToString() { return string.Format("QuidoRS({0})", Cfg.ToString(1)); }
@@ -17,6 +19,8 @@ namespace TBF.BenchControl.Modbus.QuidoRS
readonly QuidoRSCfg quidoRSCfg;
readonly GenericDevices.IModbus modbus;
public QuidoVariant Variant { get { return quidoRSCfg.Variant; } }
private ushort currentOutputs;
private DateTime lastOutputsChange;
@@ -60,12 +64,22 @@ namespace TBF.BenchControl.Modbus.QuidoRS
if (modbus.ReceivedTelegrams[quidoRSCfg.ModbusAddress].Count > 0)
{
modbus.ReceivedTelegrams[quidoRSCfg.ModbusAddress].Dequeue();
byte[] telegram = modbus.ReceivedTelegrams[quidoRSCfg.ModbusAddress].Dequeue();
if ((telegram.Length >= 8) && (telegram[1] == 0x11) && (telegram[2] == telegram.Length - 5))
{
int msgLen = telegram.Length - 7;
byte modbusAddress = telegram[3];
string msg = Encoding.ASCII.GetString(telegram, 5, msgLen);
string s = string.Format("QuidoRS detected: Address={0}, Message={1}", modbusAddress, msg);
Debug.WriteLine(s);
log.Warn(s);
}
}
}
public void RunDeviceAfter() { }
public void StopDevice() { }
public void StopDevice() { SendOutputs(0); }
public void StopDevice2() { }
@@ -124,19 +138,23 @@ namespace TBF.BenchControl.Modbus.QuidoRS
private void SendOutputs(ushort outputs)
{
byte[] msg = new byte[11];
byte addr = quidoRSCfg.ModbusAddress;
byte cmd = (byte)Function.ForceMultipleCoils;
byte dataLo = (byte)(outputs & 0xFF);
byte dataHi = (byte)(outputs >> 8);
msg[0] = quidoRSCfg.ModbusAddress;
msg[1] = (byte)Function.ForceMultipleCoils;
msg[2] = 0; /// Data Hi
msg[3] = 0; /// Data Lo
msg[4] = 0; /// Nr. of coils Hi
msg[5] = 16; /// Nr. of coils Lo
msg[6] = 2; /// Byte count
msg[7] = (byte)(outputs & 0xFF); /// Output data Lo
msg[8] = (byte)(outputs >> 8); /// Output data Hi
modbus.SendMessage(msg);
if (quidoRSCfg.Variant == QuidoVariant.QuidoRS_2_16)
{
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 16, 2, dataLo, dataHi, 0, 0 });
}
else if (quidoRSCfg.Variant == QuidoVariant.QuidoRS_4_4)
{
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 4, 1, dataLo, 0, 0 });
}
else if (quidoRSCfg.Variant == QuidoVariant.QuidoRS_8_8)
{
modbus.SendMessage(new byte[] { addr, cmd, 0, 0, 0, 8, 1, dataLo, 0, 0 });
}
lastOutputsChange = DateTime.Now;
}
@@ -145,22 +163,29 @@ namespace TBF.BenchControl.Modbus.QuidoRS
/// <summary>
/// Events: SetOpututsDone, Error
/// </summary>
/// <param name="outValue">Reference to a variable for the pressure in Bar</param>
/// <returns>SetOutputsOp instance reference casted to IOperaton</returns>
/// <param name="outValue">Parallel output data</param>
/// <returns>SetOutputsOp operation casted to IOperaton</returns>
public IOperation SetOutputsOp(ushort outValue)
{
return new SetOutputsOp(this, outValue);
}
/// <summary>
/// Events: pressureDone, Error
/// Events: Event.None
/// </summary>
/// <param name="outValue">Reference to a variable for the pressure in Bar</param>
/// <param name="setOutputsDone">Event returned when SetOutput is done</param>
/// <returns>SetOutputsOp instance reference casted to IOperaton</returns>
public IOperation ReadPressureOp(ushort outValue, Event setOutputsDone)
/// <returns>ShowBenchWaitingOp operation casted to generic IOperaton</returns>
public IOperation ShowBenchWaitingOp()
{
return new SetOutputsOp(this, outValue, setOutputsDone);
return new ShowBenchWaitingOp(this);
}
}
/// <summary>
/// Events: Event.None
/// </summary>
/// <returns>ShowBenchErrorOp operation casted to generic IOperaton</returns>
public IOperation ShowBenchErrorOp()
{
return new ShowBenchErrorOp(this);
}
}
}
+15 -4
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2016 Sensus Metering Systems
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -9,6 +9,14 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Modbus.QuidoRS
{
public enum QuidoVariant
{
QuidoRS_2_16,
QuidoRS_4_4,
QuidoRS_8_8,
Count
}
public class QuidoRSCfg : ComponentCfgBase, Generic.IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(QuidoRSCfg) })[0];
@@ -19,7 +27,8 @@ namespace TBF.BenchControl.Modbus.QuidoRS
///
/// Serialized parameters
///
public byte ModbusAddress; /// 1..255
public byte ModbusAddress; /// 1..247
public QuidoVariant Variant; /// 'QuidoRS_2_16' or 'QuidoRS_8_8'
public bool WatchdogEnabled;
public int WatchdogBitNr; /// 0..15
@@ -29,7 +38,8 @@ namespace TBF.BenchControl.Modbus.QuidoRS
Name = "QuidoRS";
ParentName = "Modbus";
ModbusAddress = 49;
WatchdogEnabled = true;
Variant = QuidoVariant.QuidoRS_2_16;
WatchdogEnabled = false;
WatchdogBitNr = 4;
}
@@ -41,9 +51,10 @@ namespace TBF.BenchControl.Modbus.QuidoRS
public string ToString(int i)
{
return string.Format("Name={0}, ModbusAddr={1}, Parent={2}",
return string.Format("Name={0}, ModbusAddress={1}, Variant={2}, Parent={2}",
Name,
ModbusAddress,
Variant,
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName));
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
@@ -46,6 +46,8 @@ namespace TBF.BenchControl.Modbus.QuidoRS
}
}
for (QuidoVariant v = 0; v < QuidoVariant.Count; v++) variantComboBox.Items.Add(v.ToString());
Redraw();
}
@@ -61,6 +63,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
modbusAddressTextBox.Text = config.ModbusAddress.ToString();
variantComboBox.Text = config.Variant.ToString();
watchdogCheckBox.Checked = config.WatchdogEnabled;
watchdogBitNrTextBox.Text = config.WatchdogBitNr.ToString();
}
@@ -70,6 +73,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
nameTextBox.Enabled = true;
parentNameComboBox.Enabled = true;
modbusAddressTextBox.Enabled = true;
variantComboBox.Enabled = true;
watchdogCheckBox.Enabled = true;
watchdogBitNrTextBox.Enabled = true;
}
@@ -84,11 +88,16 @@ namespace TBF.BenchControl.Modbus.QuidoRS
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Parent Name'";
}
if (!int.TryParse(modbusAddressTextBox.Text, out dummy) || dummy < 0 || dummy > 255)
if (!int.TryParse(modbusAddressTextBox.Text, out dummy) || dummy < 1 || dummy > 247)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Modbus Address' should be between 0 and 255";
}
if (!variantComboBox.Items.Contains(variantComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Variant'";
}
if (!int.TryParse(watchdogBitNrTextBox.Text, out dummy) || dummy < 0 || dummy > 15)
{
flags |= CfgUpdateFlags.Error;
@@ -106,6 +115,10 @@ namespace TBF.BenchControl.Modbus.QuidoRS
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.ModbusAddress = (byte)int.Parse(modbusAddressTextBox.Text);
for (QuidoVariant v = 0; v < QuidoVariant.Count; v++)
{
if (variantComboBox.Text == v.ToString()) { config.Variant = v; break; }
}
config.WatchdogEnabled = watchdogCheckBox.Checked;
config.WatchdogBitNr = int.Parse(watchdogBitNrTextBox.Text);
+30 -6
View File
@@ -41,6 +41,8 @@ namespace TBF.BenchControl.Modbus.QuidoRS
this.watchdogCheckBox = new System.Windows.Forms.CheckBox();
this.watchdogBitNrTextBox = new System.Windows.Forms.TextBox();
this.watchdogBitNrLabel = new System.Windows.Forms.Label();
this.variantComboBox = new System.Windows.Forms.ComboBox();
this.variantLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// parentNameLabel
@@ -84,7 +86,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
this.modbusAddressLabel.Location = new System.Drawing.Point(28, 108);
this.modbusAddressLabel.Name = "modbusAddressLabel";
this.modbusAddressLabel.Size = new System.Drawing.Size(86, 13);
this.modbusAddressLabel.TabIndex = 7;
this.modbusAddressLabel.TabIndex = 5;
this.modbusAddressLabel.Text = "Modbus Address";
//
// modbusAddressTextBox
@@ -93,7 +95,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
this.modbusAddressTextBox.Location = new System.Drawing.Point(138, 105);
this.modbusAddressTextBox.Name = "modbusAddressTextBox";
this.modbusAddressTextBox.Size = new System.Drawing.Size(46, 20);
this.modbusAddressTextBox.TabIndex = 8;
this.modbusAddressTextBox.TabIndex = 6;
//
// parentNameComboBox
//
@@ -108,7 +110,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
//
this.watchdogCheckBox.AutoSize = true;
this.watchdogCheckBox.Enabled = false;
this.watchdogCheckBox.Location = new System.Drawing.Point(31, 131);
this.watchdogCheckBox.Location = new System.Drawing.Point(31, 164);
this.watchdogCheckBox.Name = "watchdogCheckBox";
this.watchdogCheckBox.Size = new System.Drawing.Size(99, 17);
this.watchdogCheckBox.TabIndex = 9;
@@ -118,7 +120,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
// watchdogBitNrTextBox
//
this.watchdogBitNrTextBox.Enabled = false;
this.watchdogBitNrTextBox.Location = new System.Drawing.Point(138, 153);
this.watchdogBitNrTextBox.Location = new System.Drawing.Point(138, 186);
this.watchdogBitNrTextBox.Name = "watchdogBitNrTextBox";
this.watchdogBitNrTextBox.Size = new System.Drawing.Size(46, 20);
this.watchdogBitNrTextBox.TabIndex = 11;
@@ -126,16 +128,36 @@ namespace TBF.BenchControl.Modbus.QuidoRS
// watchdogBitNrLabel
//
this.watchdogBitNrLabel.AutoSize = true;
this.watchdogBitNrLabel.Location = new System.Drawing.Point(28, 156);
this.watchdogBitNrLabel.Location = new System.Drawing.Point(28, 189);
this.watchdogBitNrLabel.Name = "watchdogBitNrLabel";
this.watchdogBitNrLabel.Size = new System.Drawing.Size(81, 13);
this.watchdogBitNrLabel.TabIndex = 10;
this.watchdogBitNrLabel.Text = "Watchdog bit #";
//
// variantComboBox
//
this.variantComboBox.Enabled = false;
this.variantComboBox.FormattingEnabled = true;
this.variantComboBox.Location = new System.Drawing.Point(138, 131);
this.variantComboBox.Name = "variantComboBox";
this.variantComboBox.Size = new System.Drawing.Size(130, 21);
this.variantComboBox.TabIndex = 8;
//
// variantLabel
//
this.variantLabel.AutoSize = true;
this.variantLabel.Location = new System.Drawing.Point(28, 134);
this.variantLabel.Name = "variantLabel";
this.variantLabel.Size = new System.Drawing.Size(40, 13);
this.variantLabel.TabIndex = 7;
this.variantLabel.Text = "Variant";
//
// QuidoRSCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.variantComboBox);
this.Controls.Add(this.variantLabel);
this.Controls.Add(this.watchdogBitNrTextBox);
this.Controls.Add(this.watchdogBitNrLabel);
this.Controls.Add(this.watchdogCheckBox);
@@ -147,7 +169,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.componentNameLabel);
this.Name = "QuidoRSCfgCtrl";
this.Size = new System.Drawing.Size(300, 200);
this.Size = new System.Drawing.Size(374, 268);
this.Load += new System.EventHandler(this.QuidoRSCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
@@ -166,5 +188,7 @@ namespace TBF.BenchControl.Modbus.QuidoRS
private System.Windows.Forms.CheckBox watchdogCheckBox;
private System.Windows.Forms.TextBox watchdogBitNrTextBox;
private System.Windows.Forms.Label watchdogBitNrLabel;
private System.Windows.Forms.ComboBox variantComboBox;
private System.Windows.Forms.Label variantLabel;
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Copyright (c) 2015 Sensus Slovensko a.s.
///
using System;
using log4net;
@@ -0,0 +1,88 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using log4net;
using TBF.Boxes;
using TBF.Resources;
namespace TBF.BenchControl.Modbus.QuidoRS
{
public class ShowBenchErrorOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(ShowBenchErrorOp));
public override string ToString() { return string.Format("ShowBenchErrorOp(.)"); }
const ushort BenchReadyValue = 0x01;
const ushort BenchErrorValue = 0x06;
const ushort BenchConfirmedValue = 0x02;
/// Set by the constructor
readonly QuidoRS quidoRS;
bool confirmed = false;
///
ConfirmationForm confirmationForm;
///
delegate void MessageBoxFormDlgt(ShowBenchErrorOp myRef);
///
void OpenFormDlg(ShowBenchErrorOp myRef)
{
myRef.confirmationForm = new ConfirmationForm(Strings.Mute_alarm, Color.Yellow);
confirmationForm.Show();
}
/// <summary>
/// Events: Event.None
/// </summary>
/// <param name="quidoRS">Pressure meter reference</param>
public ShowBenchErrorOp(QuidoRS quidoRS)
{
if (quidoRS == null) throw new ArgumentNullException("quidoRS");
this.quidoRS = quidoRS;
log.Debug(this.ToString());
}
/// <summary>Start this operation</summary>
public void Start()
{
log.WarnFormat("ShowBenchErrorOp.Start()");
quidoRS.SetOutputs(BenchErrorValue);
confirmed = false;
Program.MainWnd.Invoke(new MessageBoxFormDlgt(OpenFormDlg), this);
}
/// <summary>Run this operation</summary>
public Event Run()
{
if (confirmed || confirmationForm.Completed)
{
log.WarnFormat("ShowBenchWaitingOp.Run() --> Confirmed");
quidoRS.SetOutputs(BenchConfirmedValue);
confirmed = true;
confirmationForm = null;
}
return Event.None;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
log.WarnFormat("ShowBenchErrorOp.Stop()");
quidoRS.SetOutputs(BenchReadyValue);
if (confirmationForm != null)
{
confirmationForm.OnCloseThisForm(this, null);
confirmationForm = null;
}
}
}
}
@@ -0,0 +1,88 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using log4net;
using TBF.Boxes;
using TBF.Resources;
namespace TBF.BenchControl.Modbus.QuidoRS
{
public class ShowBenchWaitingOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(ShowBenchWaitingOp));
public override string ToString() { return string.Format("ShowBenchWaitingOp(.)"); }
const ushort BenchReadyValue = 0x01;
const ushort BenchWaitingValue = 0x06;
const ushort BenchConfirmedValue = 0x02;
/// Set by the constructor
readonly QuidoRS quidoRS;
bool confirmed = false;
///
ConfirmationForm confirmationForm;
///
delegate void MessageBoxFormDlgt(ShowBenchWaitingOp myRef);
///
void OpenFormDlg(ShowBenchWaitingOp myRef)
{
myRef.confirmationForm = new ConfirmationForm(Strings.Mute_alarm, Color.Yellow);
confirmationForm.Show();
}
/// <summary>
/// Events: Event.None
/// </summary>
/// <param name="quidoRS">Pressure meter reference</param>
public ShowBenchWaitingOp(QuidoRS quidoRS)
{
if (quidoRS == null) throw new ArgumentNullException("quidoRS");
this.quidoRS = quidoRS;
log.Debug(this.ToString());
}
/// <summary>Start this operation</summary>
public void Start()
{
log.WarnFormat("ShowBenchWaitingOp.Start()");
quidoRS.SetOutputs(BenchWaitingValue);
confirmed = false;
Program.MainWnd.Invoke(new MessageBoxFormDlgt(OpenFormDlg), this);
}
/// <summary>Run this operation</summary>
public Event Run()
{
if (confirmed || confirmationForm.Completed)
{
log.WarnFormat("ShowBenchWaitingOp.Run() --> Confirmed");
quidoRS.SetOutputs(BenchConfirmedValue);
confirmed = true;
confirmationForm = null;
}
return Event.None;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
log.WarnFormat("ShowBenchWaitingOp.Stop()");
quidoRS.SetOutputs(BenchReadyValue);
if (confirmationForm != null)
{
confirmationForm.OnCloseThisForm(this, null);
confirmationForm = null;
}
}
}
}
@@ -0,0 +1,132 @@
///
/// Copyright (c) 2019 Sensus Metering Systems
///
namespace TBF.BenchControl.Operations
{
partial class LargeMessageBoxForm
{
/// <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.continueButton = new System.Windows.Forms.Button();
this.messageLabel = new System.Windows.Forms.Label();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.abortButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// continueButton
//
this.continueButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.continueButton.ForeColor = System.Drawing.Color.Black;
this.continueButton.Location = new System.Drawing.Point(224, 23);
this.continueButton.Name = "continueButton";
this.continueButton.Size = new System.Drawing.Size(254, 63);
this.continueButton.TabIndex = 1;
this.continueButton.Text = "Continue";
this.continueButton.UseVisualStyleBackColor = true;
this.continueButton.Click += new System.EventHandler(this.continueButton_Click);
//
// messageLabel
//
this.messageLabel.AutoSize = true;
this.messageLabel.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.messageLabel.Location = new System.Drawing.Point(44, 37);
this.messageLabel.Name = "messageLabel";
this.messageLabel.Size = new System.Drawing.Size(91, 23);
this.messageLabel.TabIndex = 4;
this.messageLabel.Text = "Message";
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.AutoScroll = true;
this.splitContainer1.Panel1.BackColor = System.Drawing.Color.OrangeRed;
this.splitContainer1.Panel1.Controls.Add(this.messageLabel);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.BackColor = System.Drawing.Color.OrangeRed;
this.splitContainer1.Panel2.Controls.Add(this.abortButton);
this.splitContainer1.Panel2.Controls.Add(this.continueButton);
this.splitContainer1.Size = new System.Drawing.Size(1002, 617);
this.splitContainer1.SplitterDistance = 508;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 5;
//
// abortButton
//
this.abortButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.abortButton.ForeColor = System.Drawing.Color.Black;
this.abortButton.Location = new System.Drawing.Point(510, 23);
this.abortButton.Name = "abortButton";
this.abortButton.Size = new System.Drawing.Size(254, 63);
this.abortButton.TabIndex = 2;
this.abortButton.Text = "Abort cycle";
this.abortButton.UseVisualStyleBackColor = true;
this.abortButton.Click += new System.EventHandler(this.abortButton_Click);
//
// LargeMessageBoxForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.OrangeRed;
this.ClientSize = new System.Drawing.Size(1002, 617);
this.Controls.Add(this.splitContainer1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LargeMessageBoxForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MessageBoxForm_FormClosing);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button continueButton;
private System.Windows.Forms.Label messageLabel;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Button abortButton;
}
}
@@ -0,0 +1,110 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Windows.Forms;
using log4net;
using TBF.Resources;
namespace TBF.BenchControl.Operations
{
public partial class LargeMessageBoxForm : Form
{
static readonly ILog log = LogManager.GetLogger(typeof(LargeMessageBoxForm));
/// One of the following two variables is 'true' when the form closes
public bool CompletedContinue;
public bool CompletedAbort;
public LargeMessageBoxForm(string message, Color backgroundColor)
{
InitializeComponent();
//ControlBox = false;
Localize();
messageLabel.Text = message;
BackColor = backgroundColor;
float textWidth = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(messageLabel.Text, messageLabel.Font).Width;
int rqrdFormWidth = (int)textWidth + 80; /// Form width calculated from the text width
if (rqrdFormWidth > Width)
{
int shift = (rqrdFormWidth - Width) / 2;
Width = rqrdFormWidth;
continueButton.Left += shift;
}
CompletedContinue = false;
CompletedAbort = false;
StartForceCloseHandler();
}
void Localize()
{
continueButton.Text = Strings.Continue;
abortButton.Text = Strings.Abort_cycle;
}
private void continueButton_Click(object sender, EventArgs e)
{
CompletedContinue = true;
Close();
}
private void abortButton_Click(object sender, EventArgs e)
{
CompletedAbort = true;
Close();
}
private void MessageBoxForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (!CompletedContinue && !CompletedAbort)
{
CompletedContinue = true; /// Default action is 'Continue'
}
}
#region Forced close handling
/// <summary>
/// Used by CoverTest, AskYesNoOp and LargeMessageBoxOp.
/// </summary>
public void OnCloseThisForm(object sender, EventArgs args)
{
if (CloseThisFormHandler == null) return;
try
{
CloseThisFormHandler(sender, null);
}
catch (Exception e)
{
log.Error("CloseThisFormHandler(...) failed", e);
}
}
public event EventHandler<EventArgs> CloseThisFormHandler;
public void StartForceCloseHandler()
{
CloseThisFormHandler += 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
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,71 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using TBF.BenchControl;
using TBF.Resources;
namespace TBF.BenchControl.Operations
{
public class LargeMessageBoxOp : IOperation
{
LargeMessageBoxForm form;
string message;
Color backColor;
bool completed = false;
/// <returns>Reference to the operation</returns>
public LargeMessageBoxOp()
: this(Strings.Message)
{
}
public LargeMessageBoxOp(string message)
: this (message, Color.Goldenrod)
{
}
public LargeMessageBoxOp(string message, Color backColor)
{
this.message = message;
this.backColor = backColor;
}
delegate void MessageBoxFormDlgt(LargeMessageBoxOp myRef);
///
void OpenFormDlg(LargeMessageBoxOp myRef)
{
myRef.form = new LargeMessageBoxForm(message, backColor);
form.Show();
}
/// <summary>Start this operation</summary>
public void Start()
{
completed = false;
Program.MainWnd.Invoke(new MessageBoxFormDlgt(OpenFormDlg), this);
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if (form.CompletedContinue) return Event.Continue;
if (form.CompletedAbort) return Event.Abort;
return Event.None;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
if (form != null)
{
form.OnCloseThisForm(this, null);
form = null;
}
}
}
}
@@ -19,6 +19,8 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public string Workplace;
public string ConnStr;
public bool CheckPreviousRecords;
public bool SaveTracingRecords;
/// Private parameterless constructor invoked by all other (public) constructors
@@ -27,7 +29,9 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
ParentName = string.Empty;
Workplace = "WR10";
ConnStr = "SERVER=10.42.128.16; DATABASE=st_wr_shared_config; UID=u9305784; PASSWORD=p89344390; CHARSET=utf8;";
}
CheckPreviousRecords = true;
SaveTracingRecords = true;
}
public MonitoringCfg(string name, IComponentFactory factory)
: this()
@@ -38,7 +42,12 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public string ToString(int i)
{
return string.Format("Name={0}, Workplace={1}", Name, Workplace);
return string.Format("Name={0}, Workplace={1}, CheckPreviousRecords={2}, SaveTracingRecords={3}, ConnStr={4}",
Name,
Workplace,
CheckPreviousRecords,
SaveTracingRecords,
ConnStr);
}
}
}
@@ -1,10 +1,12 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
/// Copyright (c) 2018-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Linq;
using log4net;
using NHibernate;
using NHibernate.Criterion;
using Config.Entities;
using TracingDB.Entities;
@@ -16,37 +18,61 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
Error,
}
public class Tracing : ComponentBase, IOperation, GenericDevices.IResultsWriter, Generic.IDevice
class DateTimeComparer : IComparer<DateTime>
{
public int Compare(DateTime x, DateTime y)
{
return DateTime.Compare(x, y);
}
}
public class Tracing : ComponentBase, IOperation, GenericDevices.IResultsWriter, GenericDevices.IStartInfoReader, Generic.IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(Tracing));
public override string ToString() { return string.Format("Tracing({0})", Cfg.ToString(1)); }
public const string WorkstepName = "Test_bench";
MonitoringCfg tracingCfg;
string workplace { get { return tracingCfg.Workplace; } }
enum CurrentOp
{
None,
SaveRecords,
CheckPreviousRecords,
SaveTracingRecords,
}
///
CurrentOp currentOp;
bool opCompleted;
bool anyError;
/// <summary>
/// Watermeters to check at the beginning of the cycle
/// </summary>
Results.Entities.WaterMeter[] waterMeters;
/// <summary>
/// Results to print
/// Data (tracing records) to write at the end of cycle
/// </summary>
Results.Entities.Batch batch;
ISessionFactory sessionFactory; /// Factory to create database sessions initialized in the constructor
ISessionFactory sessionFactory; /// Factory to create database sessions that is initialized in the constructor
IList<Process> processes;
Dictionary<int, Process> processDictionary;
Dictionary<int, IList<Workstep>> workstepsDictionary;
///
/// Previous workstep verification info
///
Process currentProcess; /// Currently used process
Workstep currentWorkstep; /// Currently used workstep of this test bench
Workstep verifiedWorkstep;
Part verifiedPart; /// Applicable when verifyReferencePart == false
bool verifyReferencePart;
public Tracing() {}
@@ -67,36 +93,33 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
///
/// Session factory is used to create database sessions
///
sessionFactory = FluentNHibernate.Cfg.Fluently
.Configure()
.Database(FluentNHibernate.Cfg.Db.MySQLConfiguration.Standard.ConnectionString(tracingCfg.ConnStr))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<TracingDB.Entities.Process>())
.ExposeConfiguration(TracingDB.DB.BuildSchema)
.BuildSessionFactory();
sessionFactory = FluentNHibernate.Cfg.Fluently.Configure()
.Database(FluentNHibernate.Cfg.Db.MySQLConfiguration.Standard.ConnectionString(tracingCfg.ConnStr))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<TracingDB.Entities.Process>())
.ExposeConfiguration(TracingDB.DB.BuildSchema)
.BuildSessionFactory();
///
/// Register this test bench in the tracing DB for approx. 2 weeks
///
ISession session = sessionFactory.OpenSession();
using (ISession session = sessionFactory.OpenSession())
{
///
/// Read processes and worksteps from the database (this verifies DB connection as well)
///
log.WarnFormat("Reading processes/worksteps from production tracing DB started");
ReadProcessesFromDB(session);
log.WarnFormat("Reading processes/worksteps from production tracing DB completed");
TracingDB.DB.RegisterWorkplace(session,
workplace,
Users.GlobalData.GetCurrentUserName(),
"1.2.3.4",
"<multiple>",
WorkstepName,
DateTime.Now + new TimeSpan(15, 0, 0, 0));
session.Flush();
session.Close();
if (session != null) session.Dispose();
///
/// Register the test bench workplace
///
TracingDB.DB.RegisterWorkplace(session,
workplace,
Users.GlobalData.GetCurrentUserName(),
"1.2.3.4",
"<multiple>",
WorkstepName,
DateTime.Now + new TimeSpan(8, 0, 0));
session.Flush();
}
currentProcess = null;
}
///
public void RunDeviceBefore() { }
public void RunDeviceAfter() { }
///
public void StopDevice()
{
if (tracingCfg.DebugLevel == DebugMode.Simulate) return;
@@ -107,13 +130,31 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
session.Flush();
}
}
public void StopDevice2() {}
public void RunDeviceBefore() {}
public void RunDeviceAfter() {}
/// <summary>
/// Reads information on start of a cycle, Events: Event.InfoRead
/// </summary>
/// <param name="waterMeters">Results of water meters</param>
/// <returns>Reference to the operation</returns>
public IOperation ReadStartInfoOp(Results.Entities.WaterMeter[] waterMeters)
{
if (!tracingCfg.CheckPreviousRecords)
{
return null;
}
else if (currentOp != CurrentOp.None)
{
throw new Exception("Sequence error");
}
else
{
this.waterMeters = waterMeters;
currentOp = CurrentOp.CheckPreviousRecords;
return this;
}
}
/// <summary>
/// Writes the test cycle results into a file, Events: Event.ResultsWritten
@@ -123,16 +164,23 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
/// <returns>Reference to the operation</returns>
public IOperation WriteResultsOp(Results.Entities.Batch batch)
{
if (currentOp != CurrentOp.None)
if (!tracingCfg.SaveTracingRecords)
{
return null;
}
else if (currentOp != CurrentOp.None)
{
throw new Exception("Sequence error");
}
else
currentOp = CurrentOp.SaveRecords;
this.batch = batch;
return this;
{
this.batch = batch;
currentOp = CurrentOp.SaveTracingRecords;
return this;
}
}
/// <summary>Start this operation</summary>
public void Start()
{
@@ -144,50 +192,47 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
/// <returns>Event.ResultsWritten or Event.Error</returns>
public Event Run()
{
if (tracingCfg.DebugLevel == DebugMode.Simulate || batch.WaterMeters.Count == 0)
if (currentOp == CurrentOp.CheckPreviousRecords)
{
opCompleted = true;
return Event.ResultsWritten;
}
if (currentOp == CurrentOp.SaveRecords)
{
if (!opCompleted)
if (tracingCfg.DebugLevel == DebugMode.Simulate)
{
ITransaction transaction = null;
try
{
ISession session = sessionFactory.OpenSession();
transaction = session.BeginTransaction();
int wrCount = WriteResultsToDatabase(session, batch);
transaction.Commit();
session.Flush();
opCompleted = true;
log.ErrorFormat("Batch {0}: {1} of {2} watermeters written to production tracing DB",
batch.BatchNr, wrCount, batch.WaterMeters.Count);
}
catch (Exception exc)
{
if (transaction != null && !transaction.WasCommitted) transaction.Rollback();
anyError = true;
log.WarnFormat("Failed to write results of batch {0} to production tracing DB: {1}",
batch.BatchNr, exc.Message);
}
return Event.InfoRead;
}
else if (!opCompleted)
{
log.WarnFormat("{0} : Run() : currentOp = {1}", Name, currentOp);
opCompleted = true;
if (CheckPreviousRecords(waterMeters) != Retv.OK) anyError = true;
return anyError ? Event.InfoNotRead : Event.InfoRead;
}
if (anyError)
return Event.ResultsNotWritten;
else
{
return anyError ? Event.InfoNotRead : Event.InfoRead;
}
}
else if (currentOp == CurrentOp.SaveTracingRecords)
{
if (tracingCfg.DebugLevel == DebugMode.Simulate || batch.WaterMeters.Count == 0)
{
return Event.ResultsWritten;
}
else if (!opCompleted)
{
log.WarnFormat("{0} : Run() : currentOp = {1}", Name, currentOp);
opCompleted = true;
if (SaveTracingRecords(batch) != Retv.OK) anyError = true;
return anyError ? Event.ResultsNotWritten : Event.ResultsWritten;
}
else
{
return anyError ? Event.ResultsNotWritten : Event.ResultsWritten;
}
}
else
{
return Event.None;
}
}
}
/// <summary>Stop this operation</summary>
public void Stop()
@@ -196,19 +241,170 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
}
Retv CheckPreviousRecords(Results.Entities.WaterMeter[] waterMeters)
{
Retv retVal = Retv.Error;
using (ISession session = sessionFactory.OpenSession())
{
for (int i = 0; i < waterMeters.Length; i++)
{
Results.Entities.WaterMeter wm = waterMeters[i];
if ((wm != null) && !string.IsNullOrEmpty(wm.SerialNr))
{
CheckPreviousRecordOfSingleWM(session, wm);
}
}
retVal = Retv.OK;
}
return retVal;
}
Retv CheckPreviousRecordOfSingleWM(ISession session, Results.Entities.WaterMeter wm)
{
///
/// Get all already existing reference records with Code == wm.SerialNr, refRecords[0] will be the most recent one
///
ReferenceRecord refRecord = null;
Workstep workstep = null;
ProjectionList projections = Projections.ProjectionList();
projections.Add(Projections.Property(() => refRecord.Id)); /// rslt[0] = reference record ID
projections.Add(Projections.Property(() => workstep.Id)); /// rslt[1] = workstep ID
projections.Add(Projections.Property(() => refRecord.Process.Id)); /// rslt[2] = process ID
projections.Add(Projections.Property(() => refRecord.TimeStamp)); /// rslt[3] = reference record time stamp
///
/// Get all reference records with Code == SerialNr from all worksteps different from 'Test_bench'
///
IList<object[]> results = session.QueryOver<ReferenceRecord>(() => refRecord)
.Where(rr => (rr.Code == wm.SerialNr))
.JoinQueryOver<Workstep>(rr => rr.Workstep, () => workstep)
.And(ws => (ws.Name != WorkstepName))
.Select(projections)
.List<object[]>();
if (results.Count == 0)
{
/// No records found => IsLastRecordOk = false
wm.ProcessId = 0;
wm.IsLastRecordOk = false;
return Retv.OK;
}
///
/// Get processId of the last record
///
int processId = 0;
DateTime lastTimeStamp = DateTime.MinValue;
foreach (var rslt in results)
{
if (DateTime.Compare((DateTime)rslt[3], lastTimeStamp) > 0)
{
lastTimeStamp = (DateTime)rslt[3];
processId = (int)rslt[2];
}
}
if (processId == 0) return Retv.Error; /// This should never happen
if ((currentProcess == null) || (currentProcess.Id != processId))
{
///
/// Process changed ==> update currentProcess / currentWorkstep / verifiedWorkstep / verifiedPart / verifyReferencePart
///
var processes = session.QueryOver<Process>()
.Where(p => (p.Id == processId))
.List();
if (processes.Count != 1) return Retv.Error;
IList<Workstep> worksteps = session.QueryOver<Workstep>()
.Where(ws => (ws.Process == processes[0]))
.And( ws => (ws.Name == WorkstepName))
.List();
if (worksteps.Count != 1) return Retv.Error;
Workstep vWS;
Part vP;
bool vRP;
///
if (!TracingDB.DB.AnalyzeProcess(session, processes[0], worksteps[0], out vWS, out vRP, out vP))
{
return Retv.Error; /// Unable to
}
currentProcess = processes[0];
currentWorkstep = worksteps[0];
verifiedWorkstep = vWS;
verifiedPart = vP;
verifyReferencePart = vRP;
}
wm.ProcessId = currentProcess.Id;
wm.IsLastRecordOk = false;
foreach (var rslt in results)
{
if ((verifiedWorkstep.Id == (int)rslt[1]) && (processId == (int)rslt[2]))
{
wm.IsLastRecordOk = true;
break;
}
}
return Retv.OK;
}
/// <summary>
/// Write results of a batch of water meters to the DB
/// </summary>
/// <param name="session">DB session</param>
/// <param name="batch">Batch entity</param>
int WriteResultsToDatabase(ISession session, Results.Entities.Batch batch)
Retv SaveTracingRecords(Results.Entities.Batch batch)
{
int wrCount = 0;
foreach (var wMtr in batch.WaterMeters)
{
wrCount += SaveSingleWM2DB(session, wMtr);
}
return wrCount;
ITransaction transaction = null;
ISession session = null;
try
{
session = sessionFactory.OpenSession();
transaction = session.BeginTransaction();
int writtenRecordsCount = 0;
foreach (var wMtr in batch.WaterMeters)
{
writtenRecordsCount += SaveSingleWM2DB(session, wMtr);
}
transaction.Commit();
session.Flush();
log.ErrorFormat("Batch {0}: {1} of {2} watermeters written to production tracing DB",
batch.BatchNr, writtenRecordsCount, batch.WaterMeters.Count);
return Retv.OK;
}
catch (Exception exc)
{
if (transaction != null && !transaction.WasCommitted) transaction.Rollback();
log.WarnFormat("Failed to write results of batch {0} to production tracing DB: {1}",
batch.BatchNr, exc.Message);
return Retv.Error;
}
finally
{
if (session != null)
{
session.Close();
session.Dispose();
}
}
}
@@ -220,36 +416,67 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
/// <returns>Number of written reference record</returns>
int SaveSingleWM2DB(ISession session, Results.Entities.WaterMeter wm)
{
if (string.IsNullOrEmpty(wm.SerialNr)) return 0; /// Without PCB number there is no DB activity
///
/// Get all already existing reference records with Code == wm.SerialNr, refRecords[0] will be the most recent one
///
IList<ReferenceRecord> refRecords;
int trialsCount = 0;
do
if (string.IsNullOrEmpty(wm.SerialNr))
{
if (trialsCount > 0) ReadProcessesFromDB(session);
refRecords = session.QueryOver<ReferenceRecord>()
.Where(rr => (rr.Code == wm.SerialNr))
.OrderBy(rr => rr.TimeStamp).Desc
.List();
trialsCount++;
/// Without PCB number there is no DB activity
return 0;
}
while (refRecords.Count == 0 && trialsCount <= 2);
///
/// Save a new reference record from this test bench if workstep "Test_bench" is defined in the obtained WM process
///
IList<Workstep> worksteps;
if ((refRecords.Count > 0) && workstepsDictionary.TryGetValue(refRecords[0].Process.Id, out worksteps) && (worksteps.Count == 1))
else if ((currentProcess != null) && (wm.ProcessId == currentProcess.Id))
{
session.SaveOrUpdate(new ReferenceRecord(refRecords[0].Process, worksteps[0], wm.SerialNr, Users.GlobalData.CurrentUser.UserName, workplace, wm.Passed ? 0 : 1));
/// Process is already loaded => save a reference record for this WM
session.SaveOrUpdate(new ReferenceRecord(currentProcess, currentWorkstep, wm.SerialNr, Users.GlobalData.CurrentUser.UserName, workplace, wm.Passed ? 0 : 1));
return 1;
}
else if (wm.ProcessId != 0)
{
/// Process ID is already known, however process and workstep have to be loaded
IList<Process> processes = session.QueryOver<Process>()
.Where(x => (x.Id == wm.ProcessId))
.List();
if (processes.Count != 1) return 0;
return 0;
foreach (var ws in processes[0].Worksteps)
{
if (ws.Name == WorkstepName)
{
session.SaveOrUpdate(new ReferenceRecord(processes[0], ws, wm.SerialNr, Users.GlobalData.CurrentUser.UserName, workplace, wm.Passed ? 0 : 1));
return 1;
}
}
return 0; /// No workste with 'WorkstepName' found
}
else
{
///
/// Process ID is unknown => do everything from scratch
///
/// Get all already existing reference records with Code == wm.SerialNr, refRecords[0] will be the most recent one
IList<ReferenceRecord> refRecords;
int trialsCount = 0;
do
{
if (trialsCount > 0) ReadProcessesFromDB(session);
refRecords = session.QueryOver<ReferenceRecord>()
.Where(rr => (rr.Code == wm.SerialNr))
.OrderBy(rr => rr.TimeStamp).Desc
.List();
trialsCount++;
}
while (refRecords.Count == 0 && trialsCount <= 2);
/// Save a new reference record from this test bench if workstep "Test_bench" is defined in the obtained WM process
IList<Workstep> worksteps;
if ((refRecords.Count > 0) && workstepsDictionary.TryGetValue(refRecords[0].Process.Id, out worksteps) && (worksteps.Count == 1))
{
session.SaveOrUpdate(new ReferenceRecord(refRecords[0].Process, worksteps[0], wm.SerialNr, Users.GlobalData.CurrentUser.UserName, workplace, wm.Passed ? 0 : 1));
return 1;
}
return 0;
}
}
@@ -259,12 +486,17 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
/// <param name="session">DB session</param>
void ReadProcessesFromDB(ISession session)
{
processes = session.QueryOver<Process>().List();
processes = session.QueryOver<Process>()
.List();
processDictionary = new Dictionary<int, Process>();
workstepsDictionary = new Dictionary<int, IList<Workstep>>();
///
foreach (var pr in processes)
{
IList<Workstep> worksteps = session.QueryOver<Workstep>().Where(ws => ((ws.Process == pr) && (ws.Name == WorkstepName))).List();
IList<Workstep> worksteps = session.QueryOver<Workstep>()
.Where(ws => ((ws.Process == pr) && (ws.Name == WorkstepName)))
.List();
processDictionary.Add(pr.Id, pr);
workstepsDictionary.Add(pr.Id, worksteps);
}
@@ -45,14 +45,18 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
nameTextBox.Text = config.Name;
workplaceTextBox.Text = config.Workplace;
connStrTextBox.Text = config.ConnStr;
}
checkPreviousRecordsCheckBox.Checked = config.CheckPreviousRecords;
saveTracingRecordsCheckBox.Checked = config.SaveTracingRecords;
}
public void Unlock()
{
nameTextBox.Enabled = true;
workplaceTextBox.Enabled = true;
connStrTextBox.Enabled = true;
}
checkPreviousRecordsCheckBox.Enabled = true;
saveTracingRecordsCheckBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
@@ -68,11 +72,13 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
if (config.Name != nameTextBox.Text)
{
config.Name = nameTextBox.Text;
flags |= CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd;
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
}
flags |= UpdateDifferent(ref config.Workplace, workplaceTextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
flags |= UpdateDifferent(ref config.ConnStr, connStrTextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
flags |= UpdateDifferent(ref config.CheckPreviousRecords, checkPreviousRecordsCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
flags |= UpdateDifferent(ref config.SaveTracingRecords, saveTracingRecordsCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
return flags;
}
@@ -38,6 +38,8 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
this.workplaceLabel = new System.Windows.Forms.Label();
this.connStrTextBox = new System.Windows.Forms.TextBox();
this.connStrLabel = new System.Windows.Forms.Label();
this.saveTracingRecordsCheckBox = new System.Windows.Forms.CheckBox();
this.checkPreviousRecordsCheckBox = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// nameTextBox
@@ -100,10 +102,34 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
this.connStrLabel.TabIndex = 21;
this.connStrLabel.Text = "Connection string";
//
// saveTracingRecordsCheckBox
//
this.saveTracingRecordsCheckBox.AutoSize = true;
this.saveTracingRecordsCheckBox.Enabled = false;
this.saveTracingRecordsCheckBox.Location = new System.Drawing.Point(110, 154);
this.saveTracingRecordsCheckBox.Name = "saveTracingRecordsCheckBox";
this.saveTracingRecordsCheckBox.Size = new System.Drawing.Size(177, 17);
this.saveTracingRecordsCheckBox.TabIndex = 24;
this.saveTracingRecordsCheckBox.Text = "Save production tracing records";
this.saveTracingRecordsCheckBox.UseVisualStyleBackColor = true;
//
// checkPreviousRecordsCheckBox
//
this.checkPreviousRecordsCheckBox.AutoSize = true;
this.checkPreviousRecordsCheckBox.Enabled = false;
this.checkPreviousRecordsCheckBox.Location = new System.Drawing.Point(110, 131);
this.checkPreviousRecordsCheckBox.Name = "checkPreviousRecordsCheckBox";
this.checkPreviousRecordsCheckBox.Size = new System.Drawing.Size(138, 17);
this.checkPreviousRecordsCheckBox.TabIndex = 23;
this.checkPreviousRecordsCheckBox.Text = "Check previous records";
this.checkPreviousRecordsCheckBox.UseVisualStyleBackColor = true;
//
// TracingCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.saveTracingRecordsCheckBox);
this.Controls.Add(this.checkPreviousRecordsCheckBox);
this.Controls.Add(this.connStrTextBox);
this.Controls.Add(this.connStrLabel);
this.Controls.Add(this.workplaceTextBox);
@@ -128,5 +154,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
private System.Windows.Forms.Label workplaceLabel;
private System.Windows.Forms.TextBox connStrTextBox;
private System.Windows.Forms.Label connStrLabel;
private System.Windows.Forms.CheckBox saveTracingRecordsCheckBox;
private System.Windows.Forms.CheckBox checkPreviousRecordsCheckBox;
}
}
@@ -89,7 +89,7 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
if (tr.Repeats() == 1)
{
flow = tr.FlowMean;
flow = tr.FlowVolume;
errorMaster = tr.ErrorMaster;
}
else
@@ -100,7 +100,7 @@ namespace TBF.BenchControl.Output.DB.SaveFlowmeterCorrections
{
if (tr2.TestDone && (tr2.TestData.Name == tr.TestData.Name))
{
flow += tr2.FlowMean;
flow += tr2.FlowVolume;
errorMaster += tr2.ErrorMaster;
count++;
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2018 Sensus Metering Systems
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -21,7 +21,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public class Database : ComponentBase, IOperation, GenericDevices.IResultsWriter, GenericDevices.IStartInfoReader, Generic.IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(Database));
public override string ToString() { return string.Format("Sensus-Oracle-Database({0})", Cfg.ToString(1)); }
public override string ToString() { return string.Format("{0}({1})", GetType().Namespace.Substring(17), Cfg.ToString(1)); }
const int Anbid_StaraTura = 4;
@@ -31,9 +31,8 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
enum CurrentOp
{
None,
CheckBarcodeScanning,
WriteResults,
ReadStartInfo,
WriteResults,
}
CurrentOp currentOp;
bool opCompleted;
@@ -58,10 +57,10 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
OracleConnection connection; /// Oracle database connection
///
/// The following 3 variables are always update together
/// The following 3 variables are always updated together
///
int id_WZTyp;
int rev_WZTyp;
int wmTypeId;
int wmTypeRevision;
SensusTestInfo[] completeTestInfos; /// Contains (1) range (90-100/100-110), (2) TBF test name, (3) string form of the flowId ...
/// ... in addition to incomplete test info from Oracle
@@ -136,19 +135,36 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
/// <param name="wmTypeId">Water meter type Id</param>
/// <param name="wmTypeRevision">Water meter type revision</param>
/// <returns>SensusTestInfos array</returns>
SensusTestInfo[] GetMatchingTestInfo(OracleConnection conn, int wmTypeId, int wmTypeRevision)
SensusTestInfo[] GetMatchingTestInfo(OracleConnection conn, int wmTypeId, out int wmTypeRevision)
{
///
/// Read 'incomplete' TestInfo from Oracle database containing only flowId-s ad qBezeichnung-s
///
IList<SensusTestInfo> oraDbTinfos = new List<SensusTestInfo>();
OracleCommand cmd = new OracleCommand("SELECT PruefungsNr, PosFehlerKalt, QBezeichnung FROM VT_PRUEFPUNKT_SOLL_SD WHERE ANBID=4 AND ID_WZTyp=:1 AND Rev_WZTyp=:2", conn);
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Int32, Value = wmTypeId }); ///:1
cmd.Parameters.Add(new OracleParameter { ParameterName = "2", OracleDbType = OracleDbType.Int32, Value = wmTypeRevision }); ///:2
///
/// For a given 'wmTypeId' find the most recent active 'wmTypeRevision'
///
wmTypeRevision = -1;
OracleCommand cmd = new OracleCommand("select REV_WZTYP from VT_WZTYP_SD where ANBID=4 and ID_WZTyp=:1 and AKTIV=:2", conn);
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wmTypeId }); ///:1
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 1 }); ///:2
///
OracleDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
wmTypeRevision = dr.GetInt32(0);
}
dr.Close();
if (wmTypeRevision == -1) return null; /// No 'wmTypeRevision' found
cmd = new OracleCommand("select PruefungsNr, PosFehlerKalt, QBezeichnung from VT_PRUEFPUNKT_SOLL_SD where ANBID=4 and ID_WZTyp=:1 and Rev_WZTyp=:2", conn);
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wmTypeId }); ///:1
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wmTypeRevision }); ///:2
///
dr = cmd.ExecuteReader();
while (dr.Read())
{
int pruefungsNr = dr.GetInt32(0);
double errLimHi = dr.GetDouble(1);
@@ -241,18 +257,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
}
}
public IOperation CheckBarcodeScanningOp(GenericDevices.IRegisterReader[] iperlHeads)
{
if (currentOp != CurrentOp.None)
{
throw new Exception("Sequence error");
}
currentOp = CurrentOp.CheckBarcodeScanning;
this.iperlHeads = iperlHeads;
return this;
}
/// <summary>Start this operation</summary>
public void Start()
@@ -269,13 +273,15 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
{
if (!opCompleted)
{
if ( waterMeters.Length == 0) return Event.ResultsWritten;
#if ORACLE_DB
if (waterMeters.Length == 0) return Event.ResultsWritten;
if ((dbCfg.DebugLevel == DebugMode.Normal) && (connection != null))
{
log.WarnFormat("{0} : Run() : currentOp = {1}", Name, currentOp);
#if ORACLE_DB
if (ReadStartInfoFromDB(connection) == Retv.Error) anyError = true;
}
#endif
}
opCompleted = true;
}
@@ -286,32 +292,19 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
if (!opCompleted)
{
if (batch.WaterMeters.Count == 0) return Event.ResultsWritten;
#if ORACLE_DB
if ((dbCfg.DebugLevel == DebugMode.Normal) && (connection != null))
{
log.WarnFormat("{0} : Run() : currentOp = {1}", Name, currentOp);
#if ORACLE_DB
if (WriteResultsToDB(connection, batch, false) == Retv.Error) anyError = true;
}
#endif
}
opCompleted = true;
}
return anyError ? Event.ResultsNotWritten : Event.ResultsWritten;
}
else if (currentOp == CurrentOp.CheckBarcodeScanning)
{
if (!opCompleted)
{
#if ORACLE_DB
if ((dbCfg.DebugLevel == DebugMode.Normal) && (connection != null))
{
if (CheckBarcodeScanning(connection, iperlHeads) == Retv.Error) anyError = true; ;
}
#endif
opCompleted = true;
}
return anyError ? Event.CheckNotDone : Event.CheckDone;
}
else
{
return Event.None;
@@ -324,49 +317,8 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
currentOp = CurrentOp.None;
}
#if ORACLE_DB
public Retv CheckBarcodeScanning(OracleConnection conn, GenericDevices.IRegisterReader[] iPerlHeads)
{
try
{
conn.Open(); /// Open the Oracle database
foreach (var rr in iPerlHeads)
{
//WaterMeters.iPerl.WaterMeter iPerlHead = rr as WaterMeters.iPerl.WaterMeter;
//if (iPerlHead != null)
//{
// OracleCommand cmd = new OracleCommand("select * from IP_ENDTEST_PD where PCBNUMBER = :1 and TESTSTATIONNAME = :2", conn);
// OracleParameter param;
// param = new OracleParameter("PCBNUMBER", OracleDbType.Varchar2); param.Value = iPerlHead.SerialNr; cmd.Parameters.Add(param);
// param = new OracleParameter("TESTSTATIONNAME", OracleDbType.Varchar2); param.Value = "STAWL001"; cmd.Parameters.Add(param);
// bool exists = false; /// true = RF_Power record exists
// OracleDataReader dr1 = cmd.ExecuteReader();
// if (dr1.Read()) { exists = true; }
// dr1.Close();
// if (!exists)
// {
// iPerlHead.CommFailed = true;
// }
//}
}
}
catch (Exception exc)
{
log.ErrorFormat("Barcode scanning records were not checked: {1}", exc.Message);
conn.Close();
return Retv.Error;
}
conn.Close();
return Retv.OK;
}
public Retv ReadStartInfoFromDB(OracleConnection conn)
{
bool anyError = false;
@@ -394,23 +346,31 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
/// <summary>
/// Read start info of one water meter from the database
/// </summary>
/// <param name="wmNr">0-based water meter number</param>
/// <param name="results">Sorted list of results to update</param>
/// <param name="conn">Oracke DB connection</param>
/// <param name="wm">Water meter entity</param>
/// <returns>Retv.OK when successful, Retv.Error on error</returns>
Retv ReadSingleWMfromDB(OracleConnection conn, Results.Entities.WaterMeter wm)
{
if (string.IsNullOrEmpty(wm.SerialNr)) return Retv.Error; /// No database activity possible w/o PCB number
try
{
if (completeTestInfos == null || (id_WZTyp != wm.WaterMeterData.WMTypeId) || (rev_WZTyp != wm.WaterMeterData.WMTypeRev))
if (completeTestInfos == null || (wmTypeId == 0) || (wmTypeId != wm.WaterMeterData.WMTypeId))
{
SensusTestInfo[] ti = GetMatchingTestInfo(conn, wm.WaterMeterData.WMTypeId, wm.WaterMeterData.WMTypeRev);
int wmTR;
SensusTestInfo[] ti = GetMatchingTestInfo(conn, wm.WaterMeterData.WMTypeId, out wmTR);
if (ti != null)
{
/// All 3 updated together
wmTypeId = wm.WaterMeterData.WMTypeId;
wmTypeRevision = wmTR;
completeTestInfos = ti;
id_WZTyp = wm.WaterMeterData.WMTypeId;
rev_WZTyp = wm.WaterMeterData.WMTypeRev;
/// Write to WaterMeter entity
wm.TestInfos = ti;
wm.WMTypeRevision = wmTR;
Sequences.ProcessData.TestInfos = ti;
}
else
{
@@ -466,7 +426,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
///
log.ErrorFormat("Water meter {0} was not found in ORACLE database.", wm.SerialNr);
dr.Close();
return Retv.Error;
return dbCfg.StartInfoIsRequired ? Retv.Error : Retv.OK;
}
dr.Close();
@@ -496,7 +456,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
///
cmd = new OracleCommand("select PRUEFINDEX, Q2CORRECTIONLEFT, Q2CORRECTIONRIGHT, ERRQ2 from VT_IP_ZAEHLER_PINDEX_PD where VT_FERNUM = :1 AND ANBID = 4", conn);
/// pruefindex, Q2_correction_RL, Q2_correction_LR, Q2_error_before_correction
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
dr = cmd.ExecuteReader();
while (dr.Read())
{
@@ -516,8 +476,8 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
///
/// testID, flow, rel.err., passed
cmd = new OracleCommand("select PRUEFUNGSNR, Q_WZ, Q_FEHLER, Q_BEST from VT_PRUEFREIHE_IST_PD where VT_FERNUM = :1 AND PRUEFINDEX = :2 AND ANBID = 4", conn);
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
cmd.Parameters.Add(new OracleParameter { ParameterName = "2", OracleDbType = OracleDbType.Int32, Value = 100 * testBenchID + maxPruefindex });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 100 * testBenchID + maxPruefindex });
dr = cmd.ExecuteReader();
while (dr.Read())
@@ -557,7 +517,10 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
///
/// Copy acquired data to WaterMeter object
///
wm.Pruefindex = maxPruefindex;
wm.Pruefindex = maxPruefindex + 1; /// Increment the proefindex from Oracle so that it is the pruefindex of the current cycle
log.InfoFormat("Data of water meter {0} successfully read from ORACLE database.", wm.SerialNr);
log.DebugFormat(" MaxPruefindex = {0}", wm.Pruefindex);
#if TURA_SPECIAL
wm.AssignedSerialNr = assignedSerialNr;
wm.CompleteSerialNr = completeSerialNr;
wm.RadioAddress = radioAddress;
@@ -572,8 +535,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
wm.ProdQ2CorrRL = q2CorrectionRL;
wm.ProdQ2CorrLR = q2CorrectionLR;
log.InfoFormat("Data of water meter {0} successfully read from ORACLE database.", wm.SerialNr);
log.DebugFormat(" MaxPruefindex = {0}", wm.Pruefindex);
log.DebugFormat(" AssignedSerialNr = {0}", wm.AssignedSerialNr);
log.DebugFormat(" CompleteSerialNr = {0}", wm.CompleteSerialNr);
log.DebugFormat(" RadioAddress = {0}", wm.RadioAddress);
@@ -587,7 +548,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
log.DebugFormat(" ProdResultCode = {0}", wm.ProdResultCode);
log.DebugFormat(" ProdQ2CorrRL = {0}", wm.ProdQ2CorrRL);
log.DebugFormat(" ProdQ2CorrLR = {0}", wm.ProdQ2CorrLR);
#endif
return Retv.OK;
}
catch (Exception exc)
@@ -600,35 +561,45 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public Retv WriteResultsToDB(OracleConnection conn, Results.Entities.Batch batch, bool safeMode)
{
OracleTransaction transaction = null;
OracleTransaction transaction;
try
{
conn.Open(); /// Open the Oracle database
transaction = conn.BeginTransaction();
}
catch (Exception exc)
{
log.ErrorFormat("Results of batch {0} not written to ORACLE DB (phase 1): {1}",
batch.BatchNr, exc.Message);
conn.Close();
return Retv.Error;
}
try
{
SaveBatchData(conn, batch);
foreach (var wMtr in batch.WaterMeters)
{
SaveSingleWM2DB(conn, wMtr, safeMode);
if ((wMtr.ErrorFlags & ((int)ErrorFlagMask.E25 | (int)ErrorFlagMask.E26 | (int)ErrorFlagMask.E27 | (int)ErrorFlagMask.E28)) == 0)
{
/// No error production process error => write the result of testing to Oracle DB
SaveSingleWM2DB(conn, wMtr, safeMode);
}
}
transaction.Commit();
conn.Close();
log.ErrorFormat("Results of batch {0} correctly written to ORACLE DB", batch.BatchNr);
return Retv.OK;
}
catch (Exception exc)
{
if (transaction != null) transaction.Rollback();
log.ErrorFormat("Results of batch {0} not written to ORACLE database: {1}",
batch.BatchNr, exc.Message);
transaction.Rollback();
conn.Close();
log.ErrorFormat("Results of batch {0} not written to ORACLE DB: {1}", batch.BatchNr, exc.Message);
return Retv.Error;
}
conn.Close();
return Retv.OK;
}
/// <summary>
@@ -727,15 +698,17 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
/// <param name="b">Batch</param>
void SaveBatchData(OracleConnection conn, Results.Entities.Batch b)
{
if ((completeTestInfos == null) || (id_WZTyp != b.WaterMeters[0].WaterMeterData.WMTypeId) || (rev_WZTyp != b.WaterMeters[0].WaterMeterData.WMTypeRev))
if ((wmTypeId != b.WaterMeters[0].WaterMeterData.WMTypeId) || (completeTestInfos == null) || (wmTypeRevision == 0))
{
SensusTestInfo[] ti = GetMatchingTestInfo(conn, b.WaterMeters[0].WaterMeterData.WMTypeId, b.WaterMeters[0].WaterMeterData.WMTypeRev);
int wmTR = 0;
SensusTestInfo[] ti = GetMatchingTestInfo(conn, b.WaterMeters[0].WaterMeterData.WMTypeId, out wmTR);
if (ti != null)
{
/// All 3 updated together
completeTestInfos = ti;
id_WZTyp = b.WaterMeters[0].WaterMeterData.WMTypeId;
rev_WZTyp = b.WaterMeters[0].WaterMeterData.WMTypeRev;
wmTypeId = b.WaterMeters[0].WaterMeterData.WMTypeId;
wmTypeRevision = wmTR;
}
else
{
@@ -743,71 +716,117 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
}
}
if (completeTestInfos == null || wmTypeId == 0 || wmTypeRevision == 0)
{
throw new Exception("No matching test infos found");
}
OracleCommand cmd = new OracleCommand("INSERT INTO VT_PRUEFREIHE_PD(ANBID, ID_Pruefstand, ID_WzPruefreihe, ID_WZTyp, " +
"Rev_WZTyp, Rev_Pruefstand_WZTyp, StartDatumZeit, EndDatumZeit, Betriebsart, " +
"QVzKontakt, FuellenBegDruck, DruckEvakVorne, DruckEvakHinten, DruckBeiAbpressen, " +
"Druckentwaessern, SpuelDurchflussIst, ProgrammVersion)" +
" VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17)", conn);
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
cmd.Parameters.Add(new OracleParameter { ParameterName = "2", OracleDbType = OracleDbType.Int32, Value = 18000 + b.TestBenchId });
cmd.Parameters.Add(new OracleParameter { ParameterName = "3", OracleDbType = OracleDbType.Int32, Value = b.BatchNr });
cmd.Parameters.Add(new OracleParameter { ParameterName = "4", OracleDbType = OracleDbType.Int32, Value = b.WaterMeters[0].WaterMeterData.WMTypeId });
cmd.Parameters.Add(new OracleParameter { ParameterName = "5", OracleDbType = OracleDbType.Int32, Value = b.WaterMeters[0].WaterMeterData.WMTypeRev });
cmd.Parameters.Add(new OracleParameter { ParameterName = "6", OracleDbType = OracleDbType.Int32, Value = 1 });
cmd.Parameters.Add(new OracleParameter { ParameterName = "7", OracleDbType = OracleDbType.TimeStamp, Value = b.StartTime });
cmd.Parameters.Add(new OracleParameter { ParameterName = "8", OracleDbType = OracleDbType.TimeStamp, Value = b.EndTime });
cmd.Parameters.Add(new OracleParameter { ParameterName = "9", OracleDbType = OracleDbType.Varchar2, Value = string.Empty });
cmd.Parameters.Add(new OracleParameter { ParameterName = "10", OracleDbType = OracleDbType.Double, Value = 0 });
cmd.Parameters.Add(new OracleParameter { ParameterName = "11", OracleDbType = OracleDbType.Double, Value = 0 });
cmd.Parameters.Add(new OracleParameter { ParameterName = "12", OracleDbType = OracleDbType.Double, Value = 0 });
cmd.Parameters.Add(new OracleParameter { ParameterName = "13", OracleDbType = OracleDbType.Double, Value = 0 });
cmd.Parameters.Add(new OracleParameter { ParameterName = "14", OracleDbType = OracleDbType.Double, Value = 0 }); /// TODO: DruckBeiAbpressen
cmd.Parameters.Add(new OracleParameter { ParameterName = "15", OracleDbType = OracleDbType.Double, Value = 0 });
cmd.Parameters.Add(new OracleParameter { ParameterName = "16", OracleDbType = OracleDbType.Double, Value = 0 }); /// TODO: SpuelDurchflussIst
cmd.Parameters.Add(new OracleParameter { ParameterName = "17", OracleDbType = OracleDbType.Varchar2, Value = string.Format("TBF v.{0}", b.ProgramVersion) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 18000 + b.TestBenchId });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = b.BatchNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = b.WaterMeters[0].WaterMeterData.WMTypeId });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wmTypeRevision });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 1 });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.TimeStamp, Value = b.StartTime });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.TimeStamp, Value = b.EndTime });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = string.Empty });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = 0 });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = 0 });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = 0 });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = 0 });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = 0 }); /// TODO: DruckBeiAbpressen
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = 0 });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = 0 }); /// TODO: SpuelDurchflussIst
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = string.Format("TBF v.{0}", b.ProgramVersion) });
cmd.ExecuteNonQuery(); /// Returns nr. of updated rows
foreach (var testInfo in completeTestInfos)
{
Results.Entities.TestRslt tr = b.GetTestRslt(testInfo.TestName, 0);
if ((-20 <= testInfo.PruefungsNr) && (testInfo.PruefungsNr <= 20)) /// LU PruefungsNr-s are between -20 and 20
{
Results.Entities.TestRslt tr = b.GetTestRslt(testInfo.TestName, 0);
if (tr == null) tr = b.GetTestRslt(testInfo.TestName, 1); /// TODO: Remove this workaround for large watermeters with multiple parts at Q3
if (tr == null) continue;
double Q_ist = (tr.VolumeMaster != 0) ? (tr.FlowVolume * tr.VolumeCTV / tr.VolumeMaster) : (double)tr.FlowVolume;
if (tr == null) tr = b.GetTestRslt(testInfo.TestName, 1); /// TODO: Remove this workaround for large watermeters with multiple parts at Q3
if (tr == null) continue;
OracleCommand cmd2 = new OracleCommand("INSERT INTO VT_PRUEFDURCHFLUSS_PD(" +
"ANBID, ID_Pruefstand, ID_WzPruefreihe, PruefungsNr, " +
"PVOL, PMasse, MinDurchfluss, MaxDurchfluss, " +
"Q_ist, KFaktor, Q_VZ, F_VZ, RegelEinstellZeit, Drehzahl, " +
"BeginnDruck_Vorne, BeginnDruck_Hinten, EndDruck_Vorne, EndDruck_Hinten, " +
"TVWZ, IVWZ, Verwendeter_VZ, BeginnGewicht, EndGewicht)" +
" VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, " +
":16, :17, :18, :19, :20, :21, :22, :23)", conn);
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
cmd.Parameters.Add(new OracleParameter { ParameterName = "2", OracleDbType = OracleDbType.Int32, Value = 18000 + b.TestBenchId });
cmd.Parameters.Add(new OracleParameter { ParameterName = "3", OracleDbType = OracleDbType.Int32, Value = b.BatchNr });
cmd.Parameters.Add(new OracleParameter { ParameterName = "4", OracleDbType = OracleDbType.Int32, Value = testInfo.PruefungsNr });
cmd.Parameters.Add(new OracleParameter { ParameterName = "5", OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.l, tr.VolumeCTV) });
cmd.Parameters.Add(new OracleParameter { ParameterName = "6", OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.kg, tr.MassEnd-tr.MassStart) });
cmd.Parameters.Add(new OracleParameter { ParameterName = "7", OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.lph, tr.FlowMin) });
cmd.Parameters.Add(new OracleParameter { ParameterName = "8", OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.lph, tr.FlowMax) });
cmd.Parameters.Add(new OracleParameter { ParameterName = "9", OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.lph, Q_ist) });
cmd.Parameters.Add(new OracleParameter { ParameterName = "10", OracleDbType = OracleDbType.Double, Value = tr.ConstMaster });
cmd.Parameters.Add(new OracleParameter { ParameterName = "11", OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.lph, tr.FlowVolume) });
cmd.Parameters.Add(new OracleParameter { ParameterName = "12", OracleDbType = OracleDbType.Double, Value = tr.ErrorMaster });
cmd.Parameters.Add(new OracleParameter { ParameterName = "13", OracleDbType = OracleDbType.Double, Value = (double)tr.FlowSetTime });
cmd.Parameters.Add(new OracleParameter { ParameterName = "14", OracleDbType = OracleDbType.Int32, Value = 0 }); /// TODO
cmd.Parameters.Add(new OracleParameter { ParameterName = "15", OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.bar, tr.PressUpStart) });
cmd.Parameters.Add(new OracleParameter { ParameterName = "16", OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.bar, tr.PressDownStart) });
cmd.Parameters.Add(new OracleParameter { ParameterName = "17", OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.bar, tr.PressUpEnd) });
cmd.Parameters.Add(new OracleParameter { ParameterName = "18", OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.bar, tr.PressDownEnd) });
cmd.Parameters.Add(new OracleParameter { ParameterName = "19", OracleDbType = OracleDbType.Double, Value = tr.TestTime });
cmd.Parameters.Add(new OracleParameter { ParameterName = "20", OracleDbType = OracleDbType.Int32, Value = tr.PulsesMaster });
cmd.Parameters.Add(new OracleParameter { ParameterName = "21", OracleDbType = OracleDbType.Int32, Value = 0 }); /// TODO
cmd.Parameters.Add(new OracleParameter { ParameterName = "22", OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.kg, tr.MassStart) });
cmd.Parameters.Add(new OracleParameter { ParameterName = "23", OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.kg, tr.MassEnd) });
cmd2.ExecuteNonQuery(); /// Returns nr. of updated rows
#if false
OracleCommand cmd2 = new OracleCommand("INSERT INTO VT_PRUEFDURCHFLUSS_PD(ANBID, ID_Pruefstand, ID_WzPruefreihe, PruefungsNr, PVOL, PMasse, " +
"MinDurchfluss, MaxDurchfluss, Q_ist, KFaktor, Q_VZ, F_VZ, RegelEinstellZeit, Drehzahl, BeginnDruck_Vorne, " +
"BeginnDruck_Hinten, EndDruck_Vorne, EndDruck_Hinten, TVWZ, IVWZ, Verwendeter_VZ, BeginnGewicht, EndGewicht) " +
"VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, :20, :21, :22, :23)", conn);
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 18000 + b.TestBenchId });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = b.BatchNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = testInfo.PruefungsNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.l, tr.VolumeCTV) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.kg, tr.MassEnd - tr.MassStart) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.lph, tr.FlowMin) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.lph, tr.FlowMax) });
double Q_ist = (tr.VolumeMaster != 0) ? (tr.FlowVolume * tr.VolumeCTV / tr.VolumeMaster) : (double)tr.FlowVolume;
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.lph, Q_ist) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = tr.ConstMaster });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.lph, tr.FlowVolume) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = tr.ErrorMaster });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = (double)tr.FlowSetTime });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 0 }); /// TODO
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.bar, tr.PressUpStart) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.bar, tr.PressDownStart) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.bar, tr.PressUpEnd) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.bar, tr.PressDownEnd) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = tr.TestTime });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = tr.PulsesMaster });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 0 }); /// TODO
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.kg, tr.MassStart) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Units.ConvertTo(Unit.kg, tr.MassEnd) });
cmd2.ExecuteNonQuery(); /// Returns nr. of updated rows
#else
OracleCommand cmd2 = new OracleCommand("INSERT INTO VT_PRUEFDURCHFLUSS_PD(" +
"ANBID, ID_Pruefstand, ID_WzPruefreihe, PruefungsNr, " +
"PVOL, PMasse, MinDurchfluss, MaxDurchfluss, " +
"Q_ist, KFaktor, Q_VZ, F_VZ, RegelEinstellZeit, Drehzahl, " +
"BeginnDruck_Vorne, BeginnDruck_Hinten, EndDruck_Vorne, EndDruck_Hinten, " +
"TVWZ, IVWZ, Verwendeter_VZ, BeginnGewicht, EndGewicht)" +
" VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, " +
":16, :17, :18, :19, :20, :21, :22, :23)", conn);
OracleParameter parm;
parm = new OracleParameter("ANBID", OracleDbType.Int32); parm.Value = Anbid_StaraTura; cmd2.Parameters.Add(parm); ///:1
parm = new OracleParameter("ID_Pruefstand", OracleDbType.Int32); parm.Value = 18000 + b.TestBenchId; cmd2.Parameters.Add(parm); ///:2
parm = new OracleParameter("ID_WzPruefreihe", OracleDbType.Int32); parm.Value = b.BatchNr; cmd2.Parameters.Add(parm); ///:3
parm = new OracleParameter("PruefungsNr", OracleDbType.Int32); parm.Value = testInfo.PruefungsNr; cmd2.Parameters.Add(parm); ///:4
///
parm = new OracleParameter("PVOL", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.l, tr.VolumeCTV); cmd2.Parameters.Add(parm); ///:5
parm = new OracleParameter("PMasse", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.kg, tr.MassEnd-tr.MassStart); cmd2.Parameters.Add(parm); ///:6
parm = new OracleParameter("MinDurchfluss", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.lph, tr.FlowMin); cmd2.Parameters.Add(parm); ///:7
parm = new OracleParameter("MaxDurchfluss", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.lph, tr.FlowMax); cmd2.Parameters.Add(parm); ///:8
double Q_ist = (tr.VolumeMaster != 0) ? (tr.FlowVolume * tr.VolumeCTV / tr.VolumeMaster) : (double)tr.FlowVolume;
parm = new OracleParameter("Q_ist", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.lph, Q_ist); cmd2.Parameters.Add(parm); ///:9
parm = new OracleParameter("KFaktor", OracleDbType.Double); parm.Value = tr.ConstMaster; cmd2.Parameters.Add(parm); ///:10
parm = new OracleParameter("Q_VZ", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.lph, tr.FlowVolume); cmd2.Parameters.Add(parm); ///:11
parm = new OracleParameter("F_VZ", OracleDbType.Double); parm.Value = tr.ErrorMaster; cmd2.Parameters.Add(parm); ///:12
parm = new OracleParameter("RegelEinstellZeit", OracleDbType.Double); parm.Value = (double)tr.FlowSetTime; cmd2.Parameters.Add(parm); ///:13
parm = new OracleParameter("Drehzahl", OracleDbType.Int32); parm.Value = 0; /* TODO */ cmd2.Parameters.Add(parm); ///:14
///
parm = new OracleParameter("BeginnDruck_Vorne", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.bar, tr.PressUpStart); cmd2.Parameters.Add(parm); ///:15
parm = new OracleParameter("BeginnDruck_Hinten", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.bar, tr.PressDownStart); cmd2.Parameters.Add(parm); ///:16
parm = new OracleParameter("EndDruck_Vorne", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.bar, tr.PressUpEnd); cmd2.Parameters.Add(parm); ///:17
parm = new OracleParameter("EndDruck_Hinten", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.bar, tr.PressDownEnd); cmd2.Parameters.Add(parm); ///:18
///
parm = new OracleParameter("TVWZ", OracleDbType.Double); parm.Value = tr.TestTime; cmd2.Parameters.Add(parm); ///:19
parm = new OracleParameter("IVWZ", OracleDbType.Int32); parm.Value = tr.PulsesMaster; cmd2.Parameters.Add(parm); ///:20
parm = new OracleParameter("Verwendeter_VZ", OracleDbType.Int32); parm.Value = 0; /* TODO */ cmd2.Parameters.Add(parm); ///:21
parm = new OracleParameter("BeginnGewicht", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.kg, tr.MassStart); cmd2.Parameters.Add(parm); ///:22
parm = new OracleParameter("EndGewicht", OracleDbType.Double); parm.Value = Units.ConvertTo(Unit.kg, tr.MassEnd); cmd2.Parameters.Add(parm); ///:23
cmd2.ExecuteNonQuery(); /// Returns nr. of updated rows
#endif
}
}
log.InfoFormat("Batch data saved, batchNr={0}", b.BatchNr);
@@ -821,19 +840,20 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
if (max_Pruefindex % 100 == 1)
{
OracleCommand cmd = new OracleCommand("INSERT INTO VT_ZAEHLER_PD(Auftragsnummer, VT_Identnummer, VT_Fernum, Max_Pruefindex, Zaehlernummer, Sekundaere_Adr, Hydr_Pruefung, ID_Benutzer, ANBID, Baujahr) VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10)", conn);
OracleCommand cmd = new OracleCommand("INSERT INTO VT_ZAEHLER_PD(Auftragsnummer, VT_Identnummer, VT_Fernum, Max_Pruefindex," +
" Zaehlernummer, Sekundaere_Adr, Hydr_Pruefung, ID_Benutzer, ANBID, Baujahr)" +
" VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10)", conn);
OracleParameter parm;
parm = new OracleParameter("Auftragsnummer", OracleDbType.Varchar2); parm.Value = wm.PurchaseOrder; cmd.Parameters.Add(parm);
parm = new OracleParameter("VT_Identnummer", OracleDbType.Varchar2); parm.Value = "IPBATMXX"; cmd.Parameters.Add(parm);
parm = new OracleParameter("VT_Fernum", OracleDbType.Varchar2); parm.Value = wm.SerialNr; cmd.Parameters.Add(parm);
parm = new OracleParameter("Max_Pruefindex", OracleDbType.Int32); parm.Value = max_Pruefindex; cmd.Parameters.Add(parm);
parm = new OracleParameter("Zaehlernummer", OracleDbType.Int32); parm.Value = -1; cmd.Parameters.Add(parm);
parm = new OracleParameter("Sekundaere_Adr", OracleDbType.Int32); parm.Value = sekundaere_Adr; cmd.Parameters.Add(parm);
parm = new OracleParameter("Hydr_Pruefung", OracleDbType.Int32); parm.Value = hydr_Pruefung; cmd.Parameters.Add(parm);
parm = new OracleParameter("ID_Benutzer", OracleDbType.Int32); parm.Value = idBenutzer; cmd.Parameters.Add(parm);
parm = new OracleParameter("ANBID", OracleDbType.Int32); parm.Value = Anbid_StaraTura; cmd.Parameters.Add(parm);
parm = new OracleParameter("Baujahr", OracleDbType.Int32); parm.Value = dbCfg.Baujahr; cmd.Parameters.Add(parm);
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.PurchaseOrder });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = "IPBATMXX" });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = max_Pruefindex });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = -1 });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = sekundaere_Adr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = hydr_Pruefung });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = idBenutzer });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = dbCfg.Baujahr });
cmd.ExecuteNonQuery();
log.InfoFormat("VT_ZAEHLER_PD inserted, PcbNr={0}, pos={1}, maxPruefix={2}", wm.SerialNr, wm.WMPosition, max_Pruefindex);
@@ -842,15 +862,14 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
{
OracleCommand cmd = new OracleCommand("UPDATE VT_ZAEHLER_PD SET Auftragsnummer = :1, VT_Identnummer = :2, Max_Pruefindex = :3, Hydr_Pruefung= :4, ID_Benutzer= :5, Baujahr= :6 WHERE VT_Fernum = :7 and ANBID = :8", conn);
OracleParameter parm;
parm = new OracleParameter("Auftragsnummer", OracleDbType.Varchar2); parm.Value = wm.PurchaseOrder; cmd.Parameters.Add(parm);
parm = new OracleParameter("VT_Identnummer", OracleDbType.Varchar2); parm.Value = "IPBATMXX"; cmd.Parameters.Add(parm);
parm = new OracleParameter("Max_Pruefindex", OracleDbType.Int32); parm.Value = max_Pruefindex; cmd.Parameters.Add(parm);
parm = new OracleParameter("Hydr_Pruefung", OracleDbType.Int32); parm.Value = hydr_Pruefung; cmd.Parameters.Add(parm);
parm = new OracleParameter("ID_Benutzer", OracleDbType.Int32); parm.Value = idBenutzer; cmd.Parameters.Add(parm);
parm = new OracleParameter("Baujahr", OracleDbType.Int32); parm.Value = dbCfg.Baujahr; cmd.Parameters.Add(parm);
parm = new OracleParameter("VT_Fernum", OracleDbType.Varchar2); parm.Value = wm.SerialNr; cmd.Parameters.Add(parm);
parm = new OracleParameter("ANBID", OracleDbType.Int32); parm.Value = Anbid_StaraTura; cmd.Parameters.Add(parm);
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.PurchaseOrder });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = "IPBATMXX" });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = max_Pruefindex });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = hydr_Pruefung });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = idBenutzer });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = dbCfg.Baujahr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
cmd.ExecuteNonQuery();
log.InfoFormat("VT_ZAEHLER_PD updated, PcbNr={0}, pos={1}, maxPruefix={2}", wm.SerialNr, wm.WMPosition, max_Pruefindex);
@@ -858,28 +877,23 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
{
OracleCommand cmd = new OracleCommand("INSERT INTO VT_ZAEHLER_PINDEX_PD(" +
"VT_Fernum, Pruefindex, ANBID, ID_Pruefstand, ID_WzPruefreihe, Hydr_Pruefung, " +
"ReedKontakt, ReedKontaktOK, ReedKontaktZeit, KorrImprate, FestWertWZ, PtestOK, " +
"Zaehlerstand, WT_Platz_NR, WZgut, ID_Benutzer, AnzahlPruefungen)" +
" VALUES (:1, :2, :3, :4, :5, :6, 0, 0, 0, :7, 0, :8, 0, :9, :10, :11, :12)", conn);
OracleParameter parm;
parm = new OracleParameter("VT_Fernum", OracleDbType.Varchar2); parm.Value = wm.SerialNr; cmd.Parameters.Add(parm);
parm = new OracleParameter("Pruefindex", OracleDbType.Int32); parm.Value = max_Pruefindex; cmd.Parameters.Add(parm);
parm = new OracleParameter("ANBID", OracleDbType.Int32); parm.Value = Anbid_StaraTura; cmd.Parameters.Add(parm);
parm = new OracleParameter("ID_Pruefstand", OracleDbType.Int32); parm.Value = 18000 + wm.Batch.TestBenchId; cmd.Parameters.Add(parm);
parm = new OracleParameter("ID_WzPruefreihe", OracleDbType.Int32); parm.Value = wm.Batch.BatchNr; cmd.Parameters.Add(parm);
parm = new OracleParameter("Hydr_Pruefung", OracleDbType.Int32); parm.Value = hydr_Pruefung; cmd.Parameters.Add(parm);
// ReedKontakt
// ReedKontaktOK
// ReedKontaktZeit
parm = new OracleParameter("KorrImprate", OracleDbType.Double); parm.Value = wm.OrigCalibFactor; cmd.Parameters.Add(parm);
// FestWertWZ
parm = new OracleParameter("PtestOK", OracleDbType.Int32); parm.Value = 0;/*TODO*/ cmd.Parameters.Add(parm);
// Zaehlerstand
parm = new OracleParameter("WT_Platz_NR", OracleDbType.Int32); parm.Value = wm.WMPosition; cmd.Parameters.Add(parm);
parm = new OracleParameter("WZgut", OracleDbType.Int32); parm.Value = wm.Passed ? 1 : 0; cmd.Parameters.Add(parm);
parm = new OracleParameter("ID_Benutzer", OracleDbType.Int32); parm.Value = idBenutzer; cmd.Parameters.Add(parm);
parm = new OracleParameter("AnzahlPruefungen", OracleDbType.Int32); parm.Value = 3; cmd.Parameters.Add(parm);
"VT_Fernum, Pruefindex, ANBID, ID_Pruefstand, ID_WzPruefreihe, Hydr_Pruefung, " +
"ReedKontakt, ReedKontaktOK, ReedKontaktZeit, KorrImprate, FestWertWZ, PtestOK, " +
"Zaehlerstand, WT_Platz_NR, WZgut, ID_Benutzer, AnzahlPruefungen)" +
" VALUES (:1, :2, :3, :4, :5, :6, 0, 0, 0, :7, 0, :8, 0, :9, :10, :11, :12)", conn); /// ReedKontakt = ReedKontaktOK = ReedKontaktZeit = FestWertWZ = Zaehlerstand = 0
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = max_Pruefindex });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 18000 + wm.Batch.TestBenchId });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Batch.BatchNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = hydr_Pruefung });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = wm.OrigCalibFactor });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 0 }); /// TODO
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.WMPosition });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Passed ? 1 : 0 });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = idBenutzer });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 3 });
cmd.ExecuteNonQuery();
log.InfoFormat("VT_ZAEHLER_PINDEX_PD inserted, PcbNr={0}, pos={1}, pruefix={2}", wm.SerialNr, wm.WMPosition, max_Pruefindex % 100);
@@ -888,41 +902,44 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
foreach (var testInfo in completeTestInfos)
{
Results.Entities.TestData tData = wm.GetTestData(testInfo.TestName);
Results.Entities.MeterTestRslt mtr;
if (tData == null)
if ((-20 <= testInfo.PruefungsNr) && (testInfo.PruefungsNr <= 20)) /// LU PruefungsNr-s are between -20 and 20
{
throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", testInfo.TestName, wm.WMPosition));
}
else if (tData.Repeats == 1)
{
mtr = wm.GetMeterTestRslt(testInfo.TestName);
if (mtr == null) throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", testInfo.TestName, wm.WMPosition));
}
else
{
Results.Entities.MeterTestRslt firstMtr = wm.GetMeterTestRslt(Utils.TestTitle(tData, 1));
if (firstMtr == null) throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", Utils.TestTitle(tData, 1), wm.WMPosition));
mtr = new Results.Entities.MeterTestRslt();
mtr.CopyContentFrom(firstMtr);
mtr.TestRslt = firstMtr.TestRslt;
mtr.WaterMeter = firstMtr.WaterMeter;
for (int i = 2; i <= tData.Repeats; i++)
Results.Entities.TestData tData = wm.GetTestData(testInfo.TestName);
Results.Entities.MeterTestRslt mtr;
if (tData == null)
{
Results.Entities.MeterTestRslt nextMtr = wm.GetMeterTestRslt(Utils.TestTitle(tData, i));
if (nextMtr == null) throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", Utils.TestTitle(tData, i), wm.WMPosition));
mtr.TestTime += nextMtr.TestTime;
mtr.VolumeMeter += nextMtr.VolumeMeter;
mtr.VolumeRef += nextMtr.VolumeRef;
mtr.VolumeEnd = nextMtr.VolumeEnd;
mtr.Passed = (mtr.Passed && nextMtr.Passed);
throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", testInfo.TestName, wm.WMPosition));
}
mtr.Error = Formulas.ErrorFromVolumes(mtr.VolumeMeter, mtr.VolumeRef);
}
else if (tData.Repeats == 1)
{
mtr = wm.GetMeterTestRslt(testInfo.TestName);
if (mtr == null) throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", testInfo.TestName, wm.WMPosition));
}
else
{
Results.Entities.MeterTestRslt firstMtr = wm.GetMeterTestRslt(Utils.TestTitle(tData, 1));
if (firstMtr == null) throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", Utils.TestTitle(tData, 1), wm.WMPosition));
SaveMeterTestResult(conn, mtr, testInfo.PruefungsNr, max_Pruefindex);
mtr = new Results.Entities.MeterTestRslt();
mtr.CopyContentFrom(firstMtr);
mtr.TestRslt = firstMtr.TestRslt;
mtr.WaterMeter = firstMtr.WaterMeter;
for (int i = 2; i <= tData.Repeats; i++)
{
Results.Entities.MeterTestRslt nextMtr = wm.GetMeterTestRslt(Utils.TestTitle(tData, i));
if (nextMtr == null) throw new Exception(string.Format("'{0}' test results missing, watermeter {1}", Utils.TestTitle(tData, i), wm.WMPosition));
mtr.TestTime += nextMtr.TestTime;
mtr.VolumeMeter += nextMtr.VolumeMeter;
mtr.VolumeRef += nextMtr.VolumeRef;
mtr.VolumeEnd = nextMtr.VolumeEnd;
mtr.Passed = (mtr.Passed && nextMtr.Passed);
}
mtr.Error = Formulas.ErrorFromVolumes(mtr.VolumeMeter, mtr.VolumeRef);
}
SaveMeterTestResult(conn, mtr, testInfo.PruefungsNr, max_Pruefindex, wmTypeRevision);
}
}
@@ -933,18 +950,18 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
"VT_Fernum, Pruefindex, ANBID, WITHCORRECTION2HZ, CORRECTION2HZ, DIFF2HZ8HZ, " +
"WITHQ2CORRECTION, Q2CORRECTIONRIGHT, ERRQ2, Q2CORRECTIONFLOWRIGHT, Q2CORRECTIONLEFT)" +
" VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11)", conn);
OracleParameter parm;
parm = new OracleParameter("VT_Fernum", OracleDbType.Varchar2); parm.Value = wm.SerialNr; cmd.Parameters.Add(parm); ///:1
parm = new OracleParameter("Pruefindex", OracleDbType.Int32); parm.Value = max_Pruefindex; cmd.Parameters.Add(parm); ///:2
parm = new OracleParameter("ANBID", OracleDbType.Int32); parm.Value = Anbid_StaraTura; cmd.Parameters.Add(parm); ///:3
parm = new OracleParameter("WITHCORRECTION2HZ", OracleDbType.Int32); parm.Value = wm.Hz2CorrectionDone ? 1 : 0; cmd.Parameters.Add(parm); ///:4
parm = new OracleParameter("CORRECTION2HZ", OracleDbType.Double); parm.Value = wm.Hz2Correction; cmd.Parameters.Add(parm); ///:5
parm = new OracleParameter("DIFF2HZ8HZ", OracleDbType.Double); parm.Value = Math.Min(99.0, Math.Max(-99.0, wm.Diff2Hz8Hz));cmd.Parameters.Add(parm); ///:6
parm = new OracleParameter("WITHQ2CORRECTION", OracleDbType.Int32); parm.Value = wm.Q2CorrectionDone ? 1 : 0; cmd.Parameters.Add(parm); ///:7
parm = new OracleParameter("Q2CORRECTIONRIGHT", OracleDbType.Int32); parm.Value = wm.Q2CorrLR; cmd.Parameters.Add(parm); ///:8
parm = new OracleParameter("ERRQ2", OracleDbType.Double); parm.Value = q2ErrWOCorrection; cmd.Parameters.Add(parm); ///:9
parm = new OracleParameter("Q2CORRECTIONFLOWRIGHT", OracleDbType.Int32);parm.Value = wm.Q2CorrFlowRight; /* 1 = R->L */ cmd.Parameters.Add(parm); ///:10
parm = new OracleParameter("Q2CORRECTIONLEFT", OracleDbType.Int32); parm.Value = wm.Q2CorrRL; cmd.Parameters.Add(parm); ///:11
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = wm.SerialNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = max_Pruefindex });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Hz2CorrectionDone ? 1 : 0 });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = wm.Hz2Correction });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Math.Min(99.0, Math.Max(-99.0, wm.Diff2Hz8Hz)) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Q2CorrectionDone ? 1 : 0 });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Q2CorrLR });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = q2ErrWOCorrection });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Q2CorrFlowRight }); /// 1 = R->L
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Q2CorrRL });
int rowsUpdated = cmd.ExecuteNonQuery();
log.InfoFormat("VT_IP_ZAEHLER_PINDEX_PD inserted, PcbNr={0}, pruefix={1}", wm.SerialNr, max_Pruefindex);
@@ -957,7 +974,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
/// </summary>
/// <param name="q">q = 0, 1, 2 or 3 (Adj., Q1, Q2, Q3)</param>
/// <returns>Nr. of rows updated</returns>
int SaveMeterTestResult(OracleConnection conn, Results.Entities.MeterTestRslt mtr, int pruefungsNr, int max_Pruefindex) ///
int SaveMeterTestResult(OracleConnection conn, Results.Entities.MeterTestRslt mtr, int pruefungsNr, int max_Pruefindex, int wmTypeRevision)
{
double Q_wm = 3600.0 * mtr.VolumeMeter / mtr.TestTime; /// in [l/hour]
double Q_wm_with_upper_bound = Math.Min(2 * 1000 * mtr.TestRslt.FlowVolume, Math.Max(0.0, Q_wm));
@@ -967,33 +984,28 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
"Q_WZ, Q_Fehler, Q_Best, NIZ, AnfangZStand, EndZStand, " +
"KorrErrQok, KorrErrQ, KorrQWz, TIZ, Vol_WZ_US, TempMittel_US)" +
" VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, 0, :14, 0, :15, 0, 0)", conn);
OracleParameter parm;
parm = new OracleParameter("VT_Fernum", OracleDbType.Varchar2); parm.Value = mtr.WaterMeter.SerialNr; cmd.Parameters.Add(parm); ///:1
parm = new OracleParameter("Pruefindex", OracleDbType.Int32); parm.Value = max_Pruefindex; cmd.Parameters.Add(parm); ///:2
parm = new OracleParameter("PruefungsNr", OracleDbType.Int32); parm.Value = pruefungsNr; cmd.Parameters.Add(parm); ///:3
parm = new OracleParameter("ANBID", OracleDbType.Int32); parm.Value = Anbid_StaraTura; cmd.Parameters.Add(parm); ///:4
parm = new OracleParameter("ID_WZTyp", OracleDbType.Int32); parm.Value = mtr.WaterMeter.WaterMeterData.WMTypeId; cmd.Parameters.Add(parm); ///:5
parm = new OracleParameter("Rev_WZTyp", OracleDbType.Int32); parm.Value = mtr.WaterMeter.WaterMeterData.WMTypeRev; cmd.Parameters.Add(parm); ///:6
parm = new OracleParameter("Rev_WZPruefpunkt", OracleDbType.Int32); parm.Value = 1; cmd.Parameters.Add(parm); ///:7
parm = new OracleParameter("Q_WZ", OracleDbType.Double); parm.Value = Q_wm_with_upper_bound; cmd.Parameters.Add(parm); ///:8
parm = new OracleParameter("Q_Fehler", OracleDbType.Double); parm.Value = Math.Min(100.0, Math.Max(-100.0, mtr.Error)); cmd.Parameters.Add(parm); ///:9
parm = new OracleParameter("Q_Best", OracleDbType.Int32); parm.Value = mtr.Passed ? 1 : 0; cmd.Parameters.Add(parm); ///:10
parm = new OracleParameter("NIZ", OracleDbType.Int32); parm.Value = 0; cmd.Parameters.Add(parm); ///:11
parm = new OracleParameter("AnfangZStand", OracleDbType.Double); parm.Value = mtr.VolumeStart; cmd.Parameters.Add(parm); ///:12
parm = new OracleParameter("EndZStand", OracleDbType.Double); parm.Value = mtr.VolumeEnd; cmd.Parameters.Add(parm); ///:13
/// KorrErrQok bool true = Q2 within limits, 'passed' in case of Q1, Q3, Q4
parm = new OracleParameter("KorrErrQ", OracleDbType.Double); parm.Value = Math.Min(100.0, Math.Max(-100.0, mtr.KorrErrQ)); cmd.Parameters.Add(parm); ///:14
/// KorrErrQ double 'Q2 error before correction' when correction done or 'Q2 error' when correction not done
/// = q2.WaterMeter.Q2CorrectionDone ? q2.WaterMeter.Q2ErrWOCorrection.ToString(Program.AltCulture) : q2.Error.ToString(Program.AltCulture)));
/// KorrQWz double
parm = new OracleParameter("TIZ", OracleDbType.Double); parm.Value = Math.Min(100000, mtr.TestTime); cmd.Parameters.Add(parm); ///:15
/// Vol_WZ_US
/// TempMittel_US
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = mtr.WaterMeter.SerialNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = max_Pruefindex });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = pruefungsNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_StaraTura });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = mtr.WaterMeter.WaterMeterData.WMTypeId });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wmTypeRevision });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 1 });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Q_wm_with_upper_bound });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Math.Min(100.0, Math.Max(-100.0, mtr.Error)) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = mtr.Passed ? 1 : 0 });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 0 });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Math.Max(-99999.999, Math.Min(mtr.VolumeStart, 99999.999)) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Math.Max(-99999.999, Math.Min(mtr.VolumeEnd, 99999.999)) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Math.Min(100.0, Math.Max(-100.0, mtr.KorrErrQ)) });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = Math.Min(100000, mtr.TestTime) });
int retv = cmd.ExecuteNonQuery();
log.DebugFormat("VT_PRUEFREIHE_IST_PD inserted, PcbNr={0}, pruefungsNr={1}, error={2}", mtr.WaterMeter.SerialNr, pruefungsNr, mtr.Error);
log.DebugFormat("VT_PRUEFREIHE_IST_PD inserted, PcbNr={0}, pruefungsNr={1}, error={2}", mtr.WaterMeter.SerialNr, pruefungsNr, mtr.Error);
return retv;
}
#endif
}
}
}

Some files were not shown because too many files have changed in this diff Show More