Compare commits

...
43 changed files with 3497 additions and 575 deletions
+2
View File
@@ -10,6 +10,8 @@ Encrypt/bin/
Encrypt/obj/
GemCard/bin
GemCard/obj
GenCode128/bin
GenCode128/obj
GraphLib/bin
GraphLib/obj
TracingDB/bin
+6 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;MURES_40</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;MURES_40</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -81,10 +81,12 @@
<Compile Include="Entities\IperlEnums.cs" />
<Compile Include="Entities\MeasurementCorrection.cs" />
<Compile Include="Entities\MetersPath.cs" />
<Compile Include="Entities\MeterTestResult.cs" />
<Compile Include="Entities\OutputPath.cs" />
<Compile Include="Entities\Procedure.cs" />
<Compile Include="Entities\ProcedureHistory.cs" />
<Compile Include="Entities\Test.cs" />
<Compile Include="Entities\TestResult.cs" />
<Compile Include="Entities\TransitionSequence.cs" />
<Compile Include="Entities\TransitionStep.cs" />
<Compile Include="Entities\User.cs" />
@@ -103,9 +105,11 @@
<Compile Include="Mappings\HeatMetersPathMap.cs" />
<Compile Include="Mappings\MeasurementCorrectionMap.cs" />
<Compile Include="Mappings\MetersPathMap.cs" />
<Compile Include="Mappings\MeterTestResultMap.cs" />
<Compile Include="Mappings\OutputPathMap.cs" />
<Compile Include="Mappings\ProcedureMap.cs" />
<Compile Include="Mappings\TestMap.cs" />
<Compile Include="Mappings\TestResultMap.cs" />
<Compile Include="Mappings\TransitionSequenceMap.cs" />
<Compile Include="Mappings\TransitionStepMap.cs" />
<Compile Include="Mappings\UserMap.cs" />
+67
View File
@@ -0,0 +1,67 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
namespace Config.Entities
{
public class MeterTestResult
{
public virtual int Id { get; protected set; }
public virtual TestResult TestResult { get; set; } /// reference to the TestResult entity
public virtual bool Disabled { get; set; } /// true = this meter was disabled and the results should be disregarded
public virtual string SerialNr { get; set; }
public virtual string EndState { get; set; }
public virtual float VolumeStart { get; set; } /// liter
public virtual float VolumeEnd { get; set; } /// liter
public virtual float VolumeMeter { get; set; } /// liter
public virtual float VolumeRef { get; set; } /// liter
public virtual float VolumeErrorPct { get; set; } /// %
public virtual float PulsesMeter { get; set; } /// # of pulses
public virtual float PulsesPerLiter { get; set; } /// Pulses per liter
public virtual float PulsesMaster { get; set; }
public virtual float Time { get; set; } /// sec.
public virtual float TimeStart { get; set; } /// sec. - Not mapped to DB !!!
public virtual float TimeEnd { get; set; } /// sec. - Not mapped to DB !!!
public virtual int CalibFactor { get; set; } /// iPerl calibration factor used during the test - Not mapped to DB !!!
public virtual double Q2Correction { get; set; } /// iPerl Q2 correction used during the test - Not mapped to DB !!!
public virtual bool Passed { get; set; } /// true=test passed - Not mapped to DB !!!
public MeterTestResult()
{
PulsesPerLiter = 1.0f;
}
public MeterTestResult(TestResult testResult)
: this()
{
TestResult = testResult;
}
public virtual MeterTestResult Clone(TestResult testResult)
{
MeterTestResult result = new MeterTestResult(testResult);
result.Disabled = Disabled;
result.SerialNr = SerialNr;
result.EndState = EndState;
result.VolumeStart = VolumeStart;
result.VolumeEnd = VolumeEnd;
result.VolumeMeter = VolumeMeter;
result.VolumeRef = VolumeRef;
result.VolumeErrorPct = VolumeErrorPct;
result.PulsesMeter = PulsesMeter;
result.PulsesPerLiter = PulsesPerLiter;
result.PulsesMaster = PulsesMaster;
result.Time = Time;
result.TimeStart = TimeStart;
result.TimeEnd = TimeEnd;
result.CalibFactor = CalibFactor;
result.Q2Correction = Q2Correction;
result.Passed = Passed;
return result;
}
}
}
+171
View File
@@ -0,0 +1,171 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
namespace Config.Entities
{
public class TestResult
{
public virtual int Id { get; protected set; }
public virtual string Name { get; set; }
public virtual int BatchNr { get; set; }
public virtual string PurchaseOrder { get; set; }
public virtual MetersKind MetersKind { get; set; }
public virtual IList<MeterTestResult> Meters { get; set; }
public virtual IList<MeterTestResult> CombinedMeters { get; set; }
/// Value copied from the procedure (Entities.Procedure)
public virtual string ProcedureName { get; set; }
public virtual string ProtocolTitle { get; set; }
/// Values copied from the test (Entities.Test)
public virtual int TestId { get; set; } /// Test entity ID to distinguish between tests with the same name
public virtual string TestName { get; set; }
public virtual int Part { get; set; }
public virtual bool DoNotEvaluate { get; set; } /// Not mapped to the database
public virtual bool DoNotPublish { get; set; } /// Not mapped to the database
public virtual float Qfrom { get; set; } /// [m3/h] Water flow low limit
public virtual float Qto { get; set; } /// [m3/h] Water flow high limit
public virtual float Volume { get; set; } /// [l] Target test volume
public virtual float TstTime { get; set; } /// [s] Test time estimate
public virtual int Repeats { get; set; }
public virtual bool Emptying { get; set; }
public virtual bool Zeroing { get; set; }
public virtual float PumpPower { get; set; } /// Power of the pump in [%] in the range 0 .. 100.0f, use values 0% and 100% for non-FM pumps
public virtual int Time2MassMsrmt { get; set; }
public virtual string Method { get; set; }
public virtual float ErrLimLo { get; set; } /// [%] Lower error limit (usually < 0)
public virtual float ErrLimHi { get; set; } /// [%] Upper error limit (usually > 0)
public virtual float Uncertainty { get; set; } /// [%] Makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
/// To be replaced by the virtual bench component parameters
public virtual string FeedingPath { get; set; }
public virtual string BenchPath { get; set; }
public virtual string OutputPath { get; set; }
public virtual string MetersPath { get; set; }
/// Results
public virtual DateTime TimeStart { get; set; } /// Date and time of the test start
public virtual DateTime TimeEnd { get; set; } /// Date and time of the test end
public virtual int RepetitionNr { get; set; } /// Repetition number from the set of repeated tests (1...)
public virtual float AmbientTempAve { get; set; } /// [deg.C] Average ambient air temperature
public virtual float AmbientPressAve { get; set; } /// Average ambient air pressure
public virtual float AmbientHumiAve { get; set; } /// [%] Average ambient air relative humidity
public virtual float PressInAvrg { get; set; } /// [Bar] Input water pressure (average)
public virtual float PressInStart { get; set; } /// [Bar]
public virtual float PressInEnd { get; set; } /// [Bar]
public virtual float PressOutAvrg { get; set; } /// [Bar]
public virtual float PressOutStart { get; set; } /// [Bar]
public virtual float PressOutEnd { get; set; } /// [Bar]
public virtual float TempInAvrg { get; set; } /// [deg.C]
public virtual float TempInStart { get; set; } /// [deg.C]
public virtual float TempInEnd { get; set; } /// [deg.C]
public virtual float TempOutAvrg { get; set; } /// [deg.C]
public virtual float TempOutStart { get; set; } /// [deg.C]
public virtual float TempOutEnd { get; set; } /// [deg.C]
public virtual float TempDivAvrg { get; set; } /// [deg.C]
public virtual float TempDivStart { get; set; } /// [deg.C]
public virtual float TempDivEnd { get; set; } /// [deg.C]
public virtual float MassStartRaw { get; set; } /// [kg]
public virtual float MassStart { get; set; } /// [kg]
public virtual float MassEndRaw { get; set; } /// [kg]
public virtual float MassEnd { get; set; } /// [kg]
public virtual float MassDiff { get; set; } /// [kg]
public virtual float DensityIn { get; set; } /// [kg/m3]
public virtual float DensityOut { get; set; } /// [kg/m3]
public virtual float DensityDiv { get; set; } /// [kg/m3]
public virtual float Buoyancy { get; set; } ///TODO -> map
public virtual float FlowMass { get; set; } /// [kg/h] calculated from conventional true value
public virtual float FlowVolume { get; set; } /// [l/h] calculated from conventional true value
public virtual float VolumeCTV { get; set; } /// [l] Volume conventional true value
public virtual float VolumeMaster { get; set; } /// [l] Volume from the master flow meter
public virtual float Time { get; set; } /// [s] Measurement time in seconds
public virtual float ErrorMaster { get; set; } /// [%]
public virtual float PulsesMaster { get; set; }
public virtual float ConstMaster { get; set; } /// [pls/l] Pulses per liter master flow meter
public virtual float QRise { get; set; } /// Detected Q_rise of a composed meter
public virtual float QFall { get; set; } /// Detected Q_fall of a composed meter
public virtual float TimeDivStart0 { get; set; }
public virtual float TimeDivStart1 { get; set; }
public virtual float TimeDivStart2 { get; set; }
public virtual float TimeDivStart3 { get; set; }
public virtual float TimeDivStart4 { get; set; }
public virtual float TimeDivStart5 { get; set; }
public virtual float TimeDivEnd0 { get; set; }
public virtual float TimeDivEnd1 { get; set; }
public virtual float TimeDivEnd2 { get; set; }
public virtual float TimeDivEnd3 { get; set; }
public virtual float TimeDivEnd4 { get; set; }
public virtual float TimeDivEnd5 { get; set; }
public TestResult()
{
Meters = new List<MeterTestResult>();
CombinedMeters = new List<MeterTestResult>();
}
public TestResult(MetersKind kind)
: this()
{
MetersKind = kind;
if (kind == MetersKind.Single)
{
for (int i = 0; i < Config.Data.WMsCount; i++) Meters.Add(new MeterTestResult(this));
}
else if (kind == MetersKind.Combined)
{
for (int i = 0; i < 2 * Config.Data.CompoundWMsCount; i++) Meters.Add(new MeterTestResult(this));
for (int i = 0; i < Config.Data.CompoundWMsCount; i++) CombinedMeters.Add(new MeterTestResult(this));
}
}
public TestResult(Test test, int repetitionNr, MetersKind kind)
: this(kind)
{
if (test.Repeats == 1)
{
Name = test.Name;
}
else
{
Name = string.Format("{0} ({1}/{2})", test.Name, repetitionNr, test.Repeats);
}
RepetitionNr = repetitionNr;
/// Copy test parameters from Entities.Procedure object
ProcedureName = test.Procedure.Name;
ProtocolTitle = string.Empty;
/// Copy test parameters from Entities.Test object
TestId = test.Id;
TestName = test.Name;
Part = test.Part;
Qfrom = test.Qfrom;
Qto = test.Qto;
Volume = test.Volume;
TstTime = test.TstTime;
Repeats = test.Repeats;
Emptying = test.DoDraining;
Zeroing = test.DoDrainingAfter;
PumpPower = PumpPower;
Time2MassMsrmt = test.TimeStop2Mass;
Method = test.Method;
ErrLimLo = test.ErrLimLo;
ErrLimHi = test.ErrLimHi;
Uncertainty = test.Uncertainty;
FeedingPath = test.FeedingPath;
BenchPath = test.BenchPath;
OutputPath = test.OutputPath;
MetersPath = test.MetersPath;
}
public override string ToString()
{
return string.Format("batch={0}, procedure={1}, test={2}, {3} {4}", BatchNr, ProcedureName, TestName, TimeStart.ToShortDateString(), TimeStart.ToShortTimeString());
}
}
}
+29
View File
@@ -0,0 +1,29 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class MeterTestResultMap : ClassMap<MeterTestResult>
{
public MeterTestResultMap()
{
Id(x => x.Id);
References(x => x.TestResult);
Map(x => x.Disabled);
Map(x => x.SerialNr);
Map(x => x.EndState);
Map(x => x.VolumeStart);
Map(x => x.VolumeEnd);
Map(x => x.VolumeMeter);
Map(x => x.VolumeRef);
Map(x => x.VolumeErrorPct);
Map(x => x.PulsesMeter);
Map(x => x.PulsesPerLiter);
Map(x => x.PulsesMaster);
Map(x => x.Time);
}
}
}
+109
View File
@@ -0,0 +1,109 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class TestResultMap : ClassMap<TestResult>
{
public TestResultMap()
{
Id(x => x.Id);
Map(x => x.Name);
Map(x => x.BatchNr);
Map(x => x.PurchaseOrder);
Map(x => x.MetersKind);
HasMany(x => x.Meters)
.Cascade.All();
HasMany(x => x.CombinedMeters)
.Cascade.All();
Map(x => x.ProcedureName);
Map(x => x.ProtocolTitle);
Map(x => x.TestId);
Map(x => x.TestName);
Map(x => x.Part);
Map(x => x.Qfrom);
Map(x => x.Qto);
Map(x => x.Volume);
Map(x => x.TstTime);
Map(x => x.Repeats);
Map(x => x.Emptying);
Map(x => x.Zeroing);
Map(x => x.PumpPower);
Map(x => x.Time2MassMsrmt);
Map(x => x.Method);
Map(x => x.ErrLimLo);
Map(x => x.ErrLimHi);
Map(x => x.Uncertainty);
Map(x => x.FeedingPath)
.CustomType("StringClob")
.CustomSqlType("varchar(4000)");
Map(x => x.BenchPath)
.CustomType("StringClob")
.CustomSqlType("varchar(4000)");
Map(x => x.OutputPath)
.CustomType("StringClob")
.CustomSqlType("varchar(4000)");
Map(x => x.MetersPath)
.CustomType("StringClob")
.CustomSqlType("varchar(4000)");
Map(x => x.TimeStart);
Map(x => x.TimeEnd);
Map(x => x.RepetitionNr);
Map(x => x.AmbientTempAve);
Map(x => x.AmbientPressAve);
Map(x => x.AmbientHumiAve);
Map(x => x.PressInAvrg);
Map(x => x.PressInStart);
Map(x => x.PressInEnd);
Map(x => x.PressOutAvrg);
Map(x => x.PressOutStart);
Map(x => x.PressOutEnd);
Map(x => x.TempInAvrg);
Map(x => x.TempInStart);
Map(x => x.TempInEnd);
Map(x => x.TempOutAvrg);
Map(x => x.TempOutStart);
Map(x => x.TempOutEnd);
Map(x => x.TempDivAvrg);
Map(x => x.TempDivStart);
Map(x => x.TempDivEnd);
Map(x => x.MassStartRaw);
Map(x => x.MassStart);
Map(x => x.MassEndRaw);
Map(x => x.MassEnd);
Map(x => x.MassDiff);
Map(x => x.DensityIn);
Map(x => x.DensityOut);
Map(x => x.DensityDiv);
Map(x => x.FlowMass); /// from conventional true value
Map(x => x.FlowVolume); /// from conventional true value
Map(x => x.VolumeCTV); /// volume conventional true value
Map(x => x.VolumeMaster); /// volume from the master flow meter
Map(x => x.Time); /// measurement time in seconds
Map(x => x.ErrorMaster);
Map(x => x.PulsesMaster);
Map(x => x.ConstMaster); /// Pulses per liter master flow meter
Map(x => x.QRise);
Map(x => x.QFall);
Map(x => x.TimeDivStart0);
Map(x => x.TimeDivStart1);
Map(x => x.TimeDivStart2);
Map(x => x.TimeDivStart3);
Map(x => x.TimeDivStart4);
Map(x => x.TimeDivStart5);
Map(x => x.TimeDivEnd0);
Map(x => x.TimeDivEnd1);
Map(x => x.TimeDivEnd2);
Map(x => x.TimeDivEnd3);
Map(x => x.TimeDivEnd4);
Map(x => x.TimeDivEnd5);
}
}
}
+51
View File
@@ -0,0 +1,51 @@
using System.Reflection;
// 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("GenCode128")]
[assembly: AssemblyDescription("GenCode128")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Chris Wuestefeld")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("2006 Chris Wuestefeld")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
+139
View File
@@ -0,0 +1,139 @@
namespace GenCode128
{
/// <summary>
/// Static tools for determining codes for individual characters in the content
/// </summary>
public static class Code128Code
{
private const int CShift = 98;
private const int CCodeA = 101;
private const int CCodeB = 100;
private const int CStartA = 103;
private const int CStartB = 104;
private const int CStop = 106;
/// <summary>
/// Indicates which code sets can represent a character -- CodeA, CodeB, or either
/// </summary>
public enum CodeSetAllowed
{
CodeA,
CodeB,
CodeAorB
}
/// <summary>
/// Get the Code128 code value(s) to represent an ASCII character, with
/// optional look-ahead for length optimization
/// </summary>
/// <param name="charAscii">The ASCII value of the character to translate</param>
/// <param name="lookAheadAscii">The next character in sequence (or -1 if none)</param>
/// <param name="currentCodeSet">The current codeset, that the returned codes need to follow;
/// if the returned codes change that, then this value will be changed to reflect it</param>
/// <returns>An array of integers representing the codes that need to be output to produce the
/// given character</returns>
public static int[] CodesForChar(int charAscii, int lookAheadAscii, ref CodeSet currentCodeSet)
{
int[] result;
var shifter = -1;
if (!CharCompatibleWithCodeset(charAscii, currentCodeSet))
{
// if we have a lookahead character AND if the next character is ALSO not compatible
if ((lookAheadAscii != -1) && !CharCompatibleWithCodeset(lookAheadAscii, currentCodeSet))
{
// we need to switch code sets
switch (currentCodeSet)
{
case CodeSet.CodeA:
shifter = CCodeB;
currentCodeSet = CodeSet.CodeB;
break;
case CodeSet.CodeB:
shifter = CCodeA;
currentCodeSet = CodeSet.CodeA;
break;
}
}
else
{
// no need to switch code sets, a temporary SHIFT will suffice
shifter = CShift;
}
}
if (shifter != -1)
{
result = new int[2];
result[0] = shifter;
result[1] = CodeValueForChar(charAscii);
}
else
{
result = new int[1];
result[0] = CodeValueForChar(charAscii);
}
return result;
}
/// <summary>
/// Tells us which codesets a given character value is allowed in
/// </summary>
/// <param name="charAscii">ASCII value of character to look at</param>
/// <returns>Which codeset(s) can be used to represent this character</returns>
public static CodeSetAllowed CodesetAllowedForChar(int charAscii)
{
if (charAscii >= 32 && charAscii <= 95)
{
return CodeSetAllowed.CodeAorB;
}
else
{
return charAscii < 32 ? CodeSetAllowed.CodeA : CodeSetAllowed.CodeB;
}
}
/// <summary>
/// Determine if a character can be represented in a given codeset
/// </summary>
/// <param name="charAscii">character to check for</param>
/// <param name="currentCodeSet">codeset context to test</param>
/// <returns>true if the codeset contains a representation for the ASCII character</returns>
public static bool CharCompatibleWithCodeset(int charAscii, CodeSet currentCodeSet)
{
var csa = CodesetAllowedForChar(charAscii);
return csa == CodeSetAllowed.CodeAorB || (csa == CodeSetAllowed.CodeA && currentCodeSet == CodeSet.CodeA)
|| (csa == CodeSetAllowed.CodeB && currentCodeSet == CodeSet.CodeB);
}
/// <summary>
/// Gets the integer code128 code value for a character (assuming the appropriate code set)
/// </summary>
/// <param name="charAscii">character to convert</param>
/// <returns>code128 symbol value for the character</returns>
public static int CodeValueForChar(int charAscii)
{
return charAscii >= 32 ? charAscii - 32 : charAscii + 64;
}
/// <summary>
/// Return the appropriate START code depending on the codeset we want to be in
/// </summary>
/// <param name="cs">The codeset you want to start in</param>
/// <returns>The code128 code to start a barcode in that codeset</returns>
public static int StartCodeForCodeSet(CodeSet cs)
{
return cs == CodeSet.CodeA ? CStartA : CStartB;
}
/// <summary>
/// Return the Code128 stop code
/// </summary>
/// <returns>the stop code</returns>
public static int StopCode()
{
return CStop;
}
}
}
+97
View File
@@ -0,0 +1,97 @@
namespace GenCode128
{
using System.Collections;
using System.Text;
/// <summary>
/// Represent the set of code values to be output into barcode form
/// </summary>
public class Code128Content
{
/// <summary>
/// Create content based on a string of ASCII data
/// </summary>
/// <param name="asciiData">the string that should be represented</param>
public Code128Content(string asciiData)
{
this.Codes = this.StringToCode128(asciiData);
}
/// <summary>
/// Provides the Code128 code values representing the object's string
/// </summary>
public int[] Codes
{
get { return codes; }
set { codes = value; }
}
int[] codes;
/// <summary>
/// Transform the string into integers representing the Code128 codes
/// necessary to represent it
/// </summary>
/// <param name="asciiData">String to be encoded</param>
/// <returns>Code128 representation</returns>
private int[] StringToCode128(string asciiData)
{
// turn the string into ascii byte data
var asciiBytes = Encoding.ASCII.GetBytes(asciiData);
// decide which codeset to start with
var csa1 = asciiBytes.Length > 0
? Code128Code.CodesetAllowedForChar(asciiBytes[0])
: Code128Code.CodeSetAllowed.CodeAorB;
var csa2 = asciiBytes.Length > 1
? Code128Code.CodesetAllowedForChar(asciiBytes[1])
: Code128Code.CodeSetAllowed.CodeAorB;
var currentCodeSet = this.GetBestStartSet(csa1, csa2);
// set up the beginning of the barcode
// assume no codeset changes, account for start, checksum, and stop
var codes = new ArrayList(asciiBytes.Length + 3) { Code128Code.StartCodeForCodeSet(currentCodeSet) };
// add the codes for each character in the string
for (var i = 0; i < asciiBytes.Length; i++)
{
int thischar = asciiBytes[i];
var nextchar = asciiBytes.Length > i + 1 ? asciiBytes[i + 1] : -1;
codes.AddRange(Code128Code.CodesForChar(thischar, nextchar, ref currentCodeSet));
}
// calculate the check digit
var checksum = (int)codes[0];
for (var i = 1; i < codes.Count; i++)
{
checksum += i * (int)codes[i];
}
codes.Add(checksum % 103);
codes.Add(Code128Code.StopCode());
var result = codes.ToArray(typeof(int)) as int[];
return result;
}
/// <summary>
/// Determines the best starting code set based on the the first two
/// characters of the string to be encoded
/// </summary>
/// <param name="csa1">First character of input string</param>
/// <param name="csa2">Second character of input string</param>
/// <returns>The codeset determined to be best to start with</returns>
private CodeSet GetBestStartSet(Code128Code.CodeSetAllowed csa1, Code128Code.CodeSetAllowed csa2)
{
var vote = 0;
vote += csa1 == Code128Code.CodeSetAllowed.CodeA ? 1 : 0;
vote += csa1 == Code128Code.CodeSetAllowed.CodeB ? -1 : 0;
vote += csa2 == Code128Code.CodeSetAllowed.CodeA ? 1 : 0;
vote += csa2 == Code128Code.CodeSetAllowed.CodeB ? -1 : 0;
return vote > 0 ? CodeSet.CodeA : CodeSet.CodeB; // ties go to codeB due to my own prejudices
}
}
}
+188
View File
@@ -0,0 +1,188 @@
namespace GenCode128
{
using System;
using System.Drawing;
/// <summary>
/// Summary description for Code128Rendering.
/// </summary>
public static class Code128Rendering
{
private const int CQuietWidth = 10;
// Code patterns:
// in principle these rows should each have 6 elements
// however, the last one -- STOP -- has 7. The cost of the
// extra integers is trivial, and this lets the code flow
// much more elegantly
private static readonly int[,] CPatterns =
{
{ 2, 1, 2, 2, 2, 2, 0, 0 }, // 0
{ 2, 2, 2, 1, 2, 2, 0, 0 }, // 1
{ 2, 2, 2, 2, 2, 1, 0, 0 }, // 2
{ 1, 2, 1, 2, 2, 3, 0, 0 }, // 3
{ 1, 2, 1, 3, 2, 2, 0, 0 }, // 4
{ 1, 3, 1, 2, 2, 2, 0, 0 }, // 5
{ 1, 2, 2, 2, 1, 3, 0, 0 }, // 6
{ 1, 2, 2, 3, 1, 2, 0, 0 }, // 7
{ 1, 3, 2, 2, 1, 2, 0, 0 }, // 8
{ 2, 2, 1, 2, 1, 3, 0, 0 }, // 9
{ 2, 2, 1, 3, 1, 2, 0, 0 }, // 10
{ 2, 3, 1, 2, 1, 2, 0, 0 }, // 11
{ 1, 1, 2, 2, 3, 2, 0, 0 }, // 12
{ 1, 2, 2, 1, 3, 2, 0, 0 }, // 13
{ 1, 2, 2, 2, 3, 1, 0, 0 }, // 14
{ 1, 1, 3, 2, 2, 2, 0, 0 }, // 15
{ 1, 2, 3, 1, 2, 2, 0, 0 }, // 16
{ 1, 2, 3, 2, 2, 1, 0, 0 }, // 17
{ 2, 2, 3, 2, 1, 1, 0, 0 }, // 18
{ 2, 2, 1, 1, 3, 2, 0, 0 }, // 19
{ 2, 2, 1, 2, 3, 1, 0, 0 }, // 20
{ 2, 1, 3, 2, 1, 2, 0, 0 }, // 21
{ 2, 2, 3, 1, 1, 2, 0, 0 }, // 22
{ 3, 1, 2, 1, 3, 1, 0, 0 }, // 23
{ 3, 1, 1, 2, 2, 2, 0, 0 }, // 24
{ 3, 2, 1, 1, 2, 2, 0, 0 }, // 25
{ 3, 2, 1, 2, 2, 1, 0, 0 }, // 26
{ 3, 1, 2, 2, 1, 2, 0, 0 }, // 27
{ 3, 2, 2, 1, 1, 2, 0, 0 }, // 28
{ 3, 2, 2, 2, 1, 1, 0, 0 }, // 29
{ 2, 1, 2, 1, 2, 3, 0, 0 }, // 30
{ 2, 1, 2, 3, 2, 1, 0, 0 }, // 31
{ 2, 3, 2, 1, 2, 1, 0, 0 }, // 32
{ 1, 1, 1, 3, 2, 3, 0, 0 }, // 33
{ 1, 3, 1, 1, 2, 3, 0, 0 }, // 34
{ 1, 3, 1, 3, 2, 1, 0, 0 }, // 35
{ 1, 1, 2, 3, 1, 3, 0, 0 }, // 36
{ 1, 3, 2, 1, 1, 3, 0, 0 }, // 37
{ 1, 3, 2, 3, 1, 1, 0, 0 }, // 38
{ 2, 1, 1, 3, 1, 3, 0, 0 }, // 39
{ 2, 3, 1, 1, 1, 3, 0, 0 }, // 40
{ 2, 3, 1, 3, 1, 1, 0, 0 }, // 41
{ 1, 1, 2, 1, 3, 3, 0, 0 }, // 42
{ 1, 1, 2, 3, 3, 1, 0, 0 }, // 43
{ 1, 3, 2, 1, 3, 1, 0, 0 }, // 44
{ 1, 1, 3, 1, 2, 3, 0, 0 }, // 45
{ 1, 1, 3, 3, 2, 1, 0, 0 }, // 46
{ 1, 3, 3, 1, 2, 1, 0, 0 }, // 47
{ 3, 1, 3, 1, 2, 1, 0, 0 }, // 48
{ 2, 1, 1, 3, 3, 1, 0, 0 }, // 49
{ 2, 3, 1, 1, 3, 1, 0, 0 }, // 50
{ 2, 1, 3, 1, 1, 3, 0, 0 }, // 51
{ 2, 1, 3, 3, 1, 1, 0, 0 }, // 52
{ 2, 1, 3, 1, 3, 1, 0, 0 }, // 53
{ 3, 1, 1, 1, 2, 3, 0, 0 }, // 54
{ 3, 1, 1, 3, 2, 1, 0, 0 }, // 55
{ 3, 3, 1, 1, 2, 1, 0, 0 }, // 56
{ 3, 1, 2, 1, 1, 3, 0, 0 }, // 57
{ 3, 1, 2, 3, 1, 1, 0, 0 }, // 58
{ 3, 3, 2, 1, 1, 1, 0, 0 }, // 59
{ 3, 1, 4, 1, 1, 1, 0, 0 }, // 60
{ 2, 2, 1, 4, 1, 1, 0, 0 }, // 61
{ 4, 3, 1, 1, 1, 1, 0, 0 }, // 62
{ 1, 1, 1, 2, 2, 4, 0, 0 }, // 63
{ 1, 1, 1, 4, 2, 2, 0, 0 }, // 64
{ 1, 2, 1, 1, 2, 4, 0, 0 }, // 65
{ 1, 2, 1, 4, 2, 1, 0, 0 }, // 66
{ 1, 4, 1, 1, 2, 2, 0, 0 }, // 67
{ 1, 4, 1, 2, 2, 1, 0, 0 }, // 68
{ 1, 1, 2, 2, 1, 4, 0, 0 }, // 69
{ 1, 1, 2, 4, 1, 2, 0, 0 }, // 70
{ 1, 2, 2, 1, 1, 4, 0, 0 }, // 71
{ 1, 2, 2, 4, 1, 1, 0, 0 }, // 72
{ 1, 4, 2, 1, 1, 2, 0, 0 }, // 73
{ 1, 4, 2, 2, 1, 1, 0, 0 }, // 74
{ 2, 4, 1, 2, 1, 1, 0, 0 }, // 75
{ 2, 2, 1, 1, 1, 4, 0, 0 }, // 76
{ 4, 1, 3, 1, 1, 1, 0, 0 }, // 77
{ 2, 4, 1, 1, 1, 2, 0, 0 }, // 78
{ 1, 3, 4, 1, 1, 1, 0, 0 }, // 79
{ 1, 1, 1, 2, 4, 2, 0, 0 }, // 80
{ 1, 2, 1, 1, 4, 2, 0, 0 }, // 81
{ 1, 2, 1, 2, 4, 1, 0, 0 }, // 82
{ 1, 1, 4, 2, 1, 2, 0, 0 }, // 83
{ 1, 2, 4, 1, 1, 2, 0, 0 }, // 84
{ 1, 2, 4, 2, 1, 1, 0, 0 }, // 85
{ 4, 1, 1, 2, 1, 2, 0, 0 }, // 86
{ 4, 2, 1, 1, 1, 2, 0, 0 }, // 87
{ 4, 2, 1, 2, 1, 1, 0, 0 }, // 88
{ 2, 1, 2, 1, 4, 1, 0, 0 }, // 89
{ 2, 1, 4, 1, 2, 1, 0, 0 }, // 90
{ 4, 1, 2, 1, 2, 1, 0, 0 }, // 91
{ 1, 1, 1, 1, 4, 3, 0, 0 }, // 92
{ 1, 1, 1, 3, 4, 1, 0, 0 }, // 93
{ 1, 3, 1, 1, 4, 1, 0, 0 }, // 94
{ 1, 1, 4, 1, 1, 3, 0, 0 }, // 95
{ 1, 1, 4, 3, 1, 1, 0, 0 }, // 96
{ 4, 1, 1, 1, 1, 3, 0, 0 }, // 97
{ 4, 1, 1, 3, 1, 1, 0, 0 }, // 98
{ 1, 1, 3, 1, 4, 1, 0, 0 }, // 99
{ 1, 1, 4, 1, 3, 1, 0, 0 }, // 100
{ 3, 1, 1, 1, 4, 1, 0, 0 }, // 101
{ 4, 1, 1, 1, 3, 1, 0, 0 }, // 102
{ 2, 1, 1, 4, 1, 2, 0, 0 }, // 103
{ 2, 1, 1, 2, 1, 4, 0, 0 }, // 104
{ 2, 1, 1, 2, 3, 2, 0, 0 }, // 105
{ 2, 3, 3, 1, 1, 1, 2, 0 } // 106
};
/// <summary>
/// Make an image of a Code128 barcode for a given string
/// </summary>
/// <param name="inputData">Message to be encoded</param>
/// <param name="barWeight">Base thickness for bar width (1 or 2 works well)</param>
/// <param name="addQuietZone">Add required horizontal margins (use if output is tight)</param>
/// <returns>An Image of the Code128 barcode representing the message</returns>
public static Image MakeBarcodeImage(string inputData, int barWeight, bool addQuietZone)
{
// get the Code128 codes to represent the message
var content = new Code128Content(inputData);
var codes = content.Codes;
var width = (((codes.Length - 3) * 11) + 35) * barWeight;
var height = Convert.ToInt32(Math.Ceiling(Convert.ToSingle(width) * .15F));
if (addQuietZone)
{
width += 2 * CQuietWidth * barWeight; // on both sides
}
// get surface to draw on
Image myImage = new Bitmap(width, height);
using (var gr = Graphics.FromImage(myImage))
{
// set to white so we don't have to fill the spaces with white
gr.FillRectangle(Brushes.White, 0, 0, width, height);
// skip quiet zone
var cursor = addQuietZone ? CQuietWidth * barWeight : 0;
for (var codeIdx = 0; codeIdx < codes.Length; codeIdx++)
{
var code = codes[codeIdx];
// take the bars two at a time: a black and a white
for (var bar = 0; bar < 8; bar += 2)
{
var barWidth = CPatterns[code, bar] * barWeight;
var spcWidth = CPatterns[code, bar + 1] * barWeight;
// if width is zero, don't try to draw it
if (barWidth > 0)
{
gr.FillRectangle(Brushes.Black, cursor, 0, barWidth, height);
}
// note that we never need to draw the space, since we
// initialized the graphics to all white
// advance cursor beyond this pair
cursor += barWidth + spcWidth;
}
}
}
return myImage;
}
}
}
+9
View File
@@ -0,0 +1,9 @@
namespace GenCode128
{
public enum CodeSet
{
CodeA,
CodeB
//// CodeC // not supported
}
}
+147
View File
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{32817BF9-E380-4467-9C7F-936F4B122BC7}</ProjectGuid>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>GenCode128</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<RootNamespace>GenCode128</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<OldToolsVersion>2.0</OldToolsVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>false</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Drawing">
<Name>System.Drawing</Name>
</Reference>
<Reference Include="System.Windows.Forms">
<Name>System.Windows.Forms</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Code128Code.cs" />
<Compile Include="CodeSet.cs" />
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Code128Content.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Code128Rendering.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
+9 -9
View File
@@ -59,15 +59,15 @@ namespace Results.Entities
public virtual bool Equals(Components bc)
{
if (TestBenchId != bc.TestBenchId) return false;
if (!TestBenchName.Equals(bc.TestBenchName)) return false;
if (!Pump.Equals(bc.Pump)) return false;
if (!RegValve.Equals(bc.RegValve)) return false;
if (!Flowmeter.Equals(bc.Flowmeter)) return false;
if (!Diverter.Equals(bc.Diverter)) return false;
if (!Scale.Equals(bc.Scale)) return false;
if (!Custom1.Equals(bc.Custom1)) return false;
if (!Custom2.Equals(bc.Custom2)) return false;
if (!Custom3.Equals(bc.Custom3)) return false;
if (TestBenchName != bc.TestBenchName) return false;
if (Pump != bc.Pump) return false;
if (RegValve != bc.RegValve) return false;
if (Flowmeter != bc.Flowmeter) return false;
if (Diverter != bc.Diverter) return false;
if (Scale != bc.Scale) return false;
if (Custom1 != bc.Custom1) return false;
if (Custom2 != bc.Custom2) return false;
if (Custom3 != bc.Custom3) return false;
return true;
}
+3 -3
View File
@@ -30,7 +30,7 @@ namespace Results.Entities
public virtual bool Evaluate { get; set; }
protected TestData()
public TestData()
{
Name = string.Empty;
Method = string.Empty;
@@ -64,13 +64,13 @@ namespace Results.Entities
/// <returns>first = two entities are equal (except of Id)</returns>
public virtual bool Equals(TestData td)
{
if (!Name.Equals(td.Name)) return false;
if (Name != td.Name) return false;
if (Repeats != td.Repeats) return false;
if (Qfrom != td.Qfrom) return false;
if (Qto != td.Qto) return false;
if (TargetVolume != td.TargetVolume) return false;
if (TargetTime != td.TargetTime) return false;
if (!Method.Equals(td.Method)) return false;
if (Method != td.Method) return false;
if (ErrLimLo != td.ErrLimLo) return false;
if (ErrLimHi != td.ErrLimHi) return false;
if (Uncertainty != td.Uncertainty) return false;
+8 -8
View File
@@ -68,8 +68,8 @@ namespace Results.Entities
/// <returns>first = two entities are equal (except of Id)</returns>
public virtual bool Equals(WaterMeterData wmd)
{
if (!ProductName.Equals(wmd.ProductName)) return false;
if (!Producer.Equals(wmd.Producer)) return false;
if (ProductName != wmd.ProductName) return false;
if (Producer != wmd.Producer) return false;
if (DN != wmd.DN) return false;
if (L != wmd.L) return false;
@@ -81,13 +81,13 @@ namespace Results.Entities
if (Q2_Qt != wmd.Q2_Qt) return false;
if (Q1_Qmin != wmd.Q1_Qmin) return false;
if (!MetrologicalClass.Equals(wmd.MetrologicalClass)) return false;
if (!TemperatureClass.Equals(wmd.TemperatureClass)) return false;
if (!PressureLossClass.Equals(wmd.PressureLossClass)) return false;
if (!MaxAdmissiblePressure.Equals(wmd.MaxAdmissiblePressure)) return false;
if (!FlowProfileSensitivityClass.Equals(wmd.FlowProfileSensitivityClass)) return false;
if (MetrologicalClass != wmd.MetrologicalClass) return false;
if (TemperatureClass != wmd.TemperatureClass) return false;
if (PressureLossClass != wmd.PressureLossClass) return false;
if (MaxAdmissiblePressure != wmd.MaxAdmissiblePressure) return false;
if (FlowProfileSensitivityClass != wmd.FlowProfileSensitivityClass) return false;
if (!ApprovalInfo.Equals(wmd.ApprovalInfo)) return false;
if (ApprovalInfo != wmd.ApprovalInfo) return false;
if (Certificate != wmd.Certificate) return false;
if (PulsesPerLtr != wmd.PulsesPerLtr) return false;
+13
View File
@@ -0,0 +1,13 @@
using System;
namespace Results.Output.Printers
{
public enum BarcodeType
{
None,
Code_128_Horizontally,
Code_128_Vertically,
QR_Code,
Count
}
}
@@ -1,19 +1,24 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using System.IO;
using Gma.QrCodeNet.Encoding;
using Config.Entities;
using Results.Resources;
using GenCode128;
namespace Results.Output.Printers.Label
{
public class LabelPrintDocument : PrintersCommon
{
/// Size of the printed area without margins, after taking into account 'pageOrientation'
static QrEncoder encoder = new QrEncoder();
/// Size of the printed area without margins, after taking into account 'pageOrientation'
readonly int printHeight;
readonly int printWidth;
@@ -93,6 +98,55 @@ namespace Results.Output.Printers.Label
e.Graphics.DrawString(item.Print(wm), this.font, Brushes.Black, printArea);
}
}
if (cfg.BarcodeType != BarcodeType.None && cfg.BarcodeType < BarcodeType.Count)
{
try
{
if (cfg.BarcodeType == BarcodeType.QR_Code)
{
QrCode qrCode = encoder.Encode(wm.SerialNr);
DrawQR(e.Graphics, qrCode, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
}
else if (cfg.BarcodeType == BarcodeType.Code_128_Horizontally || cfg.BarcodeType == BarcodeType.Code_128_Vertically)
{
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
if (cfg.BarcodeType == BarcodeType.Code_128_Vertically)
{
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
}
e.Graphics.DrawImage(img, cfg.BarcodeLeft, cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
}
}
catch (Exception)
{
}
}
}
public static void DrawQR(Graphics g, QrCode qrCode, float left, float top, float width, float height)
{
/// Assuming 100 dpi (printer)
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
float qrPixWidth = width / qrCode.Matrix.Width;
float qrPixHeight = height / qrCode.Matrix.Height;
for (int i = 0; i < qrCode.Matrix.Height; i++)
{
for (int j = 0; j < qrCode.Matrix.Width; j++)
{
if (qrCode.Matrix[j, i])
{
g.FillRectangle(Brushes.Black, new RectangleF(left + j * qrPixWidth,
top + i * qrPixHeight,
qrPixWidth,
qrPixHeight));
}
}
}
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
///
namespace Results.Output.Printers.Label
@@ -17,5 +17,10 @@ namespace Results.Output.Printers.Label
public System.Globalization.CultureInfo CultureInfo;
public bool GoodOnly;
public bool SupressPrinting; /// true = Bypass printing
}
public BarcodeType BarcodeType; /// s/n is printed as barcode when valid (BarcodeType.None < BarcodeType < BarcodeType.Count)
public int BarcodeLeft;
public int BarcodeTop;
public int BarcodeWidth;
public int BarcodeHeight;
}
}
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1340.0")]
[assembly: AssemblyFileVersion("2.18.1340.0")]
[assembly: AssemblyVersion("2.18.1423.0")]
[assembly: AssemblyFileVersion("2.18.1423.0")]
+10 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;MURES_40</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -27,7 +27,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;MURES_40</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -35,6 +35,9 @@
<Reference Include="FluentNHibernate">
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
</Reference>
<Reference Include="Gma.QrCodeNet.Encoding">
<HintPath>..\packages\QrCode.Net.0.4.0.0\net40\Gma.QrCodeNet.Encoding.dll</HintPath>
</Reference>
<Reference Include="Iesi.Collections">
<HintPath>..\packages\Iesi.Collections.4.0.0.4000\lib\net40\Iesi.Collections.dll</HintPath>
</Reference>
@@ -131,6 +134,7 @@
<SubType>Component</SubType>
</Compile>
<Compile Include="Output\Printers\Enhanced\EnhancedPrinterCfg.cs" />
<Compile Include="Output\Printers\Enums.cs" />
<Compile Include="Output\Printers\Label\LabelPrintDocument.cs">
<SubType>Component</SubType>
</Compile>
@@ -170,6 +174,10 @@
<Project>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\GenCode128\GenCode128.csproj">
<Project>{32817bf9-e380-4467-9c7f-936f4b122bc7}</Project>
<Name>GenCode128</Name>
</ProjectReference>
<ProjectReference Include="..\TracingDB\TracingDB.csproj">
<Project>{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}</Project>
<Name>TracingDB</Name>
+6 -6
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
///
using System;
using System.IO;
@@ -116,11 +116,11 @@ namespace ResultsBrowser
Bench4 = "WR14";
Bench5 = "WR15";
Bench6 = "PT7";
ConnectionString1 = "SERVER=10.42.128.93; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
ConnectionString2 = "SERVER=10.42.128.102; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
ConnectionString3 = "SERVER=10.42.128.89; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
ConnectionString4 = "SERVER=10.42.128.213; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
ConnectionString5 = "SERVER=10.42.128.214; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
ConnectionString1 = "SERVER=10.42.130.69; DATABASE=st-wr10-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
ConnectionString2 = "SERVER=10.42.129.27; DATABASE=st-wr11-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
ConnectionString3 = "SERVER=10.42.128.61; DATABASE=st-wr13-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
ConnectionString4 = "SERVER=10.42.130.72; DATABASE=st-wr14-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
ConnectionString5 = "SERVER=10.42.130.71; DATABASE=st-wr15-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
ConnectionString6 = "SERVER=10.42.129.26; DATABASE=iperlspecial-r; UID=vysledky; PASSWORD=GAqx76QUB6NbnpZP; CHARSET=utf8;";
Language = "SK";
#endif
+30
View File
@@ -0,0 +1,30 @@
using System;
namespace ResultsBrowser
{
public class OraData
{
public string PO;
public string PcbNr;
public int TestBenchId;
public int MaxPruefIx;
public int SN;
public int TestId;
public int WMPosition;
public int HydrPruefung;
public double AdjErr;
public double AdjErrA4;
public double Q3RlErr;
public double Q3LrErr;
public double Q2RlErr;
public double Q2LrErr;
public double Q1RlErr;
public double Q1LrErr;
public int CalibFactor;
public int CalibFactorLNA;
public int Q2CorrectionRl;
public int Q2CorrectionLr;
public OraData() { }
}
}
+3 -3
View File
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sensus")]
[assembly: AssemblyProduct("ResultsBrowser")]
[assembly: AssemblyCopyright("Copyright © 2015 - 2018 Sensus Slovensko a.s.")]
[assembly: AssemblyCopyright("Copyright © 2015 - 2020 Sensus Slovensko a.s.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1273.0")]
[assembly: AssemblyFileVersion("2.18.1273.0")]
[assembly: AssemblyVersion("2.18.1413.0")]
[assembly: AssemblyFileVersion("2.18.1413.0")]
+3 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;MURES_40</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -31,7 +31,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;MURES_40</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -177,6 +177,7 @@
<DependentUpon>StatisticsOptionsDlg.cs</DependentUpon>
</Compile>
<Compile Include="LocalSettings.cs" />
<Compile Include="OraData.cs" />
<Compile Include="Output\Printers\Statistics\StatisticsPrintDocument.cs">
<SubType>Component</SubType>
</Compile>
+13
View File
@@ -34,6 +34,7 @@
this.filtersFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.resultsGroupBox = new System.Windows.Forms.GroupBox();
this.resultsListView = new System.Windows.Forms.ListView();
this.customQueryButton = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.histogramBtn = new System.Windows.Forms.Button();
this.statisticsBtn = new System.Windows.Forms.Button();
@@ -84,6 +85,7 @@
//
// vSplitContainer.Panel2
//
this.vSplitContainer.Panel2.Controls.Add(this.customQueryButton);
this.vSplitContainer.Panel2.Controls.Add(this.groupBox1);
this.vSplitContainer.Panel2.Controls.Add(this.outputGroupBox);
this.vSplitContainer.Panel2.Controls.Add(this.printerConfigBtn);
@@ -158,6 +160,16 @@
this.resultsListView.UseCompatibleStateImageBehavior = false;
this.resultsListView.View = System.Windows.Forms.View.Details;
//
// customQueryButton
//
this.customQueryButton.Location = new System.Drawing.Point(31, 437);
this.customQueryButton.Name = "customQueryButton";
this.customQueryButton.Size = new System.Drawing.Size(85, 23);
this.customQueryButton.TabIndex = 14;
this.customQueryButton.Text = "Custom query";
this.customQueryButton.UseVisualStyleBackColor = true;
this.customQueryButton.Click += new System.EventHandler(this.customQueryButton_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.histogramBtn);
@@ -443,5 +455,6 @@
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox outputGroupBox;
private System.Windows.Forms.Button histogramBtn;
private System.Windows.Forms.Button customQueryButton;
}
}
+248 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -12,6 +12,8 @@ using TBF.BenchControl.Generic;
using TBF.BenchControl.GenericDevices;
using ResultsBrowser.Filters;
using ResultsBrowser.Resources;
using Oracle;
using Oracle.DataAccess.Client;
namespace ResultsBrowser
{
@@ -32,6 +34,8 @@ namespace ResultsBrowser
static IList<IComponent> tbfComponents;
static IList<IDevice> tbfDevices;
OracleConnection oracleConnection; /// Oracle database connection
public ResultsBrowserWnd(string[] args)
{
InitializeComponent();
@@ -543,5 +547,248 @@ namespace ResultsBrowser
return null;
}
private void customQueryButton_Click(object sender, EventArgs e)
{
#if IPERL
try
{
string[] orders = new string[] { "3137303", "3137301", "3142304", "3137302", "3137300" };
IList<OraData> oraDatas = new List<OraData>(); /// List of water meters
IList<int> testBenches = new List<int>(); /// List of test benches used to produce water meters
///
/// Get list of water meters satisfying (custom) criteria
///
Console.WriteLine("Collecting water meters");
foreach (var order in orders)
{
oracleConnection = new OracleConnection("Data Source=STARA01.WORLD;User Id=deltachef;Password=deltachef;");
oracleConnection.Open();
OracleCommand cmd = new OracleCommand("select VT_FERNUM, MAX_PRUEFINDEX, ZAEHLERNUMMER from VT_ZAEHLER_PD where AUFTRAGSNUMMER = :1 AND ANBID = 4 order by ZAEHLERNUMMER", oracleConnection);
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Varchar2, Value = order });
OracleDataReader dr = cmd.ExecuteReader();
int count = 0;
while (dr.Read())
{
int i = 0;
string pcbNr = dr.GetString(i++);
int maxPruefIx = dr.GetInt32(i++);
int testBenchId = maxPruefIx / 100;
maxPruefIx = maxPruefIx % 100;
int sn = dr.GetInt32(i++);
oraDatas.Add(new OraData() { PO = order, PcbNr = pcbNr, TestBenchId = testBenchId, MaxPruefIx = maxPruefIx, SN = sn });
if (!testBenches.Contains(testBenchId)) testBenches.Add(testBenchId);
count++;
}
dr.Close();
Console.WriteLine(string.Format("Order = {0} ... {1} water meters found", order, count));
}
Console.WriteLine("Collecting water meters completed");
Console.WriteLine();
///
/// Get required information about each water meter
///
Console.WriteLine("Reading additional data from Oracle");
int counter = 0;
foreach (var oraD in oraDatas)
{
Console.Write("{0} ", ++counter);
if (counter % 40 == 0) Console.WriteLine();
///
/// Read from VT_ZAEHLER_PINDEX_PD: TestId(ID_WZPRUEFREIHE))
///
OracleCommand cmd = new OracleCommand("select ID_PRUEFSTAND, ID_WZPRUEFREIHE, WT_PLATZ_NR, HYDR_PRUEFUNG from VT_ZAEHLER_PINDEX_PD where VT_FERNUM = :1 AND ANBID = 4 AND WZGUT = 1", oracleConnection);
cmd.Parameters.Add(new OracleParameter { ParameterName = "1", OracleDbType = OracleDbType.Varchar2, Value = oraD.PcbNr });
OracleDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
int i = 0;
int testBenchId = dr.GetInt32(i++) % 100;
oraD.TestId = dr.GetInt32(i++);
oraD.WMPosition = dr.GetInt32(i++);
oraD.HydrPruefung = dr.GetInt32(i++);
}
dr.Close();
///
/// Read from VT_IP_ZAEHLER_PINDEX_PD: Q2CorrectionRl, Q2CorrectionLr
///
cmd = new OracleCommand("select PRUEFINDEX, Q2CORRECTIONLEFT, Q2CORRECTIONRIGHT from VT_IP_ZAEHLER_PINDEX_PD where VT_FERNUM = :1 AND ANBID = 4", oracleConnection);
/// pruefindex, Q2_correction_RL, Q2_correction_LR, Q2_error_before_correction
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = oraD.PcbNr });
dr = cmd.ExecuteReader();
while (dr.Read())
{
int i = 0;
int prfix = (dr.GetInt32(i++) % 100);
if (prfix == oraD.MaxPruefIx)
{
oraD.Q2CorrectionRl = dr.GetInt32(i++);
oraD.Q2CorrectionLr = dr.GetInt32(i++);
}
}
dr.Close();
///
/// Read data from VT_PRUEFREIHE_IST_PD
///
/// testID, flow, rel.err., passed
cmd = new OracleCommand("select PRUEFUNGSNR, Q_WZ, Q_FEHLER, Q_BEST from VT_PRUEFREIHE_IST_PD where VT_FERNUM = :1 AND PRUEFINDEX = :2 AND ANBID = 4", oracleConnection);
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = oraD.PcbNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 100 * oraD.TestBenchId + oraD.MaxPruefIx });
dr = cmd.ExecuteReader();
while (dr.Read())
{
int i = 0;
int testId = dr.GetInt32(i++); /// PRUEFUNGSNR
double flow = dr.GetDouble(i++); /// Q_WZ
double error = dr.GetDouble(i++); /// Q_FEHLER
bool testPassed = (dr.GetInt32(i++) != 0);
/// SUEZ specific
switch (testId)
{
case -2:
oraD.AdjErrA4 = error;
break;
case -1:
oraD.AdjErr = error;
break;
case 5:
oraD.Q3LrErr = error;
break;
case 10:
oraD.Q3RlErr = error;
break;
default:
break;
}
}
dr.Close();
} /// end of foreach (var oraD in OraDatas)
Console.WriteLine();
Console.WriteLine("Reading additional data from Oracle completed");
Console.WriteLine();
oracleConnection.Close();
Console.WriteLine("Reading additional data from MySQL");
counter = 0;
foreach (var testBenchId in testBenches)
{
Console.WriteLine((testBenchId == 8) ? "WR13" : (testBenchId == 9) ? "WR15" : (testBenchId == 10) ? "WR14" : "other");
switch (testBenchId)
{
case 8:
Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr13-r; UID=root; PASSWORD=kraken; CharSet=utf8;";
break;
case 9:
Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr15-r; UID=root; PASSWORD=kraken; CharSet=utf8;";
break;
case 10:
Results.DB.ConnectionString = "SERVER=localhost; DATABASE=st-wr14-r; UID=root; PASSWORD=kraken; CharSet=utf8;";
break;
default:
Results.DB.ConnectionString = string.Empty;
break;
}
if (!string.IsNullOrEmpty(Results.DB.ConnectionString))
{
ISession session = Results.DB.CreateSession();
foreach (var oraD in oraDatas)
{
if (oraD.TestBenchId == testBenchId)
{
Console.Write("{0} ", ++counter);
if (counter % 40 == 0) Console.WriteLine();
IList<WaterMeter> wms = session.QueryOver<WaterMeter>()
.Where(x => x.SerialNr == oraD.PcbNr)
.And(x => x.Passed)
.List();
if (wms.Count == 1)
{
oraD.CalibFactor = (int)Math.Round(wms[0].CalibFactor);
oraD.CalibFactorLNA = (int)Math.Round(wms[0].CalibFactorLNA);
}
else
{
foreach (var wm in wms)
{
if (wm.Batch.BatchNr == oraD.TestId)
{
oraD.CalibFactor = (int)Math.Round(wm.CalibFactor);
oraD.CalibFactorLNA = (int)Math.Round(wm.CalibFactorLNA);
break;
}
}
}
}
}
Console.WriteLine();
session.Close();
}
}
Console.WriteLine("Reading additional data from MySQL");
Console.WriteLine();
Console.WriteLine("CSV data begin");
foreach (var oraD in oraDatas)
{
//Console.WriteLine(string.Format("S/N={0} PCB={1} bench={2} Batch={3} Pos={4} AdjA0={5} AdjA4={6} Q3RL={7} Q3LR={8} CalF={9} CAlF_LNA={10} HP={11} Q2cRL={12} Q2cLR={13}",
// oraD.SN,
// oraD.PcbNr,
// (oraD.TestBenchId == 8) ? "WR13" : (oraD.TestBenchId == 9) ? "WR15" : (oraD.TestBenchId == 10) ? "WR14" : "other",
// oraD.TestId,
// oraD.WMPosition,
// oraD.AdjErr.ToString("F1"),
// oraD.AdjErrA4.ToString("F1"),
// oraD.Q3RlErr.ToString("F1"),
// oraD.Q3LrErr.ToString("F1"),
// oraD.CalibFactor,
// oraD.CalibFactorLNA,
// oraD.HydrPruefung,
// oraD.Q2CorrectionRl,
// oraD.Q2CorrectionLr));
Console.WriteLine(string.Format("{0}; =(\"{1}\"); {2}; {3}; {4}; {5}; {6}; {7}; {8}; {9}; {10}; {12}; {13}",
oraD.SN,
oraD.PcbNr,
(oraD.TestBenchId == 8) ? "WR13" : (oraD.TestBenchId == 9) ? "WR15" : (oraD.TestBenchId == 10) ? "WR14" : "other",
oraD.TestId,
oraD.WMPosition,
oraD.AdjErr.ToString("F2"),
oraD.AdjErrA4.ToString("F2"),
oraD.Q3RlErr.ToString("F2"),
oraD.Q3LrErr.ToString("F2"),
oraD.CalibFactor,
oraD.CalibFactorLNA,
oraD.HydrPruefung,
oraD.Q2CorrectionRl,
oraD.Q2CorrectionLr));
}
Console.WriteLine("CSV data end");
}
catch (Exception exc)
{
MessageBox.Show(exc.Message);
}
#endif
}
}
}
+12
View File
@@ -50,6 +50,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Decrypt", "Decrypt\Decrypt.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Encrypt", "Encrypt\Encrypt.csproj", "{DA9B09F3-A99D-4883-A954-537560453674}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenCode128", "GenCode128\GenCode128.csproj", "{32817BF9-E380-4467-9C7F-936F4B122BC7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -202,6 +204,16 @@ Global
{DA9B09F3-A99D-4883-A954-537560453674}.Release|Mixed Platforms.Build.0 = Release|x86
{DA9B09F3-A99D-4883-A954-537560453674}.Release|x86.ActiveCfg = Release|x86
{DA9B09F3-A99D-4883-A954-537560453674}.Release|x86.Build.0 = Release|x86
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Debug|x86.ActiveCfg = Debug|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|Any CPU.Build.0 = Release|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{32817BF9-E380-4467-9C7F-936F4B122BC7}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+1 -1
View File
@@ -43,7 +43,7 @@ namespace TBF.BenchControl.Elde
public int EtPulses(int wmNr1) { return (int)ctrlBrdComponent.etPulses[wmNr1]; }
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40 || IZRAEL_200 || MALTA_WSD25
#if DN100 || MUNICH || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40 || IZRAEL_200 || MALTA_WSD25 || FUZHOU_300
public int EtPulsesK { get { return 1; } }
#else /// all new benches
public int EtPulsesK { get { return (int)ctrlBrdComponent.etPulsesK; } }
@@ -1,193 +0,0 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using Config.Entities;
using TBF.Resources;
namespace TBF.BenchControl.Output.Printers.Label
{
public class PrintLabelDocument : PrintDocument
{
const int FontSize = 9;
const string FontFamilyName = "Arial"; //"Times New Roman";
readonly int paperWidth;
readonly int paperHeight;
readonly string templateFile;
/// <summary> Property variable for the Font the user wishes to use </summary>
Font font;
///
/// Data to print
///
Results.Entities.Batch batch;
///
/// Layout and status
///
int nextWMNr; /// nr. of watermeter to be printed as the first one on the next page
int nrPages;
/// <summary>
/// Constructor
/// </summary>
/// <param name="textToPrint">Text to be printed</param>
public PrintLabelDocument(Results.Entities.Batch batch,
PageOrientation pageOrientation,
int paperWidth,
int paperHeight,
string templateFile)
{
this.batch = batch;
this.paperWidth = paperWidth;
this.paperHeight = paperHeight;
this.templateFile = templateFile;
DefaultPageSettings.Landscape = (pageOrientation == PageOrientation.Landscape);
/// Set print area size and margins (in dots using 80 dpi)
int printHeight = base.DefaultPageSettings.PaperSize.Height - base.DefaultPageSettings.Margins.Top - base.DefaultPageSettings.Margins.Bottom;
int printWidth = base.DefaultPageSettings.PaperSize.Width - base.DefaultPageSettings.Margins.Left - base.DefaultPageSettings.Margins.Right;
int leftMargin = base.DefaultPageSettings.Margins.Left; /// X
int topMargin = base.DefaultPageSettings.Margins.Top; /// Y
/// Check if the user selected to print in Landscape mode
/// if they did then we need to swap height/width parameters
if (DefaultPageSettings.Landscape)
{
int tmp = printHeight;
printHeight = printWidth;
printWidth = tmp;
}
/// One watermeter per label/page
nrPages = batch.WaterMeters.Count;
nextWMNr = 0;
}
/// <summary>
/// Override the default onbeginPrint method of the PrintDocument Object
/// </summary>
/// <param name=e></param>
/// <remarks></remarks>
protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
{
base.OnBeginPrint(e);
if (font == null) { font = new Font(FontFamilyName, FontSize, FontStyle.Regular); }
}
/// <summary>
/// Override the default OnPrintPage method of the PrintDocument.
/// </summary>
/// <param name=e></param>
/// <remarks>This provides the print logic for our document</remarks>
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs e)
{
/// Run base code
base.OnPrintPage(e);
if (File.Exists(templateFile))
{
Image img = Image.FromFile(templateFile);
e.Graphics.DrawImage(new Bitmap(img), new Rectangle(0, 0, paperWidth, paperHeight));
}
/// Set print area size and margins (in dots using 80 dpi)
int printHeight = base.DefaultPageSettings.PaperSize.Height - base.DefaultPageSettings.Margins.Top - base.DefaultPageSettings.Margins.Bottom;
int printWidth = base.DefaultPageSettings.PaperSize.Width - base.DefaultPageSettings.Margins.Left - base.DefaultPageSettings.Margins.Right;
int leftMargin = base.DefaultPageSettings.Margins.Left; /// X
int topMargin = base.DefaultPageSettings.Margins.Top; /// Y
/// Check if the user selected to print in Landscape mode
/// if they did then we need to swap height/width parameters
if (base.DefaultPageSettings.Landscape)
{
int tmp = printHeight;
printHeight = printWidth;
printWidth = tmp;
}
int x = leftMargin;
int y = topMargin;
/// Use the StringFormat class for the text layout of our document
StringFormat format = new StringFormat(StringFormatFlags.LineLimit);
///--------
/// Body
///--------
PrintWM(e, nextWMNr);
nextWMNr++;
e.HasMorePages = (nextWMNr < batch.WaterMeters.Count);
}
/// <summary>
/// Print one water meter results
/// </summary>
/// <param name="wmNr">Water meter number (0-based)</param>
void PrintWM(System.Drawing.Printing.PrintPageEventArgs e, int wmNr)
{
if (wmNr >= batch.WaterMeters.Count) return;
Results.Entities.WaterMeter wm = batch.WaterMeters[wmNr];
if (wm == null) return;
/// Serial number
if (!string.IsNullOrEmpty(wm.SerialNr)) PrintAt(e, 20, 62, string.Format("S/N: {0}", wm.SerialNr));
/// Watermeter type
PrintAt(e, 20, 74, batch.ProtocolTitle);
/// Date
PrintAt(e, 135, 74, string.Format("{0:dd/MM/yy", batch.EndTime));
Results.WMeterRsltItemSpec item1 = Results.WMeterRsltItemSpec.GetItem(Results.ItemID.Test_name);
Results.WMeterRsltItemSpec item2 = Results.WMeterRsltItemSpec.GetItem(Results.ItemID.Error);
item2.Units = Config.Unit.Pct;
item2.Precision = "F2";
item2.Format = "{0}%";
int printPosition = 1;
foreach (var mtr in wm.MeterTestRslts)
{
item1.TestID = mtr.Name();
item2.TestID = mtr.Name();
PrintAt(e, 20, 6 + 14 * printPosition, item1.Print(wm));
PrintAt(e, 78, 6 + 14 * printPosition, item2.Print(wm));
printPosition++;
}
}
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
{
PrintAt(e, p.X, p.Y, text);
}
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
{
RectangleF printArea = new RectangleF(x, y, 667, 18);
e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -76,6 +76,11 @@ namespace TBF.BenchControl.Output.Printers.Label
printerCfg.NrOfCopies = newCfg.NrOfCopies;
printerCfg.GoodOnly = newCfg.GoodOnly;
printerCfg.SupressPrinting = newCfg.SupressPrinting;
printerCfg.BarcodeType = newCfg.BarcodeType;
printerCfg.BarcodeLeft = newCfg.BarcodeLeft;
printerCfg.BarcodeTop = newCfg.BarcodeTop;
printerCfg.BarcodeWidth = newCfg.BarcodeWidth;
printerCfg.BarcodeHeight = newCfg.BarcodeHeight;
ApplyConfig();
}
@@ -131,7 +136,6 @@ namespace TBF.BenchControl.Output.Printers.Label
}
void PrintResults(Results.Entities.Batch batch, Results.Entities.WaterMeter wm, string documentName)
{
LabelPrinterCfg cfg = new LabelPrinterCfg
@@ -147,6 +151,11 @@ namespace TBF.BenchControl.Output.Printers.Label
CultureInfo = (printerCfg.Culture == Culture.system) ? Thread.CurrentThread.CurrentCulture : new CultureInfo(printerCfg.Culture.ToString()),
GoodOnly = printerCfg.GoodOnly,
SupressPrinting = printerCfg.SupressPrinting,
BarcodeType = printerCfg.BarcodeType,
BarcodeLeft = printerCfg.BarcodeLeft,
BarcodeTop = printerCfg.BarcodeTop,
BarcodeWidth = printerCfg.BarcodeWidth,
BarcodeHeight = printerCfg.BarcodeHeight,
};
for (int i = 1; i <= printerCfg.NrOfCopies; i++)
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -33,6 +33,13 @@ namespace TBF.BenchControl.Output.Printers.Label
public bool GoodOnly;
public bool SupressPrinting; /// true = Bypass printing
public Results.Output.Printers.BarcodeType BarcodeType;
public int BarcodeLeft;
public int BarcodeTop;
public int BarcodeWidth;
public int BarcodeHeight;
/// Private parameterless constructor invoked by all other (public) constructors
PrinterCfg()
{
@@ -55,18 +62,20 @@ namespace TBF.BenchControl.Output.Printers.Label
NrOfCopies = 1;
GoodOnly = false;
SupressPrinting = false;
BarcodeType = Results.Output.Printers.BarcodeType.None;
}
public string ToString(int i)
{
return string.Format("Name={0}, Orientation={1}, PaperWidth={2}, PaperHeight={3}, TemplateFile={4}, GoodOnly={5}, SupressPrinting={6}",
return string.Format("Name={0}, Orientation={1}, PaperWidth={2}, PaperHeight={3}, TemplateFile={4}, GoodOnly={5}, SupressPrinting={6}, Barcode={7}",
Name,
PageOrientation,
PaperWidth,
PaperHeight,
Template,
GoodOnly ? "yes" : "no",
SupressPrinting ? "yes" : "no"
SupressPrinting ? "yes" : "no",
BarcodeType.ToString()
);
}
}
+397 -293
View File
@@ -31,296 +31,391 @@ namespace TBF.BenchControl.Output.Printers.Label
/// </summary>
private void InitializeComponent()
{
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.supressPrintingCheckBox = new System.Windows.Forms.CheckBox();
this.orientationLabel = new System.Windows.Forms.Label();
this.orientationComboBox = new System.Windows.Forms.ComboBox();
this.templateTextBox = new System.Windows.Forms.TextBox();
this.templateLabel = new System.Windows.Forms.Label();
this.paperWidthTextBox = new System.Windows.Forms.TextBox();
this.paperWidthLabel = new System.Windows.Forms.Label();
this.paperHeightTextBox = new System.Windows.Forms.TextBox();
this.paperHeightLabel = new System.Windows.Forms.Label();
this.italicCheckBox = new System.Windows.Forms.CheckBox();
this.boldCheckBox = new System.Windows.Forms.CheckBox();
this.fontSizeTextBox = new System.Windows.Forms.TextBox();
this.fontFamilyComboBox = new System.Windows.Forms.ComboBox();
this.bodyFontLabel = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.itemsToPrintButton = new System.Windows.Forms.Button();
this.nrOfCopiesLabel = new System.Windows.Forms.Label();
this.nrOfCopiesTextBox = new System.Windows.Forms.TextBox();
this.cultureComboBox = new System.Windows.Forms.ComboBox();
this.cultureLabel = new System.Windows.Forms.Label();
this.goodOnlyCheckBox = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(122, 35);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(8, 38);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(119, 11);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(61, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "Class name";
//
// supressPrintingCheckBox
//
this.supressPrintingCheckBox.AutoSize = true;
this.supressPrintingCheckBox.Enabled = false;
this.supressPrintingCheckBox.Location = new System.Drawing.Point(122, 283);
this.supressPrintingCheckBox.Name = "supressPrintingCheckBox";
this.supressPrintingCheckBox.Size = new System.Drawing.Size(101, 17);
this.supressPrintingCheckBox.TabIndex = 11;
this.supressPrintingCheckBox.Text = "Supress printing";
this.supressPrintingCheckBox.UseVisualStyleBackColor = true;
//
// orientationLabel
//
this.orientationLabel.AutoSize = true;
this.orientationLabel.Location = new System.Drawing.Point(8, 84);
this.orientationLabel.Name = "orientationLabel";
this.orientationLabel.Size = new System.Drawing.Size(84, 13);
this.orientationLabel.TabIndex = 3;
this.orientationLabel.Text = "Page orientation";
//
// orientationComboBox
//
this.orientationComboBox.Enabled = false;
this.orientationComboBox.FormattingEnabled = true;
this.orientationComboBox.Location = new System.Drawing.Point(122, 81);
this.orientationComboBox.Name = "orientationComboBox";
this.orientationComboBox.Size = new System.Drawing.Size(130, 21);
this.orientationComboBox.TabIndex = 4;
//
// templateTextBox
//
this.templateTextBox.Enabled = false;
this.templateTextBox.Location = new System.Drawing.Point(122, 58);
this.templateTextBox.Name = "templateTextBox";
this.templateTextBox.Size = new System.Drawing.Size(228, 20);
this.templateTextBox.TabIndex = 10;
//
// templateLabel
//
this.templateLabel.AutoSize = true;
this.templateLabel.Location = new System.Drawing.Point(8, 61);
this.templateLabel.Name = "templateLabel";
this.templateLabel.Size = new System.Drawing.Size(67, 13);
this.templateLabel.TabIndex = 9;
this.templateLabel.Text = "Template file";
//
// paperWidthTextBox
//
this.paperWidthTextBox.Enabled = false;
this.paperWidthTextBox.Location = new System.Drawing.Point(122, 105);
this.paperWidthTextBox.Name = "paperWidthTextBox";
this.paperWidthTextBox.Size = new System.Drawing.Size(51, 20);
this.paperWidthTextBox.TabIndex = 6;
//
// paperWidthLabel
//
this.paperWidthLabel.AutoSize = true;
this.paperWidthLabel.Location = new System.Drawing.Point(8, 108);
this.paperWidthLabel.Name = "paperWidthLabel";
this.paperWidthLabel.Size = new System.Drawing.Size(63, 13);
this.paperWidthLabel.TabIndex = 5;
this.paperWidthLabel.Text = "Paper width";
//
// paperHeightTextBox
//
this.paperHeightTextBox.Enabled = false;
this.paperHeightTextBox.Location = new System.Drawing.Point(122, 128);
this.paperHeightTextBox.Name = "paperHeightTextBox";
this.paperHeightTextBox.Size = new System.Drawing.Size(51, 20);
this.paperHeightTextBox.TabIndex = 8;
//
// paperHeightLabel
//
this.paperHeightLabel.AutoSize = true;
this.paperHeightLabel.Location = new System.Drawing.Point(8, 131);
this.paperHeightLabel.Name = "paperHeightLabel";
this.paperHeightLabel.Size = new System.Drawing.Size(67, 13);
this.paperHeightLabel.TabIndex = 7;
this.paperHeightLabel.Text = "Paper height";
//
// bodyItalicCheckBox
//
this.italicCheckBox.AutoSize = true;
this.italicCheckBox.Enabled = false;
this.italicCheckBox.Location = new System.Drawing.Point(335, 190);
this.italicCheckBox.Name = "bodyItalicCheckBox";
this.italicCheckBox.Size = new System.Drawing.Size(15, 14);
this.italicCheckBox.TabIndex = 47;
this.italicCheckBox.UseVisualStyleBackColor = true;
//
// bodyBoldCheckBox
//
this.boldCheckBox.AutoSize = true;
this.boldCheckBox.Enabled = false;
this.boldCheckBox.Location = new System.Drawing.Point(307, 190);
this.boldCheckBox.Name = "bodyBoldCheckBox";
this.boldCheckBox.Size = new System.Drawing.Size(15, 14);
this.boldCheckBox.TabIndex = 46;
this.boldCheckBox.UseVisualStyleBackColor = true;
//
// bodyFontSizeTextBox
//
this.fontSizeTextBox.Enabled = false;
this.fontSizeTextBox.Location = new System.Drawing.Point(259, 184);
this.fontSizeTextBox.Name = "bodyFontSizeTextBox";
this.fontSizeTextBox.Size = new System.Drawing.Size(29, 20);
this.fontSizeTextBox.TabIndex = 45;
//
// bodyFontFamilyComboBox
//
this.fontFamilyComboBox.Enabled = false;
this.fontFamilyComboBox.FormattingEnabled = true;
this.fontFamilyComboBox.Location = new System.Drawing.Point(122, 184);
this.fontFamilyComboBox.Name = "bodyFontFamilyComboBox";
this.fontFamilyComboBox.Size = new System.Drawing.Size(130, 21);
this.fontFamilyComboBox.TabIndex = 44;
//
// bodyFontLabel
//
this.bodyFontLabel.AutoSize = true;
this.bodyFontLabel.Location = new System.Drawing.Point(8, 187);
this.bodyFontLabel.Name = "bodyFontLabel";
this.bodyFontLabel.Size = new System.Drawing.Size(106, 13);
this.bodyFontLabel.TabIndex = 43;
this.bodyFontLabel.Text = "Font family/size/style";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.label2.Location = new System.Drawing.Point(331, 175);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(24, 13);
this.label2.TabIndex = 49;
this.label2.Text = "Ital.";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.label1.Location = new System.Drawing.Point(297, 175);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(32, 13);
this.label1.TabIndex = 48;
this.label1.Text = "Bold";
//
// itemsToPrintButton
//
this.itemsToPrintButton.Enabled = false;
this.itemsToPrintButton.Location = new System.Drawing.Point(121, 154);
this.itemsToPrintButton.Name = "itemsToPrintButton";
this.itemsToPrintButton.Size = new System.Drawing.Size(132, 23);
this.itemsToPrintButton.TabIndex = 50;
this.itemsToPrintButton.Text = "Items to print";
this.itemsToPrintButton.UseVisualStyleBackColor = true;
this.itemsToPrintButton.Click += new System.EventHandler(this.itemsToPrintButton_Click);
//
// nrOfCopiesLabel
//
this.nrOfCopiesLabel.AutoSize = true;
this.nrOfCopiesLabel.Location = new System.Drawing.Point(8, 235);
this.nrOfCopiesLabel.Name = "nrOfCopiesLabel";
this.nrOfCopiesLabel.Size = new System.Drawing.Size(90, 13);
this.nrOfCopiesLabel.TabIndex = 52;
this.nrOfCopiesLabel.Text = "Number of copies";
//
// nrOfCopiesTextBox
//
this.nrOfCopiesTextBox.Enabled = false;
this.nrOfCopiesTextBox.Location = new System.Drawing.Point(122, 232);
this.nrOfCopiesTextBox.Name = "nrOfCopiesTextBox";
this.nrOfCopiesTextBox.Size = new System.Drawing.Size(51, 20);
this.nrOfCopiesTextBox.TabIndex = 51;
//
// cultureComboBox
//
this.cultureComboBox.Enabled = false;
this.cultureComboBox.FormattingEnabled = true;
this.cultureComboBox.Location = new System.Drawing.Point(122, 208);
this.cultureComboBox.Name = "cultureComboBox";
this.cultureComboBox.Size = new System.Drawing.Size(218, 21);
this.cultureComboBox.TabIndex = 54;
//
// cultureLabel
//
this.cultureLabel.AutoSize = true;
this.cultureLabel.Location = new System.Drawing.Point(8, 211);
this.cultureLabel.Name = "cultureLabel";
this.cultureLabel.Size = new System.Drawing.Size(42, 13);
this.cultureLabel.TabIndex = 53;
this.cultureLabel.Text = "Cullture";
//
// goodOnlyCheckBox
//
this.goodOnlyCheckBox.AutoSize = true;
this.goodOnlyCheckBox.Enabled = false;
this.goodOnlyCheckBox.Location = new System.Drawing.Point(122, 262);
this.goodOnlyCheckBox.Name = "goodOnlyCheckBox";
this.goodOnlyCheckBox.Size = new System.Drawing.Size(74, 17);
this.goodOnlyCheckBox.TabIndex = 55;
this.goodOnlyCheckBox.Text = "Good only";
this.goodOnlyCheckBox.UseVisualStyleBackColor = true;
//
// PrinterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.goodOnlyCheckBox);
this.Controls.Add(this.cultureComboBox);
this.Controls.Add(this.cultureLabel);
this.Controls.Add(this.nrOfCopiesLabel);
this.Controls.Add(this.nrOfCopiesTextBox);
this.Controls.Add(this.itemsToPrintButton);
this.Controls.Add(this.italicCheckBox);
this.Controls.Add(this.boldCheckBox);
this.Controls.Add(this.fontSizeTextBox);
this.Controls.Add(this.fontFamilyComboBox);
this.Controls.Add(this.bodyFontLabel);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.paperHeightTextBox);
this.Controls.Add(this.paperHeightLabel);
this.Controls.Add(this.paperWidthTextBox);
this.Controls.Add(this.paperWidthLabel);
this.Controls.Add(this.templateTextBox);
this.Controls.Add(this.templateLabel);
this.Controls.Add(this.orientationComboBox);
this.Controls.Add(this.orientationLabel);
this.Controls.Add(this.supressPrintingCheckBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "PrinterCfgCtrl";
this.Size = new System.Drawing.Size(372, 327);
this.Load += new System.EventHandler(this.PrinterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.supressPrintingCheckBox = new System.Windows.Forms.CheckBox();
this.orientationLabel = new System.Windows.Forms.Label();
this.orientationComboBox = new System.Windows.Forms.ComboBox();
this.templateTextBox = new System.Windows.Forms.TextBox();
this.templateLabel = new System.Windows.Forms.Label();
this.paperWidthTextBox = new System.Windows.Forms.TextBox();
this.paperWidthLabel = new System.Windows.Forms.Label();
this.paperHeightTextBox = new System.Windows.Forms.TextBox();
this.italicCheckBox = new System.Windows.Forms.CheckBox();
this.boldCheckBox = new System.Windows.Forms.CheckBox();
this.fontSizeTextBox = new System.Windows.Forms.TextBox();
this.fontFamilyComboBox = new System.Windows.Forms.ComboBox();
this.bodyFontLabel = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.itemsToPrintButton = new System.Windows.Forms.Button();
this.nrOfCopiesLabel = new System.Windows.Forms.Label();
this.nrOfCopiesTextBox = new System.Windows.Forms.TextBox();
this.cultureComboBox = new System.Windows.Forms.ComboBox();
this.cultureLabel = new System.Windows.Forms.Label();
this.goodOnlyCheckBox = new System.Windows.Forms.CheckBox();
this.barcodeLeftLabel = new System.Windows.Forms.Label();
this.barcodeLeftTextBox = new System.Windows.Forms.TextBox();
this.barcodeTopTextBox = new System.Windows.Forms.TextBox();
this.barcodeTopLabel = new System.Windows.Forms.Label();
this.barcodeWidthTextBox = new System.Windows.Forms.TextBox();
this.barcodeWidthLabel = new System.Windows.Forms.Label();
this.barcodeHeightTextBox = new System.Windows.Forms.TextBox();
this.barcodeHeightLabel = new System.Windows.Forms.Label();
this.barcodeTypeComboBox = new System.Windows.Forms.ComboBox();
this.barcodeLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(122, 35);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(8, 38);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(119, 11);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(61, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "Class name";
//
// supressPrintingCheckBox
//
this.supressPrintingCheckBox.AutoSize = true;
this.supressPrintingCheckBox.Enabled = false;
this.supressPrintingCheckBox.Location = new System.Drawing.Point(245, 200);
this.supressPrintingCheckBox.Name = "supressPrintingCheckBox";
this.supressPrintingCheckBox.Size = new System.Drawing.Size(101, 17);
this.supressPrintingCheckBox.TabIndex = 11;
this.supressPrintingCheckBox.Text = "Supress printing";
this.supressPrintingCheckBox.UseVisualStyleBackColor = true;
//
// orientationLabel
//
this.orientationLabel.AutoSize = true;
this.orientationLabel.Location = new System.Drawing.Point(8, 84);
this.orientationLabel.Name = "orientationLabel";
this.orientationLabel.Size = new System.Drawing.Size(84, 13);
this.orientationLabel.TabIndex = 3;
this.orientationLabel.Text = "Page orientation";
//
// orientationComboBox
//
this.orientationComboBox.Enabled = false;
this.orientationComboBox.FormattingEnabled = true;
this.orientationComboBox.Location = new System.Drawing.Point(122, 81);
this.orientationComboBox.Name = "orientationComboBox";
this.orientationComboBox.Size = new System.Drawing.Size(130, 21);
this.orientationComboBox.TabIndex = 4;
//
// templateTextBox
//
this.templateTextBox.Enabled = false;
this.templateTextBox.Location = new System.Drawing.Point(122, 58);
this.templateTextBox.Name = "templateTextBox";
this.templateTextBox.Size = new System.Drawing.Size(228, 20);
this.templateTextBox.TabIndex = 10;
//
// templateLabel
//
this.templateLabel.AutoSize = true;
this.templateLabel.Location = new System.Drawing.Point(8, 61);
this.templateLabel.Name = "templateLabel";
this.templateLabel.Size = new System.Drawing.Size(67, 13);
this.templateLabel.TabIndex = 9;
this.templateLabel.Text = "Template file";
//
// paperWidthTextBox
//
this.paperWidthTextBox.Enabled = false;
this.paperWidthTextBox.Location = new System.Drawing.Point(122, 105);
this.paperWidthTextBox.Name = "paperWidthTextBox";
this.paperWidthTextBox.Size = new System.Drawing.Size(51, 20);
this.paperWidthTextBox.TabIndex = 6;
//
// paperWidthLabel
//
this.paperWidthLabel.AutoSize = true;
this.paperWidthLabel.Location = new System.Drawing.Point(8, 108);
this.paperWidthLabel.Name = "paperWidthLabel";
this.paperWidthLabel.Size = new System.Drawing.Size(103, 13);
this.paperWidthLabel.TabIndex = 5;
this.paperWidthLabel.Text = "Paper width / height";
//
// paperHeightTextBox
//
this.paperHeightTextBox.Enabled = false;
this.paperHeightTextBox.Location = new System.Drawing.Point(176, 105);
this.paperHeightTextBox.Name = "paperHeightTextBox";
this.paperHeightTextBox.Size = new System.Drawing.Size(51, 20);
this.paperHeightTextBox.TabIndex = 8;
//
// italicCheckBox
//
this.italicCheckBox.AutoSize = true;
this.italicCheckBox.Enabled = false;
this.italicCheckBox.Location = new System.Drawing.Point(335, 134);
this.italicCheckBox.Name = "italicCheckBox";
this.italicCheckBox.Size = new System.Drawing.Size(15, 14);
this.italicCheckBox.TabIndex = 47;
this.italicCheckBox.UseVisualStyleBackColor = true;
//
// boldCheckBox
//
this.boldCheckBox.AutoSize = true;
this.boldCheckBox.Enabled = false;
this.boldCheckBox.Location = new System.Drawing.Point(307, 134);
this.boldCheckBox.Name = "boldCheckBox";
this.boldCheckBox.Size = new System.Drawing.Size(15, 14);
this.boldCheckBox.TabIndex = 46;
this.boldCheckBox.UseVisualStyleBackColor = true;
//
// fontSizeTextBox
//
this.fontSizeTextBox.Enabled = false;
this.fontSizeTextBox.Location = new System.Drawing.Point(259, 128);
this.fontSizeTextBox.Name = "fontSizeTextBox";
this.fontSizeTextBox.Size = new System.Drawing.Size(29, 20);
this.fontSizeTextBox.TabIndex = 45;
//
// fontFamilyComboBox
//
this.fontFamilyComboBox.Enabled = false;
this.fontFamilyComboBox.FormattingEnabled = true;
this.fontFamilyComboBox.Location = new System.Drawing.Point(122, 128);
this.fontFamilyComboBox.Name = "fontFamilyComboBox";
this.fontFamilyComboBox.Size = new System.Drawing.Size(130, 21);
this.fontFamilyComboBox.TabIndex = 44;
//
// bodyFontLabel
//
this.bodyFontLabel.AutoSize = true;
this.bodyFontLabel.Location = new System.Drawing.Point(8, 131);
this.bodyFontLabel.Name = "bodyFontLabel";
this.bodyFontLabel.Size = new System.Drawing.Size(106, 13);
this.bodyFontLabel.TabIndex = 43;
this.bodyFontLabel.Text = "Font family/size/style";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.label2.Location = new System.Drawing.Point(331, 119);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(24, 13);
this.label2.TabIndex = 49;
this.label2.Text = "Ital.";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.label1.Location = new System.Drawing.Point(297, 119);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(32, 13);
this.label1.TabIndex = 48;
this.label1.Text = "Bold";
//
// itemsToPrintButton
//
this.itemsToPrintButton.Enabled = false;
this.itemsToPrintButton.Location = new System.Drawing.Point(259, 85);
this.itemsToPrintButton.Name = "itemsToPrintButton";
this.itemsToPrintButton.Size = new System.Drawing.Size(91, 30);
this.itemsToPrintButton.TabIndex = 50;
this.itemsToPrintButton.Text = "Items to print";
this.itemsToPrintButton.UseVisualStyleBackColor = true;
this.itemsToPrintButton.Click += new System.EventHandler(this.itemsToPrintButton_Click);
//
// nrOfCopiesLabel
//
this.nrOfCopiesLabel.AutoSize = true;
this.nrOfCopiesLabel.Location = new System.Drawing.Point(8, 179);
this.nrOfCopiesLabel.Name = "nrOfCopiesLabel";
this.nrOfCopiesLabel.Size = new System.Drawing.Size(90, 13);
this.nrOfCopiesLabel.TabIndex = 52;
this.nrOfCopiesLabel.Text = "Number of copies";
//
// nrOfCopiesTextBox
//
this.nrOfCopiesTextBox.Enabled = false;
this.nrOfCopiesTextBox.Location = new System.Drawing.Point(122, 176);
this.nrOfCopiesTextBox.Name = "nrOfCopiesTextBox";
this.nrOfCopiesTextBox.Size = new System.Drawing.Size(51, 20);
this.nrOfCopiesTextBox.TabIndex = 51;
//
// cultureComboBox
//
this.cultureComboBox.Enabled = false;
this.cultureComboBox.FormattingEnabled = true;
this.cultureComboBox.Location = new System.Drawing.Point(122, 152);
this.cultureComboBox.Name = "cultureComboBox";
this.cultureComboBox.Size = new System.Drawing.Size(228, 21);
this.cultureComboBox.TabIndex = 54;
//
// cultureLabel
//
this.cultureLabel.AutoSize = true;
this.cultureLabel.Location = new System.Drawing.Point(8, 155);
this.cultureLabel.Name = "cultureLabel";
this.cultureLabel.Size = new System.Drawing.Size(42, 13);
this.cultureLabel.TabIndex = 53;
this.cultureLabel.Text = "Cullture";
//
// goodOnlyCheckBox
//
this.goodOnlyCheckBox.AutoSize = true;
this.goodOnlyCheckBox.Enabled = false;
this.goodOnlyCheckBox.Location = new System.Drawing.Point(245, 179);
this.goodOnlyCheckBox.Name = "goodOnlyCheckBox";
this.goodOnlyCheckBox.Size = new System.Drawing.Size(74, 17);
this.goodOnlyCheckBox.TabIndex = 55;
this.goodOnlyCheckBox.Text = "Good only";
this.goodOnlyCheckBox.UseVisualStyleBackColor = true;
//
// barcodeLeftLabel
//
this.barcodeLeftLabel.AutoSize = true;
this.barcodeLeftLabel.Location = new System.Drawing.Point(97, 250);
this.barcodeLeftLabel.Name = "barcodeLeftLabel";
this.barcodeLeftLabel.Size = new System.Drawing.Size(25, 13);
this.barcodeLeftLabel.TabIndex = 9;
this.barcodeLeftLabel.Text = "Left";
//
// barcodeLeftTextBox
//
this.barcodeLeftTextBox.Enabled = false;
this.barcodeLeftTextBox.Location = new System.Drawing.Point(122, 246);
this.barcodeLeftTextBox.Name = "barcodeLeftTextBox";
this.barcodeLeftTextBox.Size = new System.Drawing.Size(31, 20);
this.barcodeLeftTextBox.TabIndex = 10;
//
// barcodeTopTextBox
//
this.barcodeTopTextBox.Enabled = false;
this.barcodeTopTextBox.Location = new System.Drawing.Point(181, 246);
this.barcodeTopTextBox.Name = "barcodeTopTextBox";
this.barcodeTopTextBox.Size = new System.Drawing.Size(31, 20);
this.barcodeTopTextBox.TabIndex = 11;
//
// barcodeTopLabel
//
this.barcodeTopLabel.AutoSize = true;
this.barcodeTopLabel.Location = new System.Drawing.Point(155, 250);
this.barcodeTopLabel.Name = "barcodeTopLabel";
this.barcodeTopLabel.Size = new System.Drawing.Size(26, 13);
this.barcodeTopLabel.TabIndex = 13;
this.barcodeTopLabel.Text = "Top";
//
// barcodeWidthTextBox
//
this.barcodeWidthTextBox.Enabled = false;
this.barcodeWidthTextBox.Location = new System.Drawing.Point(249, 246);
this.barcodeWidthTextBox.Name = "barcodeWidthTextBox";
this.barcodeWidthTextBox.Size = new System.Drawing.Size(31, 20);
this.barcodeWidthTextBox.TabIndex = 14;
//
// barcodeWidthLabel
//
this.barcodeWidthLabel.AutoSize = true;
this.barcodeWidthLabel.Location = new System.Drawing.Point(214, 250);
this.barcodeWidthLabel.Name = "barcodeWidthLabel";
this.barcodeWidthLabel.Size = new System.Drawing.Size(35, 13);
this.barcodeWidthLabel.TabIndex = 15;
this.barcodeWidthLabel.Text = "Width";
//
// barcodeHeightTextBox
//
this.barcodeHeightTextBox.Enabled = false;
this.barcodeHeightTextBox.Location = new System.Drawing.Point(320, 246);
this.barcodeHeightTextBox.Name = "barcodeHeightTextBox";
this.barcodeHeightTextBox.Size = new System.Drawing.Size(30, 20);
this.barcodeHeightTextBox.TabIndex = 17;
//
// barcodeHeightLabel
//
this.barcodeHeightLabel.AutoSize = true;
this.barcodeHeightLabel.Location = new System.Drawing.Point(282, 250);
this.barcodeHeightLabel.Name = "barcodeHeightLabel";
this.barcodeHeightLabel.Size = new System.Drawing.Size(38, 13);
this.barcodeHeightLabel.TabIndex = 18;
this.barcodeHeightLabel.Text = "Height";
//
// barcodeTypeComboBox
//
this.barcodeTypeComboBox.Enabled = false;
this.barcodeTypeComboBox.FormattingEnabled = true;
this.barcodeTypeComboBox.Location = new System.Drawing.Point(122, 222);
this.barcodeTypeComboBox.Name = "barcodeTypeComboBox";
this.barcodeTypeComboBox.Size = new System.Drawing.Size(228, 21);
this.barcodeTypeComboBox.TabIndex = 19;
//
// barcodeLabel
//
this.barcodeLabel.AutoSize = true;
this.barcodeLabel.Location = new System.Drawing.Point(8, 225);
this.barcodeLabel.Name = "barcodeLabel";
this.barcodeLabel.Size = new System.Drawing.Size(88, 13);
this.barcodeLabel.TabIndex = 56;
this.barcodeLabel.Text = "Barcode with s/n";
//
// PrinterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.barcodeLabel);
this.Controls.Add(this.barcodeTypeComboBox);
this.Controls.Add(this.barcodeHeightLabel);
this.Controls.Add(this.goodOnlyCheckBox);
this.Controls.Add(this.barcodeHeightTextBox);
this.Controls.Add(this.cultureComboBox);
this.Controls.Add(this.barcodeWidthLabel);
this.Controls.Add(this.cultureLabel);
this.Controls.Add(this.barcodeWidthTextBox);
this.Controls.Add(this.barcodeTopLabel);
this.Controls.Add(this.nrOfCopiesLabel);
this.Controls.Add(this.barcodeTopTextBox);
this.Controls.Add(this.nrOfCopiesTextBox);
this.Controls.Add(this.barcodeLeftTextBox);
this.Controls.Add(this.itemsToPrintButton);
this.Controls.Add(this.barcodeLeftLabel);
this.Controls.Add(this.italicCheckBox);
this.Controls.Add(this.boldCheckBox);
this.Controls.Add(this.fontSizeTextBox);
this.Controls.Add(this.fontFamilyComboBox);
this.Controls.Add(this.bodyFontLabel);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.paperHeightTextBox);
this.Controls.Add(this.paperWidthTextBox);
this.Controls.Add(this.paperWidthLabel);
this.Controls.Add(this.templateTextBox);
this.Controls.Add(this.templateLabel);
this.Controls.Add(this.orientationComboBox);
this.Controls.Add(this.orientationLabel);
this.Controls.Add(this.supressPrintingCheckBox);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "PrinterCfgCtrl";
this.Size = new System.Drawing.Size(372, 327);
this.Load += new System.EventHandler(this.PrinterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -336,8 +431,7 @@ namespace TBF.BenchControl.Output.Printers.Label
private System.Windows.Forms.Label templateLabel;
private System.Windows.Forms.TextBox paperWidthTextBox;
private System.Windows.Forms.Label paperWidthLabel;
private System.Windows.Forms.TextBox paperHeightTextBox;
private System.Windows.Forms.Label paperHeightLabel;
private System.Windows.Forms.TextBox paperHeightTextBox;
private System.Windows.Forms.CheckBox italicCheckBox;
private System.Windows.Forms.CheckBox boldCheckBox;
private System.Windows.Forms.TextBox fontSizeTextBox;
@@ -350,6 +444,16 @@ namespace TBF.BenchControl.Output.Printers.Label
private System.Windows.Forms.TextBox nrOfCopiesTextBox;
private System.Windows.Forms.ComboBox cultureComboBox;
private System.Windows.Forms.Label cultureLabel;
private System.Windows.Forms.CheckBox goodOnlyCheckBox;
private System.Windows.Forms.CheckBox goodOnlyCheckBox;
private System.Windows.Forms.Label barcodeLeftLabel;
private System.Windows.Forms.TextBox barcodeLeftTextBox;
private System.Windows.Forms.TextBox barcodeTopTextBox;
private System.Windows.Forms.Label barcodeTopLabel;
private System.Windows.Forms.TextBox barcodeWidthTextBox;
private System.Windows.Forms.Label barcodeWidthLabel;
private System.Windows.Forms.TextBox barcodeHeightTextBox;
private System.Windows.Forms.Label barcodeHeightLabel;
private System.Windows.Forms.ComboBox barcodeTypeComboBox;
private System.Windows.Forms.Label barcodeLabel;
}
}
@@ -1,11 +1,13 @@
///
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Output.Printers;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs;
@@ -42,7 +44,12 @@ namespace TBF.BenchControl.Output.Printers.Label
{
fontFamilyComboBox.Items.Add(ff.Name);
}
}
for (BarcodeType bt = BarcodeType.None; bt < BarcodeType.Count; bt++)
{
barcodeTypeComboBox.Items.Add(bt.ToString());
}
}
private void PrinterCfgCtrl_Load(object sender, EventArgs e)
{
@@ -80,7 +87,13 @@ namespace TBF.BenchControl.Output.Printers.Label
nrOfCopiesTextBox.Text = config.NrOfCopies.ToString();
goodOnlyCheckBox.Checked = config.GoodOnly;
supressPrintingCheckBox.Checked = config.SupressPrinting;
}
barcodeTypeComboBox.Text = config.BarcodeType.ToString();
barcodeLeftTextBox.Text = config.BarcodeLeft.ToString();
barcodeTopTextBox.Text = config.BarcodeTop.ToString();
barcodeWidthTextBox.Text = config.BarcodeWidth.ToString();
barcodeHeightTextBox.Text = config.BarcodeHeight.ToString();
}
public void Unlock()
{
@@ -98,7 +111,13 @@ namespace TBF.BenchControl.Output.Printers.Label
nrOfCopiesTextBox.Enabled = true;
goodOnlyCheckBox.Enabled = true;
supressPrintingCheckBox.Enabled = true;
}
barcodeTypeComboBox.Enabled = true;
barcodeLeftTextBox.Enabled = true;
barcodeTopTextBox.Enabled = true;
barcodeWidthTextBox.Enabled = true;
barcodeHeightTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
@@ -143,6 +162,32 @@ namespace TBF.BenchControl.Output.Printers.Label
flags |= CfgUpdateFlags.Error;
}
if (!barcodeTypeComboBox.Items.Contains(barcodeTypeComboBox.Text))
{
message += Environment.NewLine + "Invalid barcode type";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(barcodeLeftTextBox.Text, out dummy) || dummy < 0 || dummy > 2000)
{
message += Environment.NewLine + "Barcode 'Left' should be between 0 and 2000";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(barcodeTopTextBox.Text, out dummy) || dummy < 0 || dummy > 2000)
{
message += Environment.NewLine + "Barcode 'Top' should be between 0 and 2000";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(barcodeWidthTextBox.Text, out dummy) || dummy < 0 || dummy > 200)
{
message += Environment.NewLine + "Barcode 'Width' should be between 0 and 200";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(barcodeHeightTextBox.Text, out dummy) || dummy < 0 || dummy > 200)
{
message += Environment.NewLine + "Barcode 'Height' should be between 0 and 200";
flags |= CfgUpdateFlags.Error;
}
return flags;
}
@@ -193,6 +238,20 @@ namespace TBF.BenchControl.Output.Printers.Label
flags |= UpdateDifferent(ref config.GoodOnly, goodOnlyCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.SupressPrinting, supressPrintingCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
for (BarcodeType bt = BarcodeType.None; bt < BarcodeType.Count; bt++)
{
if (bt.ToString().Equals(barcodeTypeComboBox.Text))
{
config.BarcodeType = bt;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
break;
}
}
flags |= UpdateDifferent(ref config.BarcodeLeft, barcodeLeftTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.BarcodeTop, barcodeTopTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.BarcodeWidth, barcodeWidthTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.BarcodeHeight, barcodeHeightTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
{
Printer.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.18.1406.0")]
[assembly: AssemblyFileVersion("2.18.1406.0")]
[assembly: AssemblyVersion("2.18.1426.0")]
[assembly: AssemblyFileVersion("2.18.1426.0")]
+6 -9
View File
@@ -39,7 +39,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEBUG;MURES_40;STABLE_MASS_EXTRAS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -49,7 +49,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;MURES_40;STABLE_MASS_EXTRAS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -58,7 +58,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEBUG;MURES_40;STABLE_MASS_EXTRAS</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
@@ -67,7 +67,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;MURES_40;STABLE_MASS_EXTRAS</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
@@ -97,8 +97,8 @@
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="ControlComponent3Munich">
<HintPath>..\packages\ControlBoard\Munich\ControlComponent3Munich.dll</HintPath>
<Reference Include="ControlComponent3U">
<HintPath>..\packages\ControlBoard\MURES-PT40\ControlComponent3U.dll</HintPath>
</Reference>
<Reference Include="FluentNHibernate">
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
@@ -990,9 +990,6 @@
<DependentUpon>PrinterCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Output\Printers\Label\Factory.cs" />
<Compile Include="BenchControl\Output\Printers\Label\PrintLabelDocument.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="BenchControl\Output\Printers\Munich\Printer.cs" />
<Compile Include="BenchControl\Output\Printers\Munich\PrinterCfg.cs" />
<Compile Include="BenchControl\Output\Printers\Munich\PrinterCfgCtrl.cs">
+2 -2
View File
@@ -54,9 +54,9 @@ namespace TBF.UI
this.horizontalSplitContainer = new System.Windows.Forms.SplitContainer();
this.mainTabControl = new System.Windows.Forms.TabControl();
this.homeTabPage = new System.Windows.Forms.TabPage();
this.ctrlBrdComponent = new ControlComponent3Munich.UserControl1();
this.ctrlBrdComponent = new ControlComponent_Torino2015.UserControl1();
this.processTabPage = new System.Windows.Forms.TabPage();
this.processTabPageCtrl = new TBF.UI.Process.ProcessTabPageCtrl6();
this.processTabPageCtrl = new TBF.UI.Process.ProcessTabPageCtrl24();
this.insertTabPage = new System.Windows.Forms.TabPage();
this.resultsTabPage = new System.Windows.Forms.TabPage();
this.resultsTabPageCtrl = new TBF.UI.Results.ResultsTabPageCtrl();
+46 -7
View File
@@ -43,6 +43,9 @@
this.upgradeDb_24_29_Button = new System.Windows.Forms.Button();
this.upgradeDb_218_220_Button = new System.Windows.Forms.Button();
this.upgradeDb_NFC_button = new System.Windows.Forms.Button();
this.getOldResultsButton = new System.Windows.Forms.Button();
this.oldProgVerLabel = new System.Windows.Forms.Label();
this.oldProgVerTextBox = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// upgradeDb_215_216_Button
@@ -118,17 +121,17 @@
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.textBox1.Location = new System.Drawing.Point(94, 418);
this.textBox1.Location = new System.Drawing.Point(83, 418);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.Size = new System.Drawing.Size(53, 20);
this.textBox1.TabIndex = 11;
//
// textBox2
//
this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.textBox2.Location = new System.Drawing.Point(94, 444);
this.textBox2.Location = new System.Drawing.Point(83, 439);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 20);
this.textBox2.Size = new System.Drawing.Size(53, 20);
this.textBox2.TabIndex = 13;
//
// label1
@@ -145,7 +148,7 @@
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 447);
this.label2.Location = new System.Drawing.Point(12, 442);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(60, 13);
this.label2.TabIndex = 12;
@@ -154,9 +157,9 @@
// pressureRepresentationButton
//
this.pressureRepresentationButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.pressureRepresentationButton.Location = new System.Drawing.Point(207, 418);
this.pressureRepresentationButton.Location = new System.Drawing.Point(210, 418);
this.pressureRepresentationButton.Name = "pressureRepresentationButton";
this.pressureRepresentationButton.Size = new System.Drawing.Size(65, 42);
this.pressureRepresentationButton.Size = new System.Drawing.Size(62, 42);
this.pressureRepresentationButton.TabIndex = 14;
this.pressureRepresentationButton.Text = "Upgrade pressure";
this.pressureRepresentationButton.UseVisualStyleBackColor = true;
@@ -192,11 +195,43 @@
this.upgradeDb_NFC_button.UseVisualStyleBackColor = true;
this.upgradeDb_NFC_button.Click += new System.EventHandler(this.upgradeDb_NFC_button_Click);
//
// getOldResultsButton
//
this.getOldResultsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.getOldResultsButton.Location = new System.Drawing.Point(142, 418);
this.getOldResultsButton.Name = "getOldResultsButton";
this.getOldResultsButton.Size = new System.Drawing.Size(62, 42);
this.getOldResultsButton.TabIndex = 15;
this.getOldResultsButton.Text = "Get old results";
this.getOldResultsButton.UseVisualStyleBackColor = true;
this.getOldResultsButton.Click += new System.EventHandler(this.getOldResultsButton_Click);
//
// oldProgVerLabel
//
this.oldProgVerLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.oldProgVerLabel.AutoSize = true;
this.oldProgVerLabel.Location = new System.Drawing.Point(12, 400);
this.oldProgVerLabel.Name = "oldProgVerLabel";
this.oldProgVerLabel.Size = new System.Drawing.Size(67, 13);
this.oldProgVerLabel.TabIndex = 16;
this.oldProgVerLabel.Text = "Old TBF ver.";
//
// oldProgVerTextBox
//
this.oldProgVerTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.oldProgVerTextBox.Location = new System.Drawing.Point(83, 397);
this.oldProgVerTextBox.Name = "oldProgVerTextBox";
this.oldProgVerTextBox.Size = new System.Drawing.Size(53, 20);
this.oldProgVerTextBox.TabIndex = 17;
//
// UpgradeSelectionDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 480);
this.Controls.Add(this.oldProgVerLabel);
this.Controls.Add(this.oldProgVerTextBox);
this.Controls.Add(this.getOldResultsButton);
this.Controls.Add(this.upgradeDb_NFC_button);
this.Controls.Add(this.upgradeDb_218_220_Button);
this.Controls.Add(this.upgradeDb_24_29_Button);
@@ -213,6 +248,7 @@
this.Controls.Add(this.upgradeDb_216_217_Button);
this.Controls.Add(this.upgradeDb_215_216_Button);
this.Name = "UpgradeSelectionDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Upgrade selection";
this.ResumeLayout(false);
this.PerformLayout();
@@ -236,6 +272,9 @@
private System.Windows.Forms.Button upgradeDb_24_29_Button;
private System.Windows.Forms.Button upgradeDb_218_220_Button;
private System.Windows.Forms.Button upgradeDb_NFC_button;
private System.Windows.Forms.Button getOldResultsButton;
private System.Windows.Forms.Label oldProgVerLabel;
private System.Windows.Forms.TextBox oldProgVerTextBox;
}
}
+398 -16
View File
@@ -1,4 +1,7 @@
using System;
///
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
@@ -7,7 +10,9 @@ using MySql.Data.MySqlClient;
using NHibernate;
using Results;
using Results.Entities;
using TBF.BenchControl.WaterMeters.WaterMeter; /// This is to deserialize ProcParams
using TBF.Resources;
using System.IO;
namespace TBF.UI.Settings
{
@@ -15,9 +20,6 @@ namespace TBF.UI.Settings
{
private static readonly ILog log = LogManager.GetLogger(typeof(UpgradeSelectionDlg));
int batchFrom;
int batchTo;
Shared.ModelessActivityForm form;
System.Threading.Thread formThread;
@@ -28,11 +30,9 @@ namespace TBF.UI.Settings
upgradeConfigDBCheckBox.Checked = true;
upgradeResultsDBCheckBox.Checked = true;
batchFrom = 1;
batchTo = Program.LocalSettings.BatchNr - 1;
textBox1.Text = batchFrom.ToString();
textBox2.Text = batchTo.ToString();
oldProgVerTextBox.Text = "1.6.x";
textBox1.Text = "1";
textBox2.Text = (Program.LocalSettings.BatchNr - 1).ToString();
}
void ActivityStart()
@@ -587,13 +587,13 @@ namespace TBF.UI.Settings
private void pressureRepresentationButton_Click(object sender, EventArgs e)
{
try
{
batchFrom = int.Parse(textBox1.Text);
batchTo = int.Parse(textBox2.Text);
if (batchFrom < 1 || batchFrom > batchTo) throw new Exception();
}
catch
int batchFrom = 0;
int batchTo = 0;
if (!int.TryParse(textBox1.Text, out batchFrom) ||
!int.TryParse(textBox2.Text, out batchTo) ||
batchFrom < 1 ||
batchFrom > batchTo)
{
MessageBox.Show("Wrong 'From batch #' or 'To batch #'", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
@@ -653,5 +653,387 @@ namespace TBF.UI.Settings
"Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void getOldResultsButton_Click(object sender, EventArgs e)
{
int testBenchId = (TBF.BenchControl.Sequences.ProcessData.BenchInfo != null) ? TBF.BenchControl.Sequences.ProcessData.BenchInfo.TestBenchId : 1;
string testBenchName = (TBF.BenchControl.Sequences.ProcessData.BenchInfo != null) ? TBF.BenchControl.Sequences.ProcessData.BenchInfo.TestBenchName : "testbench";
string oldProgVer = oldProgVerTextBox.Text;
int batchFrom = 0;
int batchTo = 0;
if (!int.TryParse(textBox1.Text, out batchFrom) ||
!int.TryParse(textBox2.Text, out batchTo) ||
batchFrom < 1 ||
batchFrom > batchTo)
{
MessageBox.Show("Wrong 'From batch #' or 'To batch #'", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if (MessageBox.Show("Are you sure ?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return;
ActivityStart();
try
{
ISession session1 = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
ISession session2 = DB.CreateSession();
/// Read all paths
var feedingPaths = session1.QueryOver<Config.Entities.FeedingPath>().List();
var benchPaths = session1.QueryOver<Config.Entities.BenchPath>().List();
var outputPaths = session1.QueryOver<Config.Entities.OutputPath>().List();
/// Initialize shared data lists
var waterMeterDataList = session2.QueryOver<WaterMeterData>().List();
var testDataList = session2.QueryOver<TestData>().List();
var componentsList = session2.QueryOver<Components>().List();
for (int batchNr = batchFrom; batchNr <= batchTo; batchNr++)
{
var TRs = session1.QueryOver<Config.Entities.TestResult>()
.Where(x => (x.BatchNr == batchNr))
.List();
if (TRs.Count > 0)
{
Config.Entities.TestResult tr0 = TRs[0];
/// Get a procedure from the name
var procedures = session1.QueryOver<Config.Entities.Procedure>()
.Where(x => x.Name == tr0.ProcedureName)
.List();
Config.Entities.Procedure proc = (procedures.Count > 0) ? procedures[0] : null;
/// Determine start- and endtime
DateTime startTime = tr0.TimeStart;
DateTime endTime = tr0.TimeEnd;
for (int i = 1; i < TRs.Count; i++)
{
if (TRs[i].TimeStart < startTime) startTime = TRs[i].TimeStart;
if (TRs[i].TimeEnd > endTime) endTime = TRs[i].TimeEnd;
}
/// Create Batch object
Batch batch = new Batch
{
BatchNr = batchNr,
TestBenchId = testBenchId,
TestBenchName = testBenchName,
ProgramVersion = oldProgVer,
UserName = string.Empty,
ProcedureName = tr0.ProcedureName,
ProcedureDescription = (proc != null) ? proc.Description : string.Empty,
ProcedureRevision = 1,
WatermetersStr = (proc != null) ? proc.Watermeters : string.Empty,
ProtocolTitle = tr0.ProtocolTitle,
Remark = string.Empty,
DensityCorr = 0,
StartTime = startTime,
EndTime = endTime,
Dirty = false,
RsltsSent = true,
RsltsPrinted = true,
Compound = (tr0.MetersKind == Config.Entities.MetersKind.Combined),
HeatMeter = (tr0.MetersKind == Config.Entities.MetersKind.HeatMeter),
};
for (int pos = 1; pos <= Config.Data.WMsCount; pos++)
{
ProcParams procParams = null;
if (proc != null)
{
string wmCompName = string.Format("WM{0:D02}", pos);
IList<Config.Entities.ComponentProcedure> componentProcedures
= session1.QueryOver<Config.Entities.ComponentProcedure>()
.Where(x => (x.Procedure == proc))
.And(x => (x.CmpntName == wmCompName))
.List();
if (componentProcedures.Count == 1)
{
procParams = ProcParams.Serializer.Deserialize(new StringReader(componentProcedures[0].Parameters)) as ProcParams;
}
}
WaterMeterData waterMeterData = new WaterMeterData();
if (procParams != null)
{
waterMeterData.ProductName = procParams.ProductName;
waterMeterData.Producer = procParams.Producer;
waterMeterData.DN = procParams.DN;
waterMeterData.L = procParams.L;
waterMeterData.Mounting = procParams.Mounting;
waterMeterData.NewQnames = procParams.NewQnames;
waterMeterData.Q4_Qmax = procParams.Qmax;
waterMeterData.Q3_Qn = procParams.Qn;
waterMeterData.Q2_Qt = procParams.Qt;
waterMeterData.Q1_Qmin = procParams.Qmin;
waterMeterData.MetrologicalClass = procParams.MetrologicalClass;
waterMeterData.TemperatureClass = procParams.TemperatureClass;
waterMeterData.PressureLossClass = procParams.PressureLossClass;
waterMeterData.MaxAdmissiblePressure = procParams.MaxAdmissiblePressure;
waterMeterData.FlowProfileSensitivityClass= procParams.FlowProfileSensitivityClass;
waterMeterData.ApprovalInfo = procParams.ApprovalInfo;
waterMeterData.Certificate = procParams.Certificate;
waterMeterData.PulsesPerLtr = procParams.PulsesPerLtr;
waterMeterData.Medium = procParams.WaterTemp;
}
waterMeterData.Compound = (tr0.MetersKind == Config.Entities.MetersKind.Combined);
waterMeterData.HeatMeter = (tr0.MetersKind == Config.Entities.MetersKind.HeatMeter);
bool isNewWMData = true;
foreach (var wmd in waterMeterDataList) if (waterMeterData.Equals(wmd))
{
waterMeterData = wmd;
isNewWMData = false;
break;
}
if (isNewWMData)
{
waterMeterDataList.Add(waterMeterData);
session2.SaveOrUpdate(waterMeterData);
}
var wm = new global::Results.Entities.WaterMeter();
wm.Batch = batch;
wm.SerialNr = null; /// To be overwritten
wm.SerialNrAux = string.Empty;
wm.PurchaseOrder = tr0.PurchaseOrder;
wm.YearOfProduction = tr0.TimeStart.Year;
wm.WMPosition = pos;
wm.EndState = "0"; /// To be overwritten
wm.EndStateAux = "0";
wm.QRise = 0; /// To be overwritten
wm.QFall = 0; /// To be overwritten
wm.Passed = true; /// To be updated (AND-ed)
wm.ResultCode = 0;
wm.ArchivePath = string.Empty;
wm.Remark = string.Empty;
wm.WaterMeterData = waterMeterData;
batch.WaterMeters.Add(wm);
}
foreach (var tr in TRs)
{
TestData testData = new TestData
{
Name = tr.Name,
Repeats = tr.Repeats,
Qfrom = tr.Qfrom,
Qto = tr.Qto,
TargetVolume = tr.Volume,
TargetTime = tr.TstTime,
Method = tr.Method,
ErrLimLo = tr.ErrLimLo,
ErrLimHi = tr.ErrLimHi,
Uncertainty = tr.Uncertainty,
DoControlWaterTemp = false,
TempLimLo = 15,
TempLimHi = 25,
Publish = tr.DoNotPublish ? (sbyte)Config.Entities.Publish.Never : (sbyte)Config.Entities.Publish.Always,
Evaluate = !tr.DoNotEvaluate,
};
bool isNewTData = true;
foreach (var td in testDataList) if (testData.Equals(td))
{
testData = td;
isNewTData = false;
break;
}
if (isNewTData)
{
testDataList.Add(testData);
session2.SaveOrUpdate(testData);
}
Config.Entities.FeedingPath feedingPath = null;
foreach (var fp in feedingPaths)
if (fp.Name == tr.FeedingPath)
{
feedingPath = fp;
break;
}
Config.Entities.OutputPath outputPath = null;
foreach (var op in outputPaths)
if (op.Name == tr.OutputPath)
{
outputPath = op;
break;
}
Components components
= new Components(testBenchId, testBenchName,
(feedingPath != null) ? feedingPath.Pump : string.Empty,
(outputPath != null) ? outputPath.FlowMeter : string.Empty,
(outputPath != null) ? outputPath.Scale : string.Empty,
(outputPath != null) ? outputPath.RegulValve : string.Empty,
(outputPath != null) ? outputPath.Diverter : string.Empty);
bool isNewCmpnts = true;
foreach (var c in componentsList) if (components.Equals(c))
{
components = c;
isNewCmpnts = false;
break;
}
if (isNewCmpnts)
{
componentsList.Add(components);
session2.SaveOrUpdate(components);
}
float factor1 = 0.01f; /// Pressure conversion from xxx to yyy
TestRslt testRslt = new TestRslt(batch, testData, tr.Part, tr.RepetitionNr);
testRslt.Components = components;
testRslt.MethodClass = null;
testRslt.TestDone = true;
testRslt.Remark = null;
testRslt.StartTime = tr.TimeStart;
testRslt.EndTime = tr.TimeEnd;
testRslt.FlowSetTime = 0;
testRslt.TimeBtwnMassMsrmnts = 0;
testRslt.TestTime = tr.Time;
testRslt.PulsesMaster = tr.PulsesMaster;
testRslt.TotalPulsesMstr = tr.PulsesMaster;
testRslt.ConstMasterRaw = tr.ConstMaster;
testRslt.ConstMasterCorr = tr.ConstMaster;
testRslt.ConstMaster = tr.ConstMaster;
testRslt.MassStartRaw = tr.MassStartRaw;
testRslt.MassStart = tr.MassStart;
testRslt.MassEndRaw = tr.MassEndRaw;
testRslt.MassEnd = tr.MassEnd;
testRslt.DensityIn = tr.DensityIn;
testRslt.DensityLine = (tr.DensityIn + tr.DensityOut) / 2;
testRslt.DensityDiv = tr.DensityDiv;
testRslt.Buoyancy = tr.Buoyancy;
testRslt.FlowMass = tr.FlowMass;
testRslt.FlowVolume = tr.FlowVolume;
testRslt.VolumeCTV = tr.VolumeCTV;
testRslt.VolumeMaster = tr.VolumeMaster;
testRslt.ErrorMaster = tr.ErrorMaster;
testRslt.AmbTempStart = tr.AmbientTempAve;
testRslt.AmbTempEnd = tr.AmbientTempAve;
testRslt.AmbTempMean = tr.AmbientTempAve;
testRslt.AmbTempMin = tr.AmbientTempAve;
testRslt.AmbTempMax = tr.AmbientTempAve;
testRslt.AmbPressMean = 0.001f * tr.AmbientPressAve;
testRslt.AmbPressStart = 0.001f * tr.AmbientPressAve;
testRslt.AmbPressEnd = 0.001f * tr.AmbientPressAve;
testRslt.AmbPressMin = 0.001f * tr.AmbientPressAve;
testRslt.AmbPressMax = 0.001f * tr.AmbientPressAve;
testRslt.AmbHumiMean = tr.AmbientHumiAve;
testRslt.AmbHumiStart = tr.AmbientHumiAve;
testRslt.AmbHumiEnd = tr.AmbientHumiAve;
testRslt.AmbHumiMin = tr.AmbientHumiAve;
testRslt.AmbHumiMax = tr.AmbientHumiAve;
testRslt.PressUpMean = factor1 * tr.PressInAvrg;
testRslt.PressUpStart = factor1 * tr.PressInStart;
testRslt.PressUpEnd = factor1 * tr.PressInEnd;
testRslt.PressUpMin = factor1 * Math.Min(tr.PressInAvrg, Math.Min(tr.PressInStart, tr.PressInEnd));
testRslt.PressUpMax = factor1 * Math.Max(tr.PressInAvrg, Math.Max(tr.PressInStart, tr.PressInEnd));
testRslt.PressDownMean = factor1 * tr.PressOutAvrg;
testRslt.PressDownStart = factor1 * tr.PressOutStart;
testRslt.PressDownEnd = factor1 * tr.PressOutEnd;
testRslt.PressDownMin = factor1 * Math.Min(tr.PressOutAvrg, Math.Min(tr.PressOutStart, tr.PressOutEnd));
testRslt.PressDownMax = factor1 * Math.Max(tr.PressOutAvrg, Math.Max(tr.PressOutStart, tr.PressOutEnd));
testRslt.TempUpMean = tr.TempInAvrg;
testRslt.TempUpStart = tr.TempInStart;
testRslt.TempUpEnd = tr.TempInEnd;
testRslt.TempUpMin = Math.Min(tr.TempInAvrg, Math.Min(tr.TempInStart, tr.TempInEnd));
testRslt.TempUpMax = Math.Max(tr.TempInAvrg, Math.Max(tr.TempInStart, tr.TempInEnd));
testRslt.TempDownMean = tr.TempOutAvrg;
testRslt.TempDownStart = tr.TempOutStart;
testRslt.TempDownEnd = tr.TempOutEnd;
testRslt.TempDownMin = Math.Min(tr.TempOutAvrg, Math.Min(tr.TempOutStart, tr.TempOutEnd));
testRslt.TempDownMax = Math.Max(tr.TempOutAvrg, Math.Max(tr.TempOutStart, tr.TempOutEnd));
testRslt.TempDivMean = tr.TempDivAvrg;
testRslt.TempDivStart = tr.TempDivStart;
testRslt.TempDivEnd = tr.TempDivEnd;
testRslt.TempDivMin = Math.Min(tr.TempDivAvrg, Math.Min(tr.TempDivStart, tr.TempDivEnd));
testRslt.TempDivMax = Math.Max(tr.TempDivAvrg, Math.Max(tr.TempDivStart, tr.TempDivEnd));
testRslt.FlowMean = tr.FlowVolume;
testRslt.FlowStart = tr.FlowVolume;
testRslt.FlowEnd = tr.FlowVolume;
testRslt.FlowMin = tr.FlowVolume;
testRslt.FlowMax = tr.FlowVolume;
var MTRs = session1.QueryOver<Config.Entities.MeterTestResult>()
.Where(x => (x.TestResult == tr))
.List();
for (int pos0 = 0; pos0 < Math.Min(MTRs.Count, batch.WaterMeters.Count); pos0++)
{
var wm = batch.WaterMeters[pos0];
var mtr = MTRs[pos0];
mtr.Passed = (testRslt.ErrLimLo() <= mtr.VolumeErrorPct) && (mtr.VolumeErrorPct <= testRslt.ErrLimHi()); /// mtr.Passed is not mapped to DB
///
/// Create MeterTestRslt entity
///
MeterTestRslt meterTestRslt = new MeterTestRslt
{
CompoundMeterId = (byte)Config.Entities.CompoundMeterId.Single,
RegReaderType = 0,
PulsesMeter = mtr.PulsesMeter,
PulsesMaster = mtr.PulsesMaster,
PulsesPerLiter = mtr.PulsesPerLiter,
VolumeStart = mtr.VolumeStart,
VolumeEnd = mtr.VolumeEnd,
VolumeMeter = mtr.VolumeMeter,
TestTime = mtr.Time,
Error = mtr.VolumeErrorPct,
TestDone = mtr.Disabled,
Passed = mtr.Passed,
WaterMeter = wm,
TestRslt = testRslt,
};
///
/// Update related WaterMeter entity
///
wm.MeterTestRslts.Add(meterTestRslt);
if (testData.Evaluate) wm.Passed = (wm.Passed && mtr.Passed);
if (wm.SerialNr == null) wm.SerialNr = mtr.SerialNr;
if (tr.QRise != 0) wm.QRise = tr.QRise;
if (tr.QFall != 0) wm.QFall = tr.QFall;
int endState1, endState2;
if (int.TryParse(wm.EndState, out endState1) && int.TryParse(mtr.EndState, out endState2) &&
endState2 > endState1)
{
wm.EndState = mtr.EndState;
}
}
batch.Tests.Add(testData);
batch.TestRslts.Add(testRslt);
} /// foreach (var tr in TRs)
session2.SaveOrUpdate(batch);
} /// if (TRs.Count > 0) ...
} /// for (int batchNr =...
session2.Flush();
session2.Close();
session1.Close();
ActivityEnd();
MessageBox.Show("Copying results completed", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception exc)
{
ActivityEnd();
MessageBox.Show(string.Format("Copying results failed:\r\n{0}", exc.Message),
"Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
+2
View File
@@ -10,6 +10,8 @@ rmdir /s /q Encrypt\bin
rmdir /s /q Encrypt\obj
rmdir /s /q GemCard\bin
rmdir /s /q GemCard\obj
rmdir /s /q GenCode128\bin
rmdir /s /q GenCode128\obj
rmdir /s /q GraphLib\bin
rmdir /s /q GraphLib\obj
rmdir /s /q TracingDB\bin
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
+2 -1
View File
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<repositories>
<repository path="..\TestBenchFramework\packages.config" />
<repository path="..\TBF\packages.config" />
<repository path="..\TracingDB\packages.config" />
</repositories>