Compare commits

..
Author SHA1 Message Date
Milan Hanajik a37141c5ad Reconfigured for Fuzhou PT150 2020-09-11 09:03:20 +02:00
Milan Hanajik a281321aa8 (1)Genesis component updated 21.8.2020, (2)EtPulsesK for FUZHOU_150 changed, ver. 2.18.1520 2020-09-11 09:02:17 +02:00
Milan Hanajik 471d0a9499 MettlerToledo : Zero instead of Taring 2020-08-07 09:30:58 +02:00
Milan Hanajik 21e6d3609c Results on screen display compound water meter results correctly. 2020-08-05 10:21:40 +02:00
Milan Hanajik fa1931c75b Bug fix in CombinedWithDetectionSeq related to test.Part 2020-08-03 09:00:52 +02:00
Milan Hanajik e40947c7c9 Output.Printers.Enhanced & Output.Printers.OnePerMeter can print barcodes with s/n-s, ver. 2.18.1507 2020-07-29 09:15:08 +02:00
Milan Hanajik 06160cc77b TestMethods.Adjustment bug fix 2020-07-28 15:24:32 +02:00
Milan Hanajik fe3fd48779 LoginDlgWithBenchSelection : List of benches is alphabetically sorted, ver. 2.18.1500 2020-07-09 16:47:18 +02:00
Milan Hanajik 6a82b7e9b2 Bug fixes: (1) DB Import/Export, (2) DB Upgrade, (3) One minute added to Batch.StartTime when restoring a batch, etc, ver. 2.18.1498 2020-06-25 11:31:30 +02:00
Milan Hanajik 705e85f10b Changes in TestMethods.Adjustment. 2020-04-27 11:54:33 +02:00
Milan Hanajik b40637acea Adjustment.WMErrorsForm48, MeretRS485Address = new byte[6] for IZRAEL_50, ver. 2.18.1441 2020-03-30 12:36:39 +02:00
Milan Hanajik be8f4fbf27 FUZHOU : ContrlComWrap.DivSampled(.,divIx) bug fix, ver. 2.18.1439 2020-03-18 07:49:37 +01:00
Milan Hanajik 98a4ee25df ThreeState water meter result printing (Algeria PT25), ver. 2.18.1438 2020-03-11 10:08:01 +01:00
Milan Hanajik 7ba8648e48 1. Algeria: Output.Printers.MultiLabel, 2. Localization to Romanian, ver. 2.18.1428 2020-03-04 12:28:00 +01:00
Milan Hanajik fbc7b9e1a9 Output.Printers.Label clean-up : SupressPrinting removed, Template may be empty. 2020-03-04 10:15:48 +01:00
Milan Hanajik faa0ef789a Bug fixes in Results.Entities.XY.Equals( ) 2020-02-27 13:55:25 +01:00
Milan Hanajik 707d5bab1a ver. 2.18.1426 2020-02-26 13:46:15 +01:00
Milan Hanajik 18840bc887 ver. 2.18.1425 2020-02-26 13:14:16 +01:00
Milan Hanajik 7b4c80ae6f ver. 2.18.1424 2020-02-26 13:01:44 +01:00
Milan Hanajik 5886c22d9b Printer.Label supports printing s/n as Code 128 barcode, ver. 2.18.1423 2020-02-25 11:32:12 +01:00
Milan Hanajik 36ea1e5337 GenCode128 project (barcode generation) added. 2020-02-25 11:32:12 +01:00
Milan Hanajik 2a42604007 'Custom query' bug fix. 2020-02-25 11:32:12 +01:00
Milan Hanajik efd5a2c2f1 ControlComWrap change for FUZHOU_300, ver. 2.18.1422 2020-02-24 08:35:28 +01:00
Milan Hanajik dbc8be0553 'Custom query' added to ResultsBrowser, ver. 2.18.1413 2020-02-14 16:22:44 +01:00
Milan Hanajik ca576e3448 ver. 2.18.1413 2020-02-10 14:19:36 +01:00
Milan Hanajik 3a55002027 ver. 2.18.1412 2020-02-10 13:55:58 +01:00
Milan Hanajik bbadacf7d3 Minor change 2020-02-10 12:13:05 +01:00
Milan Hanajik 2ff7b02e72 Output.Printers.Label with water meter s/n printed as a QR code, ver. 2.18.1411 2020-02-10 09:49:22 +01:00
96 changed files with 8164 additions and 2110 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
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;ZAMBIA</DefineConstants>
<DefineConstants>TRACE;DEBUG;FUZHOU_150</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;ZAMBIA</DefineConstants>
<DefineConstants>TRACE;FUZHOU_150</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+7 -1
View File
@@ -10,7 +10,7 @@ namespace Config
/// <summary>
/// Test bench database settings, contains bench name and settings od several databases
/// </summary>
public class DatabaseSettings : ICloneable
public class DatabaseSettings : ICloneable, IComparable
{
// Public fields
public string BenchName;
@@ -42,6 +42,12 @@ namespace Config
return result;
}
public int CompareTo(object dbs2)
{
if (!(dbs2 is DatabaseSettings)) return 0;
return String.Compare(BenchName, (dbs2 as DatabaseSettings).BenchName);
}
public override string ToString()
{
return string.Format("{0} config={1} results={2} users={3}",
+21
View File
@@ -310,6 +310,27 @@ namespace Config.Entities
Count
}
/// <summary>
/// Three state test results and/or water meter result (Algeria PT25 requirement).
/// NearlyOK means error is within error limits not narrowed by uncertainty
/// OK: Uncertainty + ErrLimLo <= error <= ErrLimHi - Uncertainty
/// NearlyOK: not OK but stil ErrLimLo <= error <= ErrLimHi
/// Nok: otherwise
/// </summary>
public enum ThreeState
{
#if LANG_FR
[Description("NC")] Nok, /// Totally failed: not OK and not NearlyOK
[Description("2e/Ff")] NearlyOK, /// Nearly OK, not OK but not totally failed
[Description("***")] OK, /// OK
#else
[Description("NOK")] Nok, /// Totally failed: not OK and not NearlyOK
[Description("Nearly OK")] NearlyOK, /// Nearly OK, not OK but not totally failed
[Description("OK")] OK, /// OK
#endif
Count
}
public enum TestRedType
{
Fix,
+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.1273.0")]
[assembly: AssemblyFileVersion("2.18.1273.0")]
[assembly: AssemblyVersion("2.18.1438.0")]
[assembly: AssemblyFileVersion("2.18.1438.0")]
+6 -1
View File
@@ -118,6 +118,7 @@ namespace Config
[Description("Text")] String,
[Description("Boolean")] Boolean,
[Description("Datum und Uhrzeit")] DateTime,
[Description("Aufgezählt")] Enum,
#elif LANG_PL
[Description("Objętość")] Volume,
[Description("Przepływ")] Flow,
@@ -139,8 +140,9 @@ namespace Config
[Description("Tekst")] String,
[Description("Boolean")] Boolean,
[Description("Data i czas")] DateTime,
[Description("Wyliczone")] Enum,
#elif LANG_CS
[Description("Objem")] Volume,
[Description("Objem")] Volume,
[Description("Průtok")] Flow,
[Description("Hmotnost")] Mass,
[Description("Čas")] Time,
@@ -160,6 +162,7 @@ namespace Config
[Description("Text")] String,
[Description("Boolean")] Boolean,
[Description("Datum a čas")] DateTime,
[Description("Vyjmenované")] Enum,
#elif LANG_IT
[Description("Volume")] Volume,
[Description("Flusso")] Flow,
@@ -181,6 +184,7 @@ namespace Config
[Description("Stringa")] String,
[Description("Boolean")] Boolean,
[Description("Data e ora")] DateTime,
[Description("Enumerato")] Enum,
#else
[Description("Volume")] Volume,
[Description("Flow")] Flow,
@@ -202,6 +206,7 @@ namespace Config
[Description("String")] String,
[Description("Boolean")] Boolean,
[Description("Date and time")] DateTime,
[Description("Enumerated")] Enum,
#endif
Count,
}
+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;
}
+2 -2
View File
@@ -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;
+35
View File
@@ -219,6 +219,41 @@ namespace Results.Entities
return passed;
}
/// <summary>
/// Three state test results and/or water meter result (Algeria PT25 requirement).
/// NearlyOK means error is within error limits not narrowed by uncertainty
/// OK: Uncertainty + ErrLimLo <= error <= ErrLimHi - Uncertainty
/// NearlyOK: not OK but stil ErrLimLo <= error <= ErrLimHi
/// Nok: otherwise
/// </summary>
public virtual ThreeState ThreeStateFromTests()
{
ErrorFlagsMode eFlagsMode;
int eFlags = ErrorFlagsFromTestsAndWM(out eFlagsMode);
ThreeState result = ThreeState.OK;
if (eFlagsMode == ErrorFlagsMode.On && eFlags != 0) result = ThreeState.Nok;
foreach (var mtr in MeterTestRslts)
{
if (mtr.Evaluate())
{
if(!mtr.TestDone || mtr.Error < mtr.ErrLimLo() || mtr.Error > mtr.ErrLimHi())
{
/// Test was not done or completely failed (was outside broader error limits)
result = ThreeState.Nok;
}
else if (result == ThreeState.OK && (mtr.Error < mtr.ErrLimLo() + mtr.Uncertainty() || mtr.Error > mtr.ErrLimHi() - mtr.Uncertainty()))
{
/// So far the water meter was OK, but this test was outside narrow error limits (= limits shrinked by Uncertainty)
result = ThreeState.NearlyOK;
}
}
}
return result;
}
public virtual bool CompletedFromTests()
{
bool completed = true;
+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;
+2
View File
@@ -318,6 +318,8 @@ namespace Results
TimeBtwnMassMsrmnts, /// 270
TestTimeCorrection, /// 271
ThreeState, /// 272
Count,
}
}
@@ -1,19 +1,24 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
/// Copyright (c) 2017-2020 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Printing;
using System.IO;
using Config.Entities;
using GenCode128;
using Gma.QrCodeNet.Encoding;
using Results.Resources;
namespace Results.Output.Printers.Enhanced
{
public class EnhancedPrintDocument : PrintDocument
{
/// 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;
@@ -23,12 +28,14 @@ namespace Results.Output.Printers.Enhanced
readonly int TitleX;
readonly int TitleY; /// Depends on the size of the header
readonly int SpacingOne;
readonly int SpacingOneAndHalf;
readonly int SpacingOne4Header;
readonly int SpacingOneAndHalf4Header;
readonly int spacingOne;
readonly int spacingOneAndHalf;
readonly int spacingOne4Header;
readonly int spacingOneAndHalf4Header;
readonly int spacingOne4Footer;
readonly int SpacingOne4Footer;
int spacingAboveTable;
int spacingBelowTable;
int CommonTop; /// = TitleY + 60
int BodyTop; /// = HdrTop + 160
@@ -124,11 +131,11 @@ namespace Results.Output.Printers.Enhanced
}
/// Document outline preliminary calculations
SpacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height;
SpacingOneAndHalf = (3 * SpacingOne) / 2;
SpacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height;
SpacingOneAndHalf4Header = (3 * SpacingOne4Header) / 2;
SpacingOne4Footer = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", footerFont).Height;
spacingOne = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", font).Height;
spacingOneAndHalf = (3 * spacingOne) / 2;
spacingOne4Header = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", headerFont).Height;
spacingOneAndHalf4Header = (3 * spacingOne4Header) / 2;
spacingOne4Footer = System.Windows.Forms.TextRenderer.MeasureText("Abcgq", footerFont).Height;
TitleX = cfg.LeftMargin;
TitleY = cfg.TopMargin;
@@ -178,17 +185,27 @@ namespace Results.Output.Printers.Enhanced
/// Prepare document outline
///----------
titleHeight = System.Windows.Forms.TextRenderer.MeasureText(header, titleFont).Height;
CommonTop = TitleY + titleHeight + SpacingOne4Header;
CommonTop = TitleY + titleHeight + spacingOne4Header;
commonHeight = commonItems.Count * SpacingOne;
BodyTop = CommonTop + commonHeight + SpacingOne4Header;
commonHeight = commonItems.Count * spacingOne;
BodyTop = CommonTop + commonHeight + spacingOne4Header;
Table table0 = Table.Create_TestsAreRows(batch.WaterMeters[0], testItems, style);
SizeF tableSize = table0.Measure(e);
int wmSectionHeight = (int)tableSize.Height + SpacingOne4Header * ((tableSize.Height > 0) ? 3 : 2);
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
if (cfg.BarcodeType == BarcodeType.None)
{
spacingAboveTable = spacingOneAndHalf4Header;
}
else
{
spacingAboveTable = Math.Max(spacingOneAndHalf4Header, cfg.BarcodeHeight + spacingOne4Header / 2);
}
spacingBelowTable = (tableSize.Height > 0) ? spacingOneAndHalf4Header : (spacingOne4Header / 2);
int wmSectionHeight = (int)tableSize.Height + spacingAboveTable + spacingBelowTable;
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * spacingOne) / wmSectionHeight;
nrWMsOnNextPage = (printHeight - 2 * spacingOne) / wmSectionHeight;
nrWMsOnNextPage = Math.Max(nrWMsOnNextPage, 1); /// Prevent division by zero if there are too many WM tests
nrPages = 1 + (batch.WaterMeters.Count - nrWMsOnFirstPage + nrWMsOnNextPage - 1) / nrWMsOnNextPage;
@@ -221,8 +238,8 @@ namespace Results.Output.Printers.Enhanced
/// Write aligned columns
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
{
PrintAt(e, leftMargin, CommonTop + SpacingOne * i, leftColumn[i]);
PrintAt(e, 300, CommonTop + SpacingOne * i, rightColumn[i]);
PrintAt(e, leftMargin, CommonTop + spacingOne * i, leftColumn[i]);
PrintAt(e, 300, CommonTop + spacingOne * i, rightColumn[i]);
}
}
@@ -241,7 +258,7 @@ namespace Results.Output.Printers.Enhanced
int wmPosition = true ? batch.WaterMeters[wmNr].WMPosition : (wmNr + 1);
if (!cfg.GoodOnly || batch.WaterMeters[wmNr].Passed)
{
nextWmTop = (int)PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop) + SpacingOneAndHalf4Header;
nextWmTop = (int)PrintWM(e, batch.WaterMeters[wmNr], wmPosition, nextWmTop) + spacingBelowTable;
}
}
@@ -252,11 +269,11 @@ namespace Results.Output.Printers.Enhanced
/// Footer
///----------
int footerWidth = (int)e.Graphics.MeasureString(footer, footerFont).Width;
PrintFooterAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - 2 * SpacingOne, footer);
PrintFooterAt(e, leftMargin + (printWidth - footerWidth) / 2, topMargin + printHeight - 2 * spacingOne, footer);
string pageNrText = string.Format("{0} {1}/{2}", Strings.Page, pageNr++, nrPages);
int pageNrWidth = (int)e.Graphics.MeasureString(pageNrText, font).Width;
PrintAt(e, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - SpacingOne, pageNrText);
PrintAt(e, leftMargin + (printWidth - pageNrWidth) / 2, topMargin + printHeight - spacingOne, pageNrText);
}
@@ -270,25 +287,48 @@ namespace Results.Output.Printers.Enhanced
float PrintWM(System.Drawing.Printing.PrintPageEventArgs e,
Results.Entities.WaterMeter wm, int printedWMNr, int top)
{
int tableTop = top + spacingAboveTable;
/// Print the water meter number and the serial number
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
PrintHeaderAt(e, leftMargin, top, wmText);
if (!string.IsNullOrEmpty(wm.SerialNr))
if (string.IsNullOrEmpty(wm.SerialNr))
{
PrintHeaderAt(e, leftMargin + (int)e.Graphics.MeasureString(wmText, headerFont).Width, top,
string.Format(" {0} = {1}", Strings.sn, wm.SerialNr));
string wmText = string.Format("{0} {1}", Strings.Water_Meter, printedWMNr);
int wmTextWidth = (int)e.Graphics.MeasureString(wmText, headerFont).Width;
PrintHeaderAt(e, leftMargin, tableTop - spacingOneAndHalf4Header, wmText);
}
else
{
string wmText = string.Format("{0} {1} {2} = {3}", Strings.Water_Meter, printedWMNr, Strings.sn, wm.SerialNr);
int wmTextWidth = (int)e.Graphics.MeasureString(wmText, headerFont).Width;
PrintHeaderAt(e, leftMargin, tableTop - spacingOneAndHalf4Header, wmText);
switch (cfg.BarcodeType)
{
case BarcodeType.Code_128_Horizontally:
{
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
e.Graphics.DrawImage(img, leftMargin + wmTextWidth + spacingOne4Header, top, cfg.BarcodeWidth, cfg.BarcodeHeight);
break;
}
case BarcodeType.Code_128_Vertically:
{
Image img = Code128Rendering.MakeBarcodeImage(wm.SerialNr, 1, true);
img.RotateFlip(RotateFlipType.Rotate90FlipNone);
e.Graphics.DrawImage(img, leftMargin + wmTextWidth + spacingOne4Header, top, cfg.BarcodeWidth, cfg.BarcodeHeight);
break;
}
case BarcodeType.QR_Code:
{
QrCode qrCode = encoder.Encode(wm.SerialNr);
DrawQR(e.Graphics, qrCode, leftMargin + wmTextWidth + spacingOne4Header, top, cfg.BarcodeWidth, cfg.BarcodeHeight);
break;
}
}
}
Table table = Table.Create_TestsAreRows(wm, testItems, style);
if (table.IsEmpty())
{
return top;
}
else
{
return table.Draw(e, leftMargin, top + SpacingOneAndHalf4Header);
}
return table.IsEmpty() ? tableTop : table.Draw(e, leftMargin, tableTop);
}
@@ -298,7 +338,7 @@ namespace Results.Output.Printers.Enhanced
}
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
{
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne);
RectangleF printArea = new RectangleF(x, y, 2000, spacingOne);
e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
}
@@ -309,7 +349,7 @@ namespace Results.Output.Printers.Enhanced
}
void PrintHeaderAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
{
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Header);
RectangleF printArea = new RectangleF(x, y, 2000, spacingOne4Header);
e.Graphics.DrawString(text, this.headerFont, Brushes.Black, printArea);
}
@@ -320,8 +360,33 @@ namespace Results.Output.Printers.Enhanced
}
void PrintFooterAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
{
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Footer);
RectangleF printArea = new RectangleF(x, y, 2000, spacingOne4Footer);
e.Graphics.DrawString(text, this.footerFont, Brushes.Black, printArea);
}
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) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
namespace Results.Output.Printers.Enhanced
@@ -30,5 +30,8 @@ namespace Results.Output.Printers.Enhanced
public string[] CommonItems;
public string[] TestItems;
public string Footer;
}
public BarcodeType BarcodeType; /// s/n is printed as barcode when valid (BarcodeType.None < BarcodeType < BarcodeType.Count)
public int BarcodeWidth;
public int BarcodeHeight;
}
}
+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
@@ -16,6 +16,10 @@ namespace Results.Output.Printers.Label
public int FontStyle;
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;
}
}
@@ -0,0 +1,175 @@
///
/// 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.MultiLabel
{
public class MultiLabelPrintDocument : PrintersCommon
{
static QrEncoder encoder = new QrEncoder();
/// Size of the printed area without margins, after taking into account 'pageOrientation'
readonly int labelHeight;
readonly int labelWidth;
/// Selected font
readonly Font font;
/// Data to print
Results.Entities.Batch batch;
MultiLabelPrinterCfg cfg;
IList<Results.Entities.WaterMeter> waterMeters;
/// Items to print
IList<WMeterRsltItemSpec> itemsToPrint;
/// <summary>
/// Constructor
/// </summary>
/// <param name="textToPrint">Text to be printed</param>
public MultiLabelPrintDocument(Results.Entities.Batch batch, MultiLabelPrinterCfg cfg, string documentName)
{
DocumentName = documentName;
this.batch = batch;
this.waterMeters = batch.WaterMeters;
this.cfg = cfg;
this.itemsToPrint = Results.WMeterRsltItemSpec.FromStrArray(cfg.ItemsToPrint);
/// Initialize fonts
font = new Font((cfg.FontFamily != null ? cfg.FontFamily : "Arial"),
(cfg.FontSize > 0 ? cfg.FontSize : 10),
(FontStyle)cfg.FontStyle);
/// Set print area size and margins (in dots using 100 dpi)
DefaultPageSettings.Landscape = (cfg.PageOrientation == PageOrientation.Landscape);
///
labelHeight = cfg.LabelHeight;
labelWidth = cfg.LabelWidth;
}
/// <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);
}
/// <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);
int labelColumn = 0;
int labelLeft = cfg.LeftTopLabelLeft;
int labelTop = cfg.LeftTopLabelTop;
foreach (var wm in waterMeters)
{
if (!wm.Disabled && (!cfg.GoodOnly || wm.Passed))
{
if (!string.IsNullOrEmpty(cfg.Template))
{
string templatePath = Path.Combine("C:\\TBF\\Templates\\", cfg.Template);
if (File.Exists(templatePath))
{
e.Graphics.DrawImage(new Bitmap(Image.FromFile(templatePath), labelWidth, labelHeight), new Rectangle(labelLeft, labelTop, labelWidth, labelHeight));
}
}
foreach (var item in itemsToPrint)
{
string[] coords = item.Caption.Split(new char[] { ';' });
int x, y;
if (coords.Length >= 2 && int.TryParse(coords[0].Trim(new char[] { ' ' }), out x)
&& int.TryParse(coords[1].Trim(new char[] { ' ' }), out y))
{
RectangleF printArea = new RectangleF(labelLeft + x, labelTop + y, labelWidth - x, labelHeight - y);
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, labelLeft + cfg.BarcodeLeft, labelTop + 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, labelLeft + cfg.BarcodeLeft, labelTop + cfg.BarcodeTop, cfg.BarcodeWidth, cfg.BarcodeHeight);
}
}
catch (Exception)
{
}
}
///
/// Move (labelLeft, labelTop) coordinates to the next label
///
if (++labelColumn == cfg.LabelColumnsCount)
{
labelColumn = 0;
labelLeft = cfg.LeftTopLabelLeft;
labelTop += cfg.LabelHeight;
}
else
{
labelLeft += cfg.LabelWidth;
}
}
}
}
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));
}
}
}
}
}
}
@@ -0,0 +1,29 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
namespace Results.Output.Printers.MultiLabel
{
public class MultiLabelPrinterCfg
{
public Config.Entities.PageOrientation PageOrientation;
public int LabelColumnsCount;
public int LeftTopLabelLeft;
public int LeftTopLabelTop;
public bool GoodOnly;
public string[] ItemsToPrint;
public int LabelWidth; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public int LabelHeight; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public string Template; /// Full path to a 'png' file
public string FontFamily;
public int FontSize;
public int FontStyle;
public System.Globalization.CultureInfo CultureInfo;
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;
}
}
@@ -1,12 +1,15 @@
///
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
/// Copyright (c) 2017-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 Config.Entities;
using GenCode128;
using Gma.QrCodeNet.Encoding;
using Results.Resources;
namespace Results.Output.Printers.OnePerMeter
@@ -16,7 +19,9 @@ namespace Results.Output.Printers.OnePerMeter
const float GapBetweenTableColumns = 10;
const float GapBetweenCommonColumns = 10;
/// 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;
@@ -158,6 +163,30 @@ namespace Results.Output.Printers.OnePerMeter
WMChart.GetChart(wm, true).Printing.PrintPaint(e.Graphics, pos);
}
if (cfg.BarcodeType != BarcodeType.None && cfg.BarcodeType < BarcodeType.Count && !string.IsNullOrEmpty(wm.SerialNr))
{
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)
{
}
}
float tableTop = cfg.TopMargin;
if (pageNr == 1)
@@ -351,5 +380,30 @@ namespace Results.Output.Printers.OnePerMeter
pageNr++;
}
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) 2017-2019 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
namespace Results.Output.Printers.OnePerMeter
@@ -54,5 +54,10 @@ namespace Results.Output.Printers.OnePerMeter
public int ImgWid;
public int ImgHgh;
public string ImgFullPathName;
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.1438.0")]
[assembly: AssemblyFileVersion("2.18.1438.0")]
+14 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;ZAMBIA</DefineConstants>
<DefineConstants>TRACE;DEBUG;FUZHOU_150</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;ZAMBIA</DefineConstants>
<DefineConstants>TRACE;FUZHOU_150</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,10 +134,15 @@
<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>
<Compile Include="Output\Printers\Label\LabelPrinterCfg.cs" />
<Compile Include="Output\Printers\MultiLabel\MultiLabelPrintDocument.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Output\Printers\MultiLabel\MultiLabelPrinterCfg.cs" />
<Compile Include="Output\Printers\PrintersCommon.cs">
<SubType>Component</SubType>
</Compile>
@@ -170,6 +178,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>
+17
View File
@@ -324,6 +324,8 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Passed, Strings.Result, Quantity.Boolean, ItemCategory.MeterResult, (w, t, u, f, p) => string.IsNullOrEmpty(t) ? w.PassedColorStr(f)
: ((w.GetMeterTestRslt(t) == null) ? "" : w.GetMeterTestRslt(t).PassedColorStr(f))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.ThreeState, "Three state result", Quantity.Enum, ItemCategory.MeterResult, (w, t, u, f, p) => FormatThreeState(f, w.ThreeStateFromTests())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.RefFlowmeter, "Ref. flowmeter", Quantity.String, ItemCategory.TestResult, (w, t, u, f, p) => (w.GetTestRslt(t) != null) ? FormatStr(f, w.GetTestRslt(t).RefFlowmeter()) : string.Empty));
AllItems.Add(new WMeterRsltItemSpec(ItemID.ResultOrErrorFlags, "Winiki lub E", Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.PassedOrErrorFlagsStr()))); /// PL specific result
@@ -520,6 +522,21 @@ namespace Results
}
}
public static string FormatThreeState(string format, ThreeState value)
{
if (string.IsNullOrEmpty(format))
{
return value.ToDescription();
}
else
{
string[] okNearlyokNok = format.Split(new char[] { '~' });
return (value == ThreeState.OK) ? okNearlyokNok[0]
: (value == ThreeState.NearlyOK) ? ((okNearlyokNok.Length >= 2) ? okNearlyokNok[1] : ThreeState.NearlyOK.ToDescription())
: ((okNearlyokNok.Length >= 3) ? okNearlyokNok[2] : ThreeState.Nok.ToDescription());
}
}
public static string FormatEnum(string format, int value)
{
if (string.IsNullOrEmpty(format))
+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;ZAMBIA</DefineConstants>
<DefineConstants>TRACE;DEBUG;FUZHOU_150</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;ZAMBIA</DefineConstants>
<DefineConstants>TRACE;FUZHOU_150</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 -2
View File
@@ -40,9 +40,8 @@ namespace TBF.BenchControl.Dummy.Balance
public float BuoyancyPress { get { return 1.013f; } }
public float BuoyancyHumi { get { return 50.0f; } }
public IOperation TaringOp(ref Boxes.DoubleBox tara)
public IOperation ZeroOp()
{
tara.Val = 0;
return this;
}
+6 -2
View File
@@ -130,8 +130,12 @@ namespace TBF.BenchControl.Elde
public float[] EtCalib = new float[8] { 1, 1, 1, 1, 1, 1, 1, 1 };
#elif MUNICH || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TORUN_50 || CEVAK_40 || TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL || MURES_40 || FUZHOU_50 || SLM_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || FUZHOU_100 || ALZIR_25
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
public byte[] MeretRS485Address = new byte[4];
public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 };
#if IZRAEL_50
public byte[] MeretRS485Address = new byte[6];
#else
public byte[] MeretRS485Address = new byte[4];
#endif
public float[] EtCalib = new float[5] { 1, 1, 1, 1, 1 };
#elif IZRAEL_50 || SLM_END
public uint[,] RegValveCalib = new uint[8,2] {{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500},{100,500}};
public byte[] MeretRS485Address = new byte[7]; /// Modbus addresses of Pr1, Pr2, Pr3, Pr4, Pr5, Pr6, T9 (Izrael) or Pr1, Pr2, Pr3, Pr4, T9, T10 (SLM END)
+2 -2
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_150 || FUZHOU_300
public int EtPulsesK { get { return 1; } }
#else /// all new benches
public int EtPulsesK { get { return (int)ctrlBrdComponent.etPulsesK; } }
@@ -110,7 +110,7 @@ namespace TBF.BenchControl.Elde
}
public float DivSamples(int time, int divIx0)
{
#if MUNICH || IZRAEL_200
#if MUNICH || IZRAEL_200 || FUZHOU_50 || FUZHOU_150 || FUZHOU_300
return ctrlBrdComponent.DIVSamples[time, 0];
#else
return ctrlBrdComponent.DIVSamples[time, divIx0];
+3 -4
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using TBF.Boxes;
@@ -17,9 +17,8 @@ namespace TBF.BenchControl.GenericDevices
/// <summary>
/// Events: BalanceDone, Error
/// </summary>
/// <param name="result">Reference to a variable for 'tara' in kg</param>
/// <returns>TaringOp instance reference casted to IOperaton</returns>
IOperation TaringOp(ref DoubleBox tara);
/// <returns>ZeroOp instance reference casted to IOperaton</returns>
IOperation ZeroOp();
/// <summary>
/// Events: BalanceDone, Error
@@ -197,7 +197,7 @@ namespace TBF.BenchControl.MettlerToledo.Multi
{
if (balanceCfg.DebugLevel == DebugMode.Simulate)
{
Masses[balanceNr] = TestBenchSim.GetSimMass(balanceNr);
Masses[balanceNr] = 123.456;
msrmntState = MsrmntState.Valid;
msrmntTimeStamp = StateMachine.Time;
return;
@@ -297,16 +297,26 @@ namespace TBF.BenchControl.MettlerToledo.Multi
public void StopDevice2() { }
/// <summary>
/// Events: BalanceDone, Error
/// </summary>
/// <param name="result">Reference to a variable for 'tara' in kg</param>
/// <returns>TaringOp instance reference casted to IOperaton</returns>
public IOperation TaringOp(ref DoubleBox tara)
/// <returns>ZeroOp reference</returns>
public IOperation ZeroOp()
{
return new TaringOp(this, ref tara);
return new ZeroOp(this);
}
/// <summary>
/// Events: BalanceDone, Error
/// </summary>
/// <param name="result">Reference to a variable for 'tara' in kg</param>
/// <returns>TaringOp reference</returns>
public IOperation TaringOp(ref DoubleBox tara)
{
return new TaringOp(this, ref tara);
}
/// <summary>
/// Events: BalanceDone, Error
/// </summary>
@@ -0,0 +1,68 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using log4net;
namespace TBF.BenchControl.MettlerToledo.Multi
{
public class ZeroOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(ZeroOp));
public override string ToString() { return string.Format("ZeroOp(.,.)"); }
bool done;
/// Set by the constructor
BalanceDev balanceDev;
/// <summary>
/// Events: BalanceDone, Error
/// </summary>
/// <param name="balanceDev">Balance device instance</param>
public ZeroOp(BalanceDev balanceDev)
{
if (balanceDev == null) throw new ArgumentNullException("balanceDev");
this.balanceDev = balanceDev;
log.Debug(this.ToString());
}
/// <summary>Start this operation</summary>
public void Start()
{
done = true;
}
/// <summary>Run this operation</summary>
/// <returns>
/// Event.None
/// Event.BalanceDone
/// Event.Error . . . . . Current.Tick == null
/// </returns>
public Event Run()
{
if (done) return Event.BalanceDone; /// Zero has been done already
if (balanceDev.MsrmntState == MsrmntState.Busy) return Event.Busy;
if (balanceDev.MsrmntState == MsrmntState.Overload)
{
done = true;
return Event.BalanceOverload;
}
if (balanceDev.MsrmntState == MsrmntState.Valid)
{
done = true;
return Event.BalanceDone; /// Zero completed
}
return Event.Busy;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
}
}
}
@@ -77,9 +77,8 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public string Format { get { return balanceCfg.Format; } }
public BalanceDev()
{
}
public BalanceDev() { }
/// <summary>
/// Constructor
@@ -258,7 +257,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard
if (balanceCfg.DebugLevel == DebugMode.Simulate)
{
Masses[balanceNr] = TestBenchSim.GetSimMass(balanceNr);
Masses[balanceNr] = 123.456;
msrmntState = MsrmntState.Valid;
msrmntTimeStamp = StateMachine.Time;
return;
@@ -474,13 +473,22 @@ namespace TBF.BenchControl.MettlerToledo.Standard
/// <summary>
/// Events: BalanceDone, Error
/// </summary>
/// <param name="result">Reference to a variable for 'tara' in kg</param>
/// <returns>TaringOp instance reference casted to IOperaton</returns>
public IOperation TaringOp(ref DoubleBox tara)
/// <returns>ZeroOp reference</returns>
public IOperation ZeroOp()
{
return new TaringOp(this, ref tara);
return new ZeroOp(this);
}
/// <summary>
/// Events: BalanceDone, Error
/// </summary>
/// <param name="result">Reference to a variable for 'tara' in kg</param>
/// <returns>TaringOp reference</returns>
public IOperation TaringOp(ref DoubleBox tara)
{
return new TaringOp(this, ref tara);
}
/// <summary>
/// Events: BalanceDone, Error
/// </summary>
@@ -0,0 +1,74 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using log4net;
namespace TBF.BenchControl.MettlerToledo.Standard
{
public class ZeroOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(ZeroOp));
public override string ToString() { return string.Format("ZeroOp(.,.)"); }
bool done;
/// Set by the constructor
BalanceDev balanceDev;
/// <summary>
/// Events: BalanceDone, Error
/// </summary>
/// <param name="balanceDev">Balance device instance</param>
/// <param name="result">Reference to variable for 'tara' in kg</param>
public ZeroOp(BalanceDev balanceDev)
{
if (balanceDev == null) throw new ArgumentNullException("balanceDev");
this.balanceDev = balanceDev;
log.Debug(this.ToString());
}
/// <summary>Start this operation</summary>
public void Start()
{
log.DebugFormat("{0} - Start()", balanceDev.Name);
done = false;
balanceDev.ZeroWhenStable();
}
/// <summary>Run this operation</summary>
/// <returns>
/// Event.None
/// Event.BalanceDone
/// Event.Error . . . . . Current.Tick == null
/// </returns>
public Event Run()
{
if (done) return Event.BalanceDone; /// Zeroing has been done already
if (balanceDev.MsrmntState == MsrmntState.Busy) return Event.Busy;
if (balanceDev.MsrmntState == MsrmntState.Overload)
{
done = true;
return Event.BalanceOverload;
}
if (balanceDev.MsrmntState == MsrmntState.Valid)
{
done = true;
return Event.BalanceDone; /// Zeroing completed
}
balanceDev.ZeroWhenStable(); /// Failed -> repeat zeroing
return Event.Busy;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
log.DebugFormat("{0} - Stop()", balanceDev.Name);
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -102,6 +102,10 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
printerCfg.DocName = newCfg.DocName;
printerCfg.NrOfCopies = newCfg.NrOfCopies;
printerCfg.BarcodeType = newCfg.BarcodeType;
printerCfg.BarcodeWidth = newCfg.BarcodeWidth;
printerCfg.BarcodeHeight = newCfg.BarcodeHeight;
ApplyConfig();
}
}
@@ -191,6 +195,9 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
CommonItems = printerCfg.CommonItems,
TestItems = printerCfg.SelectedItems,
Footer = printerCfg.Footer,
BarcodeType = printerCfg.BarcodeType,
BarcodeWidth = printerCfg.BarcodeWidth,
BarcodeHeight = printerCfg.BarcodeHeight,
};
for (int i = 1; i <= printerCfg.NrOfCopies; i++)
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using System.Xml.Serialization;
using Config.Entities;
@@ -44,6 +44,10 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
public string DocName;
public int NrOfCopies;
public Results.Output.Printers.BarcodeType BarcodeType;
public int BarcodeWidth;
public int BarcodeHeight;
[XmlIgnore]
public Config.Entities.MetersKind MetersKind;
@@ -76,6 +76,12 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
this.templateLabel = new System.Windows.Forms.Label();
this.nrOfCopiesTextBox = new System.Windows.Forms.TextBox();
this.nrOfCopiesLabel = new System.Windows.Forms.Label();
this.barcodeTypeComboBox = new System.Windows.Forms.ComboBox();
this.barcodeLabel = new System.Windows.Forms.Label();
this.barcodeWidthTextBox = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.barcodeHeightTextBox = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// nameTextBox
@@ -108,7 +114,7 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
//
this.supressPrintingCheckBox.AutoSize = true;
this.supressPrintingCheckBox.Enabled = false;
this.supressPrintingCheckBox.Location = new System.Drawing.Point(19, 259);
this.supressPrintingCheckBox.Location = new System.Drawing.Point(91, 307);
this.supressPrintingCheckBox.Name = "supressPrintingCheckBox";
this.supressPrintingCheckBox.Size = new System.Drawing.Size(101, 17);
this.supressPrintingCheckBox.TabIndex = 33;
@@ -187,9 +193,9 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
// commonItemsButton
//
this.commonItemsButton.Enabled = false;
this.commonItemsButton.Location = new System.Drawing.Point(142, 259);
this.commonItemsButton.Location = new System.Drawing.Point(193, 259);
this.commonItemsButton.Name = "commonItemsButton";
this.commonItemsButton.Size = new System.Drawing.Size(218, 23);
this.commonItemsButton.Size = new System.Drawing.Size(167, 23);
this.commonItemsButton.TabIndex = 36;
this.commonItemsButton.Text = "Common items";
this.commonItemsButton.UseVisualStyleBackColor = true;
@@ -198,9 +204,9 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
// footerButton
//
this.footerButton.Enabled = false;
this.footerButton.Location = new System.Drawing.Point(142, 303);
this.footerButton.Location = new System.Drawing.Point(193, 303);
this.footerButton.Name = "footerButton";
this.footerButton.Size = new System.Drawing.Size(218, 23);
this.footerButton.Size = new System.Drawing.Size(167, 23);
this.footerButton.TabIndex = 38;
this.footerButton.Text = "Footer";
this.footerButton.UseVisualStyleBackColor = true;
@@ -209,9 +215,9 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
// headerButton
//
this.headerButton.Enabled = false;
this.headerButton.Location = new System.Drawing.Point(142, 237);
this.headerButton.Location = new System.Drawing.Point(193, 237);
this.headerButton.Name = "headerButton";
this.headerButton.Size = new System.Drawing.Size(218, 23);
this.headerButton.Size = new System.Drawing.Size(167, 23);
this.headerButton.TabIndex = 35;
this.headerButton.Text = "Title";
this.headerButton.UseVisualStyleBackColor = true;
@@ -220,9 +226,9 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
// testItemsButton
//
this.testItemsButton.Enabled = false;
this.testItemsButton.Location = new System.Drawing.Point(142, 281);
this.testItemsButton.Location = new System.Drawing.Point(193, 281);
this.testItemsButton.Name = "testItemsButton";
this.testItemsButton.Size = new System.Drawing.Size(218, 23);
this.testItemsButton.Size = new System.Drawing.Size(167, 23);
this.testItemsButton.TabIndex = 37;
this.testItemsButton.Text = "Test items";
this.testItemsButton.UseVisualStyleBackColor = true;
@@ -251,9 +257,9 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
// docNameTextBox
//
this.docNameTextBox.Enabled = false;
this.docNameTextBox.Location = new System.Drawing.Point(197, 328);
this.docNameTextBox.Location = new System.Drawing.Point(193, 328);
this.docNameTextBox.Name = "docNameTextBox";
this.docNameTextBox.Size = new System.Drawing.Size(163, 20);
this.docNameTextBox.Size = new System.Drawing.Size(167, 20);
this.docNameTextBox.TabIndex = 40;
//
// docNameLabel
@@ -269,7 +275,7 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
//
this.goodOnlyCheckBox.AutoSize = true;
this.goodOnlyCheckBox.Enabled = false;
this.goodOnlyCheckBox.Location = new System.Drawing.Point(19, 281);
this.goodOnlyCheckBox.Location = new System.Drawing.Point(15, 307);
this.goodOnlyCheckBox.Name = "goodOnlyCheckBox";
this.goodOnlyCheckBox.Size = new System.Drawing.Size(74, 17);
this.goodOnlyCheckBox.TabIndex = 34;
@@ -494,16 +500,74 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
this.nrOfCopiesLabel.TabIndex = 44;
this.nrOfCopiesLabel.Text = "# copies";
//
// barcodeTypeComboBox
//
this.barcodeTypeComboBox.Enabled = false;
this.barcodeTypeComboBox.FormattingEnabled = true;
this.barcodeTypeComboBox.Location = new System.Drawing.Point(19, 257);
this.barcodeTypeComboBox.Name = "barcodeTypeComboBox";
this.barcodeTypeComboBox.Size = new System.Drawing.Size(167, 21);
this.barcodeTypeComboBox.TabIndex = 45;
//
// barcodeLabel
//
this.barcodeLabel.AutoSize = true;
this.barcodeLabel.Location = new System.Drawing.Point(16, 241);
this.barcodeLabel.Name = "barcodeLabel";
this.barcodeLabel.Size = new System.Drawing.Size(47, 13);
this.barcodeLabel.TabIndex = 46;
this.barcodeLabel.Text = "Barcode";
//
// barcodeWidthTextBox
//
this.barcodeWidthTextBox.Enabled = false;
this.barcodeWidthTextBox.Location = new System.Drawing.Point(79, 281);
this.barcodeWidthTextBox.Name = "barcodeWidthTextBox";
this.barcodeWidthTextBox.Size = new System.Drawing.Size(31, 20);
this.barcodeWidthTextBox.TabIndex = 14;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(42, 285);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(35, 13);
this.label5.TabIndex = 15;
this.label5.Text = "Width";
//
// barcodeHeightTextBox
//
this.barcodeHeightTextBox.Enabled = false;
this.barcodeHeightTextBox.Location = new System.Drawing.Point(156, 281);
this.barcodeHeightTextBox.Name = "barcodeHeightTextBox";
this.barcodeHeightTextBox.Size = new System.Drawing.Size(30, 20);
this.barcodeHeightTextBox.TabIndex = 17;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(116, 285);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(38, 13);
this.label6.TabIndex = 18;
this.label6.Text = "Height";
//
// 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.label6);
this.Controls.Add(this.nrOfCopiesLabel);
this.Controls.Add(this.nrOfCopiesTextBox);
this.Controls.Add(this.barcodeHeightTextBox);
this.Controls.Add(this.templateTextBox);
this.Controls.Add(this.templateLabel);
this.Controls.Add(this.label5);
this.Controls.Add(this.footerItalicCheckBox);
this.Controls.Add(this.footerBoldCheckBox);
this.Controls.Add(this.barcodeWidthTextBox);
this.Controls.Add(this.footerFontSizeTextBox);
this.Controls.Add(this.footerFontFamilyComboBox);
this.Controls.Add(this.footerFontLabel);
@@ -598,5 +662,11 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
private System.Windows.Forms.Label templateLabel;
private System.Windows.Forms.TextBox nrOfCopiesTextBox;
private System.Windows.Forms.Label nrOfCopiesLabel;
private System.Windows.Forms.ComboBox barcodeTypeComboBox;
private System.Windows.Forms.Label barcodeLabel;
private System.Windows.Forms.TextBox barcodeWidthTextBox;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox barcodeHeightTextBox;
private System.Windows.Forms.Label label6;
}
}
@@ -1,14 +1,15 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Output.Printers;
using TBF.BenchControl.Configs;
using TBF.BenchControl.Generic;
using TBF.Resources;
using TBF.BenchControl.Configs;
namespace TBF.BenchControl.Output.Printers.Enhanced
{
@@ -49,7 +50,12 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
bodyFontFamilyComboBox.Items.Add(ff.Name);
footerFontFamilyComboBox.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)
{
@@ -114,6 +120,10 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
docNameTextBox.Text = config.DocName;
nrOfCopiesTextBox.Text = config.NrOfCopies.ToString();
barcodeTypeComboBox.Text = config.BarcodeType.ToString();
barcodeWidthTextBox.Text = config.BarcodeWidth.ToString();
barcodeHeightTextBox.Text = config.BarcodeHeight.ToString();
}
public void Unlock()
@@ -149,6 +159,10 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
footerButton.Enabled = true;
docNameTextBox.Enabled = true;
nrOfCopiesTextBox.Enabled = true;
barcodeTypeComboBox.Enabled = true;
barcodeWidthTextBox.Enabled = true;
barcodeHeightTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@@ -216,6 +230,22 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
flags |= CfgUpdateFlags.Error;
}
if (!barcodeTypeComboBox.Items.Contains(barcodeTypeComboBox.Text))
{
message += Environment.NewLine + "Invalid barcode type";
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;
}
@@ -292,6 +322,18 @@ namespace TBF.BenchControl.Output.Printers.Enhanced
flags |= UpdateDifferent(ref config.DocName, docNameTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.NrOfCopies, nrOfCopiesTextBox.Text, 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.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));
@@ -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;
@@ -17,7 +17,7 @@ namespace TBF.BenchControl.Output.Printers.Label
readonly PrinterCfg printerCfg;
public bool SupressPrinting { get { return printerCfg.SupressPrinting; } }
public bool SupressPrinting { get { return (printerCfg.NrOfCopies == 0); } }
/// <summary> Data to print </summary>
Results.Entities.Batch batch;
@@ -75,7 +75,11 @@ namespace TBF.BenchControl.Output.Printers.Label
printerCfg.Culture = newCfg.Culture;
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 +135,6 @@ namespace TBF.BenchControl.Output.Printers.Label
}
void PrintResults(Results.Entities.Batch batch, Results.Entities.WaterMeter wm, string documentName)
{
LabelPrinterCfg cfg = new LabelPrinterCfg
@@ -146,7 +149,11 @@ namespace TBF.BenchControl.Output.Printers.Label
FontStyle = printerCfg.FontStyle,
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;
@@ -31,7 +31,13 @@ namespace TBF.BenchControl.Output.Printers.Label
public Culture Culture;
public int NrOfCopies;
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()
@@ -54,19 +60,19 @@ namespace TBF.BenchControl.Output.Printers.Label
FontStyle = 0;
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}, Barcode={6}",
Name,
PageOrientation,
PaperWidth,
PaperHeight,
Template,
GoodOnly ? "yes" : "no",
SupressPrinting ? "yes" : "no"
BarcodeType.ToString()
);
}
}
+386 -296
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.Output.Printers.Label
{
@@ -31,296 +31,378 @@ 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.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";
//
// 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.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();
}
@@ -328,16 +410,14 @@ namespace TBF.BenchControl.Output.Printers.Label
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.CheckBox supressPrintingCheckBox;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.Label orientationLabel;
private System.Windows.Forms.ComboBox orientationComboBox;
private System.Windows.Forms.TextBox templateTextBox;
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 +430,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)
{
@@ -79,8 +86,13 @@ namespace TBF.BenchControl.Output.Printers.Label
cultureComboBox.Text = config.Culture.ToString();
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()
{
@@ -97,14 +109,19 @@ namespace TBF.BenchControl.Output.Printers.Label
cultureComboBox.Enabled = true;
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)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!File.Exists(Path.Combine("C:\\TBF\\Templates", templateTextBox.Text)))
if (!string.IsNullOrEmpty(templateTextBox.Text) && !File.Exists(Path.Combine("C:\\TBF\\Templates", templateTextBox.Text)))
{
message += Environment.NewLine + "Template file missing";
flags |= CfgUpdateFlags.Error;
@@ -143,6 +160,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;
}
@@ -191,7 +234,20 @@ namespace TBF.BenchControl.Output.Printers.Label
flags |= UpdateDifferent(ref config.NrOfCopies, nrOfCopiesTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
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)
{
@@ -0,0 +1,26 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Output.Printers.MultiLabel
{
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(17); } }
public void ResetStaticProperties() { Printer.ResetStaticProperties(); }
public IComponent DummyComponent() { return new Printer(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Printer(cfg); }
public IComponentCfg DefaultConfig() { return new PrinterCfg(this.GetType().Namespace.Substring(24), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(PrinterCfg.Serializer, component, this);
}
}
}
@@ -0,0 +1,168 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using System.Globalization;
using System.Threading;
using Results.Output.Printers.MultiLabel;
namespace TBF.BenchControl.Output.Printers.MultiLabel
{
public class Printer : ComponentBase, IOperation, GenericDevices.IResultsPrinter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Printer));
public override string ToString() { return string.Format("MultiLabel.Printer({0})", Cfg.ToString(1)); }
readonly PrinterCfg printerCfg;
public bool SupressPrinting { get { return (printerCfg.NrOfCopies == 0); } }
/// <summary> Data to print </summary>
Results.Entities.Batch batch;
///
/// Items to print
///
IList<Results.WMeterRsltItemSpec> commonItems;
public Printer() { }
public Printer(Generic.IComponentCfg cfg)
: base(cfg)
{
printerCfg = cfg as PrinterCfg;
ApplyConfig();
log.Debug(this.ToString());
}
void ApplyConfig()
{
commonItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.ItemsToPrint);
}
#region Configuration Change Handling
public static void OnCfgChange(object sender, CfgChangeArgs args)
{
if (CfgChangeHandler == null) return;
try { CfgChangeHandler(sender, args); }
catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
}
public static event EventHandler<CfgChangeArgs> CfgChangeHandler;
public override void StartChangeHandler()
{
CfgChangeHandler += delegate(object sender, CfgChangeArgs args)
{
PrinterCfg newCfg = args.Cfg as PrinterCfg;
if (newCfg != null && newCfg.Name.Equals(Name))
{
if (args.Command == CfgChangeCmd.CfgChange)
{
printerCfg.PageOrientation = newCfg.PageOrientation;
printerCfg.LabelColumnsCount = newCfg.LabelColumnsCount;
printerCfg.LeftTopLabelLeft = newCfg.LeftTopLabelLeft;
printerCfg.LeftTopLabelTop = newCfg.LeftTopLabelTop;
printerCfg.NrOfCopies = newCfg.NrOfCopies;
printerCfg.GoodOnly = newCfg.GoodOnly;
printerCfg.ItemsToPrint = newCfg.ItemsToPrint;
printerCfg.LabelWidth = newCfg.LabelWidth;
printerCfg.LabelHeight = newCfg.LabelHeight;
printerCfg.Template = newCfg.Template;
printerCfg.FontFamily = newCfg.FontFamily;
printerCfg.FontSize = newCfg.FontSize;
printerCfg.FontStyle = newCfg.FontStyle;
printerCfg.Culture = newCfg.Culture;
printerCfg.BarcodeType = newCfg.BarcodeType;
printerCfg.BarcodeLeft = newCfg.BarcodeLeft;
printerCfg.BarcodeTop = newCfg.BarcodeTop;
printerCfg.BarcodeWidth = newCfg.BarcodeWidth;
printerCfg.BarcodeHeight = newCfg.BarcodeHeight;
ApplyConfig();
}
}
};
}
#endregion Configuration Change Handling
/// <summary>
/// Prints the test cycle results, Events: Event.ResultsPrinted
/// </summary>
/// <param name="batch">Batch results to print</param>
/// <returns>Reference to the operation</returns>
public IOperation PrintResultsOp(Results.Entities.Batch batch)
{
this.batch = batch;
return this;
}
/// <summary>Start this operation</summary>
public void Start()
{
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
if (printerCfg.Culture != Culture.system)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
PrintResults(batch, string.Format("{0}", batch.BatchNr));
Thread.CurrentThread.CurrentCulture = oriCulture;
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
return Event.ResultsPrinted;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
}
void PrintResults(Results.Entities.Batch batch, string documentName)
{
MultiLabelPrinterCfg cfg = new MultiLabelPrinterCfg
{
PageOrientation = printerCfg.PageOrientation,
LabelColumnsCount = printerCfg.LabelColumnsCount,
LeftTopLabelLeft = printerCfg.LeftTopLabelLeft,
LeftTopLabelTop = printerCfg.LeftTopLabelTop,
GoodOnly = printerCfg.GoodOnly,
ItemsToPrint = printerCfg.ItemsToPrint,
LabelWidth = printerCfg.LabelWidth,
LabelHeight = printerCfg.LabelHeight,
Template = printerCfg.Template,
FontFamily = printerCfg.FontFamily,
FontSize = printerCfg.FontSize,
FontStyle = printerCfg.FontStyle,
CultureInfo = (printerCfg.Culture == Culture.system) ? Thread.CurrentThread.CurrentCulture : new CultureInfo(printerCfg.Culture.ToString()),
BarcodeType = printerCfg.BarcodeType,
BarcodeLeft = printerCfg.BarcodeLeft,
BarcodeTop = printerCfg.BarcodeTop,
BarcodeWidth = printerCfg.BarcodeWidth,
BarcodeHeight = printerCfg.BarcodeHeight,
};
for (int i = 1; i <= printerCfg.NrOfCopies; i++)
{
string docNameEx = string.Format(((printerCfg.NrOfCopies == 1) ? "{0}" : "{0}_{1}"), documentName, i);
new Results.Output.Printers.MultiLabel.MultiLabelPrintDocument(batch, cfg, docNameEx).Print();
}
}
}
}
@@ -0,0 +1,82 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Output.Printers.MultiLabel
{
public class PrinterCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PrinterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new PrinterCfgCtrl(); }
///
/// Serialized parameters
///
public PageOrientation PageOrientation;
public int LabelColumnsCount;
public int LeftTopLabelLeft;
public int LeftTopLabelTop;
public int NrOfCopies;
public bool GoodOnly;
public string[] ItemsToPrint;
public int LabelWidth; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public int LabelHeight; /// In 0,254 mm = 1/100 in = 100dpi pixels count
public string Template; /// Full path to a 'png' file
public string FontFamily;
public int FontSize;
public int FontStyle;
public Culture Culture;
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()
{
}
public PrinterCfg(string name, IComponentFactory factory)
: this()
{
this.Name = name;
this.Factory = factory;
ParentName = string.Empty;
Template = string.Empty;
PageOrientation = PageOrientation.Portrait;
LabelWidth = 827; /// A4 width
LabelHeight = 1169; /// A4 height
FontFamily = "Arial";
FontSize = 10;
FontStyle = 0;
NrOfCopies = 1;
GoodOnly = false;
BarcodeType = Results.Output.Printers.BarcodeType.None;
}
public string ToString(int i)
{
return string.Format("Name={0}, Orientation={1}, LabelClmnsCnt={2}, LabelW={3}, LabelH={4}, Barcode={5}, TemplateFile={6}",
Name,
PageOrientation,
LabelColumnsCount,
LabelWidth,
LabelHeight,
BarcodeType.ToString(),
Template
);
}
}
}
@@ -0,0 +1,529 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
namespace TBF.BenchControl.Output.Printers.MultiLabel
{
partial class PrinterCfgCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
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.labelWidthTextBox = new System.Windows.Forms.TextBox();
this.paperWidthLabel = new System.Windows.Forms.Label();
this.labelHeightTextBox = 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.leftTopLabelTopLabel = new System.Windows.Forms.Label();
this.leftTopLabelTopTextBox = new System.Windows.Forms.TextBox();
this.leftTopLabelLeftTextBox = new System.Windows.Forms.TextBox();
this.leftTopLabelLeftLabel = new System.Windows.Forms.Label();
this.labelColumnsCountTextBox = new System.Windows.Forms.TextBox();
this.labelColumnsCountLabel = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox1.SuspendLayout();
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";
//
// orientationLabel
//
this.orientationLabel.AutoSize = true;
this.orientationLabel.Location = new System.Drawing.Point(8, 60);
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, 57);
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(120, 22);
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(6, 25);
this.templateLabel.Name = "templateLabel";
this.templateLabel.Size = new System.Drawing.Size(67, 13);
this.templateLabel.TabIndex = 9;
this.templateLabel.Text = "Template file";
//
// labelWidthTextBox
//
this.labelWidthTextBox.Enabled = false;
this.labelWidthTextBox.Location = new System.Drawing.Point(120, 44);
this.labelWidthTextBox.Name = "labelWidthTextBox";
this.labelWidthTextBox.Size = new System.Drawing.Size(51, 20);
this.labelWidthTextBox.TabIndex = 6;
//
// paperWidthLabel
//
this.paperWidthLabel.AutoSize = true;
this.paperWidthLabel.Location = new System.Drawing.Point(6, 47);
this.paperWidthLabel.Name = "paperWidthLabel";
this.paperWidthLabel.Size = new System.Drawing.Size(101, 13);
this.paperWidthLabel.TabIndex = 5;
this.paperWidthLabel.Text = "Label width / height";
//
// labelHeightTextBox
//
this.labelHeightTextBox.Enabled = false;
this.labelHeightTextBox.Location = new System.Drawing.Point(174, 44);
this.labelHeightTextBox.Name = "labelHeightTextBox";
this.labelHeightTextBox.Size = new System.Drawing.Size(51, 20);
this.labelHeightTextBox.TabIndex = 8;
//
// italicCheckBox
//
this.italicCheckBox.AutoSize = true;
this.italicCheckBox.Enabled = false;
this.italicCheckBox.Location = new System.Drawing.Point(333, 72);
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(305, 72);
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(257, 66);
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(120, 66);
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(6, 69);
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(329, 57);
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(295, 57);
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(257, 96);
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, 105);
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, 102);
this.nrOfCopiesTextBox.Name = "nrOfCopiesTextBox";
this.nrOfCopiesTextBox.Size = new System.Drawing.Size(32, 20);
this.nrOfCopiesTextBox.TabIndex = 51;
//
// cultureComboBox
//
this.cultureComboBox.Enabled = false;
this.cultureComboBox.FormattingEnabled = true;
this.cultureComboBox.Location = new System.Drawing.Point(120, 89);
this.cultureComboBox.Name = "cultureComboBox";
this.cultureComboBox.Size = new System.Drawing.Size(130, 21);
this.cultureComboBox.TabIndex = 54;
//
// cultureLabel
//
this.cultureLabel.AutoSize = true;
this.cultureLabel.Location = new System.Drawing.Point(6, 92);
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(261, 104);
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(95, 139);
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(120, 135);
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(179, 135);
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(153, 139);
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(247, 135);
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(212, 139);
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(318, 135);
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(280, 139);
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(120, 112);
this.barcodeTypeComboBox.Name = "barcodeTypeComboBox";
this.barcodeTypeComboBox.Size = new System.Drawing.Size(130, 21);
this.barcodeTypeComboBox.TabIndex = 19;
//
// barcodeLabel
//
this.barcodeLabel.AutoSize = true;
this.barcodeLabel.Location = new System.Drawing.Point(6, 115);
this.barcodeLabel.Name = "barcodeLabel";
this.barcodeLabel.Size = new System.Drawing.Size(88, 13);
this.barcodeLabel.TabIndex = 56;
this.barcodeLabel.Text = "Barcode with s/n";
//
// leftTopLabelTopLabel
//
this.leftTopLabelTopLabel.AutoSize = true;
this.leftTopLabelTopLabel.Location = new System.Drawing.Point(294, 84);
this.leftTopLabelTopLabel.Name = "leftTopLabelTopLabel";
this.leftTopLabelTopLabel.Size = new System.Drawing.Size(26, 13);
this.leftTopLabelTopLabel.TabIndex = 60;
this.leftTopLabelTopLabel.Text = "Top";
//
// leftTopLabelTopTextBox
//
this.leftTopLabelTopTextBox.Enabled = false;
this.leftTopLabelTopTextBox.Location = new System.Drawing.Point(320, 80);
this.leftTopLabelTopTextBox.Name = "leftTopLabelTopTextBox";
this.leftTopLabelTopTextBox.Size = new System.Drawing.Size(31, 20);
this.leftTopLabelTopTextBox.TabIndex = 59;
//
// leftTopLabelLeftTextBox
//
this.leftTopLabelLeftTextBox.Enabled = false;
this.leftTopLabelLeftTextBox.Location = new System.Drawing.Point(261, 80);
this.leftTopLabelLeftTextBox.Name = "leftTopLabelLeftTextBox";
this.leftTopLabelLeftTextBox.Size = new System.Drawing.Size(31, 20);
this.leftTopLabelLeftTextBox.TabIndex = 58;
//
// leftTopLabelLeftLabel
//
this.leftTopLabelLeftLabel.AutoSize = true;
this.leftTopLabelLeftLabel.Location = new System.Drawing.Point(167, 83);
this.leftTopLabelLeftLabel.Name = "leftTopLabelLeftLabel";
this.leftTopLabelLeftLabel.Size = new System.Drawing.Size(93, 13);
this.leftTopLabelLeftLabel.TabIndex = 57;
this.leftTopLabelLeftLabel.Text = "Left-Top label Left";
//
// labelColumnsCountTextBox
//
this.labelColumnsCountTextBox.Enabled = false;
this.labelColumnsCountTextBox.Location = new System.Drawing.Point(122, 80);
this.labelColumnsCountTextBox.Name = "labelColumnsCountTextBox";
this.labelColumnsCountTextBox.Size = new System.Drawing.Size(32, 20);
this.labelColumnsCountTextBox.TabIndex = 61;
//
// labelColumnsCountLabel
//
this.labelColumnsCountLabel.AutoSize = true;
this.labelColumnsCountLabel.Location = new System.Drawing.Point(9, 83);
this.labelColumnsCountLabel.Name = "labelColumnsCountLabel";
this.labelColumnsCountLabel.Size = new System.Drawing.Size(105, 13);
this.labelColumnsCountLabel.TabIndex = 62;
this.labelColumnsCountLabel.Text = "Label columns count";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.templateLabel);
this.groupBox1.Controls.Add(this.templateTextBox);
this.groupBox1.Controls.Add(this.paperWidthLabel);
this.groupBox1.Controls.Add(this.labelWidthTextBox);
this.groupBox1.Controls.Add(this.labelHeightTextBox);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.barcodeLabel);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.itemsToPrintButton);
this.groupBox1.Controls.Add(this.barcodeTypeComboBox);
this.groupBox1.Controls.Add(this.bodyFontLabel);
this.groupBox1.Controls.Add(this.barcodeHeightLabel);
this.groupBox1.Controls.Add(this.fontFamilyComboBox);
this.groupBox1.Controls.Add(this.fontSizeTextBox);
this.groupBox1.Controls.Add(this.barcodeHeightTextBox);
this.groupBox1.Controls.Add(this.boldCheckBox);
this.groupBox1.Controls.Add(this.cultureComboBox);
this.groupBox1.Controls.Add(this.italicCheckBox);
this.groupBox1.Controls.Add(this.barcodeWidthLabel);
this.groupBox1.Controls.Add(this.barcodeLeftLabel);
this.groupBox1.Controls.Add(this.cultureLabel);
this.groupBox1.Controls.Add(this.barcodeLeftTextBox);
this.groupBox1.Controls.Add(this.barcodeWidthTextBox);
this.groupBox1.Controls.Add(this.barcodeTopLabel);
this.groupBox1.Controls.Add(this.barcodeTopTextBox);
this.groupBox1.Location = new System.Drawing.Point(3, 127);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(366, 164);
this.groupBox1.TabIndex = 63;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "One label";
//
// PrinterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.labelColumnsCountLabel);
this.Controls.Add(this.labelColumnsCountTextBox);
this.Controls.Add(this.leftTopLabelTopLabel);
this.Controls.Add(this.leftTopLabelTopTextBox);
this.Controls.Add(this.leftTopLabelLeftTextBox);
this.Controls.Add(this.leftTopLabelLeftLabel);
this.Controls.Add(this.orientationComboBox);
this.Controls.Add(this.orientationLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Controls.Add(this.goodOnlyCheckBox);
this.Controls.Add(this.nrOfCopiesLabel);
this.Controls.Add(this.nrOfCopiesTextBox);
this.Name = "PrinterCfgCtrl";
this.Size = new System.Drawing.Size(372, 299);
this.Load += new System.EventHandler(this.PrinterCfgCtrl_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.Label orientationLabel;
private System.Windows.Forms.ComboBox orientationComboBox;
private System.Windows.Forms.TextBox templateTextBox;
private System.Windows.Forms.Label templateLabel;
private System.Windows.Forms.TextBox labelWidthTextBox;
private System.Windows.Forms.Label paperWidthLabel;
private System.Windows.Forms.TextBox labelHeightTextBox;
private System.Windows.Forms.CheckBox italicCheckBox;
private System.Windows.Forms.CheckBox boldCheckBox;
private System.Windows.Forms.TextBox fontSizeTextBox;
private System.Windows.Forms.ComboBox fontFamilyComboBox;
private System.Windows.Forms.Label bodyFontLabel;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button itemsToPrintButton;
private System.Windows.Forms.Label nrOfCopiesLabel;
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.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;
private System.Windows.Forms.Label leftTopLabelTopLabel;
private System.Windows.Forms.TextBox leftTopLabelTopTextBox;
private System.Windows.Forms.TextBox leftTopLabelLeftTextBox;
private System.Windows.Forms.Label leftTopLabelLeftLabel;
private System.Windows.Forms.TextBox labelColumnsCountTextBox;
private System.Windows.Forms.Label labelColumnsCountLabel;
private System.Windows.Forms.GroupBox groupBox1;
}
}
@@ -0,0 +1,310 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Output.Printers;
using TBF.BenchControl.Generic;
using TBF.BenchControl.Configs;
namespace TBF.BenchControl.Output.Printers.MultiLabel
{
public partial class PrinterCfgCtrl : ConfigCtrlUtils, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(PrinterCfgCtrl));
public bool ShowMore { get { return false; } }
PrinterCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as PrinterCfg;
Redraw();
}
}
string[] itemsToPrint;
public PrinterCfgCtrl()
{
InitializeComponent();
Localize();
orientationComboBox.Items.Add(PageOrientation.Portrait.ToString());
orientationComboBox.Items.Add(PageOrientation.Landscape.ToString());
foreach (var ff in System.Drawing.FontFamily.Families)
{
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)
{
for (Culture s = 0; s < Culture.Count; s++) cultureComboBox.Items.Add(s.ToString());
itemsToPrint = config.ItemsToPrint;
Redraw();
}
void Localize()
{
}
public void Closing()
{
}
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
orientationComboBox.Text = config.PageOrientation.ToString();
labelColumnsCountTextBox.Text = config.LabelColumnsCount.ToString();
leftTopLabelLeftTextBox.Text = config.LeftTopLabelLeft.ToString();
leftTopLabelTopTextBox.Text = config.LeftTopLabelTop.ToString();
nrOfCopiesTextBox.Text = config.NrOfCopies.ToString();
goodOnlyCheckBox.Checked = config.GoodOnly;
labelWidthTextBox.Text = config.LabelWidth.ToString();
labelHeightTextBox.Text = config.LabelHeight.ToString();
templateTextBox.Text = config.Template;
fontFamilyComboBox.Text = config.FontFamily;
fontSizeTextBox.Text = config.FontSize.ToString();
boldCheckBox.Checked = ((config.FontStyle & (int)System.Drawing.FontStyle.Bold) != 0);
italicCheckBox.Checked = ((config.FontStyle & (int)System.Drawing.FontStyle.Italic) != 0);
cultureComboBox.Text = config.Culture.ToString();
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()
{
nameTextBox.Enabled = true;
orientationComboBox.Enabled = true;
labelColumnsCountTextBox.Enabled = true;
leftTopLabelLeftTextBox.Enabled = true;
leftTopLabelTopTextBox.Enabled = true;
nrOfCopiesTextBox.Enabled = true;
goodOnlyCheckBox.Enabled = true;
itemsToPrintButton.Enabled = true;
labelWidthTextBox.Enabled = true;
labelHeightTextBox.Enabled = true;
templateTextBox.Enabled = true;
fontFamilyComboBox.Enabled = true;
fontSizeTextBox.Enabled = true;
boldCheckBox.Enabled = true;
italicCheckBox.Enabled = true;
cultureComboBox.Enabled = true;
barcodeTypeComboBox.Enabled = true;
barcodeLeftTextBox.Enabled = true;
barcodeTopTextBox.Enabled = true;
barcodeWidthTextBox.Enabled = true;
barcodeHeightTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!string.IsNullOrEmpty(templateTextBox.Text) && !File.Exists(Path.Combine("C:\\TBF\\Templates", templateTextBox.Text)))
{
message += Environment.NewLine + "Template file missing";
flags |= CfgUpdateFlags.Error;
}
if ((int)GetOrientation(orientationComboBox.Text) < 0)
{
message += Environment.NewLine + "Invalid page orientation";
flags |= CfgUpdateFlags.Error;
}
int dummy;
if (!int.TryParse(labelColumnsCountTextBox.Text, out dummy) || dummy < 1)
{
message += Environment.NewLine + "Invalid label columns count";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(leftTopLabelLeftTextBox.Text, out dummy) || dummy < 0)
{
message += Environment.NewLine + "Invalid left-top label left";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(leftTopLabelTopTextBox.Text, out dummy) || dummy < 0)
{
message += Environment.NewLine + "Invalid left-top label top";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(labelWidthTextBox.Text, out dummy) || dummy <= 0)
{
message += Environment.NewLine + "Invalid label width";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(labelHeightTextBox.Text, out dummy) || dummy <= 0)
{
message += Environment.NewLine + "Invalid label height";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(fontSizeTextBox.Text, out dummy) || dummy < 6 || dummy > 48)
{
message += Environment.NewLine + "Font size' should be between 6 and 48";
flags |= CfgUpdateFlags.Error;
}
if (!cultureComboBox.Items.Contains(cultureComboBox.Text))
{
message += Environment.NewLine + "Invalid culture";
flags |= CfgUpdateFlags.Error;
}
if (!int.TryParse(nrOfCopiesTextBox.Text, out dummy) || dummy < 0 || dummy > 9)
{
message += Environment.NewLine + "'Number of copies' should be between 0 and 9";
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;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
if (config.Name != nameTextBox.Text)
{
config.Name = nameTextBox.Text;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (config.PageOrientation != GetOrientation(orientationComboBox.Text))
{
config.PageOrientation = GetOrientation(orientationComboBox.Text);
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
}
flags |= UpdateDifferent(ref config.LabelColumnsCount, labelColumnsCountTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.LeftTopLabelLeft, leftTopLabelLeftTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.LeftTopLabelTop, leftTopLabelTopTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.NrOfCopies, nrOfCopiesTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.GoodOnly, goodOnlyCheckBox.Checked, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.ItemsToPrint, itemsToPrint, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.LabelWidth, labelWidthTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.LabelHeight, labelHeightTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.Template, templateTextBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
/// Body font properties
flags |= UpdateDifferent(ref config.FontFamily, fontFamilyComboBox.Text, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
flags |= UpdateDifferent(ref config.FontSize, int.Parse(fontSizeTextBox.Text), CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
int tmp = (boldCheckBox.Checked ? (int)System.Drawing.FontStyle.Bold : 0)
+ (italicCheckBox.Checked ? (int)System.Drawing.FontStyle.Italic : 0);
flags |= UpdateDifferent(ref config.FontStyle, tmp, CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
for (Culture i = 0; i < Culture.Count; i++)
{
if (i.ToString().Equals(cultureComboBox.Text) && (config.Culture != i))
{
config.Culture = i;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
break;
}
}
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));
}
return flags;
}
private void itemsToPrintButton_Click(object sender, EventArgs e)
{
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg()
{
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(itemsToPrint),
};
if (dlg.ShowDialog() == DialogResult.OK)
{
itemsToPrint = Results.WMeterRsltItemSpec.ToStrArray(dlg.SelectedItems);
}
}
#region Configuration Change Handling
public static void OnCmdResponse(object sender, CmdResponseArgs args)
{
if (CmdResponseHandler == null) return;
try { CmdResponseHandler(sender, args); }
catch (Exception e) { log.Error("CmdResponseHandler(...) failed", e); }
}
public static event EventHandler<CmdResponseArgs> CmdResponseHandler;
public void StartResponseHandler() { }
public void StopResponseHandler() { }
#endregion Configuration Change Handling
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017-2019 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -121,6 +121,11 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
printerCfg.ImgHgh = newCfg.ImgHgh;
printerCfg.ImgName = newCfg.ImgName;
printerCfg.DocName = newCfg.DocName;
printerCfg.BarcodeType = newCfg.BarcodeType;
printerCfg.BarcodeLeft = newCfg.BarcodeLeft;
printerCfg.BarcodeTop = newCfg.BarcodeTop;
printerCfg.BarcodeWidth = newCfg.BarcodeWidth;
printerCfg.BarcodeHeight = newCfg.BarcodeHeight;
ApplyConfig();
}
@@ -237,6 +242,11 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
ImgWid = printerCfg.ImgWid,
ImgHgh = printerCfg.ImgHgh,
ImgFullPathName = (wm.ArchivePath != null) ? System.IO.Path.Combine(wm.ArchivePath, printerCfg.ImgName) : null,
BarcodeType = printerCfg.BarcodeType,
BarcodeLeft = printerCfg.BarcodeLeft,
BarcodeTop = printerCfg.BarcodeTop,
BarcodeWidth = printerCfg.BarcodeWidth,
BarcodeHeight = printerCfg.BarcodeHeight,
};
new Results.Output.Printers.OnePerMeter.OnePerMeterPrintDocument(batch, cfg, wm, documentName).Print();
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017-2019 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using System.Xml.Serialization;
using Config.Entities;
@@ -70,6 +70,12 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
public string ImgName;
public string DocName;
public Results.Output.Printers.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;
[XmlIgnore]
public Config.Entities.MetersKind MetersKind;
@@ -109,6 +115,7 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
Footer = string.Empty;
DocName = string.Empty;
ImgName = string.Empty;
BarcodeType = Results.Output.Printers.BarcodeType.None;
}
public string ToString(int i)
@@ -107,6 +107,13 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
this.graphWidthTextBox = new System.Windows.Forms.TextBox();
this.graphTopTextBox = new System.Windows.Forms.TextBox();
this.graphLeftTextBox = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label();
this.barcodeLabel = new System.Windows.Forms.Label();
this.barcodeHeightTextBox = new System.Windows.Forms.TextBox();
this.barcodeWidthTextBox = new System.Windows.Forms.TextBox();
this.barcodeTopTextBox = new System.Windows.Forms.TextBox();
this.barcodeLeftTextBox = new System.Windows.Forms.TextBox();
this.barcodeTypeComboBox = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// nameTextBox
@@ -139,7 +146,7 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
//
this.supressPrintingCheckBox.AutoSize = true;
this.supressPrintingCheckBox.Enabled = false;
this.supressPrintingCheckBox.Location = new System.Drawing.Point(334, 26);
this.supressPrintingCheckBox.Location = new System.Drawing.Point(306, 5);
this.supressPrintingCheckBox.Name = "supressPrintingCheckBox";
this.supressPrintingCheckBox.Size = new System.Drawing.Size(101, 17);
this.supressPrintingCheckBox.TabIndex = 33;
@@ -421,7 +428,7 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
//
this.goodOnlyCheckBox.AutoSize = true;
this.goodOnlyCheckBox.Enabled = false;
this.goodOnlyCheckBox.Location = new System.Drawing.Point(334, 44);
this.goodOnlyCheckBox.Location = new System.Drawing.Point(306, 21);
this.goodOnlyCheckBox.Name = "goodOnlyCheckBox";
this.goodOnlyCheckBox.Size = new System.Drawing.Size(74, 17);
this.goodOnlyCheckBox.TabIndex = 34;
@@ -448,18 +455,18 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
// docNameLabel
//
this.docNameLabel.AutoSize = true;
this.docNameLabel.Location = new System.Drawing.Point(16, 331);
this.docNameLabel.Location = new System.Drawing.Point(297, 41);
this.docNameLabel.Name = "docNameLabel";
this.docNameLabel.Size = new System.Drawing.Size(246, 13);
this.docNameLabel.Size = new System.Drawing.Size(127, 13);
this.docNameLabel.TabIndex = 42;
this.docNameLabel.Text = "Doc.name (0=start 1-end, 2=batch, 3=wm, 4=s/n) :";
this.docNameLabel.Text = "Doc.name (0=start 1-end,";
//
// docNameTextBox
//
this.docNameTextBox.Enabled = false;
this.docNameTextBox.Location = new System.Drawing.Point(261, 328);
this.docNameTextBox.Location = new System.Drawing.Point(302, 69);
this.docNameTextBox.Name = "docNameTextBox";
this.docNameTextBox.Size = new System.Drawing.Size(135, 20);
this.docNameTextBox.Size = new System.Drawing.Size(151, 20);
this.docNameTextBox.TabIndex = 43;
//
// footerItalicCheckBox
@@ -513,7 +520,7 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
this.imageNameTextBox.Enabled = false;
this.imageNameTextBox.Location = new System.Drawing.Point(287, 306);
this.imageNameTextBox.Name = "imageNameTextBox";
this.imageNameTextBox.Size = new System.Drawing.Size(135, 20);
this.imageNameTextBox.Size = new System.Drawing.Size(166, 20);
this.imageNameTextBox.TabIndex = 44;
//
// imageLeftTextBox
@@ -758,7 +765,7 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
this.table1FormComboBox.FormattingEnabled = true;
this.table1FormComboBox.Location = new System.Drawing.Point(392, 237);
this.table1FormComboBox.Name = "table1FormComboBox";
this.table1FormComboBox.Size = new System.Drawing.Size(64, 21);
this.table1FormComboBox.Size = new System.Drawing.Size(61, 21);
this.table1FormComboBox.TabIndex = 78;
//
// label3
@@ -802,10 +809,76 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
this.graphLeftTextBox.Size = new System.Drawing.Size(33, 20);
this.graphLeftTextBox.TabIndex = 79;
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(339, 56);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(120, 13);
this.label14.TabIndex = 84;
this.label14.Text = " 2=batch, 3=wm, 4=s/n)";
//
// barcodeLabel
//
this.barcodeLabel.AutoSize = true;
this.barcodeLabel.Location = new System.Drawing.Point(17, 330);
this.barcodeLabel.Name = "barcodeLabel";
this.barcodeLabel.Size = new System.Drawing.Size(121, 13);
this.barcodeLabel.TabIndex = 89;
this.barcodeLabel.Text = "Barcode left/t/w/h/type";
//
// barcodeHeightTextBox
//
this.barcodeHeightTextBox.Enabled = false;
this.barcodeHeightTextBox.Location = new System.Drawing.Point(245, 327);
this.barcodeHeightTextBox.Name = "barcodeHeightTextBox";
this.barcodeHeightTextBox.Size = new System.Drawing.Size(31, 20);
this.barcodeHeightTextBox.TabIndex = 88;
//
// barcodeWidthTextBox
//
this.barcodeWidthTextBox.Enabled = false;
this.barcodeWidthTextBox.Location = new System.Drawing.Point(211, 327);
this.barcodeWidthTextBox.Name = "barcodeWidthTextBox";
this.barcodeWidthTextBox.Size = new System.Drawing.Size(31, 20);
this.barcodeWidthTextBox.TabIndex = 87;
//
// barcodeTopTextBox
//
this.barcodeTopTextBox.Enabled = false;
this.barcodeTopTextBox.Location = new System.Drawing.Point(177, 327);
this.barcodeTopTextBox.Name = "barcodeTopTextBox";
this.barcodeTopTextBox.Size = new System.Drawing.Size(31, 20);
this.barcodeTopTextBox.TabIndex = 86;
//
// barcodeLeftTextBox
//
this.barcodeLeftTextBox.Enabled = false;
this.barcodeLeftTextBox.Location = new System.Drawing.Point(141, 327);
this.barcodeLeftTextBox.Name = "barcodeLeftTextBox";
this.barcodeLeftTextBox.Size = new System.Drawing.Size(33, 20);
this.barcodeLeftTextBox.TabIndex = 85;
//
// barcodeTypeComboBox
//
this.barcodeTypeComboBox.Enabled = false;
this.barcodeTypeComboBox.FormattingEnabled = true;
this.barcodeTypeComboBox.Location = new System.Drawing.Point(287, 327);
this.barcodeTypeComboBox.Name = "barcodeTypeComboBox";
this.barcodeTypeComboBox.Size = new System.Drawing.Size(166, 21);
this.barcodeTypeComboBox.TabIndex = 90;
//
// PrinterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.barcodeTypeComboBox);
this.Controls.Add(this.barcodeLabel);
this.Controls.Add(this.barcodeHeightTextBox);
this.Controls.Add(this.barcodeWidthTextBox);
this.Controls.Add(this.barcodeTopTextBox);
this.Controls.Add(this.barcodeLeftTextBox);
this.Controls.Add(this.label14);
this.Controls.Add(this.label3);
this.Controls.Add(this.graphHeightTextBox);
this.Controls.Add(this.graphWidthTextBox);
@@ -968,5 +1041,12 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
private System.Windows.Forms.TextBox graphWidthTextBox;
private System.Windows.Forms.TextBox graphTopTextBox;
private System.Windows.Forms.TextBox graphLeftTextBox;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label barcodeLabel;
private System.Windows.Forms.TextBox barcodeHeightTextBox;
private System.Windows.Forms.TextBox barcodeWidthTextBox;
private System.Windows.Forms.TextBox barcodeTopTextBox;
private System.Windows.Forms.TextBox barcodeLeftTextBox;
private System.Windows.Forms.ComboBox barcodeTypeComboBox;
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2017-2019 Sensus Slovensko a.s.
/// Copyright (c) 2017-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -7,6 +7,7 @@ using System.Linq;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using Results.Output.Printers;
using TBF.BenchControl.Generic;
using TBF.Resources;
using TBF.BenchControl.Configs;
@@ -61,7 +62,12 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
{
table1FormComboBox.Items.Add(f.ToString());
}
}
for (BarcodeType bt = BarcodeType.None; bt < BarcodeType.Count; bt++)
{
barcodeTypeComboBox.Items.Add(bt.ToString());
}
}
private void PrinterCfgCtrl_Load(object sender, EventArgs e)
{
@@ -151,6 +157,12 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
docNameTextBox.Text = config.DocName;
table1FormComboBox.Text = config.Form.ToString();
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()
@@ -207,6 +219,11 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
imageHeightTextBox.Enabled = true;
imageNameTextBox.Enabled = true;
docNameTextBox.Enabled = true;
barcodeTypeComboBox.Enabled = true;
barcodeLeftTextBox.Enabled = true;
barcodeTopTextBox.Enabled = true;
barcodeWidthTextBox.Enabled = true;
barcodeHeightTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@@ -361,6 +378,32 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
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;
}
@@ -471,6 +514,20 @@ namespace TBF.BenchControl.Output.Printers.OnePerMeter
flags |= UpdateDifferent(ref config.DocName, docNameTextBox.Text, 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));
+4 -7
View File
@@ -390,13 +390,10 @@ namespace TBF.BenchControl.Sequences
Bridge.OnActivity(this, Strings.Resetting_scales);
Bridge.Bench2UI(ButtonsEtc.StopBtnEn); /// Resetting scales -> Enable STOP button
DoubleBox tara1 = new DoubleBox(0);
DoubleBox tara2 = new DoubleBox(0);
DoubleBox tara3 = new DoubleBox(0);
State.Create("MainSeq : Reset scales").AddOperation(checkUiOp)
.AddOperation((StateMachine.Tank1 is IScale) ? (StateMachine.Tank1 as IScale).TaringOp(ref tara1) : null)
.AddOperation((StateMachine.Tank2 is IScale) ? (StateMachine.Tank2 as IScale).TaringOp(ref tara2) : null)
.AddOperation((StateMachine.Tank3 is IScale) ? (StateMachine.Tank3 as IScale).TaringOp(ref tara3) : null)
.AddOperation((StateMachine.Tank1 is IScale) ? (StateMachine.Tank1 as IScale).ZeroOp() : null)
.AddOperation((StateMachine.Tank2 is IScale) ? (StateMachine.Tank2 as IScale).ZeroOp() : null)
.AddOperation((StateMachine.Tank3 is IScale) ? (StateMachine.Tank3 as IScale).ZeroOp() : null)
.EnterState();
do
{
@@ -1910,7 +1907,7 @@ namespace TBF.BenchControl.Sequences
if (oriBatch == null) return;
batchResults.Batch.StartTime = oriBatch.StartTime;
batchResults.Batch.StartTime = oriBatch.StartTime.AddMinutes(1);
batchResults.Batch.TestBenchId = (BenchInfo != null) ? BenchInfo.TestBenchId : 1;
batchResults.Batch.TestBenchName = (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench";
+140 -112
View File
@@ -1567,121 +1567,149 @@ namespace TBF.BenchControl.Sequences
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(fullTestName, part);
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
tstRslt.StartTime = DateTime.Now;
tstRslt.EndTime = DateTime.Now + new TimeSpan(0, 0, 1);
tstRslt.FlowSetTime = 10;
tstRslt.TestTime = tstRslt.TargetTime();
/// TODO: Verify whether 'ltrPerRefPulse' is up to date
tstRslt.PulsesMaster = (LtrPerRefPulse > 1E-6) ? (tstRslt.TargetVolume() / LtrPerRefPulse) : 1;
tstRslt.ConstMasterRaw = LtrPerRefPulse;
tstRslt.ConstMaster = LtrPerRefPulse;
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = 0;
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Program.LocalSettings.RealDensity / 1000.0f;
tstRslt.MassEnd = tstRslt.MassEndRaw;
tstRslt.DensityIn = Program.LocalSettings.RealDensity;
tstRslt.DensityLine = Program.LocalSettings.RealDensity;
tstRslt.DensityDiv = Program.LocalSettings.RealDensity;
tstRslt.Buoyancy = Formulas.Buoyancy();
tstRslt.FlowMass = tstRslt.MassEnd / tstRslt.TargetTime();
tstRslt.FlowVolume = tstRslt.TargetVolume() / tstRslt.TargetTime();
tstRslt.VolumeCTV = tstRslt.TargetVolume();
tstRslt.VolumeMaster = tstRslt.TargetVolume();
tstRslt.ErrorMaster = 0;
tstRslt.AmbTempMean = 20.0f;
tstRslt.AmbPressMean = 1.0f;
tstRslt.AmbHumiMean = 50.0f;
tstRslt.PressUpStart = 1.0f;
tstRslt.PressDownStart = 1.0f;
tstRslt.TempUpStart = 20.0f;
tstRslt.TempDownStart = 20.0f;
tstRslt.TempDivStart = 20.0f;
tstRslt.PressUpEnd = 1.0f;
tstRslt.PressDownEnd = 1.0f;
tstRslt.TempUpEnd = 20.0f;
tstRslt.TempDownEnd = 20.0f;
tstRslt.TempDivEnd = 20.0f;
tstRslt.PressUpMean = 1.0f;
tstRslt.PressDownMean = 1.0f;
tstRslt.TempUpMean = 20.0f;
tstRslt.TempDownMean = 20.0f;
tstRslt.TempDivMean = 20.0f;
tstRslt.PressUpMin = 1.0f;
tstRslt.PressDownMin = 1.0f;
tstRslt.TempUpMin = 20.0f;
tstRslt.TempDownMin = 20.0f;
tstRslt.TempDivMin = 20.0f;
tstRslt.PressUpMax = 1.0f;
tstRslt.PressDownMax = 1.0f;
tstRslt.TempUpMax = 20.0f;
tstRslt.TempDownMax = 20.0f;
tstRslt.TempDivMax = 20.0f;
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
tstRslt.FlowEnd = (float)RefFlowStat.Last;
tstRslt.FlowMin = (float)RefFlowStat.Min;
tstRslt.FlowMax = (float)RefFlowStat.Max;
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
Results.Entities.MeterTestRslt compoundRslt = ProcessData.BatchRslts.GetMeterTestRslt(fullTestName, i, CompoundMeterId.Compound);
Results.Entities.MeterTestRslt mainRslt = ProcessData.BatchRslts.GetMeterTestRslt(fullTestName, i, CompoundMeterId.CompoundMain);
Results.Entities.MeterTestRslt auxRslt = ProcessData.BatchRslts.GetMeterTestRslt(fullTestName, i, CompoundMeterId.CompoundAux);
double compoundVolume = tstRslt.TargetVolume() * (1.0 + 0.01 * errorPct);
double mainVolume = compoundVolume * mainPart;
double auxVolume = compoundVolume * (1.0 - mainPart);
for (int isAux = 0; isAux <= 1; isAux++) /// 0=main, 1=aux
if (tstRslt != null)
{
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
tstRslt.StartTime = DateTime.Now;
tstRslt.EndTime = DateTime.Now + new TimeSpan(0, 0, 1);
tstRslt.FlowSetTime = 10;
tstRslt.TestTime = tstRslt.TargetTime();
/// TODO: Verify whether 'ltrPerRefPulse' is up to date
tstRslt.PulsesMaster = (LtrPerRefPulse > 1E-6) ? (tstRslt.TargetVolume() / LtrPerRefPulse) : 1;
tstRslt.ConstMasterRaw = LtrPerRefPulse;
tstRslt.ConstMaster = LtrPerRefPulse;
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = 0;
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Program.LocalSettings.RealDensity / 1000.0f;
tstRslt.MassEnd = tstRslt.MassEndRaw;
tstRslt.DensityIn = Program.LocalSettings.RealDensity;
tstRslt.DensityLine = Program.LocalSettings.RealDensity;
tstRslt.DensityDiv = Program.LocalSettings.RealDensity;
tstRslt.Buoyancy = Formulas.Buoyancy();
tstRslt.FlowMass = tstRslt.MassEnd / tstRslt.TargetTime();
tstRslt.FlowVolume = tstRslt.TargetVolume() / tstRslt.TargetTime();
tstRslt.VolumeCTV = tstRslt.TargetVolume();
tstRslt.VolumeMaster = tstRslt.TargetVolume();
tstRslt.ErrorMaster = 0;
tstRslt.AmbTempMean = 20.0f;
tstRslt.AmbPressMean = 1.0f;
tstRslt.AmbHumiMean = 50.0f;
tstRslt.PressUpStart = 1.0f;
tstRslt.PressDownStart = 1.0f;
tstRslt.TempUpStart = 20.0f;
tstRslt.TempDownStart = 20.0f;
tstRslt.TempDivStart = 20.0f;
tstRslt.PressUpEnd = 1.0f;
tstRslt.PressDownEnd = 1.0f;
tstRslt.TempUpEnd = 20.0f;
tstRslt.TempDownEnd = 20.0f;
tstRslt.TempDivEnd = 20.0f;
tstRslt.PressUpMean = 1.0f;
tstRslt.PressDownMean = 1.0f;
tstRslt.TempUpMean = 20.0f;
tstRslt.TempDownMean = 20.0f;
tstRslt.TempDivMean = 20.0f;
tstRslt.PressUpMin = 1.0f;
tstRslt.PressDownMin = 1.0f;
tstRslt.TempUpMin = 20.0f;
tstRslt.TempDownMin = 20.0f;
tstRslt.TempDivMin = 20.0f;
tstRslt.PressUpMax = 1.0f;
tstRslt.PressDownMax = 1.0f;
tstRslt.TempUpMax = 20.0f;
tstRslt.TempDownMax = 20.0f;
tstRslt.TempDivMax = 20.0f;
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
tstRslt.FlowEnd = (float)RefFlowStat.Last;
tstRslt.FlowMin = (float)RefFlowStat.Min;
tstRslt.FlowMax = (float)RefFlowStat.Max;
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[2 * i + isAux];
Results.Entities.MeterTestRslt meterRslt = (isAux == 0) ? mainRslt : auxRslt;
if (meterRslt != null && regReader != null)
Results.Entities.MeterTestRslt compoundRslt = ProcessData.BatchRslts.GetMeterTestRslt(fullTestName, i, CompoundMeterId.Compound);
Results.Entities.MeterTestRslt mainRslt = ProcessData.BatchRslts.GetMeterTestRslt(fullTestName, i, CompoundMeterId.CompoundMain);
Results.Entities.MeterTestRslt auxRslt = ProcessData.BatchRslts.GetMeterTestRslt(fullTestName, i, CompoundMeterId.CompoundAux);
double compoundVolume = tstRslt.TargetVolume() * (1.0 + 0.01 * errorPct);
double mainVolume = compoundVolume * mainPart;
double auxVolume = compoundVolume * (1.0 - mainPart);
for (int isAux = 0; isAux <= 1; isAux++) /// 0=main, 1=aux
{
meterRslt.VolumeMeter = (isAux == 0) ? mainVolume : auxVolume;
meterRslt.PulsesMeter = regReader.PulsesPerLtr * meterRslt.VolumeMeter;
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
meterRslt.VolumeStart = 0;
meterRslt.VolumeEnd = meterRslt.VolumeMeter;
meterRslt.VolumeRef = tstRslt.TargetVolume();
meterRslt.TimestampStart = 0;
meterRslt.TimestampEnd = tstRslt.TargetTime();
meterRslt.TestTime = tstRslt.TargetTime();
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV);
meterRslt.Passed = (errorPct >= tstRslt.ErrLimLo() + tstRslt.Uncertainty())
&& (errorPct <= tstRslt.ErrLimHi() - tstRslt.Uncertainty());
meterRslt.TestDone = true;
}
}
compoundRslt.VolumeRef = tstRslt.VolumeCTV; /// [l] must be calculated before main & aux. meter error
compoundRslt.VolumeMeter = mainRslt.VolumeMeter + auxRslt.VolumeMeter;
compoundRslt.PulsesMaster = tstRslt.PulsesMaster;
compoundRslt.TestTime = tstRslt.TargetTime();
compoundRslt.Error = Formulas.ErrorFromVolumes(compoundRslt.VolumeMeter, tstRslt.VolumeCTV);
compoundRslt.Passed = (compoundRslt.Error >= tstRslt.ErrLimLo() + tstRslt.Uncertainty())
&& (compoundRslt.Error <= tstRslt.ErrLimHi() - tstRslt.Uncertainty());
compoundRslt.TestDone = true;
tstRslt.TestDone = true;
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[2 * i + isAux];
Results.Entities.MeterTestRslt meterRslt = (isAux == 0) ? mainRslt : auxRslt;
if (meterRslt != null && regReader != null)
{
meterRslt.VolumeMeter = (isAux == 0) ? mainVolume : auxVolume;
meterRslt.PulsesMeter = regReader.PulsesPerLtr * meterRslt.VolumeMeter;
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
meterRslt.VolumeStart = 0;
meterRslt.VolumeEnd = meterRslt.VolumeMeter;
meterRslt.VolumeRef = tstRslt.TargetVolume();
meterRslt.TimestampStart = 0;
meterRslt.TimestampEnd = tstRslt.TargetTime();
meterRslt.TestTime = tstRslt.TargetTime();
meterRslt.Error = Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, tstRslt.VolumeCTV);
meterRslt.Passed = (errorPct >= tstRslt.ErrLimLo() + tstRslt.Uncertainty())
&& (errorPct <= tstRslt.ErrLimHi() - tstRslt.Uncertainty());
meterRslt.TestDone = true;
}
}
compoundRslt.VolumeRef = tstRslt.VolumeCTV; /// [l] must be calculated before main & aux. meter error
compoundRslt.VolumeMeter = mainRslt.VolumeMeter + auxRslt.VolumeMeter;
compoundRslt.PulsesMaster = tstRslt.PulsesMaster;
compoundRslt.TestTime = tstRslt.TargetTime();
compoundRslt.Error = Formulas.ErrorFromVolumes(compoundRslt.VolumeMeter, tstRslt.VolumeCTV);
compoundRslt.Passed = (compoundRslt.Error >= tstRslt.ErrLimLo() + tstRslt.Uncertainty())
&& (compoundRslt.Error <= tstRslt.ErrLimHi() - tstRslt.Uncertainty());
compoundRslt.TestDone = true;
tstRslt.TestDone = true;
}
tstRslt.Components = Results.Entities.Components
.UpdateList(BatchRslts.ComponentsList,
new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
}
tstRslt.Components = Results.Entities.Components
.UpdateList(BatchRslts.ComponentsList,
new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
}
+2 -1
View File
@@ -148,7 +148,8 @@ namespace TBF.BenchControl
Factories.Add(new Output.Printers.Enhanced.FactorySingle());
Factories.Add(new Output.Printers.Enhanced.FactoryCompound());
Factories.Add(new Output.Printers.Enhanced.FactoryHeatMeters());
Factories.Add(new Output.Printers.Label.Factory()); /// Label printer
Factories.Add(new Output.Printers.Label.Factory());
Factories.Add(new Output.Printers.MultiLabel.Factory());
Factories.Add(new Output.Printers.Munich.PrinterFactory());
Factories.Add(new Output.Printers.OnePerMeter.FactorySingle());
Factories.Add(new Output.Printers.OnePerMeter.FactoryCompound());
@@ -25,7 +25,11 @@ namespace TBF.BenchControl.TestMethods.Adjustment
{
#pragma warning disable 162 /// Disables 'Unreachable code detected' warning
if (Config.Data.WMsCount > 12)
if (Config.Data.WMsCount > 24)
{
myRef.modelessDlg = new WMErrorsForm48(waterMeters);
}
else if (Config.Data.WMsCount > 12)
{
myRef.modelessDlg = new WMErrorsForm24(waterMeters);
}
@@ -43,6 +47,12 @@ namespace TBF.BenchControl.TestMethods.Adjustment
modelessDlg.Show();
}
void CloseWMErrorsForm()
{
UiBridge.Bridge.OnCloseModelessForm(this, null);
modelessDlg = null;
}
/// <summary>
/// Adjustment method sequence
/// </summary>
@@ -317,10 +327,6 @@ namespace TBF.BenchControl.TestMethods.Adjustment
//------------------------------------------------
if (mode == Config.Entities.DebugMode.Simulate)
{
/// TODO: Reimplement
//tstRslt = MakeSimulated(test, 1, simulatedError);
simulatedError *= 0.6f;
State.Create(string.Format("{0}({1}) : Simulating the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
@@ -328,8 +334,16 @@ namespace TBF.BenchControl.TestMethods.Adjustment
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) { retVal = Event.Error; goto stopTest; }
if (TestAndLogUiCmdStop(test,e)) { retVal = Event.UiCmdStop; goto stopTest; }
if (e.Contains(Event.Error))
{
retVal = Event.Error;
goto stopTest;
}
if (TestAndLogUiCmdStop(test,e))
{
retVal = Event.UiCmdStop;
goto stopTest;
}
}
while (!e.Contains(Event.TimerExpired));
}
@@ -373,113 +387,134 @@ namespace TBF.BenchControl.TestMethods.Adjustment
Bridge.OnProcessData(this, new ProcessDataEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Config.Entities.Progress.Test));
}
/// Measurement loop - end
/// Measurement loop - end
}
one_test_completed:
one_test_completed:
//------------------------------------------------
Bridge.OnActivity(this, Strings.Adjustment_in_progress);
//------------------------------------------------
//------------------------------------------------
Bridge.OnActivity(this, Strings.Adjustment_in_progress);
//------------------------------------------------
TestEndTime = DateTime.Now;
TestEndTime = DateTime.Now;
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
/// Make sure the CycleBeginForm is closed so that water meter data (s/n) can be copied into results
if (UIFlowControl.Stop == WaitBeginFormClosed()) goto stopTest;
///
/// Populate TestResult data entity with data
///
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
///
/// Populate TestResult data entity with data
///
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
if (tstRslt != null)
{
UpdateTempPressDensAmb(tstRslt);
if (tstRslt != null)
{
UpdateTempPressDensAmb(tstRslt);
/// Main results
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
tstRslt.StartTime = TestStartTime;
tstRslt.EndTime = TestEndTime;
tstRslt.FlowSetTime = flowSetTime;
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = 0;
tstRslt.MassEndRaw = 0;
tstRslt.MassEnd = 0;
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.Buoyancy = Config.Formulas.Buoyancy();
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0f; /// Cannot be determined without the collected water mass measurement
/// Main results
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
tstRslt.StartTime = TestStartTime;
tstRslt.EndTime = TestEndTime;
tstRslt.FlowSetTime = flowSetTime;
if (mode == Config.Entities.DebugMode.Simulate)
{
tstRslt.TestTime = tstRslt.TestData.TargetTime;
tstRslt.PulsesMaster = Convert.ToDouble(tstRslt.TestData.TargetVolume / LtrPerRefPulse);
}
else
{
tstRslt.TestTime = cBrd.TTime; /// [s] measurement time
tstRslt.PulsesMaster = Convert.ToDouble(cBrd.EtPulses(0)); /// Pulses of the master flow meter (test total)
}
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = 0;
tstRslt.MassEndRaw = 0;
tstRslt.MassEnd = 0;
tstRslt.FlowMass = 0; /// [kg/h]
tstRslt.FlowVolume = 3.6 * LtrPerRefPulse * tstRslt.PulsesMaster / tstRslt.TestTime; /// [m3/h]
tstRslt.Buoyancy = Config.Formulas.Buoyancy();
tstRslt.VolumeMaster = LtrPerRefPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.FlowVolume, rangeIx); /// Corrected master pulses per liter
tstRslt.ConstMaster = tstRslt.ConstMasterCorr; /// Corrected master pulses per liter
tstRslt.VolumeCTV = tstRslt.ConstMaster * tstRslt.PulsesMaster; /// [l] 1000.0f is because density is in [kg/m3]
tstRslt.ErrorMaster = 0.0f; /// Cannot be determined without the collected water mass measurement
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
tstRslt.FlowEnd = (float)RefFlowStat.Last;
tstRslt.FlowMin = (float)RefFlowStat.Min;
tstRslt.FlowMax = (float)RefFlowStat.Max;
tstRslt.FlowMean = (float)RefFlowStat.Average;
tstRslt.FlowStart = (float)RefFlowStat.First;
tstRslt.FlowEnd = (float)RefFlowStat.Last;
tstRslt.FlowMin = (float)RefFlowStat.Min;
tstRslt.FlowMax = (float)RefFlowStat.Max;
tstRslt.DiverterStart = 0;
tstRslt.DiverterEnd = 0;
tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0;
tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, false, 0, 0) : 0;
tstRslt.DiverterStart = 0;
tstRslt.DiverterEnd = 0;
tstRslt.ErrorFlagsMd = (ErrorFlagsComp != null) ? (sbyte)ErrorFlagsComp.Mode : (sbyte)0;
tstRslt.ErrorFlags = (ErrorFlagsComp != null) ? ErrorFlagsComp.GetErrorFlags(tstRslt, false, false, 0, 0) : 0;
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
if (!test.IsPartCompatible(Utils.PartNr(i + 1, BatchRslts.Batch.Compound))) continue;
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i];
if (meterRslt != null && regReader != null)
{
meterRslt.RegReaderType = (int)regReader.RegisterReaderType;
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
meterRslt.VolumeStart = 0; /// liter
meterRslt.VolumeEnd = 0; /// liter
if (mode == Config.Entities.DebugMode.Simulate)
{
meterRslt.PulsesMeter = tstRslt.VolumeCTV * (1.0 + (i - 5) * 0.001);
meterRslt.PulsesMaster = tstRslt.PulsesMaster;
meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse;
meterRslt.VolumeRef = tstRslt.VolumeCTV;
meterRslt.TestTime = tstRslt.TestTime;
}
else
{
meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses);
meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses);
meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter
meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter
meterRslt.TestTime = cBrd.ImpulseTime(i + 1);
}
meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.VolumeCTV, tstRslt.TestTime) + test.Uncertainty)
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.VolumeCTV, tstRslt.TestTime) - test.Uncertainty);
meterRslt.TestDone = true;
tstRslt.TestDone = true;
}
}
tstRslt.Components = Results.Entities.Components
.UpdateList(BatchRslts.ComponentsList,
new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
/// Update water meter error flags
if (ErrorFlagsComp != null)
{
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
{
if (!test.IsPartCompatible(Utils.PartNr(i + 1, BatchRslts.Batch.Compound))) continue;
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
GenericDevices.IRegisterReader regReader = sensPath.RegisterReaders[i];
if (meterRslt != null && regReader != null)
{
meterRslt.RegReaderType = (int)regReader.RegisterReaderType;
meterRslt.PulsesPerLiter = regReader.PulsesPerLtr;
meterRslt.PulsesMeter = Convert.ToDouble(regReader.WMPulses);
meterRslt.PulsesMaster = Convert.ToDouble(regReader.WMRefPulses);
meterRslt.VolumeStart = 0; /// liter
meterRslt.VolumeEnd = 0; /// liter
meterRslt.VolumeMeter = meterRslt.PulsesMeter * regReader.LtrsPerPulse; /// liter
meterRslt.VolumeRef = meterRslt.PulsesMaster * tstRslt.ConstMaster; /// liter
meterRslt.TestTime = cBrd.ImpulseTime(i + 1);
meterRslt.Error = Config.Formulas.ErrorFromVolumes(meterRslt.VolumeMeter, meterRslt.VolumeRef);
meterRslt.Passed = (meterRslt.Error >= test.GetErrLimLo(tstRslt.VolumeCTV, tstRslt.TestTime) + test.Uncertainty)
&& (meterRslt.Error <= test.GetErrLimHi(tstRslt.VolumeCTV, tstRslt.TestTime) - test.Uncertainty);
meterRslt.TestDone = true;
tstRslt.TestDone = true;
}
}
tstRslt.Components = Results.Entities.Components
.UpdateList(BatchRslts.ComponentsList,
new Results.Entities.Components((BenchInfo != null) ? BenchInfo.TestBenchId : 1,
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
inPath.Pump != null ? inPath.Pump.Name : string.Empty,
outPath.FlowMeter != null ? outPath.FlowMeter.Name : string.Empty,
outPath.Scale != null ? outPath.Scale.Name : string.Empty,
outPath.RegulValve != null ? outPath.RegulValve.Name : string.Empty,
outPath.Diverter != null ? outPath.Diverter.Name : string.Empty));
/// Update water meter error flags
if (ErrorFlagsComp != null)
{
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
if (BatchRslts.WaterMeters[i] != null)
{
if (BatchRslts.WaterMeters[i] != null)
{
BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts);
}
BatchRslts.WaterMeters[i].ErrorFlags = ErrorFlagsComp.GetWMtrErrorFlags(BatchRslts.WaterMeters[i].MeterTestRslts);
}
}
}
/// Update results
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt));
}
/// Add data - end
/// Update results
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(testName, tstRslt));
}
/// Add data - end
/// Update modeless dialog error information
@@ -516,6 +551,11 @@ namespace TBF.BenchControl.TestMethods.Adjustment
stopTestWOStoppingDivGateEtc:
if (modelessDlg is GenericDevices.IHasCompleted && !(modelessDlg as GenericDevices.IHasCompleted).Completed)
{
CloseWMErrorsForm();
}
return new List<Event> { retVal };
}
}
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
public IComponentCfg DefaultConfig()
{
return new TestMethodCfg(this.GetType().Namespace.Substring(29) +".Single", this);
return new TestMethodCfg(this.GetType().Namespace.Substring(29), this);
}
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
@@ -67,6 +67,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
completed = false;
StartForceCloseHandler();
/// Attach to 'AdjustmentInProgress' handler
UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
{
@@ -80,7 +82,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
void Localize()
{
Text = Strings.Water_Meter_States;
Text = Strings.Water_Meter_Adjustment;
groupBox1.Text = Strings.Water_Meter + " 1";
groupBox2.Text = Strings.Water_Meter + " 2";
groupBox3.Text = Strings.Water_Meter + " 3";
+252 -252
View File
@@ -31,258 +31,258 @@ namespace TBF.BenchControl.TestMethods.Adjustment
/// </summary>
private void InitializeComponent()
{
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.wmErrorTextBox2 = new System.Windows.Forms.TextBox();
this.wmErrorLabel2 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.wmErrorTextBox1 = new System.Windows.Forms.TextBox();
this.wmErrorLabel1 = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.wmErrorTextBox3 = new System.Windows.Forms.TextBox();
this.wmErrorLabel3 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.wmErrorTextBox4 = new System.Windows.Forms.TextBox();
this.wmErrorLabel4 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.wmErrorTextBox5 = new System.Windows.Forms.TextBox();
this.wmErrorLabel5 = new System.Windows.Forms.Label();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.wmErrorTextBox6 = new System.Windows.Forms.TextBox();
this.wmErrorLabel6 = new System.Windows.Forms.Label();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox6.SuspendLayout();
this.SuspendLayout();
//
// groupBox2
//
this.groupBox2.Controls.Add(this.wmErrorTextBox2);
this.groupBox2.Controls.Add(this.wmErrorLabel2);
this.groupBox2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox2.ForeColor = System.Drawing.Color.Black;
this.groupBox2.Location = new System.Drawing.Point(25, 102);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(333, 81);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Water Meter 2";
//
// wmErrorTextBox2
//
this.wmErrorTextBox2.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox2.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox2.Name = "wmErrorTextBox2";
this.wmErrorTextBox2.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox2.TabIndex = 1;
//
// wmErrorLabel2
//
this.wmErrorLabel2.AutoSize = true;
this.wmErrorLabel2.Location = new System.Drawing.Point(18, 34);
this.wmErrorLabel2.Name = "wmErrorLabel2";
this.wmErrorLabel2.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel2.TabIndex = 0;
this.wmErrorLabel2.Text = "Error [%]";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.wmErrorTextBox1);
this.groupBox1.Controls.Add(this.wmErrorLabel1);
this.groupBox1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox1.ForeColor = System.Drawing.Color.Black;
this.groupBox1.Location = new System.Drawing.Point(25, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(333, 81);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Water Meter 1";
//
// wmErrorTextBox1
//
this.wmErrorTextBox1.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox1.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox1.Name = "wmErrorTextBox1";
this.wmErrorTextBox1.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox1.TabIndex = 1;
//
// wmErrorLabel1
//
this.wmErrorLabel1.AutoSize = true;
this.wmErrorLabel1.Location = new System.Drawing.Point(18, 34);
this.wmErrorLabel1.Name = "wmErrorLabel1";
this.wmErrorLabel1.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel1.TabIndex = 0;
this.wmErrorLabel1.Text = "Error [%]";
//
// okButton
//
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.okButton.ForeColor = System.Drawing.Color.Black;
this.okButton.Location = new System.Drawing.Point(739, 26);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(98, 63);
this.okButton.TabIndex = 7;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.wmErrorTextBox3);
this.groupBox3.Controls.Add(this.wmErrorLabel3);
this.groupBox3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox3.ForeColor = System.Drawing.Color.Black;
this.groupBox3.Location = new System.Drawing.Point(25, 192);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(333, 81);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Water Meter 3";
//
// wmErrorTextBox3
//
this.wmErrorTextBox3.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox3.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox3.Name = "wmErrorTextBox3";
this.wmErrorTextBox3.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox3.TabIndex = 1;
//
// wmErrorLabel3
//
this.wmErrorLabel3.AutoSize = true;
this.wmErrorLabel3.Location = new System.Drawing.Point(18, 34);
this.wmErrorLabel3.Name = "wmErrorLabel3";
this.wmErrorLabel3.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel3.TabIndex = 0;
this.wmErrorLabel3.Text = "Error [%]";
//
// groupBox4
//
this.groupBox4.Controls.Add(this.wmErrorTextBox4);
this.groupBox4.Controls.Add(this.wmErrorLabel4);
this.groupBox4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox4.ForeColor = System.Drawing.Color.Black;
this.groupBox4.Location = new System.Drawing.Point(25, 282);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(333, 81);
this.groupBox4.TabIndex = 4;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Water Meter 4";
//
// wmErrorTextBox4
//
this.wmErrorTextBox4.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox4.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox4.Name = "wmErrorTextBox4";
this.wmErrorTextBox4.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox4.TabIndex = 1;
//
// wmErrorLabel4
//
this.wmErrorLabel4.AutoSize = true;
this.wmErrorLabel4.Location = new System.Drawing.Point(18, 34);
this.wmErrorLabel4.Name = "wmErrorLabel4";
this.wmErrorLabel4.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel4.TabIndex = 0;
this.wmErrorLabel4.Text = "Error [%]";
//
// groupBox5
//
this.groupBox5.Controls.Add(this.wmErrorTextBox5);
this.groupBox5.Controls.Add(this.wmErrorLabel5);
this.groupBox5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox5.ForeColor = System.Drawing.Color.Black;
this.groupBox5.Location = new System.Drawing.Point(25, 372);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(333, 81);
this.groupBox5.TabIndex = 5;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Water Meter 5";
//
// wmErrorTextBox5
//
this.wmErrorTextBox5.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox5.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox5.Name = "wmErrorTextBox5";
this.wmErrorTextBox5.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox5.TabIndex = 1;
//
// wmErrorLabel5
//
this.wmErrorLabel5.AutoSize = true;
this.wmErrorLabel5.Location = new System.Drawing.Point(18, 34);
this.wmErrorLabel5.Name = "wmErrorLabel5";
this.wmErrorLabel5.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel5.TabIndex = 0;
this.wmErrorLabel5.Text = "Error [%]";
//
// groupBox6
//
this.groupBox6.Controls.Add(this.wmErrorTextBox6);
this.groupBox6.Controls.Add(this.wmErrorLabel6);
this.groupBox6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox6.ForeColor = System.Drawing.Color.Black;
this.groupBox6.Location = new System.Drawing.Point(25, 462);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(333, 81);
this.groupBox6.TabIndex = 6;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "Water Meter 6";
//
// wmErrorTextBox6
//
this.wmErrorTextBox6.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox6.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox6.Name = "wmErrorTextBox6";
this.wmErrorTextBox6.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox6.TabIndex = 1;
//
// wmErrorLabel6
//
this.wmErrorLabel6.AutoSize = true;
this.wmErrorLabel6.Location = new System.Drawing.Point(18, 34);
this.wmErrorLabel6.Name = "wmErrorLabel6";
this.wmErrorLabel6.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel6.TabIndex = 0;
this.wmErrorLabel6.Text = "Error [%]";
//
// WMErrorsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGoldenrod;
this.ClientSize = new System.Drawing.Size(868, 565);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.okButton);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "WMErrorsForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "Water Meter States";
this.TopMost = true;
this.Load += new System.EventHandler(this.WMErrorsForm_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.WMErrorsForm_Paint);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
this.ResumeLayout(false);
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.wmErrorTextBox2 = new System.Windows.Forms.TextBox();
this.wmErrorLabel2 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.wmErrorTextBox1 = new System.Windows.Forms.TextBox();
this.wmErrorLabel1 = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.wmErrorTextBox3 = new System.Windows.Forms.TextBox();
this.wmErrorLabel3 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.wmErrorTextBox4 = new System.Windows.Forms.TextBox();
this.wmErrorLabel4 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.wmErrorTextBox5 = new System.Windows.Forms.TextBox();
this.wmErrorLabel5 = new System.Windows.Forms.Label();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.wmErrorTextBox6 = new System.Windows.Forms.TextBox();
this.wmErrorLabel6 = new System.Windows.Forms.Label();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox6.SuspendLayout();
this.SuspendLayout();
//
// groupBox2
//
this.groupBox2.Controls.Add(this.wmErrorTextBox2);
this.groupBox2.Controls.Add(this.wmErrorLabel2);
this.groupBox2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox2.ForeColor = System.Drawing.Color.Black;
this.groupBox2.Location = new System.Drawing.Point(25, 102);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(333, 81);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Water Meter 2";
//
// wmErrorTextBox2
//
this.wmErrorTextBox2.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox2.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox2.Name = "wmErrorTextBox2";
this.wmErrorTextBox2.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox2.TabIndex = 1;
//
// wmErrorLabel2
//
this.wmErrorLabel2.AutoSize = true;
this.wmErrorLabel2.Location = new System.Drawing.Point(18, 34);
this.wmErrorLabel2.Name = "wmErrorLabel2";
this.wmErrorLabel2.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel2.TabIndex = 0;
this.wmErrorLabel2.Text = "Error [%]";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.wmErrorTextBox1);
this.groupBox1.Controls.Add(this.wmErrorLabel1);
this.groupBox1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox1.ForeColor = System.Drawing.Color.Black;
this.groupBox1.Location = new System.Drawing.Point(25, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(333, 81);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Water Meter 1";
//
// wmErrorTextBox1
//
this.wmErrorTextBox1.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox1.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox1.Name = "wmErrorTextBox1";
this.wmErrorTextBox1.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox1.TabIndex = 1;
//
// wmErrorLabel1
//
this.wmErrorLabel1.AutoSize = true;
this.wmErrorLabel1.Location = new System.Drawing.Point(18, 34);
this.wmErrorLabel1.Name = "wmErrorLabel1";
this.wmErrorLabel1.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel1.TabIndex = 0;
this.wmErrorLabel1.Text = "Error [%]";
//
// okButton
//
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.okButton.ForeColor = System.Drawing.Color.Black;
this.okButton.Location = new System.Drawing.Point(739, 26);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(98, 63);
this.okButton.TabIndex = 7;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.wmErrorTextBox3);
this.groupBox3.Controls.Add(this.wmErrorLabel3);
this.groupBox3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox3.ForeColor = System.Drawing.Color.Black;
this.groupBox3.Location = new System.Drawing.Point(25, 192);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(333, 81);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Water Meter 3";
//
// wmErrorTextBox3
//
this.wmErrorTextBox3.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox3.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox3.Name = "wmErrorTextBox3";
this.wmErrorTextBox3.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox3.TabIndex = 1;
//
// wmErrorLabel3
//
this.wmErrorLabel3.AutoSize = true;
this.wmErrorLabel3.Location = new System.Drawing.Point(18, 34);
this.wmErrorLabel3.Name = "wmErrorLabel3";
this.wmErrorLabel3.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel3.TabIndex = 0;
this.wmErrorLabel3.Text = "Error [%]";
//
// groupBox4
//
this.groupBox4.Controls.Add(this.wmErrorTextBox4);
this.groupBox4.Controls.Add(this.wmErrorLabel4);
this.groupBox4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox4.ForeColor = System.Drawing.Color.Black;
this.groupBox4.Location = new System.Drawing.Point(25, 282);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(333, 81);
this.groupBox4.TabIndex = 4;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Water Meter 4";
//
// wmErrorTextBox4
//
this.wmErrorTextBox4.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox4.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox4.Name = "wmErrorTextBox4";
this.wmErrorTextBox4.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox4.TabIndex = 1;
//
// wmErrorLabel4
//
this.wmErrorLabel4.AutoSize = true;
this.wmErrorLabel4.Location = new System.Drawing.Point(18, 34);
this.wmErrorLabel4.Name = "wmErrorLabel4";
this.wmErrorLabel4.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel4.TabIndex = 0;
this.wmErrorLabel4.Text = "Error [%]";
//
// groupBox5
//
this.groupBox5.Controls.Add(this.wmErrorTextBox5);
this.groupBox5.Controls.Add(this.wmErrorLabel5);
this.groupBox5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox5.ForeColor = System.Drawing.Color.Black;
this.groupBox5.Location = new System.Drawing.Point(25, 372);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(333, 81);
this.groupBox5.TabIndex = 5;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Water Meter 5";
//
// wmErrorTextBox5
//
this.wmErrorTextBox5.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox5.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox5.Name = "wmErrorTextBox5";
this.wmErrorTextBox5.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox5.TabIndex = 1;
//
// wmErrorLabel5
//
this.wmErrorLabel5.AutoSize = true;
this.wmErrorLabel5.Location = new System.Drawing.Point(18, 34);
this.wmErrorLabel5.Name = "wmErrorLabel5";
this.wmErrorLabel5.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel5.TabIndex = 0;
this.wmErrorLabel5.Text = "Error [%]";
//
// groupBox6
//
this.groupBox6.Controls.Add(this.wmErrorTextBox6);
this.groupBox6.Controls.Add(this.wmErrorLabel6);
this.groupBox6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.groupBox6.ForeColor = System.Drawing.Color.Black;
this.groupBox6.Location = new System.Drawing.Point(25, 462);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(333, 81);
this.groupBox6.TabIndex = 6;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "Water Meter 6";
//
// wmErrorTextBox6
//
this.wmErrorTextBox6.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox6.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox6.Name = "wmErrorTextBox6";
this.wmErrorTextBox6.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox6.TabIndex = 1;
//
// wmErrorLabel6
//
this.wmErrorLabel6.AutoSize = true;
this.wmErrorLabel6.Location = new System.Drawing.Point(18, 34);
this.wmErrorLabel6.Name = "wmErrorLabel6";
this.wmErrorLabel6.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel6.TabIndex = 0;
this.wmErrorLabel6.Text = "Error [%]";
//
// WMErrorsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGoldenrod;
this.ClientSize = new System.Drawing.Size(868, 565);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.okButton);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "WMErrorsForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "Water Meter Adjustment";
this.TopMost = true;
this.Load += new System.EventHandler(this.WMErrorsForm_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.WMErrorsForm_Paint);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
this.ResumeLayout(false);
}
@@ -72,6 +72,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
completed = false;
StartForceCloseHandler();
/// Attach to 'AdjustmentInProgress' handler
UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
{
@@ -135,7 +137,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
void Localize()
{
Text = Strings.Water_Meter_States;
Text = Strings.Water_Meter_Adjustment;
for (int i = 0; i < textBoxesCount; i++)
{
labels[i].Text = string.Format("WM{0} {1}", i + 1, Strings.Error_pct);
@@ -31,325 +31,325 @@ namespace TBF.BenchControl.TestMethods.Adjustment
/// </summary>
private void InitializeComponent()
{
this.wmErrorTextBox2 = new System.Windows.Forms.TextBox();
this.wmErrorLabel2 = new System.Windows.Forms.Label();
this.wmErrorLabel1 = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.wmErrorTextBox3 = new System.Windows.Forms.TextBox();
this.wmErrorLabel3 = new System.Windows.Forms.Label();
this.wmErrorTextBox4 = new System.Windows.Forms.TextBox();
this.wmErrorLabel4 = new System.Windows.Forms.Label();
this.wmErrorTextBox5 = new System.Windows.Forms.TextBox();
this.wmErrorLabel5 = new System.Windows.Forms.Label();
this.wmErrorTextBox6 = new System.Windows.Forms.TextBox();
this.wmErrorLabel6 = new System.Windows.Forms.Label();
this.wmErrorTextBox1 = new System.Windows.Forms.TextBox();
this.wmErrorTextBox7 = new System.Windows.Forms.TextBox();
this.wmErrorLabel7 = new System.Windows.Forms.Label();
this.wmErrorTextBox8 = new System.Windows.Forms.TextBox();
this.wmErrorLabel8 = new System.Windows.Forms.Label();
this.wmErrorTextBox9 = new System.Windows.Forms.TextBox();
this.wmErrorLabel9 = new System.Windows.Forms.Label();
this.wmErrorTextBox10 = new System.Windows.Forms.TextBox();
this.wmErrorLabel10 = new System.Windows.Forms.Label();
this.wmErrorTextBox12 = new System.Windows.Forms.TextBox();
this.wmErrorLabel12 = new System.Windows.Forms.Label();
this.wmErrorTextBox11 = new System.Windows.Forms.TextBox();
this.wmErrorLabel11 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// wmErrorTextBox2
//
this.wmErrorTextBox2.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox2.Location = new System.Drawing.Point(198, 74);
this.wmErrorTextBox2.Name = "wmErrorTextBox2";
this.wmErrorTextBox2.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox2.TabIndex = 1;
this.wmErrorTextBox2.Visible = false;
//
// wmErrorLabel2
//
this.wmErrorLabel2.AutoSize = true;
this.wmErrorLabel2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel2.Location = new System.Drawing.Point(33, 85);
this.wmErrorLabel2.Name = "wmErrorLabel2";
this.wmErrorLabel2.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel2.TabIndex = 0;
this.wmErrorLabel2.Text = "Error [%]";
this.wmErrorLabel2.Visible = false;
//
// wmErrorLabel1
//
this.wmErrorLabel1.AutoSize = true;
this.wmErrorLabel1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel1.Location = new System.Drawing.Point(33, 39);
this.wmErrorLabel1.Name = "wmErrorLabel1";
this.wmErrorLabel1.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel1.TabIndex = 0;
this.wmErrorLabel1.Text = "Error [%]";
this.wmErrorLabel1.Visible = false;
//
// okButton
//
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.okButton.ForeColor = System.Drawing.Color.Black;
this.okButton.Location = new System.Drawing.Point(601, 28);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(98, 63);
this.okButton.TabIndex = 7;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// wmErrorTextBox3
//
this.wmErrorTextBox3.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox3.Location = new System.Drawing.Point(198, 120);
this.wmErrorTextBox3.Name = "wmErrorTextBox3";
this.wmErrorTextBox3.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox3.TabIndex = 1;
this.wmErrorTextBox3.Visible = false;
//
// wmErrorLabel3
//
this.wmErrorLabel3.AutoSize = true;
this.wmErrorLabel3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel3.Location = new System.Drawing.Point(33, 131);
this.wmErrorLabel3.Name = "wmErrorLabel3";
this.wmErrorLabel3.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel3.TabIndex = 0;
this.wmErrorLabel3.Text = "Error [%]";
this.wmErrorLabel3.Visible = false;
//
// wmErrorTextBox4
//
this.wmErrorTextBox4.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox4.Location = new System.Drawing.Point(198, 166);
this.wmErrorTextBox4.Name = "wmErrorTextBox4";
this.wmErrorTextBox4.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox4.TabIndex = 1;
this.wmErrorTextBox4.Visible = false;
//
// wmErrorLabel4
//
this.wmErrorLabel4.AutoSize = true;
this.wmErrorLabel4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel4.Location = new System.Drawing.Point(33, 177);
this.wmErrorLabel4.Name = "wmErrorLabel4";
this.wmErrorLabel4.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel4.TabIndex = 0;
this.wmErrorLabel4.Text = "Error [%]";
this.wmErrorLabel4.Visible = false;
//
// wmErrorTextBox5
//
this.wmErrorTextBox5.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox5.Location = new System.Drawing.Point(198, 213);
this.wmErrorTextBox5.Name = "wmErrorTextBox5";
this.wmErrorTextBox5.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox5.TabIndex = 1;
this.wmErrorTextBox5.Visible = false;
//
// wmErrorLabel5
//
this.wmErrorLabel5.AutoSize = true;
this.wmErrorLabel5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel5.Location = new System.Drawing.Point(33, 224);
this.wmErrorLabel5.Name = "wmErrorLabel5";
this.wmErrorLabel5.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel5.TabIndex = 0;
this.wmErrorLabel5.Text = "Error [%]";
this.wmErrorLabel5.Visible = false;
//
// wmErrorTextBox6
//
this.wmErrorTextBox6.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox6.Location = new System.Drawing.Point(198, 259);
this.wmErrorTextBox6.Name = "wmErrorTextBox6";
this.wmErrorTextBox6.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox6.TabIndex = 1;
this.wmErrorTextBox6.Visible = false;
//
// wmErrorLabel6
//
this.wmErrorLabel6.AutoSize = true;
this.wmErrorLabel6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel6.Location = new System.Drawing.Point(33, 271);
this.wmErrorLabel6.Name = "wmErrorLabel6";
this.wmErrorLabel6.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel6.TabIndex = 0;
this.wmErrorLabel6.Text = "Error [%]";
this.wmErrorLabel6.Visible = false;
//
// wmErrorTextBox1
//
this.wmErrorTextBox1.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox1.Location = new System.Drawing.Point(198, 28);
this.wmErrorTextBox1.Name = "wmErrorTextBox1";
this.wmErrorTextBox1.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox1.TabIndex = 1;
this.wmErrorTextBox1.Visible = false;
//
// wmErrorTextBox7
//
this.wmErrorTextBox7.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox7.Location = new System.Drawing.Point(198, 305);
this.wmErrorTextBox7.Name = "wmErrorTextBox7";
this.wmErrorTextBox7.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox7.TabIndex = 9;
this.wmErrorTextBox7.Visible = false;
//
// wmErrorLabel7
//
this.wmErrorLabel7.AutoSize = true;
this.wmErrorLabel7.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel7.Location = new System.Drawing.Point(33, 317);
this.wmErrorLabel7.Name = "wmErrorLabel7";
this.wmErrorLabel7.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel7.TabIndex = 8;
this.wmErrorLabel7.Text = "Error [%]";
this.wmErrorLabel7.Visible = false;
//
// wmErrorTextBox8
//
this.wmErrorTextBox8.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox8.Location = new System.Drawing.Point(198, 351);
this.wmErrorTextBox8.Name = "wmErrorTextBox8";
this.wmErrorTextBox8.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox8.TabIndex = 11;
this.wmErrorTextBox8.Visible = false;
//
// wmErrorLabel8
//
this.wmErrorLabel8.AutoSize = true;
this.wmErrorLabel8.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel8.Location = new System.Drawing.Point(33, 363);
this.wmErrorLabel8.Name = "wmErrorLabel8";
this.wmErrorLabel8.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel8.TabIndex = 10;
this.wmErrorLabel8.Text = "Error [%]";
this.wmErrorLabel8.Visible = false;
//
// wmErrorTextBox9
//
this.wmErrorTextBox9.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox9.Location = new System.Drawing.Point(198, 397);
this.wmErrorTextBox9.Name = "wmErrorTextBox9";
this.wmErrorTextBox9.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox9.TabIndex = 13;
this.wmErrorTextBox9.Visible = false;
//
// wmErrorLabel9
//
this.wmErrorLabel9.AutoSize = true;
this.wmErrorLabel9.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel9.Location = new System.Drawing.Point(33, 408);
this.wmErrorLabel9.Name = "wmErrorLabel9";
this.wmErrorLabel9.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel9.TabIndex = 12;
this.wmErrorLabel9.Text = "Error [%]";
this.wmErrorLabel9.Visible = false;
//
// wmErrorTextBox10
//
this.wmErrorTextBox10.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox10.Location = new System.Drawing.Point(198, 443);
this.wmErrorTextBox10.Name = "wmErrorTextBox10";
this.wmErrorTextBox10.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox10.TabIndex = 15;
this.wmErrorTextBox10.Visible = false;
//
// wmErrorLabel10
//
this.wmErrorLabel10.AutoSize = true;
this.wmErrorLabel10.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel10.Location = new System.Drawing.Point(33, 454);
this.wmErrorLabel10.Name = "wmErrorLabel10";
this.wmErrorLabel10.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel10.TabIndex = 14;
this.wmErrorLabel10.Text = "Error [%]";
this.wmErrorLabel10.Visible = false;
//
// wmErrorTextBox12
//
this.wmErrorTextBox12.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox12.Location = new System.Drawing.Point(198, 535);
this.wmErrorTextBox12.Name = "wmErrorTextBox12";
this.wmErrorTextBox12.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox12.TabIndex = 19;
this.wmErrorTextBox12.Visible = false;
//
// wmErrorLabel12
//
this.wmErrorLabel12.AutoSize = true;
this.wmErrorLabel12.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel12.Location = new System.Drawing.Point(33, 546);
this.wmErrorLabel12.Name = "wmErrorLabel12";
this.wmErrorLabel12.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel12.TabIndex = 18;
this.wmErrorLabel12.Text = "Error [%]";
this.wmErrorLabel12.Visible = false;
//
// wmErrorTextBox11
//
this.wmErrorTextBox11.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox11.Location = new System.Drawing.Point(198, 489);
this.wmErrorTextBox11.Name = "wmErrorTextBox11";
this.wmErrorTextBox11.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox11.TabIndex = 17;
this.wmErrorTextBox11.Visible = false;
//
// wmErrorLabel11
//
this.wmErrorLabel11.AutoSize = true;
this.wmErrorLabel11.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel11.Location = new System.Drawing.Point(33, 500);
this.wmErrorLabel11.Name = "wmErrorLabel11";
this.wmErrorLabel11.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel11.TabIndex = 16;
this.wmErrorLabel11.Text = "Error [%]";
this.wmErrorLabel11.Visible = false;
//
// WMErrorsForm12
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGoldenrod;
this.ClientSize = new System.Drawing.Size(731, 592);
this.Controls.Add(this.wmErrorTextBox12);
this.Controls.Add(this.wmErrorLabel12);
this.Controls.Add(this.wmErrorTextBox11);
this.Controls.Add(this.wmErrorLabel11);
this.Controls.Add(this.wmErrorTextBox10);
this.Controls.Add(this.wmErrorLabel10);
this.Controls.Add(this.wmErrorTextBox9);
this.Controls.Add(this.wmErrorLabel9);
this.Controls.Add(this.wmErrorTextBox8);
this.Controls.Add(this.wmErrorLabel8);
this.Controls.Add(this.wmErrorTextBox7);
this.Controls.Add(this.wmErrorLabel7);
this.Controls.Add(this.wmErrorTextBox6);
this.Controls.Add(this.wmErrorLabel6);
this.Controls.Add(this.wmErrorTextBox5);
this.Controls.Add(this.wmErrorLabel5);
this.Controls.Add(this.wmErrorTextBox4);
this.Controls.Add(this.wmErrorLabel4);
this.Controls.Add(this.wmErrorTextBox3);
this.Controls.Add(this.wmErrorLabel3);
this.Controls.Add(this.wmErrorTextBox2);
this.Controls.Add(this.wmErrorLabel2);
this.Controls.Add(this.wmErrorTextBox1);
this.Controls.Add(this.wmErrorLabel1);
this.Controls.Add(this.okButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "WMErrorsForm12";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "Water Meter States";
this.TopMost = true;
this.Load += new System.EventHandler(this.WMErrorsForm12_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.WMErrorsForm_Paint);
this.ResumeLayout(false);
this.PerformLayout();
this.wmErrorTextBox2 = new System.Windows.Forms.TextBox();
this.wmErrorLabel2 = new System.Windows.Forms.Label();
this.wmErrorLabel1 = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.wmErrorTextBox3 = new System.Windows.Forms.TextBox();
this.wmErrorLabel3 = new System.Windows.Forms.Label();
this.wmErrorTextBox4 = new System.Windows.Forms.TextBox();
this.wmErrorLabel4 = new System.Windows.Forms.Label();
this.wmErrorTextBox5 = new System.Windows.Forms.TextBox();
this.wmErrorLabel5 = new System.Windows.Forms.Label();
this.wmErrorTextBox6 = new System.Windows.Forms.TextBox();
this.wmErrorLabel6 = new System.Windows.Forms.Label();
this.wmErrorTextBox1 = new System.Windows.Forms.TextBox();
this.wmErrorTextBox7 = new System.Windows.Forms.TextBox();
this.wmErrorLabel7 = new System.Windows.Forms.Label();
this.wmErrorTextBox8 = new System.Windows.Forms.TextBox();
this.wmErrorLabel8 = new System.Windows.Forms.Label();
this.wmErrorTextBox9 = new System.Windows.Forms.TextBox();
this.wmErrorLabel9 = new System.Windows.Forms.Label();
this.wmErrorTextBox10 = new System.Windows.Forms.TextBox();
this.wmErrorLabel10 = new System.Windows.Forms.Label();
this.wmErrorTextBox12 = new System.Windows.Forms.TextBox();
this.wmErrorLabel12 = new System.Windows.Forms.Label();
this.wmErrorTextBox11 = new System.Windows.Forms.TextBox();
this.wmErrorLabel11 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// wmErrorTextBox2
//
this.wmErrorTextBox2.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox2.Location = new System.Drawing.Point(198, 74);
this.wmErrorTextBox2.Name = "wmErrorTextBox2";
this.wmErrorTextBox2.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox2.TabIndex = 1;
this.wmErrorTextBox2.Visible = false;
//
// wmErrorLabel2
//
this.wmErrorLabel2.AutoSize = true;
this.wmErrorLabel2.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel2.Location = new System.Drawing.Point(33, 85);
this.wmErrorLabel2.Name = "wmErrorLabel2";
this.wmErrorLabel2.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel2.TabIndex = 0;
this.wmErrorLabel2.Text = "Error [%]";
this.wmErrorLabel2.Visible = false;
//
// wmErrorLabel1
//
this.wmErrorLabel1.AutoSize = true;
this.wmErrorLabel1.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel1.Location = new System.Drawing.Point(33, 39);
this.wmErrorLabel1.Name = "wmErrorLabel1";
this.wmErrorLabel1.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel1.TabIndex = 0;
this.wmErrorLabel1.Text = "Error [%]";
this.wmErrorLabel1.Visible = false;
//
// okButton
//
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.okButton.ForeColor = System.Drawing.Color.Black;
this.okButton.Location = new System.Drawing.Point(601, 28);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(98, 63);
this.okButton.TabIndex = 7;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// wmErrorTextBox3
//
this.wmErrorTextBox3.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox3.Location = new System.Drawing.Point(198, 120);
this.wmErrorTextBox3.Name = "wmErrorTextBox3";
this.wmErrorTextBox3.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox3.TabIndex = 1;
this.wmErrorTextBox3.Visible = false;
//
// wmErrorLabel3
//
this.wmErrorLabel3.AutoSize = true;
this.wmErrorLabel3.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel3.Location = new System.Drawing.Point(33, 131);
this.wmErrorLabel3.Name = "wmErrorLabel3";
this.wmErrorLabel3.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel3.TabIndex = 0;
this.wmErrorLabel3.Text = "Error [%]";
this.wmErrorLabel3.Visible = false;
//
// wmErrorTextBox4
//
this.wmErrorTextBox4.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox4.Location = new System.Drawing.Point(198, 166);
this.wmErrorTextBox4.Name = "wmErrorTextBox4";
this.wmErrorTextBox4.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox4.TabIndex = 1;
this.wmErrorTextBox4.Visible = false;
//
// wmErrorLabel4
//
this.wmErrorLabel4.AutoSize = true;
this.wmErrorLabel4.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel4.Location = new System.Drawing.Point(33, 177);
this.wmErrorLabel4.Name = "wmErrorLabel4";
this.wmErrorLabel4.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel4.TabIndex = 0;
this.wmErrorLabel4.Text = "Error [%]";
this.wmErrorLabel4.Visible = false;
//
// wmErrorTextBox5
//
this.wmErrorTextBox5.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox5.Location = new System.Drawing.Point(198, 213);
this.wmErrorTextBox5.Name = "wmErrorTextBox5";
this.wmErrorTextBox5.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox5.TabIndex = 1;
this.wmErrorTextBox5.Visible = false;
//
// wmErrorLabel5
//
this.wmErrorLabel5.AutoSize = true;
this.wmErrorLabel5.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel5.Location = new System.Drawing.Point(33, 224);
this.wmErrorLabel5.Name = "wmErrorLabel5";
this.wmErrorLabel5.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel5.TabIndex = 0;
this.wmErrorLabel5.Text = "Error [%]";
this.wmErrorLabel5.Visible = false;
//
// wmErrorTextBox6
//
this.wmErrorTextBox6.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox6.Location = new System.Drawing.Point(198, 259);
this.wmErrorTextBox6.Name = "wmErrorTextBox6";
this.wmErrorTextBox6.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox6.TabIndex = 1;
this.wmErrorTextBox6.Visible = false;
//
// wmErrorLabel6
//
this.wmErrorLabel6.AutoSize = true;
this.wmErrorLabel6.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel6.Location = new System.Drawing.Point(33, 271);
this.wmErrorLabel6.Name = "wmErrorLabel6";
this.wmErrorLabel6.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel6.TabIndex = 0;
this.wmErrorLabel6.Text = "Error [%]";
this.wmErrorLabel6.Visible = false;
//
// wmErrorTextBox1
//
this.wmErrorTextBox1.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox1.Location = new System.Drawing.Point(198, 28);
this.wmErrorTextBox1.Name = "wmErrorTextBox1";
this.wmErrorTextBox1.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox1.TabIndex = 1;
this.wmErrorTextBox1.Visible = false;
//
// wmErrorTextBox7
//
this.wmErrorTextBox7.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox7.Location = new System.Drawing.Point(198, 305);
this.wmErrorTextBox7.Name = "wmErrorTextBox7";
this.wmErrorTextBox7.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox7.TabIndex = 9;
this.wmErrorTextBox7.Visible = false;
//
// wmErrorLabel7
//
this.wmErrorLabel7.AutoSize = true;
this.wmErrorLabel7.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel7.Location = new System.Drawing.Point(33, 317);
this.wmErrorLabel7.Name = "wmErrorLabel7";
this.wmErrorLabel7.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel7.TabIndex = 8;
this.wmErrorLabel7.Text = "Error [%]";
this.wmErrorLabel7.Visible = false;
//
// wmErrorTextBox8
//
this.wmErrorTextBox8.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox8.Location = new System.Drawing.Point(198, 351);
this.wmErrorTextBox8.Name = "wmErrorTextBox8";
this.wmErrorTextBox8.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox8.TabIndex = 11;
this.wmErrorTextBox8.Visible = false;
//
// wmErrorLabel8
//
this.wmErrorLabel8.AutoSize = true;
this.wmErrorLabel8.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel8.Location = new System.Drawing.Point(33, 363);
this.wmErrorLabel8.Name = "wmErrorLabel8";
this.wmErrorLabel8.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel8.TabIndex = 10;
this.wmErrorLabel8.Text = "Error [%]";
this.wmErrorLabel8.Visible = false;
//
// wmErrorTextBox9
//
this.wmErrorTextBox9.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox9.Location = new System.Drawing.Point(198, 397);
this.wmErrorTextBox9.Name = "wmErrorTextBox9";
this.wmErrorTextBox9.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox9.TabIndex = 13;
this.wmErrorTextBox9.Visible = false;
//
// wmErrorLabel9
//
this.wmErrorLabel9.AutoSize = true;
this.wmErrorLabel9.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel9.Location = new System.Drawing.Point(33, 408);
this.wmErrorLabel9.Name = "wmErrorLabel9";
this.wmErrorLabel9.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel9.TabIndex = 12;
this.wmErrorLabel9.Text = "Error [%]";
this.wmErrorLabel9.Visible = false;
//
// wmErrorTextBox10
//
this.wmErrorTextBox10.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox10.Location = new System.Drawing.Point(198, 443);
this.wmErrorTextBox10.Name = "wmErrorTextBox10";
this.wmErrorTextBox10.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox10.TabIndex = 15;
this.wmErrorTextBox10.Visible = false;
//
// wmErrorLabel10
//
this.wmErrorLabel10.AutoSize = true;
this.wmErrorLabel10.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel10.Location = new System.Drawing.Point(33, 454);
this.wmErrorLabel10.Name = "wmErrorLabel10";
this.wmErrorLabel10.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel10.TabIndex = 14;
this.wmErrorLabel10.Text = "Error [%]";
this.wmErrorLabel10.Visible = false;
//
// wmErrorTextBox12
//
this.wmErrorTextBox12.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox12.Location = new System.Drawing.Point(198, 535);
this.wmErrorTextBox12.Name = "wmErrorTextBox12";
this.wmErrorTextBox12.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox12.TabIndex = 19;
this.wmErrorTextBox12.Visible = false;
//
// wmErrorLabel12
//
this.wmErrorLabel12.AutoSize = true;
this.wmErrorLabel12.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel12.Location = new System.Drawing.Point(33, 546);
this.wmErrorLabel12.Name = "wmErrorLabel12";
this.wmErrorLabel12.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel12.TabIndex = 18;
this.wmErrorLabel12.Text = "Error [%]";
this.wmErrorLabel12.Visible = false;
//
// wmErrorTextBox11
//
this.wmErrorTextBox11.Font = new System.Drawing.Font("Verdana", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox11.Location = new System.Drawing.Point(198, 489);
this.wmErrorTextBox11.Name = "wmErrorTextBox11";
this.wmErrorTextBox11.Size = new System.Drawing.Size(137, 40);
this.wmErrorTextBox11.TabIndex = 17;
this.wmErrorTextBox11.Visible = false;
//
// wmErrorLabel11
//
this.wmErrorLabel11.AutoSize = true;
this.wmErrorLabel11.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorLabel11.Location = new System.Drawing.Point(33, 500);
this.wmErrorLabel11.Name = "wmErrorLabel11";
this.wmErrorLabel11.Size = new System.Drawing.Size(103, 23);
this.wmErrorLabel11.TabIndex = 16;
this.wmErrorLabel11.Text = "Error [%]";
this.wmErrorLabel11.Visible = false;
//
// WMErrorsForm12
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGoldenrod;
this.ClientSize = new System.Drawing.Size(731, 592);
this.Controls.Add(this.wmErrorTextBox12);
this.Controls.Add(this.wmErrorLabel12);
this.Controls.Add(this.wmErrorTextBox11);
this.Controls.Add(this.wmErrorLabel11);
this.Controls.Add(this.wmErrorTextBox10);
this.Controls.Add(this.wmErrorLabel10);
this.Controls.Add(this.wmErrorTextBox9);
this.Controls.Add(this.wmErrorLabel9);
this.Controls.Add(this.wmErrorTextBox8);
this.Controls.Add(this.wmErrorLabel8);
this.Controls.Add(this.wmErrorTextBox7);
this.Controls.Add(this.wmErrorLabel7);
this.Controls.Add(this.wmErrorTextBox6);
this.Controls.Add(this.wmErrorLabel6);
this.Controls.Add(this.wmErrorTextBox5);
this.Controls.Add(this.wmErrorLabel5);
this.Controls.Add(this.wmErrorTextBox4);
this.Controls.Add(this.wmErrorLabel4);
this.Controls.Add(this.wmErrorTextBox3);
this.Controls.Add(this.wmErrorLabel3);
this.Controls.Add(this.wmErrorTextBox2);
this.Controls.Add(this.wmErrorLabel2);
this.Controls.Add(this.wmErrorTextBox1);
this.Controls.Add(this.wmErrorLabel1);
this.Controls.Add(this.okButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "WMErrorsForm12";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "Water Meter Adjustment";
this.TopMost = true;
this.Load += new System.EventHandler(this.WMErrorsForm12_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.WMErrorsForm_Paint);
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -76,6 +76,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
completed = false;
StartForceCloseHandler();
/// Attach to 'AdjustmentInProgress' handler
UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
{
@@ -139,7 +141,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
void Localize()
{
Text = Strings.Water_Meter_States;
Text = Strings.Water_Meter_Adjustment;
for (int i = 0; i < textBoxesCount; i++)
{
labels[i].Text = string.Format("WM{0} {1}", i + 1, Strings.Error_pct);
@@ -202,8 +204,8 @@ namespace TBF.BenchControl.TestMethods.Adjustment
for (int i = 0; i < waterMetersCount; i++)
{
if (!disabled[i])
{
if ((i < MaxWMsCount) && (!disabled[i]))
{
PaintOne(graphics, rects[i], error[i], errLimLo, errLimHi);
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,277 @@
///
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using TBF.Resources;
namespace TBF.BenchControl.TestMethods.Adjustment
{
public partial class WMErrorsForm48 : Form, GenericDevices.IHasCompleted
{
private static readonly ILog log = LogManager.GetLogger(typeof(WMErrorsForm48));
const int MaxWMsCount = 48; /// Implementation limit of this form
///
/// Updated in constructor
///
readonly int waterMetersCount; /// Number of text boxes for serial numbers
readonly bool[] disabled;
int textBoxesCount;
Label[] labels;
TextBox[] errors;
Rectangle[] rects;
///
/// Updated in OnAdjustmentInProgress()
///
double[] error; /// Created in constructor
double errLimLo;
double errLimHi;
///
/// Set to 'true' when the form closes
///
public bool Completed { get { return completed; } }
bool completed;
/// <summary> Parameterless constructor for 3 watermeters </summary>
public WMErrorsForm48()
{
InitializeComponent();
ControlBox = false;
textBoxesCount = MaxWMsCount;
labels = new Label[MaxWMsCount]
{
wmErrorLabel1, wmErrorLabel2, wmErrorLabel3, wmErrorLabel4, wmErrorLabel5,
wmErrorLabel6, wmErrorLabel7, wmErrorLabel8, wmErrorLabel9, wmErrorLabel10,
wmErrorLabel11, wmErrorLabel12, wmErrorLabel13, wmErrorLabel14, wmErrorLabel15,
wmErrorLabel16, wmErrorLabel17, wmErrorLabel18, wmErrorLabel19, wmErrorLabel20,
wmErrorLabel21, wmErrorLabel22, wmErrorLabel23, wmErrorLabel24, wmErrorLabel25,
wmErrorLabel26, wmErrorLabel27, wmErrorLabel28, wmErrorLabel29, wmErrorLabel30,
wmErrorLabel31, wmErrorLabel32, wmErrorLabel33, wmErrorLabel34, wmErrorLabel35,
wmErrorLabel36, wmErrorLabel37, wmErrorLabel38, wmErrorLabel39, wmErrorLabel40,
wmErrorLabel41, wmErrorLabel42, wmErrorLabel43, wmErrorLabel44, wmErrorLabel45,
wmErrorLabel46, wmErrorLabel47, wmErrorLabel48,
};
errors = new TextBox[MaxWMsCount]
{
wmErrorTextBox1, wmErrorTextBox2, wmErrorTextBox3, wmErrorTextBox4, wmErrorTextBox5,
wmErrorTextBox6, wmErrorTextBox7, wmErrorTextBox8, wmErrorTextBox9, wmErrorTextBox10,
wmErrorTextBox11, wmErrorTextBox12, wmErrorTextBox13, wmErrorTextBox14, wmErrorTextBox15,
wmErrorTextBox16, wmErrorTextBox17, wmErrorTextBox18, wmErrorTextBox19, wmErrorTextBox20,
wmErrorTextBox21, wmErrorTextBox22, wmErrorTextBox23, wmErrorTextBox24, wmErrorTextBox25,
wmErrorTextBox26, wmErrorTextBox27, wmErrorTextBox28, wmErrorTextBox29, wmErrorTextBox30,
wmErrorTextBox31, wmErrorTextBox32, wmErrorTextBox33, wmErrorTextBox34, wmErrorTextBox35,
wmErrorTextBox36, wmErrorTextBox37, wmErrorTextBox38, wmErrorTextBox39, wmErrorTextBox40,
wmErrorTextBox41, wmErrorTextBox42, wmErrorTextBox43, wmErrorTextBox44, wmErrorTextBox45,
wmErrorTextBox46, wmErrorTextBox47, wmErrorTextBox48,
};
rects = new Rectangle[MaxWMsCount];
for (int i = 0; i < MaxWMsCount; i++)
{
int row = i % 24;
int col = i / 24;
rects[i] = new Rectangle(350 + col * 557, 22 + row * 34, 230, 25);
}
completed = false;
StartForceCloseHandler();
/// Attach to 'AdjustmentInProgress' handler
UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
{
if (InvokeRequired)
{
Invoke(new EventHandler<UiBridge.AdjustmentInProgressEventArgs>(OnAdjustmentInProgress), sender, args);
}
else OnAdjustmentInProgress(sender, args);
};
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
public WMErrorsForm48(IList<GenericDevices.IWaterMeter> waterMeters)
: this()
{
waterMetersCount = Math.Min(Config.Data.WMsCount, waterMeters.Count);
ShuffleTextBoxes(waterMetersCount, Config.Data.LineSize);
disabled = new bool[waterMetersCount];
for (int i = 0; i < waterMetersCount; i++)
{
if (i < MaxWMsCount) disabled[i] = waterMeters[i].Disabled;
}
error = new double[waterMetersCount];
}
/// <summary>
/// Make sure the layout of labels/text boxes on the screen
/// corresponds to the layout of watermeters of the test bench.
/// </summary>
/// <param name="wmsCount">Number of watermeters</param>
/// <param name="lineSize">Number of watermeters in one line</param>
void ShuffleTextBoxes(int wmsCount, int lineSize)
{
if ((wmsCount < textBoxesCount) && (lineSize > 0))
{
int nrLines = (wmsCount + lineSize - 1) / lineSize;
int gap = (textBoxesCount - wmsCount) / nrLines;
int dest = 0;
for (int l = 0; l < nrLines; l++)
{
for (int i = 0; i < lineSize; i++)
{
labels[dest] = labels[l * lineSize + l * gap + i];
errors[dest] = errors[l * lineSize + l * gap + i];
rects[dest] = rects[l * lineSize + l * gap + i];
dest++;
}
}
textBoxesCount = wmsCount;
}
}
void Localize()
{
Text = Strings.Water_Meter_Adjustment;
for (int i = 0; i < textBoxesCount; i++)
{
labels[i].Text = string.Format("WM{0} {1}", i + 1, Strings.Error_pct);
}
okButton.Text = Strings.OkBtnText;
}
private void WMErrorsForm48_Load(object sender, EventArgs e)
{
Localize();
//Height = 50 + 90 * WaterMetersCount;
for (int i = 0; i < textBoxesCount; i++)
{
labels[i].Visible = errors[i].Visible = (disabled == null || i >= disabled.Length || !disabled[i]);
errors[i].Text = "---";
}
}
private void okButton_Click(object sender, EventArgs e)
{
completed = true;
Close();
}
void OnAdjustmentInProgress(object sender, UiBridge.AdjustmentInProgressEventArgs args)
{
string testName = args.TestName;
Results.Entities.TestRslt tr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetTestRslt(testName, 0);
if (tr != null)
{
errLimLo = tr.ErrLimLo() + tr.Uncertainty();
errLimHi = tr.ErrLimHi() - tr.Uncertainty();
int count = Math.Min(waterMetersCount, TBF.BenchControl.Sequences.ProcessData.BatchRslts.WMPositionsCount);
for (int i = 0; i < count; i++)
{
Results.Entities.MeterTestRslt mtr = TBF.BenchControl.Sequences.ProcessData.BatchRslts.GetMeterTestRslt(testName, i, CompoundMeterId.Single);
if (mtr != null) error[i] = mtr.Error;
}
Redraw();
}
}
void Redraw()
{
for (int i = 0; i < textBoxesCount; i++)
{
errors[i].Text = error[i].ToString("F1");
Invalidate(rects[i]);
}
}
private void WMErrorsForm_Paint(object sender, PaintEventArgs e)
{
System.Drawing.Graphics graphics = this.CreateGraphics();
for (int i = 0; i < waterMetersCount; i++)
{
if ((i < MaxWMsCount) && (!disabled[i]))
{
PaintOne(graphics, rects[i], error[i], errLimLo, errLimHi);
}
}
}
void PaintOne(System.Drawing.Graphics g, Rectangle r, double value, double limLo, double limHi)
{
Rectangle rect1 = new Rectangle(r.Left, r.Top, r.Width / 3, r.Height);
Rectangle rect2 = new Rectangle(r.Left + r.Width / 3, r.Top, r.Width / 3, r.Height);
Rectangle rect3 = new Rectangle(r.Left + 2 * (r.Width / 3), r.Top, r.Width / 3, r.Height);
Rectangle rectCent = new Rectangle(r.Left + r.Width / 2 - 1, r.Top, 3, r.Height);
Brush redBrush = new SolidBrush(Color.FromName("Salmon"));
Brush greenBrush = new SolidBrush(Color.FromName("LightGreen"));
Brush centBrush = new SolidBrush(Color.FromName("Green"));
g.FillRectangle(redBrush, rect1);
g.FillRectangle(greenBrush, rect2);
g.FillRectangle(redBrush, rect3);
g.FillRectangle(centBrush, rectCent);
int x0 = r.Left + r.Width / 2;
int dx = r.Height / 3;
int x = (int)((double)r.Width * (2.0 * value - limLo - limHi) / (limHi - limLo) / 6.0f + 0.5f);
if (x0 - dx + x >= r.Left && x0 + dx + x < r.Left + r.Width)
{
Point[] triangle = new Point[3]
{
new Point(x0 - dx + x, r.Top),
new Point(x0 + dx + x, r.Top),
new Point(x0 + x, r.Top + 2 * r.Height / 3),
};
Brush blackBrush = new SolidBrush(Color.Black);
g.FillPolygon(blackBrush, triangle);
}
}
#region Forced close handling
public void StartForceCloseHandler()
{
UiBridge.Bridge.CloseModelessFormHandler += delegate(object sender, EventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args); }
else OnForceClose(sender, args);
};
}
void OnForceClose(object sender, EventArgs args)
{
DialogResult = DialogResult.Cancel;
Close();
}
#endregion
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -56,9 +56,9 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
return new List<Event> { Event.ConfigurationError };
}
if (test.Part < 1 || test.Part > Config.Data.CompoundWMsCount)
if (test.Part < 0 || test.Part > Config.Data.CompoundWMsCount)
{
UiBridge.Bridge.OnError(this, string.Format("Test 'Part' should be 1 .. {0}", Config.Data.CompoundWMsCount));
UiBridge.Bridge.OnError(this, string.Format("Test 'Part' should be '-' or 1 .. {0}", Config.Data.CompoundWMsCount));
return new List<Event> { Event.ConfigurationError };
}
@@ -333,7 +333,7 @@ namespace TBF.BenchControl.TestMethods.CombinedWithDetection
}
flowsForDetection[0] = cBrd.ReferenceFreq * outPath.FlowMeter.NominalFlow / 2000.0;
double diff = RegisterReaders[(test.Part - 1) * 2 + 1].WMPulses - lastWMPulses[(test.Part - 1) * 2 + 1];
double diff = RegisterReaders[Math.Max(0, test.Part - 1) * 2 + 1].WMPulses - lastWMPulses[Math.Max(0, test.Part - 1) * 2 + 1];
pulseFreqsForDetection[0] = diff / (double)(StateMachine.Time - lastTime);
lastTime = StateMachine.Time;
}
+19 -12
View File
@@ -180,8 +180,9 @@ namespace TBF
try
{
string culture = LocalSettings.Language.Replace('_', '-');
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(culture);
System.Threading.Thread.CurrentThread.CurrentUICulture
= System.Threading.Thread.CurrentThread.CurrentCulture
= new System.Globalization.CultureInfo(LocalSettings.Language.Replace('_', '-'));
}
catch (Exception e)
{
@@ -348,13 +349,26 @@ namespace TBF
/// Clone() guarantees that current bench settings wont be modified
/// when user modifies the database settings in DatabaseSettingsDlg.
Config.Data.CurrentBench = (Config.DatabaseSettings)LocalSettings.TestBenches[i].Clone();
Results.DB.DbType = Config.Data.CurrentBench.WaterMetersDBSettings.DbType;
Results.DB.ConnectionString = Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString;
/// Save the selection to local settings
LocalSettings.LastBenchName = Config.Data.CurrentBench.BenchName;
Results.DB.DbType = Config.Data.CurrentBench.WaterMetersDBSettings.DbType;
Results.DB.ConnectionString = Config.Data.CurrentBench.WaterMetersDBSettings.ConnectionString;
Results.DB.LoadSharedData();
///
/// Connect to Config database.
/// This triggers an exception in case user is a power user and there is no Config database.
///
IList<Procedure> listOfProcedures = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)
.QueryOver<Procedure>()
.Where(x => (x.ProcedureState == ProcedureState.Active))
.And(x => (x.Name == LocalSettings.LastProcedureName))
.List();
///
/// Connect to Results database and determine the last saved batch number.
///
Results.DB.LoadSharedData();
int maxBatchNr = Results.DB.GetMaxSavedBatchNr();
if (!Config.Data.CurrentBench.IsRealBench || Program.LocalSettings.BatchNr <= maxBatchNr)
{
@@ -364,13 +378,6 @@ namespace TBF
log.FatalFormat("LocalSettings.BatchNr updated to {0}", Program.LocalSettings.BatchNr);
}
/// This is to trigger an exception in case of a power user and no Config database
IList<Procedure> listOfProcedures = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config)
.QueryOver<Procedure>()
.Where(x => (x.ProcedureState == ProcedureState.Active))
.And(x => (x.Name == LocalSettings.LastProcedureName))
.List();
retryLogin = false;
break;
}
+3 -3
View File
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Sensus")]
[assembly: AssemblyProduct("TestBenchFramework")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2019 Sensus Slovensko, a.s.")]
[assembly: AssemblyCopyright("Copyright © 2013 - 2020 Sensus Slovensko, a.s.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.18.1581.0")]
[assembly: AssemblyFileVersion("2.18.1581.0")]
[assembly: AssemblyVersion("2.18.1520.0")]
[assembly: AssemblyFileVersion("2.18.1520.0")]
+9
View File
@@ -5886,6 +5886,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Water Meter Adjustment.
/// </summary>
internal static string Water_Meter_Adjustment {
get {
return ResourceManager.GetString("Water_Meter_Adjustment", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Water meter data.
/// </summary>
+3
View File
@@ -2092,4 +2092,7 @@
<data name="Grabbing_images" xml:space="preserve">
<value>Grabbing images</value>
</data>
<data name="Water_Meter_Adjustment" xml:space="preserve">
<value>Water Meter Adjustment</value>
</data>
</root>
+3
View File
@@ -834,4 +834,7 @@
<data name="Evaporation" xml:space="preserve">
<value>Evaporare</value>
</data>
<data name="FeedingTabPageTitle" xml:space="preserve">
<value>Alimentare</value>
</data>
</root>
+27 -7
View File
@@ -39,7 +39,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;ZAMBIA;STABLE_MASS_EXTRAS</DefineConstants>
<DefineConstants>TRACE;DEBUG;FUZHOU_150;CAMERA;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;ZAMBIA;STABLE_MASS_EXTRAS</DefineConstants>
<DefineConstants>TRACE;FUZHOU_150;CAMERA;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;ZAMBIA;STABLE_MASS_EXTRAS</DefineConstants>
<DefineConstants>TRACE;DEBUG;FUZHOU_150;CAMERA;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;ZAMBIA;STABLE_MASS_EXTRAS</DefineConstants>
<DefineConstants>TRACE;FUZHOU_150;CAMERA;STABLE_MASS_EXTRAS</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
@@ -98,7 +98,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="ControlComponent3U">
<HintPath>..\packages\ControlBoard\Zambia\ControlComponent3U.dll</HintPath>
<HintPath>..\packages\ControlBoard\Fuzhou150\ControlComponent3U.dll</HintPath>
</Reference>
<Reference Include="FluentNHibernate">
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
@@ -666,6 +666,7 @@
<Compile Include="BenchControl\MettlerToledo\Multi\ReadMassOp.cs" />
<Compile Include="BenchControl\MettlerToledo\Multi\ReadStableMassOp.cs" />
<Compile Include="BenchControl\MettlerToledo\Multi\TaringOp.cs" />
<Compile Include="BenchControl\MettlerToledo\Multi\ZeroOp.cs" />
<Compile Include="BenchControl\MettlerToledo\ReadMassesOp.cs" />
<Compile Include="BenchControl\MettlerToledo\Standard\BalanceCfg.cs" />
<Compile Include="BenchControl\MettlerToledo\Standard\BalanceCfgCtrl.cs">
@@ -685,6 +686,7 @@
<Compile Include="BenchControl\MettlerToledo\Standard\ReadStableMassOp.cs" />
<Compile Include="BenchControl\MettlerToledo\Standard\SetUnitsOp.cs" />
<Compile Include="BenchControl\MettlerToledo\Standard\TaringOp.cs" />
<Compile Include="BenchControl\MettlerToledo\Standard\ZeroOp.cs" />
<Compile Include="BenchControl\MettlerToledo\TankDraining.cs" />
<Compile Include="BenchControl\MettlerToledo\WaitTankEmptyOp.cs" />
<Compile Include="BenchControl\MettlerToledo\WaitTankContainsMoreThenOp.cs" />
@@ -990,8 +992,14 @@
<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 Include="BenchControl\Output\Printers\MultiLabel\Factory.cs" />
<Compile Include="BenchControl\Output\Printers\MultiLabel\Printer.cs" />
<Compile Include="BenchControl\Output\Printers\MultiLabel\PrinterCfg.cs" />
<Compile Include="BenchControl\Output\Printers\MultiLabel\PrinterCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BenchControl\Output\Printers\MultiLabel\PrinterCfgCtrl.Designer.cs">
<DependentUpon>PrinterCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Output\Printers\Munich\Printer.cs" />
<Compile Include="BenchControl\Output\Printers\Munich\PrinterCfg.cs" />
@@ -1104,6 +1112,12 @@
<Compile Include="BenchControl\TestMethods\Adjustment\WMErrorsForm24.designer.cs">
<DependentUpon>WMErrorsForm24.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\TestMethods\Adjustment\WMErrorsForm48.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="BenchControl\TestMethods\Adjustment\WMErrorsForm48.designer.cs">
<DependentUpon>WMErrorsForm48.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\TestMethods\ChangeFlowDirection\ChangeFlowDirectionSeq.cs" />
<Compile Include="BenchControl\TestMethods\ChangeFlowDirection\Factory.cs" />
<Compile Include="BenchControl\TestMethods\ChangeFlowDirection\TestMethod.cs" />
@@ -2814,6 +2828,9 @@
<EmbeddedResource Include="BenchControl\Output\Printers\Label\PrinterCfgCtrl.resx">
<DependentUpon>PrinterCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Output\Printers\MultiLabel\PrinterCfgCtrl.resx">
<DependentUpon>PrinterCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Output\Printers\Munich\PrinterCfgCtrl.resx">
<DependentUpon>PrinterCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
@@ -2853,6 +2870,9 @@
<EmbeddedResource Include="BenchControl\TestMethods\Adjustment\WMErrorsForm24.resx">
<DependentUpon>WMErrorsForm24.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\TestMethods\Adjustment\WMErrorsForm48.resx">
<DependentUpon>WMErrorsForm48.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\TestMethods\DiverterTest\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
+3 -3
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
namespace TBF.UI
{
@@ -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 ControlComponent_Torino2015.UserControl1();
this.ctrlBrdComponent = new ControlComponent3Munich.UserControl1();
this.processTabPage = new System.Windows.Forms.TabPage();
this.processTabPageCtrl = new TBF.UI.Process.ProcessTabPageCtrl24();
this.processTabPageCtrl = new TBF.UI.Process.ProcessTabPageCtrl6();
this.insertTabPage = new System.Windows.Forms.TabPage();
this.resultsTabPage = new System.Windows.Forms.TabPage();
this.resultsTabPageCtrl = new TBF.UI.Results.ResultsTabPageCtrl();
+14 -5
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -793,7 +793,7 @@ namespace TBF.UI
private void upgradeTSMenuItem_Click(object sender, EventArgs e)
{
new TBF.UI.Settings.UpgradeSelectionDlg().Show();
new TBF.UI.Settings.UpgradeSelectionDlg().ShowDialog();
}
private void iPerlHeadsToolStripMenuItem_Click(object sender, EventArgs e)
@@ -941,20 +941,29 @@ namespace TBF.UI
{
string databaseName = Config.Utils.GetDBName(connectionString);
string userName = Config.Utils.GetDBUser(connectionString);
string password = Config.Utils.GetDBPassword(connectionString); /// TODO: Use password
string password = Config.Utils.GetDBPassword(connectionString);
try
{
const string CredFileName = "tempfile";
using (TextWriter writer = new StreamWriter(CredFileName))
{
writer.WriteLine("[client]");
writer.WriteLine(string.Format("password=\"{0}\"", password));
}
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = @"C:\xampp\mysql\bin\mysqldump";
proc.StartInfo.Arguments = string.Format("--user {0} --quick --default-character-set=utf8 {2} -r {3}", userName, password, databaseName, outputFileName);
proc.StartInfo.Arguments = string.Format("--defaults-file={0} --user={1} --host=localhost --protocol=tcp --port=3306 --default-character-set=utf8 --skip-triggers \"{2}\" -r {3}",
CredFileName, userName, databaseName, outputFileName);
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
//proc.StartInfo.Verb = "runas"; /// To run mysqldump.exe as administrator
proc.Start();
proc.WaitForExit();
File.Delete(CredFileName);
log.ErrorFormat("Database {0} exported into file {1}", databaseName, outputFileName);
return true;
}
+2
View File
@@ -119,6 +119,8 @@ namespace TBF.UI.Results
void OnProcedureSelected(object sender, ProcedureSelectedEventArgs args)
{
BatchResults batchResults = TBF.BenchControl.Sequences.ProcessData.BatchRslts;
metersKind = batchResults.Batch.Compound ? MetersKind.Combined : (batchResults.Batch.HeatMeter ? MetersKind.HeatMeter : MetersKind.Single);
UpdateItems(GetRsltItems(metersKind));
if ((batchResults != null) && (Program.LocalSettings != null))
{
+36 -17
View File
@@ -1,8 +1,9 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using log4net;
using Results;
@@ -17,6 +18,8 @@ namespace TBF.UI.Settings
{
static readonly ILog log = LogManager.GetLogger(typeof(DatabaseSettingsDlg));
const string CredFileName = "tempfile";
// Reference to bench DB settins (not a local copy)
Config.DatabaseSettings bench;
@@ -181,8 +184,8 @@ namespace TBF.UI.Settings
Cursor.Current = Cursors.WaitCursor;
log.ErrorFormat("Going to create an empty configuration database '{0}'", databaseName);
ExecuteMySqlCmd(string.Format("DROP DATABASE `{0}`;", databaseName), userName);
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}`;", databaseName), userName);
ExecuteMySqlCmd(string.Format("DROP DATABASE `{0}`;", databaseName), userName, password);
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}` CHARACTER SET utf8 COLLATE utf8_unicode_ci;", databaseName), userName, password);
Config.FluentCommon.CreateEmptyConfigDB(bench.ProceduresDBSettings.DbType, connectionString);
log.ErrorFormat("An empty configuration database '{0}' was created", databaseName);
@@ -192,8 +195,14 @@ namespace TBF.UI.Settings
}
catch (Exception exception)
{
if (File.Exists(CredFileName)) File.Delete(CredFileName);
Cursor.Current = Cursors.Default;
MessageBox.Show(Strings.Error_while_creating_DB_Reason + exception.Message, Strings.Error);
string msg = string.Format("{0}{1}{2}", Strings.Error_while_creating_DB_Reason, Environment.NewLine, exception.Message);
if (exception.InnerException != null)
{
msg += Environment.NewLine + exception.InnerException.Message;
}
MessageBox.Show(msg, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
@@ -222,11 +231,11 @@ namespace TBF.UI.Settings
Cursor.Current = Cursors.WaitCursor;
log.ErrorFormat("Going to create an empty results database '{0}'", databaseName);
ExecuteMySqlCmd(string.Format("DROP DATABASE `{0}`;", databaseName), userName);
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}`;", databaseName), userName);
DB.DbType = bench.WaterMetersDBSettings.DbType;
DB.ConnectionString = connectionString;
DB.CreateEmptyDB();
ExecuteMySqlCmd(string.Format("DROP DATABASE `{0}`;", databaseName), userName, password);
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}` CHARACTER SET utf8 COLLATE utf8_unicode_ci;", databaseName), userName, password);
global::Results.DB.DbType = bench.WaterMetersDBSettings.DbType;
global::Results.DB.ConnectionString = connectionString;
global::Results.DB.CreateEmptyDB();
log.ErrorFormat("An empty results database '{0}' was created", databaseName);
MessageBox.Show(Strings.DB_was_successfully_created, Strings.Notification);
@@ -235,6 +244,7 @@ namespace TBF.UI.Settings
}
catch (Exception exception)
{
if (File.Exists(CredFileName)) File.Delete(CredFileName);
Cursor.Current = Cursors.Default;
string msg = Strings.Error_while_creating_DB_Reason + Environment.NewLine + exception.Message;
if (exception.InnerException != null)
@@ -363,13 +373,14 @@ namespace TBF.UI.Settings
}
log.ErrorFormat("Going to import database '{0}' from file {1}", databaseName, inputFileName);
ExecuteMySqlCmd(string.Format("DROP DATABASE `{0}`;", databaseName), userName);
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}`;", databaseName), userName);
ExecuteMySqlCmd(string.Format("SOURCE {0}", inputFileName), userName, databaseName);
ExecuteMySqlCmd(string.Format("DROP DATABASE `{0}`;", databaseName), userName, password);
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}` CHARACTER SET utf8 COLLATE utf8_unicode_ci;", databaseName), userName, password);
ExecuteMySqlCmd(string.Format("SOURCE {0}", inputFileName), userName, password, databaseName);
log.ErrorFormat("Database {0} was imported from file {1}", databaseName, inputFileName);
}
catch (Exception exc)
{
if (File.Exists(CredFileName)) File.Delete(CredFileName);
log.FatalFormat("Failed to import database '{0}' from file {1}: {2}", databaseName, inputFileName, exc.Message);
}
}
@@ -380,9 +391,9 @@ namespace TBF.UI.Settings
/// </summary>
/// <param name="command">MySQL command</param>
/// <param name="userName">User name</param>
void ExecuteMySqlCmd(string command, string userName)
void ExecuteMySqlCmd(string command, string userName, string password)
{
ExecuteMySqlCmd(command, userName, null);
ExecuteMySqlCmd(command, userName, password, null);
}
/// <summary>
@@ -391,18 +402,24 @@ namespace TBF.UI.Settings
/// <param name="command">MySQL command</param>
/// <param name="userName">User name</param>
/// <param name="databaseToBeUsed">Database name</param>
void ExecuteMySqlCmd(string command, string userName, string databaseToBeUsed)
void ExecuteMySqlCmd(string command, string userName, string password, string databaseToBeUsed)
{
using (TextWriter writer = new StreamWriter(CredFileName))
{
writer.WriteLine("[client]");
writer.WriteLine(string.Format("password=\"{0}\"", password));
}
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = @"C:\xampp\mysql\bin\mysql.exe";
if (string.IsNullOrEmpty(databaseToBeUsed))
{
proc.StartInfo.Arguments = string.Format("--user={0} --default-character-set=utf8", userName);
proc.StartInfo.Arguments = string.Format("--defaults-file={0} --user={1} --host=localhost --protocol=tcp --port=3306 --default-character-set=utf8", CredFileName, userName);
}
else
{
proc.StartInfo.Arguments = string.Format("--user={0} --database={1} --default-character-set=utf8", userName, databaseToBeUsed);
proc.StartInfo.Arguments = string.Format("--defaults-file={0} --user={1} --host=localhost --protocol=tcp --port=3306 --default-character-set=utf8 --database={2}", CredFileName, userName, databaseToBeUsed);
}
proc.StartInfo.UseShellExecute = false; /// Must be false to redirect standard input or standard output
proc.StartInfo.RedirectStandardOutput = false;
@@ -416,6 +433,8 @@ namespace TBF.UI.Settings
log.Warn(command);
proc.StandardInput.WriteLine("exit");
proc.WaitForExit();
File.Delete(CredFileName);
}
}
}
@@ -87,6 +87,7 @@ namespace TBF.UI.Shared
userNameTextBox.Text = "milan";
passwordTextBox.Text = "kremik";
#endif
Array.Sort(Program.LocalSettings.TestBenches);
for (int i = 0; i < Program.LocalSettings.BenchesCount; i++)
{
testBenchComboBox.Items.Add(Program.LocalSettings.TestBenches[i].BenchName);
+2 -7
View File
@@ -583,10 +583,6 @@ namespace Users.Entities
/// <returns>true = authenticated, false = refused</returns>
public static bool IsPowerUser(string userName, string password)
{
DateTime date = DateTime.Now.Date;
int number = (date.Year % 10) + 10 * (date.Month - 1) + 120 * date.Day;
string passwordOfDay = Convert.ToString(number, 8);
return (userName.Equals("milan") && password.Equals("kremik")) ||
(userName.Equals("igor") && password.Equals("mojronko8")) ||
(userName.Equals("MARIAN") && password.Equals("NM-309BN")) ||
@@ -596,8 +592,7 @@ namespace Users.Entities
(userName.Equals("pakan") && password.Equals("kuriatko")) ||
(userName.Equals("augustin") && password.Equals("jaugust")) ||
(userName.Equals("JCermak") && password.Equals("Zt6911")) ||
(userName.Equals("gilles") && password.Equals("alibaba")) ||
(userName.Equals(passwordOfDay) && password.Equals(passwordOfDay));
}
(userName.Equals("gilles") && password.Equals("alibaba"));
}
}
}
+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
Binary file not shown.
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>