Compare commits

..
Author SHA1 Message Date
Milan Hanajik ab44e39754 Reconfigured for iPearlSpecial-Camera 2018-06-20 11:02:34 +02:00
1041 changed files with 26292 additions and 105219 deletions
-2
View File
@@ -1,2 +0,0 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
+2 -9
View File
@@ -1,25 +1,19 @@
Config/bin/
Config/obj/
Decrypt/bin/
Decrypt/obj/
DeviceTest/bin/
DeviceTest/obj/
Dirichlet.Numerics/bin
Dirichlet.Numerics/obj
Encrypt/bin/
Encrypt/obj/
GemCard/bin
GemCard/obj
GraphLib/bin
GraphLib/obj
TracingDB/bin
TracingDB/obj
MonitoringDB/bin
MonitoringDB/obj
Results/bin/
Results/obj/
ResultsBrowser/bin/
ResultsBrowser/obj/
Statistics/bin/
Statistics/obj/
TBF/bin/
TBF/obj/
TBFSetup/Debug/
@@ -29,6 +23,5 @@ Users/obj/
UserManagement/bin/
UserManagement/obj/
Doc/
.vs/
*.suo
*.bak
+2 -5
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;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;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -78,7 +78,6 @@
<Compile Include="Entities\IHasName.cs" />
<Compile Include="Entities\IHasValves.cs" />
<Compile Include="Entities\IParamsProvider.cs" />
<Compile Include="Entities\IperlEnums.cs" />
<Compile Include="Entities\MeasurementCorrection.cs" />
<Compile Include="Entities\MetersPath.cs" />
<Compile Include="Entities\OutputPath.cs" />
@@ -87,7 +86,6 @@
<Compile Include="Entities\Test.cs" />
<Compile Include="Entities\TransitionSequence.cs" />
<Compile Include="Entities\TransitionStep.cs" />
<Compile Include="Entities\Uncertainty.cs" />
<Compile Include="Entities\User.cs" />
<Compile Include="Entities\VirtualBenchSequence.cs" />
<Compile Include="Entities\VirtualBenchStep.cs" />
@@ -109,7 +107,6 @@
<Compile Include="Mappings\TestMap.cs" />
<Compile Include="Mappings\TransitionSequenceMap.cs" />
<Compile Include="Mappings\TransitionStepMap.cs" />
<Compile Include="Mappings\UncertaintyMap.cs" />
<Compile Include="Mappings\UserMap.cs" />
<Compile Include="Mappings\VirtualBenchSequenceMap.cs" />
<Compile Include="Mappings\VirtualBenchStepMap.cs" />
+7 -37
View File
@@ -10,59 +10,29 @@ namespace Config
#if MUNICH
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 3;
public const int LineSize = 1;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200
#elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || GENESIS || SLM_150 || PETERSBURG_200
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif PUCHONG_200
#elif FUZHOU300 || FUZHOU150 || PT200IL || PUCHONG_PT200 || GENESIS || SLM_150 || PETERSBURG_200
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif DEWA_300
public const int WMsCount = 10;
public const int LineSize = 10;
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif DUBAJ_50
public const int WMsCount = 10;
public const int LineSize = 5;
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif IZRAEL_50
public const int WMsCount = 40;
public const int LineSize = 10;
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif FUZHOU_100
public const int WMsCount = 10;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif TORINO_50 || BADGER_MALA_TRAT || BERLIN
#elif TORINO50 || BADGER_MALA_TRAT || BERLIN
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50
#elif TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40 || FUZHOU_40 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || ZAMBIA
public const int WMsCount = 20;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
@@ -74,7 +44,7 @@ namespace Config
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif TURA_IPERL || TURA_IPERL_NEW
#elif TURA_IPERL
public const int WMsCount = 40;
public const int LineSize = 20;
public const int CompoundWMsCount = 1;
+1 -1
View File
@@ -37,7 +37,7 @@ namespace Config
result.IsRealBench = IsRealBench;
result.ProceduresDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
result.WaterMetersDBSettings = (Users.DBSettings)WaterMetersDBSettings.Clone();
result.UsersDBSettings = (Users.DBSettings)UsersDBSettings.Clone();
result.UsersDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
return result;
}
+2 -3
View File
@@ -1,8 +1,9 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities
@@ -18,7 +19,6 @@ namespace Config.Entities
public virtual LogLevel Logging { get; set; }
public virtual string Parameters { get; set; }
public virtual IList<MeasurementCorrection> Corrections { get; set; }
public virtual IList<Uncertainty> Uncertainties { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
@@ -27,7 +27,6 @@ namespace Config.Entities
Name = string.Empty;
ClassName = string.Empty;
Corrections = new List<MeasurementCorrection>();
Uncertainties = new List<Uncertainty>();
}
public static Component CreateFromCfg(string name, string className, string parentName, int itemNr,
+3 -97
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -58,25 +58,10 @@ namespace Config.Entities
[Description("Remote DB only")] RemoteDBOnly,
[Description("Both DB-s, local 1st")] BothDBsLocalFirst,
[Description("Both DB-s, remote 1st")] BothDBsRemoteFirst,
Count
Count,
}
/// <summary>
/// Contains a procedure name and a database specification (local/remote).
/// </summary>
public class ProcedureInfo
{
public readonly string Name;
public readonly Users.Entities.DBKind DBKind;
public ProcedureInfo(string name, Users.Entities.DBKind dbKind)
{
Name = name;
DBKind = dbKind;
}
}
public enum ProcedureState
public enum ProcedureState
{
Active,
History,
@@ -224,14 +209,6 @@ namespace Config.Entities
Count
}
public enum MeretProtocol
{
[Description("<undefined>")] Undefined,
[Description("Meret (obsolete)")] Meret,
[Description("Modbus")] Modbus,
Count
}
public enum Publish : sbyte
{
#if LANG_DE
@@ -498,75 +475,4 @@ 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),
}
}
+1 -5
View File
@@ -60,11 +60,7 @@ namespace Config.Entities
/// <param name="strValue">String representation of the parameter</param>
CfgUpdateFlags UpdateParam(int ix, string strValue);
/// <summary>
/// Updates DB entities for related parameters
/// </summary>
/// <returns>true when successful</returns>
bool UpdateEmbeddedDbEntity();
void UpdateEmbeddedDbEntity();
/// <summary>
/// Creates an object copy
-44
View File
@@ -1,44 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
namespace Config.Entities
{
public enum Side
{
#if LANG_CS
[Description("Levá")] Left,
[Description("Pravá")] Right,
#else
[Description("Left")] Left,
[Description("Right")] Right,
#endif
Count
}
public enum FlowDir
{
R_L,
L_R,
Count
}
public enum Counting
{
Arbitrary,
Positive,
Negative,
Count
}
public enum OptoHeadState
{
Disabled,
OptoAndDirOK,
OptoNok,
DirNok,
Count
}
}
+2 -5
View File
@@ -12,14 +12,11 @@ namespace Config.Entities
public virtual float Measurement { get; set; }
public virtual float Correction { get; set; }
public MeasurementCorrection()
{
RangeIx = 0;
}
public MeasurementCorrection() { }
public MeasurementCorrection(int rangeIx)
{
RangeIx = rangeIx;
RangeIx = rangeIx;
}
}
}
+16 -53
View File
@@ -25,8 +25,8 @@ namespace Config.Entities
public virtual float Volume { get; set; } /// Test volume (target) in [l]
public virtual float TstTime { get; set; } /// Test time (estimate) in [s]
public virtual string Method { get; set; }
public virtual float ErrLimLo { get; set; } /// in [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
public virtual float ErrLimHi { get; set; } /// in [%] usually > 0, in case of heat meters: -Qn in m3/h
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0) or 1=class1, 2=class2, 3=class3
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0) or -Qn in m3/h
public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual int Repeats { get; set; }
public virtual bool DoDraining { get; set; }
@@ -56,9 +56,6 @@ namespace Config.Entities
public virtual string RelTransAfter { get; set; }
public virtual string TransitionAfter { get; set; }
public virtual bool IsOuterLoopStart { get; set; } /// Not mapped to database
public virtual bool IsOuterLoopEnd { get; set; } /// Not mapped to database
public virtual IList<ComponentTest> MoreParams { get; set; }
public virtual Procedure Procedure { get; set; }
@@ -313,88 +310,54 @@ namespace Config.Entities
return null;
}
public virtual double GetErrLimLo(double volumeCTV, double testTime)
public virtual float GetErrLimLo(float flow)
{
if (ErrLimLo <= ErrLimHi)
{
return ErrLimLo; /// Error limit of a water meter
return ErrLimLo; /// Error limit of a water meter
}
else
{
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(ErrLimLo);
double Qp = Math.Abs(ErrLimHi);
double Q = (testTime == 0) ? 1 : Math.Max(3.6 * volumeCTV / testTime, 0.00001); /// Div. by zero avoided
float Qp = Math.Abs(ErrLimHi);
float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
{
default:
case 1: return -Math.Min(3.5, 1.0 + 0.01 * Qp / Q);
case 2: return -Math.Min(5.0, 2.0 + 0.02 * Qp / Q);
case 3: return -Math.Min(5.0, 3.0 + 0.05 * Qp / Q);
case 1: return -Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
case 2: return -Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
case 3: return -Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
}
}
}
public virtual double GetErrLimHi(double volumeCTV, double testTime)
public virtual float GetErrLimHi(float flow)
{
if (ErrLimLo <= ErrLimHi)
{
return ErrLimHi; /// Error limit of a water meter
return ErrLimHi; /// Error limit of a water meter
}
else
{
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(ErrLimLo);
double Qp = Math.Abs(ErrLimHi);
double Q = (testTime == 0) ? 1 : Math.Max(3.6 * volumeCTV / testTime, 0.00001); /// Div. by zero avoided
float Qp = Math.Abs(ErrLimHi);
float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
{
default:
case 1: return +Math.Min(3.5, 1.0 + 0.01 * Qp / Q);
case 2: return +Math.Min(5.0, 2.0 + 0.02 * Qp / Q);
case 3: return +Math.Min(5.0, 3.0 + 0.05 * Qp / Q);
case 1: return +Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
case 2: return +Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
case 3: return +Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
}
}
}
public virtual bool IsPartCompatible(int waterMeterPartNr)
{
if ((this.Part == 0) || (waterMeterPartNr == 0)) return true;
if ((this.Part % 10) == waterMeterPartNr) return true;
if (((this.Part / 10) % 10) == waterMeterPartNr) return true;
if (((this.Part / 100) % 10) == waterMeterPartNr) return true;
if (((this.Part / 1000) % 10) == waterMeterPartNr) return true;
return false;
}
/// <summary>
/// Determines whether tests part number is OK.
/// Examples of correct part number are:
/// 1, 2, 12, 21 in case of max. part nr.== 2
/// 1, 2, 3, 4, 12, 13, 14, 23, 24, 34, 123, 124, 134, 234, 1234 in case of max. part nr.== 4
/// </summary>
/// <param name="partNr">Tests par tnumber</param>
/// <returns>true when Part number is OK</returns>
public static bool IsGoodPartNr(int partNr)
{
bool firstDigitIsOK = ((partNr % 10) > 0) && ((partNr % 10) <= Config.Data.MaxPartNr);
bool secondDigitIsOK = (((partNr/10) % 10) > 0) && (((partNr/10) % 10) <= Config.Data.MaxPartNr);
bool thirdDigitIsOK = (((partNr/100) % 10) > 0) && (((partNr/100) % 10) <= Config.Data.MaxPartNr);
bool fourthDigitIsOK = (((partNr/1000) % 10) > 0) && (((partNr/1000) % 10) <= Config.Data.MaxPartNr);
if (firstDigitIsOK && (partNr / 10 == 0)) return true;
if (firstDigitIsOK && secondDigitIsOK && (partNr / 100 == 0)) return true;
if (firstDigitIsOK && secondDigitIsOK && thirdDigitIsOK && (partNr / 1000 == 0)) return true;
if (firstDigitIsOK && secondDigitIsOK && thirdDigitIsOK && fourthDigitIsOK && (partNr / 10000 == 0)) return true;
return false;
}
public override string ToString()
{
+2 -56
View File
@@ -1,10 +1,7 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities
{
@@ -40,56 +37,5 @@ namespace Config.Entities
foreach (var step in TransitionSteps) { result.TransitionSteps.Add(step.Clone()); }
return result;
}
public virtual void Export(StreamWriter output)
{
output.WriteLine(ItemNr.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Name);
output.WriteLine(Description);
foreach (var step in TransitionSteps) { step.Export(output); }
output.WriteLine();
output.Close();
}
public static TransitionSequence Import(StreamReader input)
{
TransitionSequence result = new TransitionSequence();
result.ItemNr = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
result.Name = input.ReadLine();
result.Description = input.ReadLine();
while (true)
{
TransitionStep step = TransitionStep.Import(input, result);
if (step == null)
break;
else
result.TransitionSteps.Add(step);
}
return result;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
const string fmt = "{0} = {1}\r\n (in the file {2})\r\n";
string ln;
ln = inp.ReadLine(); /// skip ItemNr
ln = inp.ReadLine(); if (ln != Name) { diff.AppendFormat(fmt, "Name", Name, ln); };
ln = inp.ReadLine(); if (ln != Description) { diff.AppendFormat(fmt, "Description", Description, ln); };
//foreach (var step in TransitionSteps)
//{
// string testDiff = step.Compare(inp);
// if (testDiff.Contains(
//}
return diff.ToString();
}
}
}
}
+1 -62
View File
@@ -1,10 +1,8 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015, 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities
{
@@ -63,64 +61,5 @@ namespace Config.Entities
result += indent + "PumpsWithFMPct = " + PumpWithFMPcts + Environment.NewLine;
return result;
}
public virtual void Export(StreamWriter output)
{
CultureInfo ci = CultureInfo.InvariantCulture;
output.WriteLine(ItemNr.ToString(ci));
output.WriteLine(Duration.ToString(ci));
output.WriteLine(Message);
output.WriteLine(EndCondition);
output.WriteLine(ValvesOpen);
output.WriteLine(ValvesClose);
output.WriteLine(RegulValvesPct);
output.WriteLine(PumpWithFMPcts);
}
public static TransitionStep Import(StreamReader input, TransitionSequence newSequence)
{
string firstLine = input.ReadLine();
if (string.IsNullOrEmpty(firstLine))
{
return null;
}
CultureInfo ci = CultureInfo.InvariantCulture;
int itemNr = int.Parse(firstLine, ci);
TransitionStep tst = new TransitionStep(itemNr, newSequence);
tst.Duration = int.Parse(input.ReadLine(), ci);
tst.Message = input.ReadLine();
tst.EndCondition = input.ReadLine();
tst.ValvesOpen = input.ReadLine();
tst.ValvesClose = input.ReadLine();
tst.RegulValvesPct = input.ReadLine();
tst.PumpWithFMPcts = input.ReadLine();
return tst;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
string fmt = string.Format("Step {0} : ", ItemNr) + "{0} = {1}\r\n (in the file {2})\r\n";
string ln;
CultureInfo ci = CultureInfo.InvariantCulture;
string firstLine = inp.ReadLine();
if (string.IsNullOrEmpty(firstLine)) return string.Format("TransitionStep {0} is missing in the compared file\r\n", ItemNr);
if (ItemNr.ToString() != firstLine) { diff.AppendFormat(fmt, "ItemNr", ItemNr, firstLine); };
ln = inp.ReadLine(); if (ln != Duration.ToString(ci)) { diff.AppendFormat(fmt, "Duration", Duration.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Message) { diff.AppendFormat(fmt, "Message", Message, ln); };
ln = inp.ReadLine(); if (ln != EndCondition) { diff.AppendFormat(fmt, "EndCondition", EndCondition, ln); };
ln = inp.ReadLine(); if (ln != ValvesOpen) { diff.AppendFormat(fmt, "ValvesOpen", ValvesOpen, ln); };
ln = inp.ReadLine(); if (ln != ValvesClose) { diff.AppendFormat(fmt, "ValvesClose", ValvesClose, ln); };
ln = inp.ReadLine(); if (ln != RegulValvesPct) { diff.AppendFormat(fmt, "RegulValvesPct", RegulValvesPct, ln); };
ln = inp.ReadLine(); if (ln != PumpWithFMPcts) { diff.AppendFormat(fmt, "PumpWithFMPcts", PumpWithFMPcts, ln); };
return diff.ToString();
}
}
}
-20
View File
@@ -1,20 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
namespace Config.Entities
{
public class Uncertainty
{
public virtual int Id { get; protected set; }
public virtual float Measurement { get; set; }
public virtual float MainUncertainty { get; set; }
public virtual float Resolution { get; set; }
public virtual float DriftPerYr { get; set; }
public virtual float Conditions { get; set; }
public virtual float UncertaintyOfCorrection { get; set; }
public Uncertainty() { }
}
}
+2 -5
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -11,11 +11,8 @@ namespace Config.Entities
public virtual int Id { get; protected set; }
public virtual string UserName { get; set; } /// = name, alias, abbreviation
public virtual string FullName { get; set; } /// = description
public virtual string Tag { get; set; }
public virtual int Number { get; set; }
public virtual int Number { get; set; }
public virtual string Password { get; set; }
public virtual string Password2 { get; set; }
public virtual string Password3 { get; set; }
public virtual DateTime LastPwChange { get; set; }
public virtual IList<Group> Groups { get; set; } //User can be a member of a list of groups
+1 -21
View File
@@ -1,9 +1,8 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.IO;
namespace Config.Entities
{
@@ -36,24 +35,5 @@ namespace Config.Entities
foreach (var step in VirtualBenchSteps) { result.VirtualBenchSteps.Add(step.Clone()); }
return result;
}
public virtual void Export(StreamWriter output)
{
/// TODO
}
public static VirtualBenchSequence Import(StreamReader input)
{
VirtualBenchSequence result = new VirtualBenchSequence();
/// TODO
return result;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
/// TODO
return diff.ToString();
}
}
}
+62 -2
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
@@ -41,7 +41,7 @@ namespace Config
break;
case Users.Entities.DBKind.RemoteConfig:
dbType = Data.CurrentBench.UsersDBSettings.DbType;
connectionString = Data.CurrentBench.UsersDBSettings.ConnectionString;
connectionString = Data.CurrentBench.WaterMetersDBSettings.ConnectionString;
break;
}
@@ -127,6 +127,41 @@ namespace Config
return SessionFactories[ix].OpenSession();
}
public static void SaveToDb(Users.Entities.DBKind database, object obj)
{
SaveToDb(CreateSession(database), obj);
}
public static void SaveToDb(ISession session, object obj)
{
using (var transaction = session.BeginTransaction())
{
try
{
session.SaveOrUpdate(obj);
transaction.Commit();
}
catch
{
transaction.Rollback();
}
}
}
public static void DeleteFromDb(Users.Entities.DBKind database, object obj)
{
DeleteFromDb(CreateSession(database), obj);
}
public static void DeleteFromDb(ISession session, object obj)
{
using (var transaction = session.BeginTransaction())
{
session.Delete(obj);
transaction.Commit();
}
}
/// <summary>
/// Create an empty users database.
/// Database contains only the user 'admin' and the control board component 'CB'.
@@ -183,5 +218,30 @@ namespace Config
return true;
}
/// <summary>
/// Create an empty water meters database
/// </summary>
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
/// <param name="connectionString">Connection string</param>
/// <returns>true=success, false=error</returns>
public static bool CreateEmptyResultsDB(Users.Entities.DBType dbType, string connectionString)
{
ISessionFactory sessionFactory = CreateSessionFactory(Users.Entities.DBKind.Results, dbType, connectionString, true);
if (sessionFactory == null) return false;
/// Populate the database
//using (var session = sessionFactory.OpenSession())
//{
// using (var transaction = session.BeginTransaction())
// {
// /// Create one component
// var cmpnt = (new BenchControl.Elde.ControlBoardCfg("CB", 1)).CreateDbEntity();
// session.SaveOrUpdate(cmpnt);
// transaction.Commit();
// }
//}
return true;
}
}
}
+35 -50
View File
@@ -221,60 +221,45 @@ namespace Config
return error;
}
/// <summary>
/// Calculates corrected value form a list of corrections by interpolation.
/// It is assumed that values in the list 'corrections' are sorted.
/// </summary>
/// <param name="rawMeasurement">Raw uncorrected value</param>
/// <param name="corrections">Sorted (value, correction) pairs</param>
/// <returns>Corrected value</returns>
public static double CorrectedValue(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
{
if (corrections == null || corrections.Count == 0) return rawValue;
/// <summary>
/// Calculates corrected value from a list of corrections by interpolation.
/// It is assumed that values in the list 'corrections' are sorted.
/// </summary>
/// <param name="rawMeasurement">Raw uncorrected value</param>
/// <param name="corrections">Sorted (value, correction) pairs</param>
/// <returns>Corrected value</returns>
public static double CorrectedValue(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
{
return rawValue + GetCorrection(rawValue, corrections);
}
if (rawValue < corrections[0].Measurement)
{
return rawValue + corrections[0].Correction;
}
/// <summary>
/// Get a correction from a list of corrections by interpolation.
/// It is assumed that values in the list 'corrections' are sorted.
/// </summary>
/// <param name="rawMeasurement">Raw uncorrected value</param>
/// <param name="corrections">Sorted (value, correction) pairs</param>
/// <returns>Corrected value</returns>
public static double GetCorrection(double rawValue, IList<Config.Entities.MeasurementCorrection> corrections)
{
if ((corrections == null) || (corrections.Count == 0)) return 0; /// No correction
int count = corrections.Count;
for (int i = 1; i < count; i++)
{
if (rawValue < corrections[i].Measurement)
{
double d1 = rawValue - corrections[i-1].Measurement;
double d2 = corrections[i].Measurement - rawValue;
if (rawValue < corrections[0].Measurement)
{
/// rawValue is below the lowest value in the correction table
return corrections[0].Correction;
}
double corr;
if (d1 + d2 <= float.Epsilon)
{
corr = (corrections[i - 1].Correction + corrections[i].Correction) / 2.0;
}
else
{
corr = (corrections[i - 1].Correction * d2 + corrections[i].Correction * d1) / (d1 + d2);
}
return rawValue + corr;
}
}
int count = corrections.Count;
for (int i = 1; i < count; i++)
{
if (rawValue < corrections[i].Measurement)
{
double d1 = rawValue - corrections[i - 1].Measurement;
double d2 = corrections[i].Measurement - rawValue;
if (d1 + d2 <= float.Epsilon)
{
/// Neigboring values in the corection table are close to each other -> calculate the average
return (corrections[i - 1].Correction + corrections[i].Correction) / 2.0;
}
else
{
/// Interpolate the correction from neigboring values in the corection table
return (corrections[i - 1].Correction * d2 + corrections[i].Correction * d1) / (d1 + d2);
}
}
}
/// rawValue is above the highest value in the correction table
return corrections[count - 1].Correction;
}
return rawValue + corrections[count - 1].Correction;
}
/// <summary>
+2 -5
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Config.Entities;
@@ -23,9 +23,6 @@ namespace Config.Mappings
HasMany(x => x.Corrections)
.OrderBy("Measurement")
.Cascade.All();
HasMany(x => x.Uncertainties)
.OrderBy("Measurement")
.Cascade.All();
}
}
}
}
-22
View File
@@ -1,22 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class UncertaintyMap : ClassMap<Uncertainty>
{
public UncertaintyMap()
{
Id(x => x.Id);
Map(x => x.Measurement);
Map(x => x.MainUncertainty);
Map(x => x.Resolution);
Map(x => x.DriftPerYr);
Map(x => x.Conditions);
Map(x => x.UncertaintyOfCorrection);
}
}
}
+1 -6
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
@@ -12,12 +12,7 @@ namespace Config.Mappings
Id(x => x.Id);
Map(x => x.UserName).Column("Name");
Map(x => x.Number);
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
Map(x => x.Tag);
#endif
Map(x => x.Password);
Map(x => x.Password2);
Map(x => x.Password3);
Map(x => x.FullName).Column("Description");
Map(x => x.LastPwChange);
HasMany(x => x.Groups)
+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.24.1315.0")]
[assembly: AssemblyFileVersion("2.24.1315.0")]
[assembly: AssemblyVersion("2.18.928.0")]
[assembly: AssemblyFileVersion("2.18.928.0")]
+2 -75
View File
@@ -1,7 +1,4 @@
///
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
///
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -12,21 +9,7 @@ namespace Config
{
public static string SignificantDigitsToFmt(double value, int sigDigits)
{
if (sigDigits == 6)
{
if (value >= 99999.5 || value < -99999.5) return "F0";
else if (value >= 9999.95 || value < -9999.95) return "F1";
else if (value >= 999.995 || value < -999.995) return "F2";
else if (value >= 99.9995 || value < -99.9995) return "F3";
else if (value >= 9.99995 || value < -9.99995) return "F4";
else if (value >= 0.999995 || value < -0.999995) return "F5";
else if (value >= 0.0999995 || value < -0.0999995) return "F6";
else if (value >= 0.00999995 || value < -0.00999995) return "F7";
else if (value >= 0.000999995 || value < -0.000999995) return "F8";
else if (value >= 0.0000999995 || value < -0.0000999995) return "F9";
else return "F10";
}
else if (sigDigits == 5)
if (sigDigits == 5)
{
if (value >= 9999.5 || value < -9999.5) return "F0";
else if (value >= 999.95 || value < -999.95) return "F1";
@@ -82,61 +65,5 @@ namespace Config
else return "F5";
}
}
/// <summary>
/// Extract and return a DB server from a MySQL connection string.
/// </summary>
public static string GetDBServer(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "SERVER=" });
}
/// <summary>
/// Extract and return a DB name from a MySQL connection string.
/// </summary>
public static string GetDBName(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "DATABASE=" });
}
/// <summary>
/// Extract and return a username from a MySQL connection string
/// </summary>
public static string GetDBUser(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "USER=", "UID=" });
}
/// <summary>
/// Extract and return a password from a MySQL connection string
/// </summary>
public static string GetDBPassword(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "PASSWORD=", "PWD=" });
}
/// <summary>
/// Extract and return an element of a MySQL connection string
/// (a host, a database, a user name or a password).
/// Return an empty string on any error.
/// </summary>
public static string GetFromConnectionString(string connectionString, string[] patterns)
{
foreach (var pattern in patterns)
{
int startIx = connectionString.IndexOf(pattern);
if (startIx >= 0)
{
/// pattern found, extract the subsequent element
startIx += pattern.Length;
int endIx = connectionString.IndexOf(';', startIx);
return (endIx > 0) ? connectionString.Substring(startIx, endIx - startIx) : string.Empty;
}
}
/// pattern NOT found
return string.Empty;
}
}
}
-64
View File
@@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D476ABBE-A455-4476-8A8D-3F6151217B51}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Decrypt</RootNamespace>
<AssemblyName>Decrypt</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>Decrypt.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
-9
View File
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<StartArguments>config.xml</StartArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<StartArguments>config.xml</StartArguments>
</PropertyGroup>
</Project>
-96
View File
@@ -1,96 +0,0 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Decrypt
{
/// <summary>
/// See also:
/// https://www.fluxbytes.com/csharp/encrypt-and-decrypt-files-in-c/
/// </summary>
class Program
{
static byte[] key = new byte[] { 83, 254, 105, 64, 184, 201, 195, 127, 52, 99, 77, 45, 252, 132, 163, 156 };
static byte[] IV = new byte[] { 189, 23, 137, 56, 204, 241, 242, 118, 28, 89, 9, 198, 224, 111, 186, 125 };
static void Main(string[] args)
{
if ((args.Length < 1) || !File.Exists(args[0]))
{
Console.WriteLine("Usage: Decode <file>");
Console.ReadKey();
return;
}
string fileName = args[0];
string intermediateFile = fileName + ".plain"; /// Intermediate file, output of cryptography decoding
string backupFile = fileName + ".bak";
try
{
using (StreamReader reader = new StreamReader(fileName))
{
if (reader.ReadLine().StartsWith("<?xml version="))
{
Console.WriteLine(string.Format("File {0} is not encrypted.", fileName));
Console.ReadKey();
return;
}
}
bool successful = false;
using (RijndaelManaged aes = new RijndaelManaged { Padding = PaddingMode.Zeros })
{
using (FileStream fsCrypt = new FileStream(fileName, FileMode.Open))
{
using (FileStream fsOut = new FileStream(intermediateFile, FileMode.Create))
{
using (ICryptoTransform decryptor = aes.CreateDecryptor(key, IV))
{
using (CryptoStream cs = new CryptoStream(fsCrypt, decryptor, CryptoStreamMode.Read))
{
int data;
while ((data = cs.ReadByte()) != -1)
{
if (data != 0) fsOut.WriteByte((byte)data);
}
successful = true;
}
}
}
}
}
if (successful)
{
/// File decryption successfuly completed => rotate files
if (File.Exists(backupFile)) File.Delete(backupFile);
File.Move(fileName, backupFile);
File.Move(intermediateFile, fileName);
return;
}
else
{
Failed(fileName, intermediateFile, "");
return;
}
}
catch (Exception e)
{
Failed(fileName, intermediateFile, e.Message);
return;
}
}
static void Failed(string fileName, string toBeDeleted, string message)
{
if (File.Exists(toBeDeleted))
{
File.Delete(toBeDeleted);
}
Console.WriteLine(string.Format("Decryption of file {0} failed: {1}", fileName, message));
Console.ReadKey();
}
}
}
-36
View File
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Decrypt")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Decrypt")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c17ec788-0e12-4f9c-aadf-ea4e83a9f373")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
-3
View File
@@ -1,3 +0,0 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
+23 -85
View File
@@ -7,6 +7,7 @@ using System.Threading;
using System.Windows.Forms;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using TBF.BenchControl.GenericDevices;
using System.Xml.Serialization;
@@ -26,11 +27,11 @@ namespace DeviceTest
IComponentCfg component2Cfg;
IComponentCfg component3Cfg;
static IList<IDevice> tbfDevices;
static IList<IComponent> tbfComponents;
static IComponent tbfComponent1forOp;
static IComponent tbfComponent2forOp;
static IComponent tbfComponent3forOp;
static IList<TBF.BenchControl.Generic.IDevice> tbfDevices;
static IList<TBF.BenchControl.Generic.IComponent> tbfComponents;
static TBF.BenchControl.Generic.IComponent tbfComponent1forOp;
static TBF.BenchControl.Generic.IComponent tbfComponent2forOp;
static TBF.BenchControl.Generic.IComponent tbfComponent3forOp;
static Thread workerThread;
static bool workerThreadRunning;
@@ -55,10 +56,7 @@ namespace DeviceTest
static TBF.Boxes.FloatBox floatBox;
static TBF.Boxes.DoubleBox dblBox1;
static TBF.Boxes.DoubleBox dblBox2;
static TBF.Boxes.DoubleBox dblBox3;
static Event evnt;
static Event evnt;
static DeviceTestDlg()
@@ -275,14 +273,7 @@ namespace DeviceTest
radioButton3.Text = "SelectTank 3";
radioButton4.Text = "SelectTank -";
}
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";
else radioButton1.Text = "spare";
}
///
void UpdateOperations2(string className)
@@ -302,14 +293,7 @@ namespace DeviceTest
radioButton23.Text = "SelectTank 3";
radioButton24.Text = "SelectTank -";
}
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";
else radioButton21.Text = "spare";
}
///
void UpdateOperations3(string className)
@@ -329,14 +313,7 @@ namespace DeviceTest
radioButton33.Text = "SelectTank 3";
radioButton34.Text = "SelectTank -";
}
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";
else radioButton31.Text = "spare";
}
@@ -425,7 +402,7 @@ namespace DeviceTest
cfgControl.Config = parentCfg;
cfgControl.Config.ItemNr = 0;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
cfgForm.TbfComponents = new List<Config.Entities.Component>();
cfgForm.ComponentCfgCtrl = cfgControl;
@@ -454,7 +431,7 @@ namespace DeviceTest
cfgControl.Config = component1Cfg;
cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -488,7 +465,7 @@ namespace DeviceTest
cfgControl.Config = component2Cfg;
cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -523,7 +500,7 @@ namespace DeviceTest
cfgControl.Config = component3Cfg;
cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -680,25 +657,13 @@ namespace DeviceTest
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
}
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
{
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
}
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
//operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//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)
@@ -716,28 +681,16 @@ namespace DeviceTest
}
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
{
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
operation21 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation22 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
}
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
{
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
}
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
//operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//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)
@@ -755,38 +708,23 @@ namespace DeviceTest
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
operation31 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation32 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
//operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//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;
while (workerThreadRunning)
while (workerThreadRunning)
{
Thread.Sleep(1000);
StateMachine.Time = ++time;
if (workerThreadRunning)
if (workerThreadRunning)
{
foreach (var d in tbfDevices) d.RunDeviceBefore();
+2 -2
View File
@@ -72,10 +72,10 @@ namespace DeviceTest
}
/// Configure and start logging
log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Path.Combine(LocAppDataDir, log4netConfigFName)));
log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(LocAppDataDir + log4netConfigFName));
log = LogManager.GetLogger(typeof(Program));
log.Fatal("--------------------------------------------------------------------------------");
log.FatalFormat("DeviceTest ver.{0}", Version);
log.Fatal(string.Format("TBF ver.{0}", Version));
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
-64
View File
@@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DA9B09F3-A99D-4883-A954-537560453674}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Encrypt</RootNamespace>
<AssemblyName>Encrypt</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>Encrypt.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
-93
View File
@@ -1,93 +0,0 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Encrypt
{
/// <summary>
/// See also:
/// https://www.fluxbytes.com/csharp/encrypt-and-decrypt-files-in-c/
/// </summary>
class Program
{
static byte[] key = new byte[] { 83, 254, 105, 64, 184, 201, 195, 127, 52, 99, 77, 45, 252, 132, 163, 156 };
static byte[] IV = new byte[] { 189, 23, 137, 56, 204, 241, 242, 118, 28, 89, 9, 198, 224, 111, 186, 125 };
static void Main(string[] args)
{
if ((args.Length < 1) || !File.Exists(args[0]))
{
Console.WriteLine("Usage: Encode <file>");
Console.ReadKey();
return;
}
string fileName = args[0];
string intermediateFile = fileName + ".encrypted"; /// Intermediate file, output of cryptography encoding
string backupFile = fileName + ".bak";
try
{
using (StreamReader reader = new StreamReader(fileName))
{
if (!reader.ReadLine().StartsWith("<?xml version="))
{
Console.WriteLine(string.Format("File {0} is already encrypted.", fileName));
Console.ReadKey();
return;
}
}
bool successful = false;
using (RijndaelManaged aes = new RijndaelManaged { Padding = PaddingMode.Zeros })
{
using (FileStream fsCrypt = new FileStream(intermediateFile, FileMode.Create))
{
using (ICryptoTransform encryptor = aes.CreateEncryptor(key, IV))
{
using (CryptoStream cs = new CryptoStream(fsCrypt, encryptor, CryptoStreamMode.Write))
{
using (FileStream fsIn = new FileStream(fileName, FileMode.Open))
{
int data;
while ((data = fsIn.ReadByte()) != -1) cs.WriteByte((byte)data);
successful = true;
}
}
}
}
}
if (successful)
{
/// File encryption successfuly completed => rotate files
if (File.Exists(backupFile)) File.Delete(backupFile);
File.Move(fileName, backupFile);
File.Move(intermediateFile, fileName);
return;
}
else
{
Failed(fileName, intermediateFile);
return;
}
}
catch (Exception)
{
Failed(fileName, intermediateFile);
return;
}
}
static void Failed(string fileName, string toBeDeleted)
{
if (File.Exists(toBeDeleted))
{
File.Delete(toBeDeleted);
}
Console.WriteLine(string.Format("Encryption of file {0} failed.", fileName));
Console.ReadKey();
}
}
}
-36
View File
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Encrypt")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Encrypt")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0f602531-6f1f-416e-af4d-9242855715a8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
-3
View File
@@ -1,3 +0,0 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
+15
View File
@@ -121,6 +121,21 @@
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
<COMReference Include="GemCardExLib">
<Guid>{F1FF634B-BEDF-461C-A409-5B88E05F5117}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="SCARDSSPLib">
<Guid>{82C38704-19F1-11D3-A11F-00C04F79F800}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
</COMReference>
<COMReference Include="stdole">
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
<VersionMajor>2</VersionMajor>
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace TracingDB.Entities
namespace MonitoringDB.Entities
{
public class Part
{
@@ -19,20 +19,12 @@ namespace TracingDB.Entities
public virtual Workstep Workstep { get; set; }
public Part()
protected Part()
{
Name = string.Empty;
Description = string.Empty;
}
public Part(string name, Process process, string description)
{
Name = name;
Description = description;
Process = process;
Workstep = null;
}
/// <summary>
/// Constructor used when the part is added to a process
/// </summary>
@@ -59,28 +51,18 @@ namespace TracingDB.Entities
/// </summary>
/// <param name="process">Process owning the cloned part</param>
/// <returns>Cloned part</returns>
public virtual Part Clone(Process owningProcess)
{
Part rslt = new Part();
rslt.Name = Name;
public virtual Part Clone(Process owningProcess)
{
Part rslt = new Part(Name, owningProcess, CodeType, CodeForm, CodeLocation);
rslt.OraDBType = OraDBType;
rslt.Description = Description;
rslt.CodeType = CodeType;
rslt.CodeForm = CodeForm;
rslt.CodeLocation = CodeLocation;
rslt.LifetimeManagement = LifetimeManagement;
rslt.StepNumber = StepNumber;
rslt.Process = owningProcess;
rslt.Workstep = null;
return rslt;
}
rslt.LifetimeManagement = LifetimeManagement;
return rslt;
}
public override string ToString()
{
return string.Format("{0} ({1}: {2})", Name, StepNumber, Description);
return string.Format("{0} step={1} ({2})", Name, StepNumber, Description);
}
}
}
+68
View File
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
namespace MonitoringDB.Entities
{
public class Process
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; }
public virtual ReleaseStatus ReleaseStatus { get; set; }
public virtual DateTime TimeStamp { get; set; }
public virtual string UserName { get; set; }
public virtual IList<Part> Parts { get; set; }
public virtual IList<Workstep> Worksteps { get; set; }
/// <summary>
/// Default (private) constructor inicializing lists
/// </summary>
protected Process()
{
Parts = new List<Part>();
Worksteps = new List<Workstep>();
}
/// <summary>
/// Constructor used when this process is created
/// </summary>
/// <param name="name"></param>
public Process(string name)
: this()
{
Name = name;
Description = string.Empty;
ReleaseStatus = ReleaseStatus.In_preparation;
TimeStamp = DateTime.Now;
UserName = "admin";
}
/// <summary>
/// Create a copy of a process with a new name
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public virtual Process Clone(string name)
{
Process rslt = new Process(name);
rslt.Description = Description;
foreach (var part in Parts) rslt.Parts.Add(part.Clone(rslt));
foreach (var workstep in Worksteps) rslt.Worksteps.Add(workstep.Clone(rslt));
return rslt;
}
public override string ToString()
{
return string.Format("{0} '{1}' ({2}) {3} {4}",
ItemNr,
Name,
TimeStamp.Date.ToShortDateString(),
(Description == null) ? string.Empty : Description,
ReleaseStatus);
}
}
}
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace TracingDB.Entities
namespace MonitoringDB.Entities
{
public class Record
{
@@ -55,11 +55,7 @@ namespace TracingDB.Entities
public override string ToString()
{
return string.Format("code={0} part={1}{2} description={3}",
Code,
Part.Name,
string.IsNullOrEmpty(Part.OraDBType) ? string.Empty : string.Format(" ORACLE='{0}'", Part.OraDBType),
Part.Description);
return string.Format("code={0} part={1} description='{2}'", Code, Part.Name, Part.Description);
}
}
}
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace TracingDB.Entities
namespace MonitoringDB.Entities
{
public class ReferenceRecord
{
@@ -33,7 +33,6 @@ namespace TracingDB.Entities
/// <param name="code">Scanned barcode</param>
public ReferenceRecord(Process process, Workstep workstep, string code,
string userName, string workplace, int result)
: this()
{
Process = process;
Workstep = workstep;
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace TracingDB.Entities
namespace MonitoringDB.Entities
{
public class Workstep
{
@@ -9,47 +9,13 @@ namespace TracingDB.Entities
public virtual int WorkstepNr { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; }
public virtual int CheckPartNr { get; set; } /// 0 == No previous part checked
public virtual int CheckPartNr { get; set; }
public virtual bool AllowRepairs { get; set; }
public virtual Process Process { get; set; }
public virtual Part ReferencePart { get; set; }
public virtual IList<Part> Parts { get; set; }
public virtual Workstep Clone(Process owningProcess)
{
Workstep rslt = new Workstep(WorkstepNr, Name, owningProcess);
rslt.Description = Description;
rslt.CheckPartNr = CheckPartNr;
rslt.AllowRepairs = AllowRepairs;
if (ReferencePart != null)
{
foreach (var p in owningProcess.Parts)
{
if (p.Name == ReferencePart.Name)
{
rslt.ReferencePart = p;
break;
}
}
}
foreach (var srcP in Parts)
{
foreach (var p in owningProcess.Parts)
{
if ((p.Name == srcP.Name) && (p.StepNumber == srcP.StepNumber))
{
rslt.Parts.Add(p);
p.Workstep = rslt;
}
}
}
return rslt;
}
/// <summary>
/// Default (private) constructor inicializing a list
@@ -76,9 +42,41 @@ namespace TracingDB.Entities
ReferencePart = null;
}
public virtual Workstep Clone(Process owningProcess)
{
Workstep rslt = new Workstep(WorkstepNr, Name, owningProcess);
rslt.Description = Description;
rslt.CheckPartNr = CheckPartNr;
rslt.AllowRepairs = AllowRepairs;
if (ReferencePart != null)
{
foreach (var p in owningProcess.Parts)
{
if (p.Name == ReferencePart.Name) rslt.ReferencePart = p;
}
}
foreach (var srcP in Parts)
{
foreach (var p in owningProcess.Parts)
{
if (p.Name == srcP.Name)
{
rslt.Parts.Add(p);
p.StepNumber = srcP.StepNumber;
p.Workstep = rslt;
}
}
}
return rslt;
}
public override string ToString()
{
return Name; /// Displayed in Pracovisko.WorkstepDlg.workstepComboBox, Items are Workstep objects
//return string.Format("{0} {1} ({2}) Ref: {3}", WorkstepNr, Name, Description, (ReferencePart != null) ? ReferencePart.Name : "none");
return string.Format("{0}: {1}", WorkstepNr, Name);
}
}
}
+94
View File
@@ -0,0 +1,94 @@
namespace MonitoringDB
{
public enum CodeType
{
UniqueNr,
FlowtubeNr, /// prvé 3 znaky sa zhodujú s poslednými 3 znakmi názvu
FlowtubeNrLU, /// začiatok kódu sa zhoduje s názvom
BatchNr,
BatchNrContainingPartName,
DateMMYY,
QualityCheck,
}
public enum CodeForm
{
Barcode,
QRCode,
Keyboard,
OkNok,
}
public enum CodeLocation
{
OnPart,
OnPallet,
}
public enum LifetimeManagement
{
None,
OneYear,
Count,
}
public enum ReleaseStatus
{
In_preparation,
Released,
ReleasedActive,
Deactivated,
Count,
}
public enum Mode
{
Debug, // Debug mode - no Oracle database used
Test, // Test database used
Production, // Production database used
Count,
}
public enum LoginLevel
{
None,
TeamLeader,
Administrator,
MH,
Count,
}
public enum ItemSpecID
{
RefRecordID = 0,
TimeStamp,
Workstep,
Workplace,
UserName,
Barcode,
PartBarcode,
TimeStamp2,
Workstep2,
Workplace2,
UserName2,
Barcode2,
PartBarcode2,
SerialNr,
PurchaseOrder,
TestResult,
MaxPruefindex,
Process,
}
public enum ItemSpecCaps
{
None = 0,
ReferenceRecord = 1,
AssociatedRecord = 2,
OracleQuery = 4,
}
}
+212
View File
@@ -0,0 +1,212 @@
using System;
using System.Collections.Generic;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
namespace MonitoringDB
{
public static class FluentNH
{
/// <summary>
/// Current session factory for the last used connection string or null
/// </summary>
public static ISessionFactory SessionFactory;
/// <summary> Connection string for all sessions </summary>
static string connectionString;
///
public static string ConnectionString
{
get { return connectionString; }
set
{
if (value != connectionString)
{
connectionString = value;
SessionFactory = null; /// Clear SessionFactory on connection string change
}
}
}
/// <summary>
/// NHibernate session factory (to create the database session 'SessionFactory')
/// </summary>
/// <returns>A database session</returns>
static ISessionFactory CreateSessionFactory()
{
return CreateSessionFactory(false);
}
/// <summary>
/// NHibernate session factory (to create the database session 'SessionFactory')
/// </summary>
/// <returns>A database session</returns>
public static ISessionFactory CreateSessionFactory(bool createDB)
{
FluentConfiguration cfg = Fluently
.Configure()
.Database(MySQLConfiguration.Standard.ConnectionString(connectionString))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entities.Process>());
if (createDB)
{
return cfg.ExposeConfiguration(BuildSchemaCreate).BuildSessionFactory();
}
else
{
return cfg.ExposeConfiguration(BuildSchema).BuildSessionFactory();
}
}
public delegate void BuildSchemaDlgt(Configuration config);
public static void BuildSchema(Configuration config)
{
/// This NHibernate tool takes a configuration (with mapping info in)
/// and exports a database schema from it
new SchemaExport(config).SetOutputFile("db_schema");
}
static void BuildSchemaCreate(Configuration config)
{
/// This NHibernate tool takes a configuration (with mapping info in)
/// and exports a database schema from it
new SchemaExport(config).Create(true, true);
}
/// Create a NHibernate session for the given database
public static ISession CreateSession(string connectionString)
{
ConnectionString = connectionString; /// Clears session factory on connction string change
if (SessionFactory == null)
SessionFactory = CreateSessionFactory();
return SessionFactory.OpenSession();
}
/// <summary>
/// Create an empty database.
/// Database contains only the user 'admin' and the control board component 'CB'.
/// </summary>
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
/// <param name="connectionString">Connection string</param>
/// <returns>true=success, false=error</returns>
public static bool CreateEmptyDB(string connectionString)
{
ConnectionString = connectionString;
ISessionFactory sessionFactory = CreateSessionFactory(true);
if (sessionFactory == null) return false;
/// Populate the database
using (var session = sessionFactory.OpenSession())
{
//using (var transaction = session.BeginTransaction())
//{
// var part1 = new MonitoringDB.Entities.Part("flow tube", CodeType.UniqueNr, CodeForm.QRCode, 0);
// session.SaveOrUpdate(part1);
// transaction.Commit();
//}
}
return true;
}
public static IList<WMPart> FindWMParts(string pcbNumber, string connString)
{
IList<WMPart> foundParts = new List<WMPart>(); /// initially empty
if (string.IsNullOrEmpty(pcbNumber)) return foundParts; /// return an empty list
try
{
ISession session = CreateSession(connString);
IList<Entities.ReferenceRecord> referenceRecords = session
.QueryOver<Entities.ReferenceRecord>()
.Where(x => (x.Code == pcbNumber))
.OrderBy(x => x.TimeStamp).Desc
.List<Entities.ReferenceRecord>();
if (referenceRecords.Count == 0) return foundParts;
foundParts.Add(new WMPart(referenceRecords[0]));
Entities.Process process = referenceRecords[0].Process;
///
foreach (var refR in referenceRecords)
{
if (process != refR.Process)
{
continue; /// skip records obtained by another process
}
IList<Entities.Record> relatedRecords = session
.QueryOver<Entities.Record>()
.Where(x => (x.ReferenceRecord == refR))
.List<Entities.Record>();
foreach (var relR in relatedRecords)
{
foundParts.Add(new WMPart(relR));
foreach (var ws in process.Worksteps)
{
if (ws.ReferencePart == relR.Part)
{
FindWMPartsRecursively(process, ws.ReferencePart, relR.Code, session, ref foundParts);
}
}
}
}
}
catch
{
}
return foundParts;
}
static void FindWMPartsRecursively(Entities.Process process, Entities.Part refPart, string code, ISession session, ref IList<WMPart> foundParts)
{
IList<Entities.ReferenceRecord> referenceRecords = session
.QueryOver<Entities.ReferenceRecord>()
.Where(x => (x.Workstep.ReferencePart == refPart))
.Where(x => (x.Code == code))
.OrderBy(x => x.TimeStamp).Desc
.List<Entities.ReferenceRecord>();
if (referenceRecords.Count == 0) return;
foreach (var refR in referenceRecords)
{
IList<Entities.Record> relatedRecords = session
.QueryOver<Entities.Record>()
.Where(x => (x.ReferenceRecord == refR))
.List<Entities.Record>();
foreach (var relR in relatedRecords)
{
foundParts.Add(new WMPart(relR));
foreach (var ws in process.Worksteps)
{
if (ws.ReferencePart == relR.Part)
{
FindWMPartsRecursively(process, ws.ReferencePart, relR.Code, session, ref foundParts);
}
}
}
}
}
}
}
@@ -9,7 +9,7 @@ using System.Data;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace TracingDB.Forms
namespace MonitoringDB.Forms
{
/// <summary>
/// Event Handler for SubItem events
@@ -61,10 +61,6 @@ namespace TracingDB.Forms
private const int HDN_ITEMCHANGINGW = (HDN_FIRST-20);
#endregion
public SortOrder SortOrder = SortOrder.None;
public int SortColumn = -1;
/// <summary>
/// Required designer variable.
/// </summary>
@@ -398,18 +394,12 @@ namespace TracingDB.Forms
OnSubItemEndEditing(e);
if (_editSubItem >= 0 && _editSubItem < _editItem.SubItems.Count)
{
_editItem.SubItems[_editSubItem].Text = e.DisplayText;
}
_editItem.SubItems[_editSubItem].Text = e.DisplayText;
if (_editingControl != null)
{
_editingControl.Leave -= new EventHandler(_editControl_Leave);
_editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress);
_editingControl.Leave -= new EventHandler(_editControl_Leave);
_editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress);
_editingControl.Visible = false;
}
_editingControl.Visible = false;
_editingControl = null;
_editItem = null;
@@ -1,4 +1,4 @@
namespace Statistics.Forms
namespace MonitoringDB.Forms
{
partial class ModelessForm
{
@@ -2,7 +2,7 @@
using System.Drawing;
using System.Windows.Forms;
namespace Statistics.Forms
namespace MonitoringDB.Forms
{
public partial class ModelessForm : Form
{
@@ -5,10 +5,10 @@ using System;
using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using TracingDB.Entities;
using TracingDB.Resources;
using MonitoringDB.Entities;
using MonitoringDB.Resources;
namespace TracingDB.Forms
namespace MonitoringDB.Forms
{
public partial class ResultsConfigDlg : Form
{
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2016 Sensus Metering Systems
///
namespace TracingDB.Forms
namespace MonitoringDB.Forms
{
partial class ResultsConfigDlg
{
@@ -39,7 +39,7 @@ namespace TracingDB.Forms
this.removeAllButton = new System.Windows.Forms.Button();
this.removeButton = new System.Windows.Forms.Button();
this.addButton = new System.Windows.Forms.Button();
this.selectedResultsListViewEx = new TracingDB.Forms.ListViewEx();
this.selectedResultsListViewEx = new MonitoringDB.Forms.ListViewEx();
this.upButton = new System.Windows.Forms.Button();
this.downButton = new System.Windows.Forms.Button();
this.SuspendLayout();
@@ -133,8 +133,8 @@ namespace TracingDB.Forms
this.selectedResultsListViewEx.TabIndex = 47;
this.selectedResultsListViewEx.UseCompatibleStateImageBehavior = false;
this.selectedResultsListViewEx.View = System.Windows.Forms.View.Details;
this.selectedResultsListViewEx.SubItemClicked += new TracingDB.Forms.SubItemEventHandler(this.selectedResultsListViewEx_SubItemClicked);
this.selectedResultsListViewEx.SubItemEndEditing += new TracingDB.Forms.SubItemEndEditingEventHandler(this.selectedResultsListViewEx_SubItemEndEditing);
this.selectedResultsListViewEx.SubItemClicked += new MonitoringDB.Forms.SubItemEventHandler(this.selectedResultsListViewEx_SubItemClicked);
this.selectedResultsListViewEx.SubItemEndEditing += new MonitoringDB.Forms.SubItemEndEditingEventHandler(this.selectedResultsListViewEx_SubItemEndEditing);
//
// upButton
//
+263
View File
@@ -0,0 +1,263 @@
namespace MonitoringDB.Forms
{
partial class SettingsDlg
{
/// <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.groupBox1 = new System.Windows.Forms.GroupBox();
this.connectionStringTextBox = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.workplaceNameTextBox = new System.Windows.Forms.TextBox();
this.saveButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.extraBatteryLifetimeTextBox = new System.Windows.Forms.TextBox();
this.oracleGroupBox = new System.Windows.Forms.GroupBox();
this.checkPcbIsInOracleCheckBox = new System.Windows.Forms.CheckBox();
this.oracleBatteryCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.usersDBConnStringTextBox = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.oracleGroupBox.SuspendLayout();
this.groupBox5.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.connectionStringTextBox);
this.groupBox1.Location = new System.Drawing.Point(12, 69);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(622, 50);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Connection string pre záznamy z výroby";
//
// connectionStringTextBox
//
this.connectionStringTextBox.Location = new System.Drawing.Point(17, 18);
this.connectionStringTextBox.Name = "connectionStringTextBox";
this.connectionStringTextBox.Size = new System.Drawing.Size(586, 20);
this.connectionStringTextBox.TabIndex = 0;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.radioButton2);
this.groupBox2.Controls.Add(this.radioButton1);
this.groupBox2.Location = new System.Drawing.Point(12, 250);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(268, 70);
this.groupBox2.TabIndex = 4;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Režim činnosti";
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(101, 41);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(58, 17);
this.radioButton2.TabIndex = 1;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "Výroba";
this.radioButton2.UseVisualStyleBackColor = true;
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(101, 20);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(46, 17);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Test";
this.radioButton1.UseVisualStyleBackColor = true;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.workplaceNameTextBox);
this.groupBox3.Location = new System.Drawing.Point(12, 12);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(622, 50);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Meno pracoviska";
//
// workplaceNameTextBox
//
this.workplaceNameTextBox.Location = new System.Drawing.Point(17, 18);
this.workplaceNameTextBox.Name = "workplaceNameTextBox";
this.workplaceNameTextBox.Size = new System.Drawing.Size(586, 20);
this.workplaceNameTextBox.TabIndex = 0;
//
// saveButton
//
this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.saveButton.Location = new System.Drawing.Point(348, 270);
this.saveButton.Name = "saveButton";
this.saveButton.Size = new System.Drawing.Size(104, 42);
this.saveButton.TabIndex = 6;
this.saveButton.Text = "Uložiť";
this.saveButton.UseVisualStyleBackColor = true;
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.Location = new System.Drawing.Point(488, 270);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(104, 42);
this.cancelButton.TabIndex = 7;
this.cancelButton.Text = "Zrušiť";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// groupBox4
//
this.groupBox4.Controls.Add(this.extraBatteryLifetimeTextBox);
this.groupBox4.Location = new System.Drawing.Point(12, 182);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(268, 62);
this.groupBox4.TabIndex = 3;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Predĺženie životnosti baterky v mesiacoch";
//
// extraBatteryLifetimeTextBox
//
this.extraBatteryLifetimeTextBox.Location = new System.Drawing.Point(17, 25);
this.extraBatteryLifetimeTextBox.Name = "extraBatteryLifetimeTextBox";
this.extraBatteryLifetimeTextBox.Size = new System.Drawing.Size(230, 20);
this.extraBatteryLifetimeTextBox.TabIndex = 0;
//
// oracleGroupBox
//
this.oracleGroupBox.Controls.Add(this.checkPcbIsInOracleCheckBox);
this.oracleGroupBox.Controls.Add(this.oracleBatteryCheckBox);
this.oracleGroupBox.Location = new System.Drawing.Point(297, 182);
this.oracleGroupBox.Name = "oracleGroupBox";
this.oracleGroupBox.Size = new System.Drawing.Size(337, 74);
this.oracleGroupBox.TabIndex = 5;
this.oracleGroupBox.TabStop = false;
this.oracleGroupBox.Text = "Oracle";
this.oracleGroupBox.Visible = false;
//
// checkPcbIsInOracleCheckBox
//
this.checkPcbIsInOracleCheckBox.AutoSize = true;
this.checkPcbIsInOracleCheckBox.Location = new System.Drawing.Point(18, 45);
this.checkPcbIsInOracleCheckBox.Name = "checkPcbIsInOracleCheckBox";
this.checkPcbIsInOracleCheckBox.Size = new System.Drawing.Size(213, 17);
this.checkPcbIsInOracleCheckBox.TabIndex = 0;
this.checkPcbIsInOracleCheckBox.Text = "Skontrolovať či PCB už bola overovaná";
this.checkPcbIsInOracleCheckBox.UseVisualStyleBackColor = true;
//
// oracleBatteryCheckBox
//
this.oracleBatteryCheckBox.AutoSize = true;
this.oracleBatteryCheckBox.Location = new System.Drawing.Point(18, 19);
this.oracleBatteryCheckBox.Name = "oracleBatteryCheckBox";
this.oracleBatteryCheckBox.Size = new System.Drawing.Size(193, 17);
this.oracleBatteryCheckBox.TabIndex = 0;
this.oracleBatteryCheckBox.Text = "Uložiť informácie o batérii do Oracle";
this.oracleBatteryCheckBox.UseVisualStyleBackColor = true;
//
// groupBox5
//
this.groupBox5.Controls.Add(this.usersDBConnStringTextBox);
this.groupBox5.Location = new System.Drawing.Point(12, 125);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(622, 50);
this.groupBox5.TabIndex = 2;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Connection string pre centrálnu databázu používateľov";
//
// usersDBConnStringTextBox
//
this.usersDBConnStringTextBox.Location = new System.Drawing.Point(17, 18);
this.usersDBConnStringTextBox.Name = "usersDBConnStringTextBox";
this.usersDBConnStringTextBox.Size = new System.Drawing.Size(586, 20);
this.usersDBConnStringTextBox.TabIndex = 0;
//
// SettingsDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(648, 333);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.oracleGroupBox);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.saveButton);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "SettingsDlg";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "SettingsDlg";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.oracleGroupBox.ResumeLayout(false);
this.oracleGroupBox.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox connectionStringTextBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TextBox workplaceNameTextBox;
private System.Windows.Forms.Button saveButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.TextBox extraBatteryLifetimeTextBox;
private System.Windows.Forms.GroupBox oracleGroupBox;
private System.Windows.Forms.CheckBox oracleBatteryCheckBox;
private System.Windows.Forms.CheckBox checkPcbIsInOracleCheckBox;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.TextBox usersDBConnStringTextBox;
}
}
+87
View File
@@ -0,0 +1,87 @@
using System;
using System.Windows.Forms;
namespace MonitoringDB.Forms
{
public partial class SettingsDlg : Form
{
public string WorkplaceName
{
set { workplaceNameTextBox.Text = value; }
get { return workplaceNameTextBox.Text; }
}
public string ConnectionString
{
set { connectionStringTextBox.Text = value; }
get { return connectionStringTextBox.Text; }
}
public string UsersDBConnString
{
set { usersDBConnStringTextBox.Text = value; }
get { return usersDBConnStringTextBox.Text; }
}
public bool OracleBattery
{
set { oracleBatteryCheckBox.Checked = value; }
get { return oracleBatteryCheckBox.Checked; }
}
public bool CheckPcbIsInOracle
{
set { checkPcbIsInOracleCheckBox.Checked = value; }
get { return checkPcbIsInOracleCheckBox.Checked; }
}
public int ExtraBatterLifetime
{
get
{
int extraLifetime;
if (int.TryParse(extraBatteryLifetimeTextBox.Text, out extraLifetime) && extraLifetime >= 0) return extraLifetime;
return 0;
}
}
public MonitoringDB.Mode Mode
{
set
{
radioButton1.Checked = (value == MonitoringDB.Mode.Test);
radioButton2.Checked = (value == MonitoringDB.Mode.Production);
}
get
{
return radioButton1.Checked ? MonitoringDB.Mode.Test : MonitoringDB.Mode.Production;
}
}
/// <summary>
/// Basic configuration dialog
/// </summary>
/// <param name="isWorkplace">false = Konfiguracia pracovisk, true = Pracovisko</param>
public SettingsDlg(bool isWorkplace)
{
InitializeComponent();
if (isWorkplace)
{
oracleGroupBox.Visible = true;
}
extraBatteryLifetimeTextBox.Text = "0";
}
private void saveButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
Close();
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}
+49
View File
@@ -0,0 +1,49 @@
using System;
using System.Windows.Forms;
namespace MonitoringDB.Forms
{
public partial class TrivialLoginDlg : Form
{
public LoginLevel LoginLevel;
public TrivialLoginDlg()
{
InitializeComponent();
LoginLevel = LoginLevel.None;
}
private void okButton_Click(object sender, EventArgs e)
{
if (passwordTextBox.Text.ToLower().Equals("barcode"))
{
LoginLevel = LoginLevel.Administrator;
DialogResult = DialogResult.OK;
Close();
}
else if (passwordTextBox.Text.ToLower().Equals("teamleader"))
{
LoginLevel = LoginLevel.TeamLeader;
DialogResult = DialogResult.OK;
Close();
}
else if (passwordTextBox.Text.ToLower().Equals("kremik"))
{
LoginLevel = LoginLevel.MH;
DialogResult = DialogResult.OK;
Close();
}
else
{
DialogResult = DialogResult.Cancel;
Close();
}
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}
+105
View File
@@ -0,0 +1,105 @@
namespace MonitoringDB.Forms
{
partial class TrivialLoginDlg
{
/// <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.passwordGroupBox = new System.Windows.Forms.GroupBox();
this.passwordTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.passwordGroupBox.SuspendLayout();
this.SuspendLayout();
//
// passwordGroupBox
//
this.passwordGroupBox.Controls.Add(this.passwordTextBox);
this.passwordGroupBox.Location = new System.Drawing.Point(12, 10);
this.passwordGroupBox.Name = "passwordGroupBox";
this.passwordGroupBox.Size = new System.Drawing.Size(200, 49);
this.passwordGroupBox.TabIndex = 0;
this.passwordGroupBox.TabStop = false;
this.passwordGroupBox.Text = "Heslo";
//
// passwordTextBox
//
this.passwordTextBox.Location = new System.Drawing.Point(51, 18);
this.passwordTextBox.Name = "passwordTextBox";
this.passwordTextBox.PasswordChar = '*';
this.passwordTextBox.Size = new System.Drawing.Size(100, 20);
this.passwordTextBox.TabIndex = 0;
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(237, 18);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 39);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(330, 18);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 39);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// LoginDlg
//
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(426, 73);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.passwordGroupBox);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LoginDlg";
this.Text = "LoginDlg";
this.passwordGroupBox.ResumeLayout(false);
this.passwordGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox passwordGroupBox;
private System.Windows.Forms.TextBox passwordTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
}
}
@@ -3,12 +3,12 @@
///
using System;
using System.Collections.Generic;
using TracingDB.Entities;
using TracingDB.Resources;
using MonitoringDB.Entities;
using MonitoringDB.Resources;
using NHibernate;
using NHibernate.Criterion;
namespace TracingDB
namespace MonitoringDB
{
public class ItemSpec
{
@@ -50,11 +50,6 @@ namespace TracingDB
Width = 0;
}
public override string ToString()
{
return string.Format("uid={0}, name={1}, caption={2}", Uid, Name, Caption);
}
/// <summary> Copy constructor </summary>
public ItemSpec Clone()
{
@@ -99,58 +94,28 @@ namespace TracingDB
{
AllItems = new List<ItemSpec>();
AllItems.Add(new ItemSpec(ItemSpecID.RefRecordID, Strings.RefRecordID, (x, f, p, w) => ((int)x).ToString(), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.RefRecordID, Strings.RefRecordID, (x, f, p, w) => ((int)x).ToString(), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp, Strings.Time_stamp, (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workstep, Strings.Workstep, (x, f, p, w) => FormatStr(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workplace, Strings.Workplace, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.UserName, Strings.User_name, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Barcode, Strings.Ref_part_barcode, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.RefPartName, Strings.Ref_part_name, (x, f, p, w) => FormatStr(f, ((Workstep)x).ReferencePart.Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode, Strings.Part_barcode, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartName, Strings.Part_name, (x, f, p, w) => FormatStr(f, ((Part)x).Name), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp, Strings.Time_stamp, (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workstep, Strings.Workstep, (x, f, p, w) => string.IsNullOrEmpty(f) ? ((Workstep)x).Name : string.Format(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workplace, Strings.Workplace, (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.UserName, Strings.User_name, (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Barcode, Strings.Barcode, (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode, Strings.Part_barcode, (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp2, Strings.Time_stamp+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workstep2, Strings.Workstep + "2", (x, f, p, w) => FormatStr(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workplace2, Strings.Workplace + "2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.UserName2, Strings.User_name + "2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Barcode2, Strings.Barcode + "2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode2, Strings.Part_barcode+"2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp2, Strings.Time_stamp+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workstep2, Strings.Workstep+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? ((Workstep)x).Name : string.Format(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workplace2, Strings.Workplace+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.UserName2, Strings.User_name+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Barcode2, Strings.Barcode+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode2, Strings.Part_barcode+"2",(x, f, p, w)=> string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.SerialNr, Strings.Serial_nr, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.PurchaseOrder, Strings.Purchase_order, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.TestResult, Strings.Test_result, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.MaxPruefindex, Strings.Tests_count, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.MaxTestindexEx,Strings.Tests_count_and_rslt,(x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.TestBenchId, Strings.Test_bench_Id, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.Process, Strings.Process, (x, f, p, w) => FormatStr(f, ((Process)x).Name), ItemSpecCaps.ReferenceRecord));
}
public static string FormatStr(string format, object value)
{
int len;
if (string.IsNullOrEmpty(format))
{
return (string)value;
}
else if (int.TryParse(format, out len) && len > 0)
{
if (((string)value).Length >= len)
{
return ((string)value).Substring(0, len);
}
else
{
return (string)value;
}
}
else
{
return string.Format(format, value);
}
AllItems.Add(new ItemSpec(ItemSpecID.SerialNr, Strings.Serial_nr, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.PurchaseOrder, Strings.Purchase_order, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.TestResult, Strings.Test_result, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.MaxPruefindex, Strings.Max_pruefindex, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.Process, Strings.Process, (x, f, p, w) => string.IsNullOrEmpty(f) ? ((Process)x).Name : string.Format(f, ((Process)x).Name), ItemSpecCaps.ReferenceRecord));
}
public PropertyProjection GetProperty(ReferenceRecord refRecord, Record record)
@@ -164,9 +129,7 @@ namespace TracingDB
case ItemSpecID.Workplace: return Projections.Property(() => refRecord.Workplace);
case ItemSpecID.UserName: return Projections.Property(() => refRecord.UserName);
case ItemSpecID.Barcode: return Projections.Property(() => refRecord.Code);
case ItemSpecID.RefPartName: return Projections.Property(() => refRecord.Workstep);
case ItemSpecID.PartBarcode: return Projections.Property(() => record.Code);
case ItemSpecID.PartName: return Projections.Property(() => record.Part);
case ItemSpecID.TimeStamp2: return null;
case ItemSpecID.Workstep2: return null;
@@ -179,8 +142,6 @@ namespace TracingDB
case ItemSpecID.PurchaseOrder: return null;
case ItemSpecID.TestResult: return null;
case ItemSpecID.MaxPruefindex: return null;
case ItemSpecID.MaxTestindexEx: return null;
case ItemSpecID.TestBenchId: return null;
case ItemSpecID.Process: return Projections.Property(() => refRecord.Process);
@@ -212,8 +173,6 @@ namespace TracingDB
case ItemSpecID.PurchaseOrder: return null;
case ItemSpecID.TestResult: return null;
case ItemSpecID.MaxPruefindex: return null;
case ItemSpecID.MaxTestindexEx: return null;
case ItemSpecID.TestBenchId: return null;
case ItemSpecID.Process: return Projections.Property(() => refRecord2.Process);
@@ -1,6 +1,6 @@
using FluentNHibernate.Mapping;
namespace TracingDB.Mappings
namespace MonitoringDB.Mappings
{
class PartMap : ClassMap<Entities.Part>
{
+25
View File
@@ -0,0 +1,25 @@
using FluentNHibernate.Mapping;
namespace MonitoringDB.Mappings
{
class ProcessMap : ClassMap<Entities.Process>
{
public ProcessMap()
{
Id(x => x.Id);
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Description);
Map(x => x.ReleaseStatus);
Map(x => x.TimeStamp);
Map(x => x.UserName);
HasMany(x => x.Parts)
.OrderBy("Name")
.Cascade.All();
HasMany(x => x.Worksteps)
.OrderBy("WorkstepNr")
.Cascade.All();
}
}
}
@@ -1,6 +1,6 @@
using FluentNHibernate.Mapping;
namespace TracingDB.Mappings
namespace MonitoringDB.Mappings
{
class RecordMap : ClassMap<Entities.Record>
{
@@ -1,6 +1,6 @@
using FluentNHibernate.Mapping;
namespace TracingDB.Mappings
namespace MonitoringDB.Mappings
{
class ReferenceRecordMap : ClassMap<Entities.ReferenceRecord>
{
@@ -1,6 +1,6 @@
using FluentNHibernate.Mapping;
namespace TracingDB.Mappings
namespace MonitoringDB.Mappings
{
class WorkstepMap : ClassMap<Entities.Workstep>
{
@@ -8,8 +8,8 @@
<ProjectGuid>{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TracingDB</RootNamespace>
<AssemblyName>TracingDB</AssemblyName>
<RootNamespace>MonitoringDB</RootNamespace>
<AssemblyName>MonitoringDB</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
@@ -61,14 +61,15 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BatteryAndFlowtubeInfo.cs" />
<Compile Include="Entities\WorkplaceRegistration.cs" />
<Compile Include="Forms\ListViewEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Forms\ListViewExtensions.cs" />
<Compile Include="Forms\LviIntColumnComparer.cs" />
<Compile Include="Forms\LviTextColumnComparer.cs" />
<Compile Include="Forms\TrivialLoginDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\TrivialLoginDlg.designer.cs">
<DependentUpon>TrivialLoginDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\ModelessForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -81,8 +82,13 @@
<Compile Include="Forms\ResultsConfigDlg.designer.cs">
<DependentUpon>ResultsConfigDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\SettingsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\SettingsDlg.designer.cs">
<DependentUpon>SettingsDlg.cs</DependentUpon>
</Compile>
<Compile Include="ItemSpec.cs" />
<Compile Include="Mappings\WorkplaceRegistrationMap.cs" />
<Compile Include="QuitAppException.cs" />
<Compile Include="Resources\Strings.Designer.cs">
<AutoGen>True</AutoGen>
@@ -98,7 +104,7 @@
<Compile Include="Entities\ReferenceRecord.cs" />
<Compile Include="Entities\Workstep.cs" />
<Compile Include="Enums.cs" />
<Compile Include="DB.cs" />
<Compile Include="FluentNH.cs" />
<Compile Include="Mappings\PartMap.cs" />
<Compile Include="Mappings\ProcessMap.cs" />
<Compile Include="Mappings\RecordMap.cs" />
@@ -110,18 +116,23 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="WPlaceRegistrationMgmt.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Forms\ListViewEx.resx">
<DependentUpon>ListViewEx.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\TrivialLoginDlg.resx">
<DependentUpon>TrivialLoginDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ModelessForm.resx">
<DependentUpon>ModelessForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ResultsConfigDlg.resx">
<DependentUpon>ResultsConfigDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\SettingsDlg.resx">
<DependentUpon>SettingsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -130,18 +141,11 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Strings.sk.resx" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RecordProcessing\RecordProcessing.csproj">
<Project>{67BD7A8F-0FED-4FDE-B875-78D5A2BC9B2C}</Project>
<Name>RecordProcessing</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Common")]
[assembly: AssemblyCopyright("Copyright © 2015-2018 Sensus Slovensko, a.s.")]
[assembly: AssemblyCopyright("Copyright © 2015-2017")]
[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.0.81.0")]
[assembly: AssemblyFileVersion("2.0.81.0")]
[assembly: AssemblyVersion("1.5.57.0")]
[assembly: AssemblyFileVersion("1.5.57.0")]
@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace TracingDB.Properties {
namespace MonitoringDB.Properties {
using System;
@@ -39,7 +39,7 @@ namespace TracingDB.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TracingDB.Properties.Resources", typeof(Resources).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MonitoringDB.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
@@ -1,6 +1,6 @@
using System;
namespace TracingDB
namespace MonitoringDB
{
public class QuitAppException : Exception
{
@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace TracingDB.Resources {
namespace MonitoringDB.Resources {
using System;
@@ -39,7 +39,7 @@ namespace TracingDB.Resources {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TracingDB.Resources.Strings", typeof(Strings).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MonitoringDB.Resources.Strings", typeof(Strings).Assembly);
resourceMan = temp;
}
return resourceMan;
@@ -160,7 +160,7 @@ namespace TracingDB.Resources {
}
/// <summary>
/// Looks up a localized string similar to Another part barcode (s/n).
/// Looks up a localized string similar to Another part barcode.
/// </summary>
internal static string Part_barcode {
get {
@@ -168,15 +168,6 @@ namespace TracingDB.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Another part name (SAP nr.).
/// </summary>
internal static string Part_name {
get {
return ResourceManager.GetString("Part_name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Precision.
/// </summary>
@@ -187,7 +178,7 @@ namespace TracingDB.Resources {
}
/// <summary>
/// Looks up a localized string similar to Workflow.
/// Looks up a localized string similar to Process.
/// </summary>
internal static string Process {
get {
@@ -204,24 +195,6 @@ namespace TracingDB.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Ref. part barcode (s/n).
/// </summary>
internal static string Ref_part_barcode {
get {
return ResourceManager.GetString("Ref_part_barcode", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Ref. part name (SAP nr.).
/// </summary>
internal static string Ref_part_name {
get {
return ResourceManager.GetString("Ref_part_name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Record ID.
/// </summary>
@@ -285,15 +258,6 @@ namespace TracingDB.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Test bench Id.
/// </summary>
internal static string Test_bench_Id {
get {
return ResourceManager.GetString("Test_bench_Id", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Test result.
/// </summary>
@@ -303,24 +267,6 @@ namespace TracingDB.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Tests count.
/// </summary>
internal static string Tests_count {
get {
return ResourceManager.GetString("Tests_count", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Tests count (negative when NOK).
/// </summary>
internal static string Tests_count_and_rslt {
get {
return ResourceManager.GetString("Tests_count_and_rslt", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Text.
/// </summary>
@@ -339,15 +285,6 @@ namespace TracingDB.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to unsaved.
/// </summary>
internal static string unsaved {
get {
return ResourceManager.GetString("unsaved", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Up.
/// </summary>
@@ -385,7 +322,7 @@ namespace TracingDB.Resources {
}
/// <summary>
/// Looks up a localized string similar to Workflow step.
/// Looks up a localized string similar to Workstep.
/// </summary>
internal static string Workstep {
get {
@@ -151,13 +151,13 @@
<value>OK</value>
</data>
<data name="Part_barcode" xml:space="preserve">
<value>Another part barcode (s/n)</value>
<value>Another part barcode</value>
</data>
<data name="Precision" xml:space="preserve">
<value>Precision</value>
</data>
<data name="Process" xml:space="preserve">
<value>Workflow</value>
<value>Process</value>
</data>
<data name="Purchase_order" xml:space="preserve">
<value>Purchase order</value>
@@ -192,9 +192,6 @@
<data name="Time_stamp" xml:space="preserve">
<value>Time stamp</value>
</data>
<data name="unsaved" xml:space="preserve">
<value>unsaved</value>
</data>
<data name="UpBtnText" xml:space="preserve">
<value>Up</value>
</data>
@@ -208,24 +205,6 @@
<value>Workplace</value>
</data>
<data name="Workstep" xml:space="preserve">
<value>Workflow step</value>
</data>
<data name="Ref_part_barcode" xml:space="preserve">
<value>Ref. part barcode (s/n)</value>
</data>
<data name="Ref_part_name" xml:space="preserve">
<value>Ref. part name (SAP nr.)</value>
</data>
<data name="Part_name" xml:space="preserve">
<value>Another part name (SAP nr.)</value>
</data>
<data name="Tests_count" xml:space="preserve">
<value>Tests count</value>
</data>
<data name="Tests_count_and_rslt" xml:space="preserve">
<value>Tests count (negative when NOK)</value>
</data>
<data name="Test_bench_Id" xml:space="preserve">
<value>Test bench Id</value>
<value>Workstep</value>
</data>
</root>
@@ -1,6 +1,6 @@
using TracingDB.Entities;
using MonitoringDB.Entities;
namespace TracingDB
namespace MonitoringDB
{
public class ScanVerificationInfo
{
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Xml.Serialization;
namespace TracingDB
namespace MonitoringDB
{
[XmlRoot("dictionary")]
public class SerializableDictionary<TKey, TValue>
@@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TracingDB.Entities;
using MonitoringDB.Entities;
namespace TracingDB
namespace MonitoringDB
{
public class WMPart
{
+8 -16
View File
@@ -27,8 +27,8 @@ namespace Results
public Batch Batch;
public WaterMeter[] WaterMeters;
public static BatchResults NewFromProcedure(int batchNr, int benchId, string benchName, string a1, string a2, string a3, string a4, string a5,
string user, int userNr, string programVer, Config.Entities.Procedure procedure,
public static BatchResults NewFromProcedure(int batchNr, int benchId, string user, int userNr, string programVer,
Config.Entities.Procedure procedure,
WaterMeterData[] waterMeterDatas, int[] waterMeterParts, double densityCorr)
{
BatchResults d = new BatchResults(waterMeterDatas.Length);
@@ -37,14 +37,8 @@ namespace Results
/// Create new batch
d.Batch = new Batch()
{
BatchNr = batchNr,
TestBenchId = benchId,
TestBenchName = benchName,
Address1 = a1,
Address2 = a2,
Address3 = a3,
Address4 = a4,
Address5 = a5,
TestBenchId = benchId,
BatchNr = batchNr,
ProgramVersion = programVer,
UserName = user,
UserNumber = userNr,
@@ -96,7 +90,7 @@ namespace Results
{
if (d.WaterMeters[i] == null) continue;
if (!t.IsPartCompatible(waterMeterParts[i])) continue;
if (t.Part != 0 && waterMeterParts[i] != 0 && t.Part != waterMeterParts[i]) continue;
///
/// Create empty watermeter test results and add them to the list and to dictionaries
@@ -164,11 +158,11 @@ namespace Results
{
for (int i = 0; i < WMPositionsCount; i++)
{
if ((WaterMeters[i] != null) && !WaterMeters[i].Disabled)
if (WaterMeters[i] != null)
{
foreach (var mtr in WaterMeters[i].MeterTestRslts)
{
if (!mtr.TestDone) return false;
if (!mtr.TestDone) return false;
}
}
}
@@ -205,10 +199,8 @@ namespace Results
{
foreach (var mtr in WaterMeters[i].MeterTestRslts)
{
if (mtr.TestData().Name.ToLower().Contains("adj") || mtr.TestData().Name.ToLower().Contains("just"))
{
if (mtr.TestData().Name.ToLower().Contains("adj"))
return true;
}
}
}
}
+3 -19
View File
@@ -11,13 +11,7 @@ namespace Results.Entities
public virtual int Id { get; protected set; }
public virtual int BatchNr { get; set; }
public virtual int TestBenchId { get; set; }
public virtual string TestBenchName { get; set; } /// CEVAK, not mapped to DB
public virtual string Address1 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address2 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address3 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address4 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address5 { get; set; } /// CEVAK, not mapped to DB
public virtual string ProgramVersion { get; set; }
public virtual string ProgramVersion { get; set; }
public virtual string UserName { get; set; }
public virtual int UserNumber { get; set; }
public virtual string ProcedureName { get; set; }
@@ -29,17 +23,7 @@ namespace Results.Entities
public virtual float DensityCorr { get; set; } /// Density correction in [kg/m3]
public virtual float Custom2 { get; set; }
public virtual float Custom3 { get; set; }
public virtual int Counter1 { get; set; }
public virtual int Counter2 { get; set; }
public virtual int Counter3 { get; set; }
public virtual int Counter4 { get; set; }
public virtual int Counter5 { get; set; }
public virtual int Counter6 { get; set; }
public virtual int Counter7 { get; set; }
public virtual int Counter8 { get; set; }
public virtual int Counter9 { get; set; }
public virtual int Counter10 { get; set; }
public virtual DateTime StartTime { get; set; }
public virtual DateTime StartTime { get; set; }
public virtual DateTime EndTime { get; set; }
public virtual bool Dirty { get; set; }
public virtual bool RsltsSent { get; set; }
@@ -48,7 +32,7 @@ namespace Results.Entities
public virtual IList<WaterMeter> WaterMeters { get; set; }
public virtual IList<TestRslt> TestRslts { get; set; }
public virtual bool Compound { get; set; } /// Not mapped to DB now
public virtual bool HeatMeter { get; set; } /// Not mapped to DB now ///
public virtual bool HeatMeter { get; set; } /// Not mapped to DB now
public Batch()
{
+4 -20
View File
@@ -10,7 +10,7 @@ namespace Results.Entities
public virtual int Id { get; protected set; }
public virtual byte CompoundMeterId { get; set; } /// 0=single, 1=compound/main, 2=compound/aux., 3=compound/overal, 4=heat meter volume, 5=heat meter energy
public virtual int RegReaderType { get; set; } /// Not mapped to the DB, does not depend on localization and customer
public virtual int RegReaderType { get; set; } /// Not mapped to the DB, does not depent on localisation and customer
public virtual double PulsesMeter { get; set; } /// # of water meter or heat meter pulses
public virtual double PulsesMaster { get; set; } /// # of reference flowmeter pulses (gated by this water meter pulses)
@@ -25,13 +25,9 @@ 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
#if ORACLE_DB
public virtual double LastError { get; set; } /// [%] Previous test error at this Q in case Pruefindex > 1
#endif
public virtual WaterMeter WaterMeter { get; set; } /// reference to the WaterMeter entity
public virtual TestRslt TestRslt { get; set; } /// reference to the TestRslt entity
@@ -84,18 +80,10 @@ namespace Results.Entities
public virtual bool IsDataStream() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.DataStream); }
public virtual bool IsManual() { return (RegReaderType == (int)Config.Entities.RegisterReaderType.Manual); }
public virtual string PassedColorStr(string yesNoFormatOrEmpty)
public virtual string PassedColorStr()
{
if (string.IsNullOrEmpty(yesNoFormatOrEmpty))
{
return Utils.PassedColorStr(Passed, Evaluate());
}
else
{
string[] yesNo = yesNoFormatOrEmpty.Split(new char[] { '~' });
return Passed ? yesNo[0] : ((yesNo.Length >= 2) ? yesNo[1] : Results.Resources.Strings.No);
}
}
return Utils.PassedColorStr(Passed, Evaluate());
}
public MeterTestRslt()
{
@@ -128,13 +116,9 @@ namespace Results.Entities
TimestampEnd = src.TimestampEnd;
TestTime = src.TestTime;
Error = src.Error;
ErrorIndicators = src.ErrorIndicators;
KorrErrQ = src.KorrErrQ;
TestDone = src.TestDone;
Passed = src.Passed;
#if ORACLE_DB
LastError = src.LastError;
#endif
}
public override string ToString()
+2 -2
View File
@@ -20,8 +20,8 @@ namespace Results.Entities
public virtual double TargetVolume { get; set; } /// [l] target test volume
public virtual double TargetTime { get; set; } /// [s] target test time
public virtual string Method { get; set; }
public virtual double ErrLimLo { get; set; } /// [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
public virtual double ErrLimHi { get; set; } /// [%] usually > 0, in case of heat meters: -Qn in m3/h
public virtual double ErrLimLo { get; set; } /// [%] (usually < 0)
public virtual double ErrLimHi { get; set; } /// [%] (usually > 0)
public virtual double Uncertainty { get; set; } /// [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual bool DoControlWaterTemp { get; set; }
public virtual float TempLimLo { get; set; }
+16 -57
View File
@@ -15,24 +15,19 @@ namespace Results.Entities
public virtual TestData TestData { get; set; }
public virtual Components Components { get; set; }
public virtual int Part { get; set; }
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
public virtual string MethodClass { get; set; } /// Not mapped to DB, does not depend on localization and customer
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
public virtual string MethodClass { get; set; } /// Not mapped to the DB, does not depent on localisation and customer
/// Main results
public virtual bool TestDone { get; set; }
public virtual string Remark { get; set; }
public virtual DateTime StartTime { get; set; } /// Date and time of the test start
public virtual DateTime EndTime { get; set; } /// Date and time of the test end
public virtual int FlowSetTime { get; set; } /// [s] Flow set time in seconds
public virtual int TimeBtwnMassMsrmnts { get; set; } /// [s] Time between two mass measurements in seconds (if applicable)
public virtual double TestTime { get; set; } /// [s] Test time in seconds
public virtual double TestTimeCorrection { get; set; } /// [s] Correction of the test time due to diverter (0 for methods w/o diverter or when there is no correction table)
public virtual double PulsesMaster { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the water to the tank
public virtual double TotalPulsesMstr { get; set; } /// [pls] FlyingStartMassCollectionProlonged: MID pulses of the complete test (not mapped to DB)
public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected.
public virtual double ConstMasterCorr { get; set; } /// [l/pls] Liters per pulse of the master flow meter corrected by a correction table.
public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter calculated from a mass measurement.
/// When mass measurement is not available, corrected by a correction table.
public virtual DateTime StartTime { get; set; } /// Date and time of the test start
public virtual DateTime EndTime { get; set; } /// Date and time of the test end
public virtual int FlowSetTime { get; set; } /// [s] Measurement time in seconds
public virtual double TestTime { get; set; } /// [s] Measurement time in seconds
public virtual double PulsesMaster { get; set; }
public virtual double ConstMasterRaw { get; set; } /// [l/pls] Liters per pulse of the master flow meter uncorrected
public virtual double ConstMaster { get; set; } /// [l/pls] Liters per pulse of the master flow meter
public virtual double MassStartRaw { get; set; } /// [kg]
public virtual double MassStart { get; set; } /// [kg]
public virtual double MassEndRaw { get; set; } /// [kg]
@@ -45,7 +40,7 @@ namespace Results.Entities
public virtual double FlowVolume { get; set; } /// [m3/h]
public virtual double VolumeCTV { get; set; } /// [l] Volume conventional true value
public virtual double VolumeMaster { get; set; } /// [l] Volume from the master flow meter
public virtual double ErrorMaster { get; set; } /// [%] Error of the master flow meter
public virtual double ErrorMaster { get; set; } /// [%]
public virtual float DiverterStart { get; set; } /// [s] Diverter switch time when test starts
public virtual float DivStart10 { get; set; } /// [s] Diverter switch time when test starts at level 10 (e.g. 10%) (not mapped to DB)
@@ -112,7 +107,7 @@ namespace Results.Entities
public virtual float FlowMean { get; set; } /// [m3/h] mean flow from the reference flowmeter
public virtual float FlowStart { get; set; } /// [m3/h] flow at the start of test from the reference flowmeter
public virtual float FlowEnd { get; set; } /// [m3/h] flow at the end of test from the reference flowmeter
public virtual float FlowMin { get; set; } /// [m3/h]
public virtual float FlowMin { get; set; } /// [m3/h] not mapped to DB
public virtual float FlowMax { get; set; } /// [m3/h]
public virtual float Custom1 { get; set; } /// [°C] T ref hi mean
@@ -134,25 +129,10 @@ namespace Results.Entities
public virtual double TargetVolume() { return TestData.TargetVolume; }
public virtual double TargetTime() { return TestData.TargetTime; }
public virtual string Method() { return TestData.Method; }
public virtual string RefFlowmeter() { return (Components != null) ? Components.Flowmeter : string.Empty; }
public virtual bool IsRelErrTest() { return (MethodClass != null) ? (MethodClass.Contains("FixedStart") || MethodClass.Contains("FlyingStart") || MethodClass.Contains("CombinedWithDetection") || MethodClass.Contains("DiverterTest")) : true; }
public virtual bool IsRelErrTest() { return (MethodClass != null) ? (MethodClass.Contains("FixedStart") || MethodClass.Contains("FlyingStart") || MethodClass.Contains("CombinedWithDetection")) : true; }
public virtual bool IsPMaxTest() { return (MethodClass != null) ? (MethodClass.Contains("PMaxTest") || MethodClass.Contains("LeakTest")) : true; }
public virtual bool IsStartStop() { return (MethodClass != null) ? MethodClass.Contains("FixedStart") : true; }
public virtual bool IsDiverter() { return (MethodClass != null) ? ((MethodClass.Contains("FlyingStart") && MethodClass.Contains("MassColl")) || MethodClass.Contains("DiverterTest")) : true; }
public virtual bool IsVolumeMethod() { return (MethodClass != null) ? (MethodClass.Contains("TestMethods.FixedStart.") || MethodClass.Contains("TestMethods.FlyingStart.")) : false; }
public virtual string MethodElde()
{
if (MethodClass == null) return string.Empty;
else if (MethodClass.Contains("TestMethods.FlyingStartMassCollection.")) return "MS";
else if (MethodClass.Contains("TestMethods.FlyingStartMassCollectionProlonged.")) return "MS";
else if (MethodClass.Contains("TestMethods.FlyingStartMassCollectionComparative.")) return "MS";
else if (MethodClass.Contains("TestMethods.FlyingStart.")) return "VS";
else if (MethodClass.Contains("TestMethods.FixedStartMassCollection.")) return "MP";
else if (MethodClass.Contains("TestMethods.FixedStartTankCollection.")) return "VP";
else if (MethodClass.Contains("TestMethods.FixedStart.")) return "VP";
else return string.Empty;
}
public virtual bool IsDiverter() { return (MethodClass != null) ? (MethodClass.Contains("FlyingStart") && MethodClass.Contains("MassColl")) : true; }
public virtual double ErrLimLo()
{
@@ -165,7 +145,7 @@ namespace Results.Entities
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(TestData.ErrLimLo);
double Qp = Math.Abs(TestData.ErrLimHi);
double Q = (TestTime == 0) ? 1 : Math.Max(3.6 * VolumeCTV / TestTime, 0.00001); /// Div. by zero avoided
double Q = Math.Max(FlowMean, 0.00001); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
@@ -189,7 +169,7 @@ namespace Results.Entities
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(TestData.ErrLimLo);
double Qp = Math.Abs(TestData.ErrLimHi);
double Q = (TestTime == 0) ? 1 : Math.Max(3.6 * VolumeCTV / TestTime, 0.00001); /// Div. by zero avoided
double Q = Math.Max(FlowMean, 0.00001); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
@@ -235,13 +215,10 @@ namespace Results.Entities
StartTime = src.StartTime;
EndTime = src.EndTime;
FlowSetTime = src.FlowSetTime;
TimeBtwnMassMsrmnts = src.TimeBtwnMassMsrmnts;
TestTime = src.TestTime;
PulsesMaster = src.PulsesMaster;
TotalPulsesMstr = src.TotalPulsesMstr;
ConstMasterRaw = src.ConstMasterRaw;
ConstMasterCorr = src.ConstMasterCorr;
ConstMaster = src.ConstMaster;
ConstMaster = src.ConstMaster;
MassStartRaw = src.MassStartRaw;
MassStart = src.MassStart;
MassEndRaw = src.MassEndRaw;
@@ -256,13 +233,7 @@ namespace Results.Entities
VolumeMaster = src.VolumeMaster;
ErrorMaster = src.ErrorMaster;
DiverterStart = src.DiverterStart;
DivStart10 = src.DivStart10;
DivStart50 = src.DivStart50;
DivStart90 = src.DivStart90;
DiverterEnd = src.DiverterEnd;
DivEnd10 = src.DivEnd10;
DivEnd50 = src.DivEnd50;
DivEnd90 = src.DivEnd90;
ErrorFlags = src.ErrorFlags;
ErrorFlagsMd = src.ErrorFlagsMd;
RefEnergy = src.RefEnergy;
@@ -345,18 +316,6 @@ namespace Results.Entities
#endif
}
public virtual bool IsPartCompatible(int waterMeterPartNr)
{
if ((this.Part == 0) || (waterMeterPartNr == 0)) return true;
if ((this.Part % 10) == waterMeterPartNr) return true;
if (((this.Part / 10) % 10) == waterMeterPartNr) return true;
if (((this.Part / 100) % 10) == waterMeterPartNr) return true;
if (((this.Part / 1000) % 10) == waterMeterPartNr) return true;
return false;
}
public override string ToString()
{
return string.Format("batch={0}, procedure={1}, test={2}, {3} {4}", Batch.BatchNr, Batch.ProcedureName, Name(), StartTime.ToShortDateString(), StartTime.ToShortTimeString());
+25 -218
View File
@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Text;
using Config.Entities;
using Results.Resources;
namespace Results.Entities
{
@@ -42,8 +41,8 @@ namespace Results.Entities
public class WaterMeter
{
public virtual int Id { get; protected set; }
public virtual string SerialNr { get; set; } /// S/N _or_ S/N of the main meter of a compound meter _or_ PCB Number of an iPerl water meter
public virtual string SerialNrAux { get; set; } /// S/N of the aux. meter of a compound meter _or_ a complete assigned S/N of an iPerl water meter
public virtual string SerialNr { get; set; } /// Main s/n for compound meters, PCB Number for iPerl water meter
public virtual string SerialNrAux { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter
public virtual string PurchaseOrder { get; set; }
public virtual int YearOfProduction { get; set; }
public virtual int WMPosition { get; set; }
@@ -58,48 +57,25 @@ namespace Results.Entities
public virtual string Remark { get; set; }
#if IPERL
public virtual double OrigCalibFactor { get; set; } /// Original iPerl calibration factor used during the test
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test
public virtual double OrigCalibFactorLNA{ get; set; } /// Original iPerl LNA calibration factor used during the test
public virtual double CalibFactorLNA { get; set; } /// iPerl LNA calibration factor used during the test
public virtual double Q2ErrWOCorrection { get; set; }
public virtual int Q2CorrRL { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
public virtual int Q2CorrLR { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
public virtual int SerialNrEx { get; set; } /// Aux s/n for compound meters, Serial number for iPerl water meter
public virtual double OrigCalibFactor { get; set; } /// iPerl calibration factor used during the test
public virtual double CalibFactor { get; set; } /// iPerl calibration factor used during the test
public virtual double Q2ErrWOCorrection { get; set; }
public virtual bool Q2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
public virtual double Q2Correction { get; set; } /// !!! obsolete
public virtual int Q2CorrRFlow { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
public virtual int Q2CorrLFlow { get; set; } /// iPerl Q2 correction for the L-flow written to iPerl
public virtual int Q2CorrFlowRight { get; set; } /// 1 = right to left
public virtual double Diff2Hz8Hz { get; set; }
public virtual bool Hz2CorrectionDone { get; set; } /// true = iPerl Q2 correction was done
public virtual int Hz2Correction { get; set; } /// iPerl Q2 correction used during the test
public virtual string FWVersion { get; set; }
#endif
#if TURA_SPECIAL
/// <summary>
/// Data from a production test bench (in case of tests on iPerl special)
/// </summary>
public virtual int AssignedSerialNr { get; set; }
public virtual string CompleteSerialNr { get; set; }
public virtual string RadioAddress { get; set; }
public virtual int PaletteNr { get; set; }
public virtual int UmkartonNr { get; set; }
public virtual string ProdTestBench { get; set; }
public virtual int ProdWMPosition { get; set; }
public virtual string ProdUserName { get; set; }
public virtual string ProdPurchaseOrder { get; set; }
public virtual bool ProdPassed { get; set; }
public virtual int ProdResultCode { get; set; }
public virtual int ProdQ2CorrRL { get; set; } /// iPerl Q2 correction for the R-flow written to iPerl
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; } /// >= 1 ... pruefindex
public virtual int HydrPruefung { get; set; }
public virtual int WMTypeRevision { get; set; } /// Not mapped to DB !!!
public virtual object RawTestInfos { get; set; } /// IList<SensusTestInfo> fetched from Oracle at the beginning of the cycle, not mapped to DB !!!
public virtual object CompleteTestInfos { get; set; } /// SensusTestInfo[] obtained as a best match at the beginning of the cycle, not mapped to 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 !!!
#endif
public virtual int ProcessId { get; set; } /// Not mapped to DB !!! Tracing DB Process ID
public virtual bool LastRecordIsNok { get; set; } /// Not mapped to DB !!! Previous record verification result
public virtual WaterMeterData WaterMeterData { get; set; }
public virtual WaterMeterData WaterMeterData { get; set; }
public virtual Batch Batch { get; set; }
public virtual IList<MeterTestRslt> MeterTestRslts { get; set; }
@@ -141,7 +117,7 @@ namespace Results.Entities
ErrorFlagsMode eFlagsMode = 0; /// = ErrorFlagsMode.Off;
foreach (var mtr in MeterTestRslts)
{
if (mtr.Evaluate() && mtr.TestDone) errorFlags |= mtr.TestRslt.ErrorFlags;
if (mtr.TestDone) errorFlags |= mtr.TestRslt.ErrorFlags;
if ((int)mtr.TestRslt.ErrorFlagsMode() > (int)eFlagsMode) eFlagsMode = mtr.TestRslt.ErrorFlagsMode();
}
errorFlagsMode = eFlagsMode; /// Maximum from all tests (=ErrorFlagsMode.On if at least one test is ErrorFlagsMode.On)
@@ -173,7 +149,7 @@ namespace Results.Entities
{
ErrorFlagsMode errorFlagsMode;
string eFlags = Utils.ErrorFlagsStr(ErrorFlagsFromTestsAndWM(out errorFlagsMode));
return string.IsNullOrEmpty(eFlags) ? (WaterMeterData.Text4 + PassedColorStr(null)) : eFlags;
return string.IsNullOrEmpty(eFlags) ? (WaterMeterData.Text4 + PassedColorStr()) : eFlags;
}
/// <summary>
@@ -233,17 +209,9 @@ namespace Results.Entities
}
public virtual string PassedColorStr(string yesNoFormatOrEmpty)
public virtual string PassedColorStr()
{
if (string.IsNullOrEmpty(yesNoFormatOrEmpty))
{
return Utils.PassedColorStr(Passed, true);
}
else
{
string[] yesNo = yesNoFormatOrEmpty.Split(new char[] { '~' });
return Passed ? yesNo[0] : ((yesNo.Length >= 2) ? yesNo[1] : Results.Resources.Strings.No);
}
return Utils.PassedColorStr(Passed, true);
}
@@ -284,12 +252,7 @@ namespace Results.Entities
{
return mtr;
}
else if (meterId == Config.Entities.CompoundMeterId.SingleOrCompound &&
mtr.CompoundMeterId == (byte)Config.Entities.CompoundMeterId.HeatMeterEnergy)
{
return mtr;
}
}
}
}
return null;
}
@@ -301,21 +264,6 @@ namespace Results.Entities
return null;
}
public virtual bool TryGetTestRslt(string testName, out TestRslt testRslt)
{
MeterTestRslt mtr = GetMeterTestRslt(testName);
if (mtr != null)
{
testRslt = mtr.TestRslt;
return true;
}
else
{
testRslt = null;
return false;
}
}
public virtual TestData GetTestData(string testName)
{
foreach (var mtr in MeterTestRslts)
@@ -328,21 +276,6 @@ namespace Results.Entities
return null;
}
public virtual bool TryGetTestData(string testName, out TestData testData)
{
foreach (var mtr in MeterTestRslts)
{
if (mtr.TestRslt.TestData.Name == testName)
{
testData = mtr.TestRslt.TestData;
return true;
}
}
testData = null;
return false;
}
/// <summary>
@@ -351,16 +284,6 @@ namespace Results.Entities
public WaterMeter()
{
MeterTestRslts = new List<MeterTestRslt>();
#if ORACLE_DB
Pruefindex = 1;
HydrPruefung = 0;
WMTypeRevision = 0;
RawTestInfos = null;
CompleteTestInfos = null;
#endif
ProcessId = 0;
ErrorFlags = 0;
LastRecordIsNok = false;
}
@@ -383,44 +306,24 @@ namespace Results.Entities
ArchivePath = src.ArchivePath;
Remark = src.Remark;
#if IPERL
SerialNrEx = src.SerialNrEx;
OrigCalibFactor = src.OrigCalibFactor;
CalibFactor = src.CalibFactor;
OrigCalibFactorLNA = src.OrigCalibFactorLNA;
CalibFactorLNA = src.CalibFactorLNA;
Q2ErrWOCorrection = src.Q2ErrWOCorrection;
Q2CorrRL = src.Q2CorrRL;
Q2CorrLR = src.Q2CorrLR;
Q2CorrectionDone = src.Q2CorrectionDone;
Q2Correction = src.Q2Correction;
Q2CorrRFlow = src.Q2CorrRFlow;
Q2CorrLFlow = src.Q2CorrLFlow;
Q2CorrFlowRight = src.Q2CorrFlowRight;
Diff2Hz8Hz = src.Diff2Hz8Hz;
Hz2CorrectionDone = src.Hz2CorrectionDone;
Hz2Correction = src.Hz2Correction;
FWVersion = src.FWVersion;
#endif
#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;
Pruefindex = src.Pruefindex;
HydrPruefung = src.HydrPruefung;
WMTypeRevision = src.WMTypeRevision;
RawTestInfos = src.RawTestInfos;
CompleteTestInfos = src.CompleteTestInfos;
#endif
ProcessId = src.ProcessId;
LastRecordIsNok = src.LastRecordIsNok;
foreach (var mtr in MeterTestRslts)
{
MeterTestRslt srcMtr = src.GetMeterTestRslt(mtr.Name(), (Config.Entities.CompoundMeterId)mtr.CompoundMeterId);
@@ -436,7 +339,7 @@ namespace Results.Entities
{
StringBuilder sb = new StringBuilder(80);
#if IPERL
sb.AppendFormat("PCB:{0} S/N:{1} ", SerialNr, SerialNrAux);
sb.AppendFormat("PCB:{0} S/N:{1} ", SerialNr, SerialNrEx);
#else
sb.AppendFormat("S/N:{0} ", SerialNr);
#endif
@@ -445,101 +348,5 @@ namespace Results.Entities
sb.AppendFormat(" test start: {0} {1} batch={2}", StartTime().ToShortDateString(), StartTime().ToShortTimeString(), BatchNr());
return sb.ToString();
}
/// <summary>
/// Get decorated test names for a specified watermeter
/// </summary>
/// <param name="wMtr">Watermeter results entity</param>
/// <returns>A list of strings</returns>
public virtual IList<string> GetAllDecoratedTestNames()
{
IList<string> testNames = new List<string>();
if (MeterTestRslts != null)
{
foreach (var mtr in MeterTestRslts)
{
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());
}
}
}
return testNames;
}
static readonly System.Drawing.Color NotCompletedColor = System.Drawing.Color.White;
static readonly System.Drawing.Color OkColor = System.Drawing.Color.LightGreen;
static readonly System.Drawing.Color NokColor = System.Drawing.Color.LightPink;
static readonly System.Drawing.Color RejectColor = System.Drawing.Color.Magenta;
static readonly System.Drawing.Color ProductionErrorColor = System.Drawing.Color.RoyalBlue;
static readonly System.Drawing.Color WrongDirectionColor = System.Drawing.Color.Gold;
static readonly System.Drawing.Color WrongQ2FactorsColor = System.Drawing.Color.Red;
/// <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>
public virtual System.Drawing.Color GetColorOfResults(bool maxRepeatsExceeded, out string message)
{
bool wmtrCompleted = CompletedFromTests();
bool wmtrPassed = PassedFromTests();
if ((ErrorFlags & (int)ErrorFlagMask.E28) != 0)
{
message = Strings.Previous_step_is_missing_or_NOK;
return ProductionErrorColor;
}
else if ((ErrorFlags & (int)ErrorFlagMask.E27) != 0)
{
message = Strings.Wrong_iPerl_counting_direction;
return WrongDirectionColor;
}
else if ((ErrorFlags & (int)ErrorFlagMask.E26) != 0)
{
message = Strings.Invalid_Q2_correction_factors;
return WrongQ2FactorsColor;
}
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
if (maxRepeatsExceeded)
{
message = Strings.Test_repetition_count_exceeded_upper_limit;
return RejectColor;
}
else
{
message = Strings.Failed;
return NokColor;
}
}
else if (Disabled)
{
/// Water meter was not completed yet => did not pass, did not fail
message = Strings.This_position_is_disabled;
return NotCompletedColor;
}
else
{
/// Water meter was not completed yet => did not pass, did not fail
message = Strings.Test_in_progress;
return NotCompletedColor;
}
}
}
}
+2
View File
@@ -54,6 +54,7 @@ namespace Results.Entities
#if ORACLE_DB
public virtual int WMTypeId { get; set; }
public virtual int WMTypeRev { get; set; }
#endif
public WaterMeterData()
@@ -110,6 +111,7 @@ namespace Results.Entities
#if ORACLE_DB
if (WMTypeId != wmd.WMTypeId) return false;
if (WMTypeRev != wmd.WMTypeRev) return false;
#endif
return true;
}
+268 -216
View File
@@ -1,11 +1,14 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Resources;
using NHibernate;
using TracingDB.Entities;
namespace Results.Forms
{
@@ -13,33 +16,42 @@ namespace Results.Forms
{
static readonly ILog log = LogManager.GetLogger(typeof(BatchResultsDlg));
DateTime lastRedraw;
DateTime lastSizeChange;
bool loaded;
///
/// Public members
///
public Results.BatchResults Results;
public IList<Results.WMeterRsltItemSpec> Items;
public MetersArrangement MetersArrangement;
public TestsArrangement TestsArrangement;
public int NrMetersInOneGroup;
public bool ShowDisabledPositions;
public int MinWidth;
public int MinHeight;
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_SingleWM;
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_CombinedWM;
public IList<Results.WMeterRsltItemSpec> RsltItems_Screen_HeatM;
public int[] RsltsClmnWidths { set { rsltsClmnWidths = value; } }
public int PopupResultsLeft;
public int PopupResultsTop;
public int PopupResultsWidth;
public int PopupResultsHeight;
public int[] RsltsClmnWidths;
public Results.BatchResults Results { set { Display(value); } }
///
/// Private members
///
IOneWMResultsCtrl[] wmRsltsCtrl; /// An array of controls with water meter results.
IOneWMResultsCtrl firstEnabledControl;
DateTime lastRedraw;
DateTime lastSizeChange;
int metersInOneGroup;
int nrGroups;
Results.BatchResults results;
MetersKind metersKind;
ListView firstListView;
public int[] rsltsClmnWidths;
int rsltsClmnCount { get { return (rsltsClmnWidths != null) ? rsltsClmnWidths.Length : 0; } }
int lvWidth;
int lvHeight;
Timer timer;
@@ -47,223 +59,291 @@ namespace Results.Forms
public BatchResultsDlg()
{
InitializeComponent();
Text = Strings.Results;
firstEnabledControl = null;
lastSizeChange = DateTime.Now;
nrGroups = 1;
metersInOneGroup = 1;
/// Create a timer with one second interval.
// Create a timer with a ten second interval.
timer = new Timer();
timer.Interval = 1000; /// ms
timer.Interval = 500; /// ms
timer.Tick += new EventHandler(OnTimer);
timer.Start();
}
private void BatchResultsDlg_Load(object sender, EventArgs e)
{
if (PopupResultsLeft != 0) Left = PopupResultsLeft;
if (PopupResultsTop != 0) Top = PopupResultsTop;
if (PopupResultsWidth != 0) Width = PopupResultsWidth;
if (PopupResultsLeft != 0) Left = PopupResultsLeft;
if (PopupResultsTop != 0) Top = PopupResultsTop;
if (PopupResultsWidth != 0) Width = PopupResultsWidth;
if (PopupResultsHeight != 0) Height = PopupResultsHeight;
CreateControlsAndFillPanel(Results);
UpdateColumnWidths(RsltsClmnWidths);
UpdateResults(Results);
loaded = true;
if (results != null) Redraw();
}
public void Display(Results.BatchResults results)
{
this.results = results;
if (loaded) Redraw();
}
///
/// Handle double-click inside a water meter results control
///
void OnDoubleClick(object sender, Results.Forms.WaterMeterEventArgs args)
IList<Results.WMeterRsltItemSpec> GetRsltItems(MetersKind metersKind)
{
if (Results.WaterMeters != null && args.WMPosition > 0)
IList<Results.WMeterRsltItemSpec> srcItems;
switch (metersKind)
{
foreach (var wm in Results.WaterMeters)
{
if ((wm != null) && (wm.WMPosition == args.WMPosition))
{
ShowMoreWMResults(wm);
return;
}
}
default:
case MetersKind.Single: srcItems = RsltItems_Screen_SingleWM; break;
case MetersKind.Combined: srcItems = RsltItems_Screen_CombinedWM; break;
case MetersKind.HeatMeter: srcItems = RsltItems_Screen_HeatM; break;
}
MessageBox.Show(Strings.No_water_meter);
return;
}
void UpdateColumnWidths(int[] columnWidths)
{
foreach (var ctrl in wmRsltsCtrl) ctrl.Update(columnWidths);
}
void UpdateScrollpositions(int scrollStart)
{
/// TODO
IList<Results.WMeterRsltItemSpec> copiedItems = new List<Results.WMeterRsltItemSpec>();
foreach (var it in srcItems) copiedItems.Add(it.Clone());
return copiedItems;
}
/// <summary>
/// Re-draw the results. Apply new settings if they changed.
/// </summary>
void CreateControlsAndFillPanel(Results.BatchResults results)
public void Redraw()
{
if ((results == null) || (results.WMPositionsCount == 0))
{
/// There are no water meters at all
flowLayoutPanel.Controls.Clear();
wmRsltsCtrl = new OneWMResultsRowsCtrl[0];
firstEnabledControl = null;
return;
}
///
/// Determine water meter positions count
///
int displayedControlsCount = 0;
for (int i = 0; i < results.WaterMeters.Length; i++)
{
if (results.WaterMeters[i] != null)
{
if (ShowDisabledPositions || !results.WaterMeters[i].Disabled)
{
displayedControlsCount++;
}
}
}
///
/// Calculate geometry
///
metersInOneGroup = Math.Max(1, Math.Min(displayedControlsCount, NrMetersInOneGroup));
nrGroups = Math.Max(1, (displayedControlsCount + metersInOneGroup - 1) / metersInOneGroup);
int oneWidth;
int oneHeight;
///
if (MetersArrangement == MetersArrangement.Horizontally)
{
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / metersInOneGroup - 6);
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / nrGroups - 6);
}
else
{
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / nrGroups - 6);
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
}
///
/// Create controls and fill the FlowLayoutPanel
///
flowLayoutPanel.SuspendLayout();
flowLayoutPanel.Controls.Clear();
flowLayoutPanel.WrapContents = true;
flowLayoutPanel.AutoScroll = true;
wmRsltsCtrl = new IOneWMResultsCtrl[displayedControlsCount];
int ix = 0;
firstEnabledControl = null;
for (int i = 0; i < results.WaterMeters.Length; i++)
{
if (results.WaterMeters[i] != null)
{
if (!results.WaterMeters[i].Disabled || ShowDisabledPositions)
{
/// Create one water meter position / control
wmRsltsCtrl[ix] = (TestsArrangement == TestsArrangement.Rows)
? new OneWMResultsRowsCtrl() as IOneWMResultsCtrl
: new OneWMResultsColumnsCtrl() as IOneWMResultsCtrl;
wmRsltsCtrl[ix].Width = oneWidth;
wmRsltsCtrl[ix].Height = oneHeight;
wmRsltsCtrl[ix].Update(Items);
wmRsltsCtrl[ix].WMResultsClickedHandler += delegate(object s, Results.Forms.WaterMeterEventArgs args)
{
if (InvokeRequired)
{
Invoke(new EventHandler<Results.Forms.WaterMeterEventArgs>(OnDoubleClick), s, args);
}
else
{
OnDoubleClick(s, args);
}
};
flowLayoutPanel.Controls.Add(wmRsltsCtrl[ix] as UserControl);
if ((firstEnabledControl == null) && !results.WaterMeters[i].Disabled) firstEnabledControl = wmRsltsCtrl[ix];
ix++;
}
}
}
flowLayoutPanel.ResumeLayout();
lastRedraw = DateTime.Now;
}
this.SuspendLayout();
void UpdateResults(Results.BatchResults batchResults)
{
if ((batchResults != null) && (batchResults.WaterMeters != null))
try
{
int ctrlIx = 0;
for (int i = 0; i < batchResults.WaterMeters.Length; i++)
/// Determine how many water meters were enabled for result evaluation and printing
int enabledWMsCount = 0;
for (int i = 0; i < results.WMPositionsCount; i++)
{
if (!batchResults.WaterMeters[i].Disabled || ShowDisabledPositions)
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
{
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(batchResults.WaterMeters[i]);
enabledWMsCount++;
}
}
}
}
int metersInOneGroup = Math.Max(1, Math.Min(enabledWMsCount, NrMetersInOneGroup));
int nrGroups = Math.Max(1, (enabledWMsCount + metersInOneGroup - 1) / metersInOneGroup);
void ShowMoreWMResults(Results.Entities.WaterMeter wm)
{
if ((TracingDB.DB.SessionFactory == null) || string.IsNullOrEmpty(wm.SerialNr))
{
new Results.Forms.MoreWMResultsDlg(wm, null).ShowDialog();
}
else
{
using (ISession session = TracingDB.DB.SessionFactory.OpenSession())
if (MetersArrangement == MetersArrangement.Horizontally)
{
IList<ReferenceRecord> refRecords = session.QueryOver<ReferenceRecord>()
.Where(x => (x.Code == wm.SerialNr))
.OrderBy(x => x.TimeStamp).Desc
.List();
for (int i = 0; i < refRecords.Count; i++)
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
lvWidth = flowLayoutPanel.Width / metersInOneGroup - 6;
lvHeight = flowLayoutPanel.Height / nrGroups - 6;
}
else
{
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
lvWidth = flowLayoutPanel.Width / nrGroups - 6;
lvHeight = flowLayoutPanel.Height / metersInOneGroup - 6;
}
flowLayoutPanel.Controls.Clear();
flowLayoutPanel.WrapContents = true;
flowLayoutPanel.AutoScroll = true;
bool first = true;
for (int i = 0; i < results.WMPositionsCount; i++)
{
if (results.WaterMeters[i] != null && !results.WaterMeters[i].Disabled)
{
ReferenceRecord refR = refRecords[i];
if ((refR.Records != null) && (refR.Records.Count > 0))
ListView lview = (TestsArrangement == TestsArrangement.Rows)
? GetResultsTestsAreRows(results.WaterMeters[i], i + 1)
: GetResultsTestsAreColumns(results.WaterMeters[i], i + 1);
if (lview != null)
{
/// Reference record has additional records/parts (i.e. it is PCB assembly workflow step)
///
foreach (var rec in refR.Records)
flowLayoutPanel.Controls.Add(lview);
if (first)
{
if (rec.Part.OraDBType.ToLower().Contains("flowtube"))
{
/// rec.Part is a flowtube
///
IList<ReferenceRecord> flowtubeRRs = session.QueryOver<ReferenceRecord>()
.Where(x => (x.Code == rec.Code))
.OrderBy(x => x.TimeStamp).Desc
.List();
foreach (var rr in flowtubeRRs) refRecords.Add(rr);
}
firstListView = lview;
first = false;
}
}
}
new Results.Forms.MoreWMResultsDlg(wm, refRecords).ShowDialog();
}
}
catch (Exception e)
{
log.FatalFormat("Redrawing results failed : {0}", e.Message);
if (e.InnerException != null)
{
log.FatalFormat("InnerMessage : {0}", e.InnerException.Message);
}
log.FatalFormat("StackTrace : {0}{1}", Environment.NewLine, e.StackTrace);
}
this.ResumeLayout(false);
}
/// <summary>
/// Get an empty ListView control with appropriate parameters.
/// </summary>
/// <returns>ListView control</returns>
ListView GetListView()
{
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;
}
/// <summary>
/// Get decorated test names for a specified watermeter
/// </summary>
/// <param name="wMtr">Watermeter results entity</param>
/// <returns>A list of strings</returns>
IList<string> GetAllDecoratedTestNames(Results.Entities.WaterMeter wMtr)
{
IList<string> testNames = new List<string>();
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr.IsPilotRslt() && mtr.TestDone && (mtr.Publish() != Config.Entities.Publish.Never)
&& (mtr.Publish() != Config.Entities.Publish.Internal))
{
testNames.Add(mtr.Name());
}
}
return testNames;
}
/// <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)
{
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
ListView lview = GetListView();
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
if (items == null || items.Count == 0) return lview;
// Header
lview.Columns.Add(printedWMNr.ToString(), (rsltsClmnCount > 0) ? rsltsClmnWidths[0] : 40);
int col = 1;
foreach (var item in items)
{
lview.Columns.Add(item.Caption, (rsltsClmnCount > col) ? rsltsClmnWidths[col] : 70);
col++;
}
IList<string> testNames = GetAllDecoratedTestNames(wMtr);
int ix = 0;
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never
&& mtr.Publish() != Config.Entities.Publish.Internal)
{
ListViewItem lvi = new ListViewItem(testNames[ix++]);
for (int i = 0; i < items.Count; i++)
{
string str = items[i].Print(wMtr, mtr.Name());
/// Extract and use color information
string[] texts = str.Split(new char[] { '|' });
if (texts.Length == 1)
{
lvi.SubItems.Add(str);
}
else if (texts.Length == 2)
{
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
lvi.UseItemStyleForSubItems = false;
lvi.SubItems.Add(texts[0]);
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
}
else
{
lvi.SubItems.Add(string.Empty);
}
}
lview.Items.Add(lvi);
}
}
return lview;
}
/// <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 GetResultsTestsAreColumns(Results.Entities.WaterMeter wMtr, int printedWMNr)
{
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
ListView lview = GetListView();
IList<Results.WMeterRsltItemSpec> items = GetRsltItems(metersKind);
if (items == null || items.Count == 0) return lview;
// Header
lview.Columns.Add(printedWMNr.ToString(), (rsltsClmnCount > 0) ? rsltsClmnWidths[0] : 40);
int i = 1;
foreach (var str in GetAllDecoratedTestNames(wMtr))
{
lview.Columns.Add(str, (rsltsClmnCount > i) ? rsltsClmnWidths[i] : 70);
i++;
}
foreach (var item in items)
{
ListViewItem lvi = new ListViewItem(item.Caption);
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
mtr.Publish() != Config.Entities.Publish.Internal)
{
string str = item.Print(wMtr, mtr.Name());
string[] texts = str.Split(new char[] { '|' });
if (texts.Length == 1)
{
lvi.SubItems.Add(str);
}
else if (texts.Length == 2)
{
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
lvi.UseItemStyleForSubItems = false;
lvi.SubItems.Add(texts[0]);
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
}
else
{
lvi.SubItems.Add(string.Empty);
}
}
}
lview.Items.Add(lvi);
}
return lview;
}
private void BatchResultsDlg_FormClosing(object sender, FormClosingEventArgs e)
{
@@ -273,7 +353,6 @@ namespace Results.Forms
PopupResultsHeight = Height;
}
private void flowLayoutPanel_SizeChanged(object sender, EventArgs e)
{
lastSizeChange = DateTime.Now;
@@ -283,40 +362,13 @@ namespace Results.Forms
{
if (DateTime.Compare(lastSizeChange, lastRedraw) > 0)
{
/// The last size change was more recent then the last redraw
/// The last size change was later then the last redraw
DateTime now = DateTime.Now;
if (DateTime.Compare(lastSizeChange + new TimeSpan(0, 0, 1), now) < 0)
{
/// More then 1 second since the last panel size change
/// Calculate geometry
int oneWidth;
int oneHeight;
///
if (MetersArrangement == MetersArrangement.Horizontally)
{
flowLayoutPanel.FlowDirection = FlowDirection.LeftToRight;
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / metersInOneGroup - 6);
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / nrGroups - 6);
}
else
{
flowLayoutPanel.FlowDirection = FlowDirection.TopDown;
oneWidth = Math.Max(MinWidth, flowLayoutPanel.Width / nrGroups - 6);
oneHeight = Math.Max(MinHeight, flowLayoutPanel.Height / metersInOneGroup - 6);
}
/// Update size of controls
flowLayoutPanel.SuspendLayout();
///
foreach (var oneCtrl in wmRsltsCtrl)
{
oneCtrl.Width = oneWidth;
oneCtrl.Height = oneHeight;
}
///
flowLayoutPanel.ResumeLayout();
/// More then 1s since the last size change
Redraw();
}
}
}
-25
View File
@@ -1,25 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace Results.Forms
{
public interface IOneWMResultsCtrl
{
event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
bool Disabled { get; } /// true when water meter position is disabled
int WMPosition { get; } /// 1-based WM position
int Width { get; set; } /// Control width
int Height { get; set; } /// Control height
ListView.ColumnHeaderCollection Columns { get; } /// Embedded ListView control columns
void Update(int[] columnWidths);
void Update(IList<Results.WMeterRsltItemSpec> items);
void Update(Results.Entities.WaterMeter wMtr);
}
}
-104
View File
@@ -1,104 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Results.Forms
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static class ListViewExtensions
{
[StructLayout(LayoutKind.Sequential)]
public struct HDITEM
{
public Mask mask;
public int cxy;
[MarshalAs(UnmanagedType.LPTStr)]
public string pszText;
public IntPtr hbm;
public int cchTextMax;
public Format fmt;
public IntPtr lParam;
// _WIN32_IE >= 0x0300
public int iImage;
public int iOrder;
// _WIN32_IE >= 0x0500
public uint type;
public IntPtr pvFilter;
// _WIN32_WINNT >= 0x0600
public uint state;
[Flags]
public enum Mask
{
Format = 0x4, // HDI_FORMAT
};
[Flags]
public enum Format
{
SortDown = 0x200, // HDF_SORTDOWN
SortUp = 0x400, // HDF_SORTUP
};
};
public const int LVM_FIRST = 0x1000;
public const int LVM_GETHEADER = LVM_FIRST + 31;
public const int HDM_FIRST = 0x1200;
public const int HDM_GETITEM = HDM_FIRST + 11;
public const int HDM_SETITEM = HDM_FIRST + 12;
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, ref HDITEM lParam);
public static void SetSortIcon(this ListViewEx listViewControl, int columnIndex, SortOrder order)
{
IntPtr columnHeader = SendMessage(listViewControl.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero);
for (int columnNumber = 0; columnNumber <= listViewControl.Columns.Count - 1; columnNumber++)
{
var columnPtr = new IntPtr(columnNumber);
var item = new HDITEM
{
mask = HDITEM.Mask.Format
};
if (SendMessage(columnHeader, HDM_GETITEM, columnPtr, ref item) == IntPtr.Zero)
{
throw new Win32Exception();
}
if (order != SortOrder.None && columnNumber == columnIndex)
{
switch (order)
{
case SortOrder.Ascending:
item.fmt &= ~HDITEM.Format.SortDown;
item.fmt |= HDITEM.Format.SortUp;
break;
case SortOrder.Descending:
item.fmt &= ~HDITEM.Format.SortUp;
item.fmt |= HDITEM.Format.SortDown;
break;
default:
break;
}
}
else
{
item.fmt &= ~HDITEM.Format.SortDown & ~HDITEM.Format.SortUp;
}
if (SendMessage(columnHeader, HDM_SETITEM, columnPtr, ref item) == IntPtr.Zero)
{
throw new Win32Exception();
}
}
}
}
}
-31
View File
@@ -1,31 +0,0 @@
using System;
using System.Collections;
using System.Windows.Forms;
namespace Results.Forms
{
public class LviIntColumnComparer : IComparer
{
int column;
SortOrder order;
public LviIntColumnComparer()
{
column = 0;
order = SortOrder.Ascending;
}
public LviIntColumnComparer(int column, SortOrder order)
{
this.column = column;
this.order = order;
}
public int Compare(object x, object y)
{
int valX = int.Parse(((ListViewItem)x).SubItems[column].Text);
int valY = int.Parse(((ListViewItem)y).SubItems[column].Text);
return (order == SortOrder.Descending) ? (valY - valX) : (valX - valY);
}
}
}
-31
View File
@@ -1,31 +0,0 @@
using System;
using System.Collections;
using System.Windows.Forms;
namespace Results.Forms
{
public class LviTextColumnComparer : IComparer
{
private int column;
SortOrder order;
public LviTextColumnComparer()
{
column = 0;
order = SortOrder.Ascending;
}
public LviTextColumnComparer(int column, SortOrder order)
{
this.column = column;
this.order = order;
}
public int Compare(object x, object y)
{
string txtX = ((ListViewItem)x).SubItems[column].Text;
string txtY = ((ListViewItem)y).SubItems[column].Text;
return (order == SortOrder.Descending) ? String.Compare(txtY, txtX) : String.Compare(txtX, txtY);
}
}
}
-164
View File
@@ -1,164 +0,0 @@
namespace Results.Forms
{
partial class MoreWMResultsDlg
{
/// <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.tabControl1 = new System.Windows.Forms.TabControl();
this.graphsTabPage = new System.Windows.Forms.TabPage();
this.productionTracingTabPage = new System.Windows.Forms.TabPage();
this.productionTracingSplitContainer = new System.Windows.Forms.SplitContainer();
this.messageLabel = new System.Windows.Forms.Label();
this.tracingResultsListView = new System.Windows.Forms.ListView();
this.allResultsTabPage = new System.Windows.Forms.TabPage();
this.tabControl1.SuspendLayout();
this.productionTracingTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.productionTracingSplitContainer)).BeginInit();
this.productionTracingSplitContainer.Panel1.SuspendLayout();
this.productionTracingSplitContainer.Panel2.SuspendLayout();
this.productionTracingSplitContainer.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.allResultsTabPage);
this.tabControl1.Controls.Add(this.graphsTabPage);
this.tabControl1.Controls.Add(this.productionTracingTabPage);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1195, 448);
this.tabControl1.TabIndex = 0;
//
// graphsTabPage
//
this.graphsTabPage.Location = new System.Drawing.Point(4, 22);
this.graphsTabPage.Name = "graphsTabPage";
this.graphsTabPage.Padding = new System.Windows.Forms.Padding(3);
this.graphsTabPage.Size = new System.Drawing.Size(1187, 422);
this.graphsTabPage.TabIndex = 1;
this.graphsTabPage.Text = "Graphs";
this.graphsTabPage.UseVisualStyleBackColor = true;
//
// productionTracingTabPage
//
this.productionTracingTabPage.Controls.Add(this.productionTracingSplitContainer);
this.productionTracingTabPage.Location = new System.Drawing.Point(4, 22);
this.productionTracingTabPage.Name = "productionTracingTabPage";
this.productionTracingTabPage.Size = new System.Drawing.Size(1187, 422);
this.productionTracingTabPage.TabIndex = 2;
this.productionTracingTabPage.Text = "Production tracing";
this.productionTracingTabPage.UseVisualStyleBackColor = true;
//
// productionTracingSplitContainer
//
this.productionTracingSplitContainer.BackColor = System.Drawing.SystemColors.Control;
this.productionTracingSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.productionTracingSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.productionTracingSplitContainer.IsSplitterFixed = true;
this.productionTracingSplitContainer.Location = new System.Drawing.Point(0, 0);
this.productionTracingSplitContainer.Name = "productionTracingSplitContainer";
this.productionTracingSplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// productionTracingSplitContainer.Panel1
//
this.productionTracingSplitContainer.Panel1.Controls.Add(this.messageLabel);
this.productionTracingSplitContainer.Panel1MinSize = 55;
//
// productionTracingSplitContainer.Panel2
//
this.productionTracingSplitContainer.Panel2.Controls.Add(this.tracingResultsListView);
this.productionTracingSplitContainer.Panel2MinSize = 60;
this.productionTracingSplitContainer.Size = new System.Drawing.Size(1187, 422);
this.productionTracingSplitContainer.SplitterDistance = 55;
this.productionTracingSplitContainer.SplitterWidth = 1;
this.productionTracingSplitContainer.TabIndex = 0;
//
// messageLabel
//
this.messageLabel.AutoSize = true;
this.messageLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.messageLabel.Location = new System.Drawing.Point(12, 9);
this.messageLabel.Name = "messageLabel";
this.messageLabel.Size = new System.Drawing.Size(152, 37);
this.messageLabel.TabIndex = 1;
this.messageLabel.Text = "Message";
//
// tracingResultsListView
//
this.tracingResultsListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.tracingResultsListView.GridLines = true;
this.tracingResultsListView.Location = new System.Drawing.Point(0, 0);
this.tracingResultsListView.Name = "tracingResultsListView";
this.tracingResultsListView.Size = new System.Drawing.Size(1187, 366);
this.tracingResultsListView.TabIndex = 0;
this.tracingResultsListView.UseCompatibleStateImageBehavior = false;
this.tracingResultsListView.View = System.Windows.Forms.View.Details;
//
// allResultsTabPage
//
this.allResultsTabPage.Location = new System.Drawing.Point(4, 22);
this.allResultsTabPage.Name = "allResultsTabPage";
this.allResultsTabPage.Padding = new System.Windows.Forms.Padding(3);
this.allResultsTabPage.Size = new System.Drawing.Size(1187, 422);
this.allResultsTabPage.TabIndex = 0;
this.allResultsTabPage.Text = "All results";
this.allResultsTabPage.UseVisualStyleBackColor = true;
//
// MoreWMResultsDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1195, 448);
this.Controls.Add(this.tabControl1);
this.Name = "MoreWMResultsDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Water meter results";
this.tabControl1.ResumeLayout(false);
this.productionTracingTabPage.ResumeLayout(false);
this.productionTracingSplitContainer.Panel1.ResumeLayout(false);
this.productionTracingSplitContainer.Panel1.PerformLayout();
this.productionTracingSplitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.productionTracingSplitContainer)).EndInit();
this.productionTracingSplitContainer.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabControl1;
private OneWMResultsRowsCtrl oneWMResultsCtrl;
private System.Windows.Forms.TabPage graphsTabPage;
private System.Windows.Forms.TabPage productionTracingTabPage;
private System.Windows.Forms.SplitContainer productionTracingSplitContainer;
private System.Windows.Forms.Label messageLabel;
private System.Windows.Forms.ListView tracingResultsListView;
private System.Windows.Forms.TabPage allResultsTabPage;
}
}
-188
View File
@@ -1,188 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using TracingDB.Entities;
using Results.Resources;
using Config.Entities;
using System.Drawing;
using System.Windows.Forms.DataVisualization.Charting;
namespace Results.Forms
{
public partial class MoreWMResultsDlg : Form
{
public MoreWMResultsDlg(Results.Entities.WaterMeter wm, IList<ReferenceRecord> refRecords)
{
InitializeComponent();
Localize();
ShowAllResults(wm);
ShowChart(wm);
if (refRecords == null)
{
tabControl1.SelectTab(1);
tabControl1.TabPages.RemoveAt(2);
}
else
{
tabControl1.SelectTab(2);
ShowTracingResults(wm, refRecords);
}
}
void Localize()
{
Text = Strings.Water_meter_results;
tabControl1.TabPages[0].Text = Strings.All_results;
tabControl1.TabPages[1].Text = Strings.Graphs;
tabControl1.TabPages[2].Text = Strings.Production_tracing_results;
}
/// <summary>
/// Display all results for this water meter in the 1st tab page
/// </summary>
/// <param name="wMtr">Water meter entity</param>
void ShowAllResults(Results.Entities.WaterMeter wMtr)
{
// string message;
// Color commonBackColor = wMtr.GetColorOfResults(false, out message); /// Ony message is used later on
//#if ORACLE_DB
// oneWMResultsCtrl.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
//#else
// oneWMResultsCtrl.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
//#endif
// IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.AllItems;
// // Header
// oneWMResultsCtrl.Columns.Add(wMtr.WMPosition.ToString(), 100);
// int i = 1;
// foreach (var str in wMtr.GetAllDecoratedTestNames())
// {
// oneWMResultsCtrl.Columns.Add(str, 100);
// i++;
// }
// foreach (var item in items)
// {
// ListViewItem lvi = new ListViewItem(item.Name);
// foreach (var mtr in wMtr.MeterTestRslts)
// {
// if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
// mtr.Publish() != Config.Entities.Publish.Internal)
// {
// string str = item.Print(wMtr, mtr.Name());
// string[] texts = str.Split(new char[] { '|' });
// if (texts.Length == 1)
// {
// lvi.SubItems.Add(str);
// }
// else if (texts.Length == 2)
// {
// Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
// lvi.UseItemStyleForSubItems = false;
// lvi.SubItems.Add(texts[0]);
// lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
// }
// else
// {
// lvi.SubItems.Add(string.Empty);
// }
// }
// }
// oneWMResultsCtrl.Items.Add(lvi);
// }
}
void ShowChart(Results.Entities.WaterMeter wm)
{
//chart.ChartAreas[0].AxisX.LabelStyle.Format = "dd.MM.yy";
//chart.ChartAreas[0].AxisX.Interval = 1;
//chart.ChartAreas[0].AxisX.IntervalType = ;
tabControl1.TabPages[1].Controls.Add(Results.Output.WMChart.GetChart(wm, false));
}
/// <summary>
/// Display tracing results in the 3rd tab page
/// </summary>
/// <param name="wm">Water meter entity</param>
/// <param name="refRecords">ReferenceRecord-s from tracing DB</param>
void ShowTracingResults(Results.Entities.WaterMeter wm, IList<ReferenceRecord> refRecords)
{
tracingResultsListView.Columns.Add(Strings.Date_and_time, 110);
tracingResultsListView.Columns.Add(Strings.Step, 100);
tracingResultsListView.Columns.Add(Strings.Workplace, 100);
tracingResultsListView.Columns.Add(Strings.Name, 100);
tracingResultsListView.Columns.Add(Strings.Result, 70);
tracingResultsListView.Columns.Add(Strings.Part, 90);
tracingResultsListView.Columns.Add(Strings.Code, 150);
tracingResultsListView.Columns.Add(Strings.Workflow, 450);
if (refRecords == null || refRecords.Count == 0)
{
messageLabel.Text = "V sledovaní výroby nie sú žiadne záznamy";
}
else
{
Process proc = refRecords[0].Process;
bool[] isMissing = new bool[proc.Worksteps.Count];
for (int i = 0; i < isMissing.Length; i++) isMissing[i] = true;
foreach (var rr in refRecords)
{
tracingResultsListView.Items.Add(new ListViewItem(new string[]
{
rr.TimeStamp.ToString("dd.MM.yyyy HH:mm"),
rr.Workstep.Name,
rr.Workplace,
rr.UserName,
rr.Result == 0 ? "OK" : "NOK",
rr.Workstep.ReferencePart.Name,
rr.Code,
rr.Process.Name,
}));
for (int i = 0; i < isMissing.Length; i++)
{
if (proc.Worksteps[i] == rr.Workstep) isMissing[i] = false;
}
}
string missingWorkplace = null;
for (int i = 0; i < isMissing.Length; i++)
{
if (isMissing[i])
{
if (missingWorkplace == null)
{
missingWorkplace = proc.Worksteps[i].Name;
messageLabel.Text = string.Format("Chýba záznam z pracoviska {0}", missingWorkplace);
}
else
{
messageLabel.Text = string.Format("Chýba záznam z pracoviska {0} aj z nasledujúcich pracovísk", missingWorkplace);
}
}
}
if (missingWorkplace == null)
{
messageLabel.Text = "Všetko je OK";
}
}
}
}
}
-103
View File
@@ -1,103 +0,0 @@
namespace Results.Forms
{
partial class OneWMResultsColumnsCtrl
{
/// <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;
this.tBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tBox_MouseDoubleClick);
//
// 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;
}
}
-159
View File
@@ -1,159 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
namespace Results.Forms
{
public partial class OneWMResultsColumnsCtrl : UserControl, IOneWMResultsCtrl
{
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
///
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
{
try
{
if (WMResultsClickedHandler != null) WMResultsClickedHandler(sender, new WaterMeterEventArgs(wmPosition));
}
catch (Exception)
{
}
}
bool disabled;
int wmPosition; /// 1-based water meter position
string caption;
Color bkColor;
int[] columnWidths;
IList<Results.WMeterRsltItemSpec> items;
public bool Disabled { get { return disabled; } } /// Read only
public int WMPosition { get { return wmPosition; } } /// Read only
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } } /// Read only
public OneWMResultsColumnsCtrl()
{
InitializeComponent();
disabled = false;
wmPosition = 0;
tBox.Text = caption = "---";
tBox.BackColor = lView.BackColor = bkColor = Color.White;
items = new List<Results.WMeterRsltItemSpec>();
columnWidths = new int[0];
}
public void Update(int[] columnWidths)
{
this.columnWidths = columnWidths;
/// Always update ListView column widths
int col = 0;
foreach (ColumnHeader column in lView.Columns)
{
column.Width = (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : ((col == 0) ? 40 : 70);
col++;
}
}
public void Update(IList<Results.WMeterRsltItemSpec> items)
{
this.items = items;
}
public void Update(Results.Entities.WaterMeter wMtr)
{
if (wMtr == null || wMtr.Disabled)
{
/// Water meter position is disabled
this.disabled = true;
lView.Items.Clear();
tBox.Text = caption = "---";
tBox.BackColor = lView.BackColor = bkColor = Color.White;
return;
}
/// Update background color
string message = string.Empty;
Update(wMtr.GetColorOfResults(false, out message));
/// Update caption
#if ORACLE_DB
tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
#endif
/// Header
lView.Columns.Add(wmPosition.ToString(), (columnWidths.Length > 0) ? columnWidths[0] : 40);
int col = 1;
foreach (var str in wMtr.GetAllDecoratedTestNames())
{
lView.Columns.Add(str, (columnWidths.Length > col) ? columnWidths[col] : 70);
col++;
}
lView.Items.Clear();
if (items == null || items.Count == 0) return;
foreach (var item in items)
{
ListViewItem lvi = new ListViewItem(item.Caption);
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never &&
mtr.Publish() != Config.Entities.Publish.Internal)
{
string str = item.Print(wMtr, mtr.Name());
string[] texts = str.Split(new char[] { '|' });
if (texts.Length == 1)
{
lvi.SubItems.Add(str);
}
else if (texts.Length == 2)
{
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
lvi.UseItemStyleForSubItems = false;
lvi.SubItems.Add(texts[0]);
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
}
else
{
lvi.SubItems.Add(string.Empty);
}
}
}
lView.Items.Add(lvi);
}
}
///
/// Private
///
void Update(int wmPosition)
{
this.wmPosition = wmPosition;
if (lView.Columns.Count > 0)
{
lView.Columns[0].Text = wmPosition.ToString();
}
}
void Update(Color backColor)
{
if (this.bkColor != backColor)
{
tBox.BackColor = lView.BackColor = this.bkColor = backColor;
}
}
}
}
-103
View File
@@ -1,103 +0,0 @@
namespace Results.Forms
{
partial class OneWMResultsRowsCtrl
{
/// <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;
this.tBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.tBox_MouseDoubleClick);
//
// 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;
}
}
-169
View File
@@ -1,169 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
namespace Results.Forms
{
public partial class OneWMResultsRowsCtrl : UserControl, IOneWMResultsCtrl
{
public event EventHandler<WaterMeterEventArgs> WMResultsClickedHandler;
///
private void tBox_MouseDoubleClick(object sender, MouseEventArgs e)
{
try
{
if (WMResultsClickedHandler != null) WMResultsClickedHandler(sender, new WaterMeterEventArgs(wmPosition));
}
catch (Exception)
{
}
}
bool disabled;
int wmPosition; /// 1-based water meter position
string caption;
Color bkColor;
int[] columnWidths;
IList<Results.WMeterRsltItemSpec> items;
public bool Disabled { get { return disabled; } } /// Read only
public int WMPosition { get { return wmPosition; } } /// Read only
public ListView.ColumnHeaderCollection Columns { get { return lView.Columns; } } /// Read only
public OneWMResultsRowsCtrl()
{
InitializeComponent();
disabled = false;
wmPosition = 0;
tBox.Text = caption = "---";
tBox.BackColor = lView.BackColor = bkColor = Color.White;
items = new List<Results.WMeterRsltItemSpec>();
columnWidths = new int[0];
}
public void Update(int[] columnWidths)
{
this.columnWidths = columnWidths;
/// Always update ListView column widths
int col = 0;
foreach (ColumnHeader column in lView.Columns)
{
column.Width = (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : ((col == 0) ? 40 : 70);
col++;
}
}
public void Update(IList<Results.WMeterRsltItemSpec> items)
{
this.items = items;
/// Always draw ListView header
lView.Columns.Clear();
lView.Columns.Add(wmPosition.ToString(), (columnWidths.Length > 0) ? columnWidths[0] : 40);
if (items == null || items.Count == 0) return;
int col = 1;
foreach (var item in items)
{
lView.Columns.Add(item.Caption, (columnWidths.Length > col) ? columnWidths[col] : 70);
col++;
}
}
public void Update(Results.Entities.WaterMeter wMtr)
{
if (wMtr == null || wMtr.Disabled)
{
/// Water meter position is disabled
this.disabled = true;
lView.Items.Clear();
tBox.Text = caption = "---";
tBox.BackColor = lView.BackColor = bkColor = Color.White;
return;
}
/// Update background color
string message = string.Empty;
Update(wMtr.GetColorOfResults(false, out message));
/// Update caption
#if ORACLE_DB
tBox.Text = caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
tBox.Text = caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
#endif
Update(wMtr.WMPosition);
/// Update test results
IList<string> testNames = wMtr.GetAllDecoratedTestNames();
int ix = 0;
lView.Items.Clear();
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Config.Entities.Publish.Never
&& mtr.Publish() != Config.Entities.Publish.Internal)
{
ListViewItem lvi = new ListViewItem(testNames[ix++]);
if (items != null)
{
for (int i = 0; i < items.Count; i++)
{
string str = items[i].Print(wMtr, mtr.Name());
/// Extract and use color information
string[] texts = str.Split(new char[] { '|' });
if (texts.Length == 1)
{
lvi.SubItems.Add(str);
}
else if (texts.Length == 2)
{
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
lvi.UseItemStyleForSubItems = false;
lvi.SubItems.Add(texts[0]);
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
}
else
{
lvi.SubItems.Add(string.Empty);
}
}
}
lView.Items.Add(lvi);
}
}
}
///
/// Private
///
void Update(int wmPosition)
{
this.wmPosition = wmPosition;
if (lView.Columns.Count > 0)
{
lView.Columns[0].Text = wmPosition.ToString();
}
}
void Update(Color backColor)
{
if (this.bkColor != backColor)
{
tBox.BackColor = lView.BackColor = this.bkColor = backColor;
}
}
}
}
-65
View File
@@ -1,65 +0,0 @@
namespace Results.Forms
{
partial class TracingResultsDlg
{
/// <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.tracingResultsListView = new System.Windows.Forms.ListView();
this.SuspendLayout();
//
// tracingResultsListView
//
this.tracingResultsListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.tracingResultsListView.GridLines = true;
this.tracingResultsListView.Location = new System.Drawing.Point(0, 0);
this.tracingResultsListView.Name = "tracingResultsListView";
this.tracingResultsListView.Size = new System.Drawing.Size(1228, 178);
this.tracingResultsListView.TabIndex = 0;
this.tracingResultsListView.UseCompatibleStateImageBehavior = false;
this.tracingResultsListView.View = System.Windows.Forms.View.Details;
//
// TracingResultsDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1228, 178);
this.Controls.Add(this.tracingResultsListView);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TracingResultsDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "TracingResultsDlg";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListView tracingResultsListView;
}
}
-44
View File
@@ -1,44 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using TracingDB.Entities;
using Results.Resources;
namespace Results.Forms
{
public partial class TracingResultsDlg : Form
{
public TracingResultsDlg(IList<ReferenceRecord> rRecords)
{
InitializeComponent();
Text = Strings.Production_tracing_results;
tracingResultsListView.Columns.Add(Strings.Date_and_time, 110);
tracingResultsListView.Columns.Add(Strings.Step, 100);
tracingResultsListView.Columns.Add(Strings.Workplace, 100);
tracingResultsListView.Columns.Add(Strings.Name, 100);
tracingResultsListView.Columns.Add(Strings.Result, 70);
tracingResultsListView.Columns.Add(Strings.Part, 90);
tracingResultsListView.Columns.Add(Strings.Code, 150);
tracingResultsListView.Columns.Add(Strings.Workflow, 450);
foreach (var rr in rRecords)
{
tracingResultsListView.Items.Add(new ListViewItem(new string[] {
rr.TimeStamp.ToString("dd.MM.yyyy HH:mm"),
rr.Workstep.Name,
rr.Workplace,
rr.UserName,
rr.Result == 0 ? "OK" : "NOK",
rr.Workstep.ReferencePart.Name,
rr.Code,
rr.Process.Name,
}));
}
}
}
}
-14
View File
@@ -1,14 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
namespace Results.Forms
{
public class WaterMeterEventArgs : EventArgs
{
public int WMPosition;
public WaterMeterEventArgs(int wmPosition) { WMPosition = wmPosition; }
}
}
+71 -137
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
/// Copyright (c) 2016-2017 Sensus Metering Systems
///
using System;
@@ -71,7 +71,7 @@ namespace Results
Pulse__liter, /// 61 Water meter constant (pulses per liter) specific for one test
Reference_pulses_ni, /// 62 Reference pulses gated for specific meter (synchro method)
Reference_energy, /// 63
Bench_ID, /// 64 Test bench ID (int) obtained from a component implementing IBenchInfo
Test_bench_ID, /// 64
Program_version, /// 65
User_name, /// 66
User_nr, /// 67
@@ -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
@@ -251,72 +251,6 @@ namespace Results
Flow_ctv_start, /// 217
Flow_ctv_end, /// 218
ConstMasterRaw, /// 219 ConstMaster (like 194) uncorrected
Reference_error_corr, /// 220 Reference flow meter error after correction using correction curve
Proc_description, /// 221 Procedure description (CEVAK, not mapped to DB)
Bench_name, /// 222 'Test bench name' (string) obtained from a component implementing IBenchInfo
Bench_address1, /// 223 'Address 1' from IBenchInfo
Bench_address2, /// 224 'Address 2' from IBenchInfo
Bench_address3, /// 225 'Address 3' from IBenchInfo
Bench_address4, /// 226 'Address 4' from IBenchInfo
Bench_address5, /// 227 'Address 5' from IBenchInfo
Max_test_index, /// 228 MaxPruefindex % 100
VolumeCTV, /// 229
/// iPerl
LastError, /// 230 For iPerl previous test result (test with Proefindex-1)
OrigCalibFactorLNA, /// 231
CalibFactorLNA, /// 232
WM_remark, /// 233
/// iPerl special
Prod_AssignedSerialNr, /// 234
Prod_CompleteSerialNr, /// 235
Prod_RadioAddress, /// 236
Prod_PaletteNr, /// 237
Prod_UmkartonNr, /// 238
Prod_TestBench, /// 239
Prod_WMPosition, /// 240
Prod_UserName, /// 241
Prod_PurchaseOrder, /// 242
Prod_Passed, /// 243
Prod_ResultCode, /// 244
Prod_Q2CorrRL, /// 245
Prod_Q2CorrLR, /// 246
TestPartStr, /// 247
Error_heat_mtr_vol, /// 248
Energy_start, /// 249
Energy_end, /// 250
OraWMTypeID, /// 251
OraWMTypeRev, /// 252
E25, /// 253
E26, /// 254
E27, /// 255
E28, /// 256
RefFlowmeter, /// 257
Test_Method_Elde, /// 258
Counter1, /// 259 counterIdx0 = 0
Counter2, /// 260 counterIdx0 = 1
Counter3, /// 261 counterIdx0 = 2
Counter4, /// 262 counterIdx0 = 3
Counter5, /// 263 counterIdx0 = 4
Counter6, /// 264 counterIdx0 = 5
Counter7, /// 265 counterIdx0 = 6
Counter8, /// 266 counterIdx0 = 7
Counter9, /// 267 counterIdx0 = 8
Counter10, /// 268 counterIdx0 = 9
ConstMasterCorr, /// 269
TimeBtwnMassMsrmnts, /// 270
TestTimeCorrection, /// 271
Count,
}
+1 -11
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
/// Copyright (c) 2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Results.Entities;
@@ -26,16 +26,6 @@ namespace Results.Mappings
.Column("Custom1"); ;
Map(x => x.Custom2);
Map(x => x.Custom3);
Map(x => x.Counter1);
Map(x => x.Counter2);
Map(x => x.Counter3);
Map(x => x.Counter4);
Map(x => x.Counter5);
Map(x => x.Counter6);
Map(x => x.Counter7);
Map(x => x.Counter8);
Map(x => x.Counter9);
Map(x => x.Counter10);
Map(x => x.StartTime);
Map(x => x.EndTime);
Map(x => x.Dirty);
+3 -6
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// Copyright (c) 2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Results.Entities;
@@ -12,7 +12,6 @@ namespace Results.Mappings
{
Id(x => x.Id);
Map(x => x.CompoundMeterId);
Map(x => x.RegReaderType);
Map(x => x.PulsesMeter);
Map(x => x.PulsesMaster);
Map(x => x.PulsesPerLiter);
@@ -26,10 +25,8 @@ namespace Results.Mappings
Map(x => x.Error);
Map(x => x.TestDone);
Map(x => x.Passed);
#if ORACLE_DB
Map(x => x.LastError);
#endif
References(x => x.WaterMeter);
References(x => x.WaterMeter);
References(x => x.TestRslt);
}
}
+2 -7
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
/// Copyright (c) 2015-2017 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Results.Entities;
@@ -16,7 +16,6 @@ namespace Results.Mappings
References<Components>(x => x.Components);
Map(x => x.Part);
Map(x => x.RepetitionNr);
Map(x => x.MethodClass);
Map(x => x.TestDone);
Map(x => x.Remark)
@@ -25,13 +24,9 @@ namespace Results.Mappings
Map(x => x.StartTime);
Map(x => x.EndTime);
Map(x => x.FlowSetTime);
Map(x => x.TimeBtwnMassMsrmnts);
Map(x => x.TestTime);
Map(x => x.TestTimeCorrection);
Map(x => x.PulsesMaster);
Map(x => x.ConstMasterRaw);
Map(x => x.ConstMasterCorr);
Map(x => x.ConstMaster);
Map(x => x.ConstMaster);
Map(x => x.MassStartRaw);
Map(x => x.MassStart);
Map(x => x.MassEndRaw);
+1 -2
View File
@@ -42,8 +42,6 @@ namespace Results.Mappings
Map(x => x.MetrologicalClassAux);
Map(x => x.ApprovalInfoAux);
Map(x => x.Medium);
Map(x => x.Text1);
Map(x => x.Text2);
Map(x => x.Text3);
@@ -56,6 +54,7 @@ namespace Results.Mappings
#endif
#if ORACLE_DB
Map(x => x.WMTypeId);
Map(x => x.WMTypeRev);
#endif
}
}

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