Compare commits

...
Author SHA1 Message Date
Milan Hanajik 49a959f758 Reconfigured for CEVAK 40 2020-10-14 09:36:45 +02:00
Milan Hanajik 8506289c5c Improved file name formatting for Output.FileWrites.Basic/Enhanced/Xml/XmlBatch, ver. 2.18.1526. 2020-10-14 09:35:36 +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
Milan Hanajik 65c441d929 ver. 2.18.1406 2020-01-31 09:01:05 +01:00
Milan Hanajik 9390dc95c2 Solution upgraded to VS2012, ver. 2.18.1401 2020-01-17 08:27:46 +01:00
Milan Hanajik 97c612e49b ver. 2.18.1388 2019-12-19 11:25:30 +01:00
Milan Hanajik 4a185ed35b Output.DB.ProductionTracing : Alternative profuction tracing DB possible. 2019-12-18 17:48:11 +01:00
Milan Hanajik 2718c4021c RestoreAndFixBatch functionality modified. 2019-12-18 15:04:28 +01:00
Milan Hanajik ebb2950e84 (1) Bug fix in sending FM pump frequencies to control board, (2) More logging, ver. 2.18.1387 2019-12-18 13:25:05 +01:00
Milan Hanajik 67a53909f8 FixedstartDeferredEvalSeq : Delay time before grabbing images introduced. 2019-12-11 14:21:37 +01:00
Milan Hanajik fbfbbecca4 E5 fixed, ver. 2.18.1380 2019-12-11 14:21:24 +01:00
Milan Hanajik e8db0f46c3 MainSeq bug fix : Program crashed when OuterLoop.Start was started as the first test, ver. 2.18.1374 2019-12-05 14:52:00 +01:00
Milan Hanajik c1705713df ALZIR_25 : French language 2019-11-26 17:18:07 +01:00
Milan Hanajik 0fd1d9e141 Elde.RegisterReader.RegisterReader.Position, IRegisterReader.Position, etc. introduced, ver. 2.18.1367 2019-11-26 17:17:55 +01:00
Milan Hanajik 5ee66205a9 ALZIR_25 symbol and component (22.11.2019) added 2019-11-26 17:14:20 +01:00
Milan Hanajik 03e8108704 FixedStartDeferredEval a FixedStartMassCollDeferredEval, ver. 2.18.1362 2019-11-15 16:55:55 +01:00
Milan Hanajik ed4179be5f All three TesttMethods.Adjustment.WMErrorsForm-s are more robust. 2019-11-15 16:55:53 +01:00
Milan Hanajik bedbecbcc3 TestMethods.FixedStart.FixedStartSeq code cleanup, references to scale/tank/draining/mass measurement removed. 2019-11-15 16:55:29 +01:00
Milan Hanajik e81de2267b ver. 2.18.1361 2019-11-12 07:57:44 +01:00
Milan Hanajik 3dfff4ad70 New iPerlCommunication.iPerlHead porc. parameter DoQ2CorrInside05pct and related functionality. 2019-11-11 11:28:39 +01:00
Milan Hanajik 7a640621ac Bug fixes : (1) FlowMeterDewa, (2) ControlComWrap.ReferenceFreqs(int i), ver. 2.18.1360 2019-11-11 09:46:25 +01:00
Milan Hanajik 807daf2bcd ver. 2.18.1357 2019-10-29 13:37:16 +01:00
Milan Hanajik ede1773b4f ver. 2.18.1356 2019-10-28 15:45:35 +01:00
Milan Hanajik e3ae1b24f1 Output.fileWriters.IperlLogger bug fix, ver. 2.18.1355 2019-10-28 15:38:42 +01:00
Milan Hanajik f6dc9d74fc iPerlCommunication : DelayBetweenRetries introduced. 2019-10-28 14:47:05 +01:00
Milan Hanajik 51f3a6e6c2 (1) ProcedureDlg: Draining before/after in Process tab, (2) DoDrainingAfter implemented in test method sequences. 2019-10-25 15:25:47 +02:00
Milan Hanajik f81d5111a9 ver. 2.18.1351 2019-10-24 09:02:12 +02:00
Milan Hanajik b24ec4ea2d ver. 2.18.1350 2019-10-24 08:55:44 +02:00
Milan Hanajik f3ed9a64f7 Transition sequences and hydraulic paths are not displayed and cannot be edited for test methods with DoTranisitions( ) == false. 2019-10-24 08:55:41 +02:00
Milan Hanajik 866939abbd (1) TBF.BenchControl.Elde.SendCommandArgs class and cbCommandQueue (2) DiverterToTank, DiverterToSink commands modified. 2019-10-24 08:55:40 +02:00
Milan Hanajik 248f51fa69 TransitionContext.AfterTestWithOverlap, PID coef. set earlier as well, nextHydroTest in MainSeq. 2019-10-24 08:55:31 +02:00
Milan Hanajik b4dc83e7fa (1) Modifications for WR20, WR21 (2) ProcessData.BenchInfo.TestBenchId/TextBenchName are always used by Oracle and ProductionTracing. 2019-10-22 12:48:58 +02:00
Milan Hanajik 0bb6a2cd8c ver. 2.18.1331 2019-10-15 09:35:45 +02:00
Milan Hanajik c3d3a8c987 (1) "Fix' possible for user 'milan' even when previous records are missing, (2) More OracleWZTypSelection, ver. 2.18.1330 2019-10-11 16:56:20 +02:00
Milan Hanajik 825230d9e9 ver. 2.18.1328 2019-10-09 14:41:00 +02:00
Milan Hanajik cb13e3f108 ver. 2.18.1327 2019-10-09 14:34:01 +02:00
Milan Hanajik 2552949c59 ver. 2.18.1326 2019-10-09 14:22:51 +02:00
Milan Hanajik 317e0f16cb (1) TestMethods.Dummy component, (2) Three custom shared buttons, (3) ProcedureDlg and Procedures.TestWizard modified. 2019-10-09 14:00:08 +02:00
Milan Hanajik 8e046046cd SensusTestInfo extended 2019-10-09 13:59:56 +02:00
Milan Hanajik e440981068 'ShowDisabledPositions' supported when displaying previous results. 2019-10-08 09:48:37 +02:00
Milan Hanajik 299f3ecb68 ver. 2.18.1325 2019-10-01 12:02:30 +02:00
Milan Hanajik 39aa02f9ab Oracle DB only : Refactorization : TBF.UI namespace, no change of function, part 2. 2019-10-01 11:12:51 +02:00
Milan Hanajik d502873d17 FlowMeter, FlowmeterTriplet : Condiiton (flow < 0.1 * NominalFlow) removed from LtrPerPulseCorrected( ), ver. 2.18.1324 2019-09-26 15:53:00 +02:00
Milan Hanajik da192a207c (1) StandardCamera.TestStartEndForm fixed (exclamation), (2) Simulate mode for camera with sample.bmp, ver. 2.18.1322 2019-09-23 08:03:16 +02:00
Milan Hanajik 23560f1702 Bug fix : Program crashed when on-screen result items were defined for the first time on a PC (columnWidths == null). 2019-09-23 07:16:35 +02:00
Milan Hanajik 36a6fba408 (1) FlowMeteDewa uses EtPulses2, EtPulses3, (2) WMChart fixed, Q4 displayed, (3) Minor MainSeq bug fix, ver. 2.18.1318 2019-09-22 17:11:48 +02:00
221 changed files with 19045 additions and 4597 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
+3 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;CEVAK_40;LANG_CS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -28,7 +28,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;CEVAK_40;LANG_CS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -125,6 +125,7 @@
<ItemGroup>
<EmbeddedResource Include="Resources\Strings.cs.resx" />
<EmbeddedResource Include="Resources\Strings.de.resx" />
<EmbeddedResource Include="Resources\Strings.fr.resx" />
<EmbeddedResource Include="Resources\Strings.it.resx" />
<EmbeddedResource Include="Resources\Strings.pl.resx" />
<EmbeddedResource Include="Resources\Strings.resx">
+1 -1
View File
@@ -62,7 +62,7 @@ namespace Config
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50
#elif TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || ALZIR_25
public const int WMsCount = 20;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
+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}",
+69 -4
View File
@@ -90,6 +90,10 @@ namespace Config.Entities
[Description("Wasserzähler")] Single,
[Description("Verbundwasserzähler")] Combined,
[Description("Wärmezähler")] HeatMeter,
#elif LANG_FR
[Description("Compteurs eau")] Single,
[Description("Mètres composés")] Combined,
[Description("Thermomètres")] HeatMeter,
#elif LANG_CS
[Description("Vodoměry")] Single,
[Description("Kombinované vodoměry")] Combined,
@@ -125,6 +129,9 @@ namespace Config.Entities
#elif LANG_IT
[Description("freddo")] ColdWater,
[Description("caldo")] HotWater,
#elif LANG_FR
[Description("eau froide")] ColdWater,
[Description("eau chaude")] HotWater,
#else
[Description("cold")] ColdWater,
[Description("hot")] HotWater,
@@ -240,6 +247,11 @@ namespace Config.Entities
[Description("immer")] Always = 1,
[Description("Bildschirm")] OnScreen = 2,
[Description("intern")] Internal = 3,
#elif LANG_FR
[Description("jamais")] Never = 0,
[Description("toujours")] Always = 1,
[Description("À l'écran")] OnScreen = 2,
[Description("interne")] Internal = 3,
#elif LANG_CS
/// czech
[Description("nikdy")] Never = 0,
@@ -281,6 +293,10 @@ namespace Config.Entities
[Description("Waage")] Scale,
[Description("Spanne")] Spread,
[Description("Standardabw.")] StdDev,
#elif LANG_FR
[Description("Balance")] Scale,
[Description("Envergure")] Spread,
[Description("Déviation std.")] StdDev,
#elif LANG_CS
/// cesky
[Description("váhou")] Scale,
@@ -291,9 +307,30 @@ namespace Config.Entities
[Description("Spread")] Spread,
[Description("Std.dev.")] StdDev,
#endif
Count
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,
@@ -345,6 +382,14 @@ namespace Config.Entities
[Description("Prüfpunktergebnisse")] TestResult,
[Description("Wasserzelledaten")] MeterData,
[Description("Wasserzelleergebnisse")] MeterResult,
#elif LANG_FR
[Description("Autres")] Other,
[Description("Données de banc")] BenchData,
[Description("Résultats du banc")] BenchResult,
[Description("Données de test")] TestData,
[Description("Résultats de test")] TestResult,
[Description("Données du compteur d'eau")] MeterData,
[Description("Résultats du compteur d'eau")] MeterResult,
#else
[Description("Other")] Other,
[Description("Bench data")] BenchData,
@@ -354,7 +399,7 @@ namespace Config.Entities
[Description("Meter data")] MeterData,
[Description("Meter result")] MeterResult,
#endif
Count,
Count,
}
/// <summary> Possible modes of operation of components and devices. </summary>
@@ -371,6 +416,17 @@ namespace Config.Entities
[Description("Reply")] Reply,
[Description("Simuliert")] Simulate, /// Test bench simulation, this mode does not require any hardware
[Description("Geerbt")] Inherit,
#elif LANG_FR
[Description("Détection automatique: Éteindre")] DetectedOff = -2,
[Description("Détection automatique: Allumé")] DetectedOn = -1,
[Description("Ordinaire")] Normal = 0,
[Description("Détection automatique")] AutoDetect,
[Description("Erreur d'exécution")] FailureDuringOperation,
[Description("Éteindre")] Off,
[Description("Record")] Record,
[Description("Répondre")] Reply,
[Description("Simuler")] Simulate,
[Description("Hériter")] Inherit,
#else
[Description("Detected off")] DetectedOff = -2,
[Description("Detected on")] DetectedOn = -1,
@@ -383,7 +439,7 @@ namespace Config.Entities
[Description("Simulate")] Simulate, /// Test bench simulation, this mode does not require any hardware
[Description("Inherit")] Inherit,
#endif
Count,
Count,
}
public enum LogLevel
@@ -430,6 +486,11 @@ namespace Config.Entities
[Description("zentriert")] Center,
[Description("rechts")] Right,
[Description("angepasst")] Justified,
#elif LANG_FR
[Description("gauche")] Left,
[Description("centré")] Center,
[Description("droit")] Right,
[Description("justifié")] Justified,
#else
[Description("Left")] Left,
[Description("Center")] Center,
@@ -479,6 +540,10 @@ namespace Config.Entities
[Description("aus")] Off,
[Description("info")] Info,
[Description("ein")] On,
#elif LANG_FR
[Description("éteindre")] Off,
[Description("info")] Info,
[Description("allumé")] On,
#elif LANG_CS
[Description("vypnuto")] Off,
[Description("info")] Info,
@@ -496,7 +561,7 @@ namespace Config.Entities
[Description("info")] Info,
[Description("on")] On,
#endif
Count
Count
}
+36
View File
@@ -234,6 +234,42 @@ namespace Config.Entities
return null;
}
/// <summary>
/// Processes the selection done by the bench control panel in the main sequence.
/// </summary>
/// <param name="selection">Selection.Q1, .Q2, .Q3 or .Test</param>
/// <returns>The selected test or null</returns>
public virtual Test GetTest(string expandedTestName, out int testIx, out int repetNr)
{
for (int ix = 0; ix < Tests.Count; ix++)
{
Test test = Tests[ix];
if (test.Name.Equals(expandedTestName))
{
/// Name is not expanded => Repeats==1
testIx = ix;
repetNr = 1;
return test;
}
for (int r = 1; r <= test.Repeats; r++)
{
if (test.GetExpandedTestName(r).Equals(expandedTestName))
{
testIx = ix;
repetNr = r;
return test;
}
}
}
testIx = 0;
repetNr = 1;
return null;
}
public override string ToString()
{
return string.Format("{0}, rev.{1}", Name, Revision);
+33 -6
View File
@@ -30,7 +30,7 @@ namespace Config.Entities
public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual int Repeats { get; set; }
public virtual bool DoDraining { get; set; }
public virtual bool DoZeroing { get; set; }
public virtual bool DoDrainingAfter { get; set; }
public virtual bool DoControlWaterTemp { get; set; }
public virtual float TempLimLo { get; set; } /// Lower limit for the controlled temperature
public virtual float TempLimHi { get; set; } /// Upper limit for the controlled temperature
@@ -76,7 +76,7 @@ namespace Config.Entities
DoEvaluate = true;
Repeats = 1;
DoDraining = false;
DoZeroing = false;
DoDrainingAfter = false;
DoControlWaterTemp = false;
TempLimLo = 15.0f;
TempLimHi = 25.0f;
@@ -124,7 +124,7 @@ namespace Config.Entities
result.Uncertainty = Uncertainty;
result.Repeats = Repeats;
result.DoDraining = DoDraining;
result.DoZeroing = DoZeroing;
result.DoDrainingAfter = DoDrainingAfter;
result.DoControlWaterTemp = DoControlWaterTemp;
result.TempLimLo = TempLimLo;
result.TempLimHi = TempLimHi;
@@ -172,7 +172,7 @@ namespace Config.Entities
output.WriteLine(Uncertainty.ToString(ci));
output.WriteLine(Repeats.ToString(ci));
output.WriteLine(DoDraining.ToString());
output.WriteLine(DoZeroing.ToString());
output.WriteLine(DoDrainingAfter.ToString());
output.WriteLine(DoControlWaterTemp.ToString());
output.WriteLine(TempLimLo.ToString(ci));
output.WriteLine(TempLimHi.ToString(ci));
@@ -222,7 +222,7 @@ namespace Config.Entities
tst.Uncertainty = float.Parse(input.ReadLine(), ci);
tst.Repeats = int.Parse(input.ReadLine(), ci);
tst.DoDraining = bool.Parse(input.ReadLine());
tst.DoZeroing = bool.Parse(input.ReadLine());
tst.DoDrainingAfter = bool.Parse(input.ReadLine());
tst.DoControlWaterTemp = bool.Parse(input.ReadLine());
tst.TempLimLo = float.Parse(input.ReadLine(), ci);
tst.TempLimHi = float.Parse(input.ReadLine(), ci);
@@ -280,7 +280,7 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != Uncertainty.ToString(ci)) { diff.AppendFormat(fmt, "Uncertainty", Uncertainty.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Repeats.ToString(ci)) { diff.AppendFormat(fmt, "Repeats", Repeats.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDraining.ToString(ci)) { diff.AppendFormat(fmt, "Draining", DoDraining.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoZeroing.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoZeroing.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDrainingAfter.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoDrainingAfter.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoControlWaterTemp.ToString()) { diff.AppendFormat(fmt, "DoControlWaterTemp", DoControlWaterTemp.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); };
@@ -313,6 +313,33 @@ namespace Config.Entities
return null;
}
/// <summary>
/// Return test title for a this test and a given repetition number
/// </summary>
/// <param name="repetitonNr">1 .. Nr. repetitions</param>
/// <returns>Test title (string)</returns>
public virtual string GetExpandedTestName(int repetitionNr)
{
if (Repeats == 1)
{
if (Part == 0)
{
/// Single test
return Name;
}
else
{
/// A part of a single test
return string.Format("{0} ({1})", Name, Part);
}
}
else
{
/// More test repetitions
return string.Format("{0} ({1}/{2})", Name, repetitionNr, Repeats);
}
}
public virtual double GetErrLimLo(double volumeCTV, double testTime)
{
if (ErrLimLo <= ErrLimHi)
+1 -1
View File
@@ -24,7 +24,7 @@ namespace Config.Mappings
Map(x => x.Repeats);
Map(x => x.DoDraining)
.Column("Emptying");
Map(x => x.DoZeroing)
Map(x => x.DoDrainingAfter)
.Column("Zeroing");
Map(x => x.DoControlWaterTemp);
Map(x => x.TempLimLo);
+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")]
+153
View File
@@ -0,0 +1,153 @@
<?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>
<data name="Administrator" xml:space="preserve">
<value>Administrateur</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>Spécialiste en calibration</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>Chef de laboratoire</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>Spécialiste en maintenance</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>Métrologue</value>
</data>
<data name="Tester" xml:space="preserve">
<value>Testeur</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>Spécialiste d'essais</value>
</data>
<data name="Failed" xml:space="preserve">
<value>Échoué</value>
</data>
<data name="Passed" xml:space="preserve">
<value>Passé</value>
</data>
<data name="Cannot_open_DB_Cause_0" xml:space="preserve">
<value>Impossible d'ouvrir la base de données Cause\\r\\n{0}</value>
</data>
<data name="Error" xml:space="preserve">
<value>Erreur</value>
</data>
</root>
+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>
+11 -5
View File
@@ -130,13 +130,19 @@ namespace Results
public static BatchResults FromBatch(Batch batch)
{
int wmCount = batch.WaterMeters.Count;
if (wmCount == 0) return null;
if (batch.WaterMeters == null || batch.WaterMeters.Count == 0) return null;
BatchResults batchResults = new BatchResults(wmCount);
int wmPosMax = 0;
foreach (var wm in batch.WaterMeters) if (wm.WMPosition > wmPosMax) wmPosMax = wm.WMPosition;
BatchResults batchResults = new BatchResults(wmPosMax);
batchResults.Batch = batch;
batchResults.WaterMeters = new WaterMeter[wmCount];
for (int i = 0; i < wmCount; i++) batchResults.WaterMeters[i] = batch.WaterMeters[i];
batchResults.WaterMeters = new WaterMeter[wmPosMax];
for (int i = 0; i < batch.WaterMeters.Count; i++)
{
WaterMeter wm = batch.WaterMeters[i];
batchResults.WaterMeters[wm.WMPosition - 1] = wm;
}
return batchResults;
}
+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;
+38
View File
@@ -97,6 +97,7 @@ namespace Results.Entities
public virtual object CompleteTestInfos { get; set; } /// SensusTestInfo[] obtained as a best match at the beginning of the cycle, not mapped to DB !!!
#endif
public virtual int ProcessId { get; set; } /// Not mapped to DB !!! Tracing DB Process ID
public virtual int SessionId { get; set; } /// Not mapped to DB !!! 1 (regular tracing DB session) or 2 (alternative tracing DB session)
public virtual bool LastRecordIsNok { get; set; } /// Not mapped to DB !!! Previous record verification result
public virtual WaterMeterData WaterMeterData { get; set; }
@@ -218,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;
@@ -359,6 +395,7 @@ namespace Results.Entities
CompleteTestInfos = null;
#endif
ProcessId = 0;
SessionId = 0;
ErrorFlags = 0;
LastRecordIsNok = false;
}
@@ -419,6 +456,7 @@ namespace Results.Entities
CompleteTestInfos = src.CompleteTestInfos;
#endif
ProcessId = src.ProcessId;
SessionId = src.SessionId;
LastRecordIsNok = src.LastRecordIsNok;
foreach (var mtr in MeterTestRslts)
+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;
+25 -22
View File
@@ -126,12 +126,9 @@ namespace Results.Forms
int displayedControlsCount = 0;
for (int i = 0; i < results.WaterMeters.Length; i++)
{
if (results.WaterMeters[i] != null)
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
{
if (ShowDisabledPositions || !results.WaterMeters[i].Disabled)
{
displayedControlsCount++;
}
displayedControlsCount++;
}
}
@@ -170,16 +167,23 @@ namespace Results.Forms
firstEnabledControl = null;
for (int i = 0; i < results.WaterMeters.Length; i++)
{
if (results.WaterMeters[i] != null)
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
{
if (!results.WaterMeters[i].Disabled || ShowDisabledPositions)
/// Create one water meter position / control
wmRsltsCtrl[ix] = (TestsArrangement == TestsArrangement.Rows)
? new OneWMResultsRowsCtrl() as IOneWMResultsCtrl
: new OneWMResultsColumnsCtrl() as IOneWMResultsCtrl;
wmRsltsCtrl[ix].Width = oneWidth;
wmRsltsCtrl[ix].Height = oneHeight;
if ((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled)
{
/// Create one water meter position / control
wmRsltsCtrl[ix] = (TestsArrangement == TestsArrangement.Rows)
? new OneWMResultsRowsCtrl() as IOneWMResultsCtrl
: new OneWMResultsColumnsCtrl() as IOneWMResultsCtrl;
wmRsltsCtrl[ix].Width = oneWidth;
wmRsltsCtrl[ix].Height = oneHeight;
if ((firstEnabledControl == null) && (results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled)
{
firstEnabledControl = wmRsltsCtrl[ix];
}
//wmRsltsCtrl[ix].Update(results.WaterMeters[i].WMPosition);
wmRsltsCtrl[ix].Update(Items);
wmRsltsCtrl[ix].WMResultsClickedHandler += delegate(object s, Results.Forms.WaterMeterEventArgs args)
{
@@ -192,11 +196,10 @@ namespace Results.Forms
OnDoubleClick(s, args);
}
};
flowLayoutPanel.Controls.Add(wmRsltsCtrl[ix] as UserControl);
if ((firstEnabledControl == null) && !results.WaterMeters[i].Disabled) firstEnabledControl = wmRsltsCtrl[ix];
ix++;
}
flowLayoutPanel.Controls.Add(wmRsltsCtrl[ix] as UserControl);
ix++;
}
}
@@ -206,16 +209,16 @@ namespace Results.Forms
}
void UpdateResults(Results.BatchResults batchResults)
void UpdateResults(Results.BatchResults results)
{
if ((batchResults != null) && (batchResults.WaterMeters != null))
if ((results != null) && (results.WaterMeters != null))
{
int ctrlIx = 0;
for (int i = 0; i < batchResults.WaterMeters.Length; i++)
for (int i = 0; i < results.WaterMeters.Length; i++)
{
if (!batchResults.WaterMeters[i].Disabled || ShowDisabledPositions)
if (((results.WaterMeters[i] != null) && !results.WaterMeters[i].Disabled) || ShowDisabledPositions)
{
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(batchResults.WaterMeters[i]);
if (ctrlIx < wmRsltsCtrl.Length) wmRsltsCtrl[ctrlIx++].Update(results.WaterMeters[i]);
}
}
}
+2 -2
View File
@@ -90,11 +90,11 @@ namespace Results.Forms
#endif
/// Header
lView.Columns.Add(wmPosition.ToString(), (columnWidths.Length > 0) ? columnWidths[0] : 40);
lView.Columns.Add(wmPosition.ToString(), (columnWidths != null && columnWidths.Length > 0) ? columnWidths[0] : 40);
int col = 1;
foreach (var str in wMtr.GetAllDecoratedTestNames())
{
lView.Columns.Add(str, (columnWidths.Length > col) ? columnWidths[col] : 70);
lView.Columns.Add(str, (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : 70);
col++;
}
+2 -2
View File
@@ -67,13 +67,13 @@ namespace Results.Forms
/// Always draw ListView header
lView.Columns.Clear();
lView.Columns.Add(wmPosition.ToString(), (columnWidths.Length > 0) ? columnWidths[0] : 40);
lView.Columns.Add(wmPosition.ToString(), (columnWidths != null && columnWidths.Length > 0) ? columnWidths[0] : 40);
if (items == null || items.Count == 0) return;
int col = 1;
foreach (var item in items)
{
lView.Columns.Add(item.Caption, (columnWidths.Length > col) ? columnWidths[col] : 70);
lView.Columns.Add(item.Caption, (columnWidths != null && columnWidths.Length > col) ? columnWidths[col] : 70);
col++;
}
}
+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;
}
}
+13 -3
View File
@@ -13,17 +13,25 @@ namespace Results.Output
{
public static Chart GetChart(WaterMeter wm, bool isPrinter)
{
return GetChart(wm, isPrinter, Config.Unit.lph, false);
return GetChart(wm, isPrinter, Config.Unit.lph);
}
public static Chart GetChart(WaterMeter wm, bool isPrinter, Config.Unit flowUnit, bool isQ4)
public static Chart GetChart(WaterMeter wm, bool isPrinter, Config.Unit flowUnit)
{
double maxFlow_m3h = 0;
IList<PointF> unsortedPoints = new List<PointF>();
foreach (var mtr in wm.MeterTestRslts)
{
if (mtr.IsPilotRslt() && mtr.TestRslt.TestData.Evaluate && (mtr.TestRslt.TestTime > 0) && (mtr.TestRslt.PulsesMaster > 0))
{
double flow = Config.Units.ConvertTo(flowUnit, 3.6 * mtr.TestRslt.VolumeCTV / mtr.TestRslt.TestTime);
double flow_m3h = (mtr.TestTime != 0)
? (3.6 * mtr.TestRslt.VolumeCTV / mtr.TestTime * mtr.PulsesMaster / mtr.TestRslt.PulsesMaster)
: (3.6 * mtr.TestRslt.VolumeCTV / mtr.TestRslt.TestTime);
if (flow_m3h > maxFlow_m3h) maxFlow_m3h = flow_m3h;
double flow = Config.Units.ConvertTo(flowUnit, flow_m3h); /// Convert to specified units
if (flow > 0)
{
unsortedPoints.Add(new PointF((float)flow, (float)mtr.Error));
@@ -32,6 +40,8 @@ namespace Results.Output
}
IEnumerable<PointF> sortedPoints = unsortedPoints.OrderBy(x => x.X);
bool isQ4 = (maxFlow_m3h > 1.1 * wm.WaterMeterData.Q3_Qn);
Chart chart = new Chart
{
Name = "chart",
+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.1290.0")]
[assembly: AssemblyFileVersion("2.18.1290.0")]
[assembly: AssemblyVersion("2.18.1438.0")]
[assembly: AssemblyFileVersion("2.18.1438.0")]
+807
View File
@@ -0,0 +1,807 @@
<?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>
<data name="Add" xml:space="preserve">
<value>Ajouter &gt;</value>
</data>
<data name="Alignment" xml:space="preserve">
<value>Alignement</value>
</data>
<data name="Approval" xml:space="preserve">
<value>Approbation</value>
</data>
<data name="Available_results" xml:space="preserve">
<value>Résultats disponibles</value>
</data>
<data name="Batch_nr" xml:space="preserve">
<value>Numéro de lot</value>
</data>
<data name="Bench" xml:space="preserve">
<value>Banc</value>
</data>
<data name="CancelBtnText" xml:space="preserve">
<value>Annuler</value>
</data>
<data name="Caption" xml:space="preserve">
<value>Légende</value>
</data>
<data name="Configuration" xml:space="preserve">
<value>Configuration</value>
</data>
<data name="Density" xml:space="preserve">
<value>Densité</value>
</data>
<data name="DownBtnText" xml:space="preserve">
<value>Vers le bas</value>
</data>
<data name="End" xml:space="preserve">
<value>Fin</value>
</data>
<data name="EndState_aux" xml:space="preserve">
<value>État final aux</value>
</data>
<data name="EndState_main" xml:space="preserve">
<value>État final principal</value>
</data>
<data name="End_state" xml:space="preserve">
<value>État final</value>
</data>
<data name="ErrLimHi" xml:space="preserve">
<value>Err LimHi</value>
</data>
<data name="ErrLimLo" xml:space="preserve">
<value>Err LimLo</value>
</data>
<data name="Error" xml:space="preserve">
<value>Erreur</value>
</data>
<data name="ErrRef" xml:space="preserve">
<value>Err Ref</value>
</data>
<data name="Err_aux" xml:space="preserve">
<value>Err aux</value>
</data>
<data name="Err_main" xml:space="preserve">
<value>Err principale</value>
</data>
<data name="Flow" xml:space="preserve">
<value>Couler</value>
</data>
<data name="Format" xml:space="preserve">
<value>Format</value>
</data>
<data name="H_amb" xml:space="preserve">
<value>Hamb</value>
</data>
<data name="Item" xml:space="preserve">
<value>Article</value>
</data>
<data name="MClass" xml:space="preserve">
<value>MClass</value>
</data>
<data name="OkBtnText" xml:space="preserve">
<value>Oui</value>
</data>
<data name="PO" xml:space="preserve">
<value>Commande</value>
</data>
<data name="Pos" xml:space="preserve">
<value>Pos.</value>
</data>
<data name="Precision" xml:space="preserve">
<value>Précision</value>
</data>
<data name="Procedure" xml:space="preserve">
<value>Procédure</value>
</data>
<data name="Producer" xml:space="preserve">
<value>Producteur</value>
</data>
<data name="Protocol" xml:space="preserve">
<value>Protocole</value>
</data>
<data name="Pulses" xml:space="preserve">
<value>Impulsion</value>
</data>
<data name="PulsesLiter" xml:space="preserve">
<value>Impulsion/litre</value>
</data>
<data name="P_amb" xml:space="preserve">
<value>P amb</value>
</data>
<data name="P_dn_end" xml:space="preserve">
<value>P dn fin</value>
</data>
<data name="P_dn" xml:space="preserve">
<value>P dn</value>
</data>
<data name="P_dn_start" xml:space="preserve">
<value>P dn début</value>
</data>
<data name="P_up_end" xml:space="preserve">
<value>P up fin</value>
</data>
<data name="P_up" xml:space="preserve">
<value>P up</value>
</data>
<data name="P_up_start" xml:space="preserve">
<value>P up début</value>
</data>
<data name="Q_fall" xml:space="preserve">
<value>Q tomber</value>
</data>
<data name="Q_from" xml:space="preserve">
<value>Q de</value>
</data>
<data name="Q_rise" xml:space="preserve">
<value>Q monter</value>
</data>
<data name="Q_to" xml:space="preserve">
<value>Q à</value>
</data>
<data name="RefPulses" xml:space="preserve">
<value>Ref Puls</value>
</data>
<data name="Remove" xml:space="preserve">
<value>&lt; Retirer</value>
</data>
<data name="Remove_all" xml:space="preserve">
<value>Enlever tout</value>
</data>
<data name="Result" xml:space="preserve">
<value>Résultat</value>
</data>
<data name="Selected_results" xml:space="preserve">
<value>Résultats sélectionnés</value>
</data>
<data name="sn" xml:space="preserve">
<value>s/n</value>
</data>
<data name="sn_aux" xml:space="preserve">
<value>s/n aux</value>
</data>
<data name="sn_main" xml:space="preserve">
<value>s/n principale</value>
</data>
<data name="Start" xml:space="preserve">
<value>Début</value>
</data>
<data name="Test" xml:space="preserve">
<value>Test</value>
</data>
<data name="Test_ID" xml:space="preserve">
<value>Test ID</value>
</data>
<data name="Test_method" xml:space="preserve">
<value>Méthode d'essai</value>
</data>
<data name="Test_vol" xml:space="preserve">
<value>Test vol</value>
</data>
<data name="T_amb" xml:space="preserve">
<value>T amb</value>
</data>
<data name="T_div" xml:space="preserve">
<value>T div</value>
</data>
<data name="T_end" xml:space="preserve">
<value>T fin</value>
</data>
<data name="T_in" xml:space="preserve">
<value>T dans</value>
</data>
<data name="T_out" xml:space="preserve">
<value>T en dehors</value>
</data>
<data name="T_s" xml:space="preserve">
<value>T [s]</value>
</data>
<data name="T_start" xml:space="preserve">
<value>T début</value>
</data>
<data name="Uncertainty" xml:space="preserve">
<value>Incertitude</value>
</data>
<data name="Units" xml:space="preserve">
<value>Unités</value>
</data>
<data name="UpBtnText" xml:space="preserve">
<value>En haut</value>
</data>
<data name="User" xml:space="preserve">
<value>Utilisateur</value>
</data>
<data name="User_nr" xml:space="preserve">
<value>N° Utilisateur</value>
</data>
<data name="Ver" xml:space="preserve">
<value>Ver.</value>
</data>
<data name="VolRef" xml:space="preserve">
<value>Vol ref.</value>
</data>
<data name="Volume" xml:space="preserve">
<value>Le volume</value>
</data>
<data name="Width" xml:space="preserve">
<value>Largeur</value>
</data>
<data name="WMs" xml:space="preserve">
<value>CEs</value>
</data>
<data name="WM_Type" xml:space="preserve">
<value>CE Type</value>
</data>
<data name="Year" xml:space="preserve">
<value>Année</value>
</data>
<data name="Results" xml:space="preserve">
<value>Résultats</value>
</data>
<data name="Remark" xml:space="preserve">
<value>Remarque</value>
</data>
<data name="Result_code" xml:space="preserve">
<value>Code de résultat</value>
</data>
<data name="Mounting" xml:space="preserve">
<value>Montage</value>
</data>
<data name="Energy" xml:space="preserve">
<value>Énergie</value>
</data>
<data name="Energy_ref" xml:space="preserve">
<value>Énergie ref</value>
</data>
<data name="P_delta" xml:space="preserve">
<value>P delta</value>
</data>
<data name="P_delta_end" xml:space="preserve">
<value>P delta fin</value>
</data>
<data name="P_delta_mean" xml:space="preserve">
<value>P delta moyenne</value>
</data>
<data name="P_delta_start" xml:space="preserve">
<value>P delta début</value>
</data>
<data name="Meter_type" xml:space="preserve">
<value>Type de compteur</value>
</data>
<data name="Compound" xml:space="preserve">
<value>Composé</value>
</data>
<data name="Heat_meter" xml:space="preserve">
<value>Thermomètre</value>
</data>
<data name="Single" xml:space="preserve">
<value>Unique</value>
</data>
<data name="Page" xml:space="preserve">
<value>Page</value>
</data>
<data name="End_volume" xml:space="preserve">
<value>Volume fin</value>
</data>
<data name="Start_volume" xml:space="preserve">
<value>Volume début</value>
</data>
<data name="End_volume_aux" xml:space="preserve">
<value>Fin volume aux</value>
</data>
<data name="End_volume_main" xml:space="preserve">
<value>Fin volume principale</value>
</data>
<data name="Start_volume_aux" xml:space="preserve">
<value>Début volume aux</value>
</data>
<data name="Start_volume_main" xml:space="preserve">
<value>Début volume principale</value>
</data>
<data name="Volume_aux" xml:space="preserve">
<value>Volume aux</value>
</data>
<data name="Volume_main" xml:space="preserve">
<value>Volume principale</value>
</data>
<data name="End_mass" xml:space="preserve">
<value>Fin masse</value>
</data>
<data name="Start_mass" xml:space="preserve">
<value>Début masse</value>
</data>
<data name="Category" xml:space="preserve">
<value>Catégorie</value>
</data>
<data name="Quantity" xml:space="preserve">
<value>Quantité</value>
</data>
<data name="Water_Meter" xml:space="preserve">
<value>Compteur d'eau</value>
</data>
<data name="VName_Flow" xml:space="preserve">
<value>Q</value>
</data>
<data name="VName_Press" xml:space="preserve">
<value>Press.</value>
</data>
<data name="VName_Temp" xml:space="preserve">
<value>Temp.</value>
</data>
<data name="VName_Dens" xml:space="preserve">
<value>Ro</value>
</data>
<data name="VName_Humi" xml:space="preserve">
<value>Hu.</value>
</data>
<data name="VName_Mass" xml:space="preserve">
<value>Masse</value>
</data>
<data name="VName_TstTime" xml:space="preserve">
<value>Tau</value>
</data>
<data name="VName_Vol" xml:space="preserve">
<value>Vol.</value>
</data>
<data name="Tooltip_P_de_ac" xml:space="preserve">
<value>Différence de pression mesurée par delta P mètre - réelle</value>
</data>
<data name="Tooltip_P_de_avg" xml:space="preserve">
<value>Différence de pression mesurée par delta P mètre - moyenne</value>
</data>
<data name="Tooltip_P_de_en" xml:space="preserve">
<value>Différence de pression mesurée par delta P mètre - à la fin de l'essai</value>
</data>
<data name="Tooltip_P_de_me" xml:space="preserve">
<value>Différence de pression mesurée par delta P mètre - moyenne</value>
</data>
<data name="Tooltip_P_de_st" xml:space="preserve">
<value>Différence de pression mesurée par delta P mètre - au début de l'essai</value>
</data>
<data name="Tooltip_P_dw_ac" xml:space="preserve">
<value>Pression à la sortie réelle</value>
</data>
<data name="Tooltip_P_dw_avg" xml:space="preserve">
<value>Pression moyenne à la sortie</value>
</data>
<data name="Tooltip_P_dw_en" xml:space="preserve">
<value>Pression à la sortie à la fin du test</value>
</data>
<data name="Tooltip_P_dw_me" xml:space="preserve">
<value>Pression moyenne à la sortie</value>
</data>
<data name="Tooltip_P_dw_st" xml:space="preserve">
<value>Pression à la sortie au début du test</value>
</data>
<data name="Tooltip_P_up_ac" xml:space="preserve">
<value>Pression à l'entrée réelle</value>
</data>
<data name="Tooltip_P_up_avg" xml:space="preserve">
<value>Pression moyenne à l'entrée</value>
</data>
<data name="Tooltip_P_up_en" xml:space="preserve">
<value>Pression à l'entrée à la fin de l'essai</value>
</data>
<data name="Tooltip_P_up_me" xml:space="preserve">
<value>Pression moyenne à l'entrée</value>
</data>
<data name="Tooltip_P_up_st" xml:space="preserve">
<value>Pression à l'entrée au début de l'essai</value>
</data>
<data name="Tooltip_Q_m_r" xml:space="preserve">
<value>Débit calculé à partir de la masse vraie et du temps conventionnels</value>
</data>
<data name="Tooltip_Q_riac" xml:space="preserve">
<value>Débit obtenu à partir du compteur principal - réel</value>
</data>
<data name="Tooltip_Q_rim" xml:space="preserve">
<value>Débit obtenu à partir du compteur principal - moyenne</value>
</data>
<data name="Tooltip_Q_v_r" xml:space="preserve">
<value>Débit mesuré par le débitmètre de référence</value>
</data>
<data name="Tooltip_T_di_ac" xml:space="preserve">
<value>Température réelle au déviateur</value>
</data>
<data name="Tooltip_T_di_avg" xml:space="preserve">
<value>Température moyenne au déviateur</value>
</data>
<data name="Tooltip_T_di_en" xml:space="preserve">
<value>Température au déviateur à la fin du test - 4 dernières mesures avant la fin</value>
</data>
<data name="Tooltip_T_di_me" xml:space="preserve">
<value>Température moyenne au déviateur</value>
</data>
<data name="Tooltip_T_di_st" xml:space="preserve">
<value>Température au déviateur au début du test - 4 premières mesures après le début</value>
</data>
<data name="Tooltip_T_dw_ac" xml:space="preserve">
<value>Température réelle à la sortie</value>
</data>
<data name="Tooltip_T_dw_avg" xml:space="preserve">
<value>Température moyenne à la sortie</value>
</data>
<data name="Tooltip_T_dw_en" xml:space="preserve">
<value>Température à la sortie à la fin du test - 4 dernières mesures avant la fin</value>
</data>
<data name="Tooltip_T_dw_me" xml:space="preserve">
<value>Température moyenne à la sortie</value>
</data>
<data name="Tooltip_T_dw_st" xml:space="preserve">
<value>Température à la sortie au début du test - 4 premières mesures après le début</value>
</data>
<data name="Tooltip_T_up_ac" xml:space="preserve">
<value>Température réelle à l'entrée</value>
</data>
<data name="Tooltip_T_up_avg" xml:space="preserve">
<value>Température moyenne à l'entrée lors d'un test</value>
</data>
<data name="Tooltip_T_up_en" xml:space="preserve">
<value>Température à l'entrée à la fin de l'essai - 4 dernières mesures avant la fin</value>
</data>
<data name="Tooltip_T_up_me" xml:space="preserve">
<value>Température moyenne à l'entrée lors d'un test</value>
</data>
<data name="Tooltip_T_up_st" xml:space="preserve">
<value>Température d'entrée au début du test - 4 premières mesures après le début</value>
</data>
<data name="aux" xml:space="preserve">
<value>aux.</value>
</data>
<data name="main" xml:space="preserve">
<value>principale</value>
</data>
<data name="Tooltip_E_rel" xml:space="preserve">
<value>Erreur relative d'un compteur</value>
</data>
<data name="Tooltip_E_rel_ref" xml:space="preserve">
<value>Erreur relative du compteur maître</value>
</data>
<data name="Tooltip_sn" xml:space="preserve">
<value>Numéro de série du compteur</value>
</data>
<data name="Tooltip_sn_aux" xml:space="preserve">
<value>Numéro de série du compteur auxiliaire d'un compteur d'eau composé</value>
</data>
<data name="Tooltip_sn_main" xml:space="preserve">
<value>Numéro de série du compteur principal d'un compteur d'eau composé</value>
</data>
<data name="Tooltip_Vol_Mt" xml:space="preserve">
<value>Volume mesuré par le compteur testé</value>
</data>
<data name="Tooltip_Vol_rm" xml:space="preserve">
<value>Volume de référence pour compteur testé</value>
</data>
<data name="VName_Error" xml:space="preserve">
<value>E</value>
</data>
<data name="fall" xml:space="preserve">
<value>tomber</value>
</data>
<data name="from" xml:space="preserve">
<value>de</value>
</data>
<data name="rise" xml:space="preserve">
<value>monter</value>
</data>
<data name="to" xml:space="preserve">
<value>à</value>
</data>
<data name="Tooltip_Hu_Amb_M" xml:space="preserve">
<value>Humidité ambiante pendant le test</value>
</data>
<data name="Tooltip_P_Amb_M" xml:space="preserve">
<value>Pression ambiante pendant le test</value>
</data>
<data name="Tooltip_T_Amb_M" xml:space="preserve">
<value>Température ambiante pendant le test</value>
</data>
<data name="Test_done" xml:space="preserve">
<value>Test fait</value>
</data>
<data name="Test_passed" xml:space="preserve">
<value>Test réussi</value>
</data>
<data name="No" xml:space="preserve">
<value>Non</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Oui</value>
</data>
<data name="Density_correction" xml:space="preserve">
<value>Correction densité</value>
</data>
<data name="Error_flags" xml:space="preserve">
<value>Drapeaux erreur</value>
</data>
<data name="Legalizator" xml:space="preserve">
<value>Légalisateur</value>
</data>
<data name="User_description" xml:space="preserve">
<value>Description utilisateur</value>
</data>
<data name="Failed_meters_count" xml:space="preserve">
<value>Compteur échoué</value>
</data>
<data name="Passed_meters_count" xml:space="preserve">
<value>Mètres passés</value>
</data>
<data name="sensitivity" xml:space="preserve">
<value>sensibilité</value>
</data>
<data name="Tooltip_Q_end" xml:space="preserve">
<value>Débit obtenu à partir du compteur principal - fin</value>
</data>
<data name="Tooltip_Q_max" xml:space="preserve">
<value>Débit obtenu à partir du compteur principal - max.</value>
</data>
<data name="Tooltip_Q_min" xml:space="preserve">
<value>Débit obtenu à partir du compteur principal - min</value>
</data>
<data name="Tooltip_Q_start" xml:space="preserve">
<value>Débit obtenu à partir du compteur principal - départ</value>
</data>
<data name="Tooltip_P_dw_max" xml:space="preserve">
<value>Pression maximale à la sortie pendant le test</value>
</data>
<data name="Tooltip_P_dw_min" xml:space="preserve">
<value>Pression minimale à la sortie pendant le test</value>
</data>
<data name="Tooltip_P_up_max" xml:space="preserve">
<value>Pression maximale à l'entrée pendant l'essai</value>
</data>
<data name="Tooltip_P_up_min" xml:space="preserve">
<value>Pression minimale à l'entrée lors de l'essai</value>
</data>
<data name="Tooltip_T_di_max" xml:space="preserve">
<value>Température maximale au déviateur pendant le test</value>
</data>
<data name="Tooltip_T_di_min" xml:space="preserve">
<value>Température minimale au déviateur pendant le test</value>
</data>
<data name="Tooltip_T_dw_max" xml:space="preserve">
<value>Température maximale à la sortie pendant le test</value>
</data>
<data name="Tooltip_T_dw_min" xml:space="preserve">
<value>Température minimale à la sortie pendant le test</value>
</data>
<data name="Tooltip_T_up_max" xml:space="preserve">
<value>Température maximale à l'entrée pendant le test</value>
</data>
<data name="Tooltip_T_up_min" xml:space="preserve">
<value>Température minimale à l'entrée pendant l'essai</value>
</data>
<data name="Tooltip_P_de_max" xml:space="preserve">
<value>Différence de pression mesurée par delta P mètre - maximum pendant le test</value>
</data>
<data name="Tooltip_P_de_min" xml:space="preserve">
<value>Différence de pression mesurée par delta P mètre - minimum pendant l'essai</value>
</data>
<data name="Tooltip_Rho_Wa_calc" xml:space="preserve">
<value>Densité calculée de l'eau à partir d'une table ou d'une formule à la température d'étalonnage de la densité de l'eau (r)</value>
</data>
<data name="Tooltip_T_rho_0" xml:space="preserve">
<value>Température de l'échantillon d'eau lors de l'étalonnage de la densité de l'eau</value>
</data>
<data name="Tooltip_T_ln_ac" xml:space="preserve">
<value>Température réelle dans la ligne</value>
</data>
<data name="Tooltip_T_ln_avg" xml:space="preserve">
<value>Température moyenne dans la ligne pendant un test</value>
</data>
<data name="Tooltip_T_ln_en" xml:space="preserve">
<value>Température dans la ligne à la fin du test - 4 dernières mesures avant la fin</value>
</data>
<data name="Tooltip_T_ln_max" xml:space="preserve">
<value>Température maximale dans la ligne pendant le test</value>
</data>
<data name="Tooltip_T_ln_me" xml:space="preserve">
<value>Température moyenne dans la ligne pendant un test</value>
</data>
<data name="Tooltip_T_ln_min" xml:space="preserve">
<value>Température minimale dans la ligne pendant le test</value>
</data>
<data name="Tooltip_T_ln_st" xml:space="preserve">
<value>Température dans la ligne au début du test - 4 premières mesures après le début</value>
</data>
<data name="Unit" xml:space="preserve">
<value>Unité</value>
</data>
<data name="Procedure_description" xml:space="preserve">
<value>Description procédure</value>
</data>
<data name="Bench_ID" xml:space="preserve">
<value>ID banc</value>
</data>
<data name="Bench_name" xml:space="preserve">
<value>Nom banc</value>
</data>
<data name="Address" xml:space="preserve">
<value>Adresse</value>
</data>
<data name="Tooltip_E_rel_last" xml:space="preserve">
<value>Erreur relative d'un compteur dans un test précédent / en production</value>
</data>
<data name="Batch" xml:space="preserve">
<value>Lot</value>
</data>
<data name="repetition" xml:space="preserve">
<value>répétition</value>
</data>
<data name="Invalid_Q2_correction_factors" xml:space="preserve">
<value>Facteurs correction Q2 non valides</value>
</data>
<data name="Previous_step_is_missing_or_NOK" xml:space="preserve">
<value>L'étape précédente est manquante ou NOK</value>
</data>
<data name="Test_repetition_count_exceeded_upper_limit" xml:space="preserve">
<value>nombre répétitions test dépasse limite supérieure</value>
</data>
<data name="Wrong_iPerl_counting_direction" xml:space="preserve">
<value>Mauvais sens comptage iPerl</value>
</data>
<data name="Failed" xml:space="preserve">
<value>Échoué</value>
</data>
<data name="Passed" xml:space="preserve">
<value>Passé</value>
</data>
<data name="Test_in_progress" xml:space="preserve">
<value>Test en cours</value>
</data>
<data name="Counter_0" xml:space="preserve">
<value>Compteur {0}</value>
</data>
<data name="Date_and_time" xml:space="preserve">
<value>Date et heure</value>
</data>
<data name="Name" xml:space="preserve">
<value>Prénom</value>
</data>
<data name="Step" xml:space="preserve">
<value>Étape</value>
</data>
<data name="Workplace" xml:space="preserve">
<value>Lieu travail</value>
</data>
<data name="Workflow" xml:space="preserve">
<value>Flux travail</value>
</data>
<data name="Production_tracing_results" xml:space="preserve">
<value>Résultats production</value>
</data>
<data name="Code" xml:space="preserve">
<value>Code</value>
</data>
<data name="Part" xml:space="preserve">
<value>Partie</value>
</data>
<data name="All_results" xml:space="preserve">
<value>Tous résultats</value>
</data>
<data name="Graphs" xml:space="preserve">
<value>Graphiques</value>
</data>
<data name="No_water_meter" xml:space="preserve">
<value>Pas de compteur</value>
</data>
<data name="Serial_number_is_missing" xml:space="preserve">
<value>Numérotation en série</value>
</data>
</root>
+15 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;CEVAK_40;LANG_CS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
@@ -27,7 +27,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;CEVAK_40;LANG_CS</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>
@@ -217,6 +229,7 @@
<EmbeddedResource Include="Resources\Strings.de.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Strings.fr.resx" />
<EmbeddedResource Include="Resources\Strings.it.resx" />
<EmbeddedResource Include="Resources\Strings.pl.resx" />
<EmbeddedResource Include="Resources\Strings.resx">
+5 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
///
using System;
using System.Text;
@@ -30,6 +30,8 @@ namespace Results
case 10: return 38; /// WR14
case 11: return 39; /// WR18
case 12: return 40; /// WR19
case 13: return 41; /// WR20
case 14: return 42; /// WR21
default: return 0;
}
}
@@ -47,6 +49,8 @@ namespace Results
case 10: return "WR14";
case 11: return "WR18";
case 12: return "WR19";
case 13: return "WR20";
case 14: return "WR21";
default: return string.Empty;
}
}
+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")]
+306
View File
@@ -0,0 +1,306 @@
<?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>
<data name="Error" xml:space="preserve">
<value>Erreur</value>
</data>
<data name="Test_bench" xml:space="preserve">
<value>Banc essai</value>
</data>
<data name="Name" xml:space="preserve">
<value>Prénom</value>
</data>
<data name="CancelBtnText" xml:space="preserve">
<value>Annuler</value>
</data>
<data name="OkBtnText" xml:space="preserve">
<value>Ok</value>
</data>
<data name="ConfigureDatabaseText" xml:space="preserve">
<value>Configurer les bancs d'essai (mot de passe requis)</value>
</data>
<data name="ExitBtnText" xml:space="preserve">
<value>Quitter </value>
</data>
<data name="Procedure" xml:space="preserve">
<value>Procédure</value>
</data>
<data name="Test" xml:space="preserve">
<value>Tester</value>
</data>
<data name="Component" xml:space="preserve">
<value>Composant</value>
</data>
<data name="Configure" xml:space="preserve">
<value>Configurer</value>
</data>
<data name="Printer" xml:space="preserve">
<value>Imprimante</value>
</data>
<data name="Question" xml:space="preserve">
<value>Question</value>
</data>
<data name="Connection_string" xml:space="preserve">
<value>Chaîne connexion</value>
</data>
<data name="Add" xml:space="preserve">
<value>&amp;Ajouter &gt;</value>
</data>
<data name="Message" xml:space="preserve">
<value>Message</value>
</data>
<data name="Data" xml:space="preserve">
<value>Données</value>
</data>
<data name="Protocol" xml:space="preserve">
<value>Protocole</value>
</data>
<data name="Serial_Number" xml:space="preserve">
<value>Numéro série</value>
</data>
<data name="Language" xml:space="preserve">
<value>Langue</value>
</data>
<data name="Add_filter" xml:space="preserve">
<value>Ajouter filtre</value>
</data>
<data name="Clear_filters" xml:space="preserve">
<value>Effacer filtres</value>
</data>
<data name="Execute_query" xml:space="preserve">
<value>Exécuter ordre</value>
</data>
<data name="Export_query_results" xml:space="preserve">
<value>Résultats exportation</value>
</data>
<data name="Filters" xml:space="preserve">
<value>Filtres</value>
</data>
<data name="Format_of_results" xml:space="preserve">
<value>Configurer la sortie</value>
</data>
<data name="Load_filters" xml:space="preserve">
<value>charge filters</value>
</data>
<data name="Print_query_results" xml:space="preserve">
<value>Résultats impression</value>
</data>
<data name="Query_results" xml:space="preserve">
<value>Résultats requête</value>
</data>
<data name="Results_Browser" xml:space="preserve">
<value>Résultats Browser</value>
</data>
<data name="Save_filters" xml:space="preserve">
<value>Enregistrer filtres</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Réglages</value>
</data>
<data name="Test_benches" xml:space="preserve">
<value>Bancs essai</value>
</data>
<data name="RetryDatabaseText" xml:space="preserve">
<value>Recommencez</value>
</data>
<data name="Date" xml:space="preserve">
<value>Date</value>
</data>
<data name="From" xml:space="preserve">
<value>De</value>
</data>
<data name="To" xml:space="preserve">
<value>À</value>
</data>
<data name="Statistics" xml:space="preserve">
<value>Statistiques</value>
</data>
<data name="Columns" xml:space="preserve">
<value>colonnes</value>
</data>
<data name="Rows" xml:space="preserve">
<value>Lignes</value>
</data>
<data name="Select_a_filter" xml:space="preserve">
<value>Sélectionnez filtre</value>
</data>
<data name="Error_displaying_results" xml:space="preserve">
<value>Erreur affichage résultats</value>
</data>
<data name="All_files" xml:space="preserve">
<value>Tous fichiers</value>
</data>
<data name="Error_saving_file" xml:space="preserve">
<value>Fichier sauvegarde erreurs</value>
</data>
<data name="Error_serializing_filters" xml:space="preserve">
<value>Erreurs sérialisation filtres</value>
</data>
<data name="Query_files" xml:space="preserve">
<value>Fichiers requête</value>
</data>
<data name="No_program_settings_found" xml:space="preserve">
<value>Aucun paramètre programme trouvé</value>
</data>
<data name="Using_default_settings" xml:space="preserve">
<value>Utilisation valeurs par défaut</value>
</data>
<data name="Selected_language_not_supported" xml:space="preserve">
<value>Langue sélectionnée non prise en charge</value>
</data>
<data name="Using_English" xml:space="preserve">
<value>Utilisation anglais</value>
</data>
<data name="Warning" xml:space="preserve">
<value>Attention</value>
</data>
<data name="Count" xml:space="preserve">
<value>Compter</value>
</data>
<data name="Format" xml:space="preserve">
<value>Format</value>
</data>
<data name="Page_orientation" xml:space="preserve">
<value>Page orientation</value>
</data>
<data name="Yes_Portrait_No_Landscape" xml:space="preserve">
<value>Oui portrait non paysage</value>
</data>
<data name="Print" xml:space="preserve">
<value>Impression</value>
</data>
<data name="Configure_printer" xml:space="preserve">
<value>Configurer impréssion</value>
</data>
<data name="No_printer_defined" xml:space="preserve">
<value>Aucune imprimante définie</value>
</data>
<data name="Printing_failed" xml:space="preserve">
<value>Impression échouée</value>
</data>
<data name="Printing_completed" xml:space="preserve">
<value>Impression terminée</value>
</data>
<data name="Error_exporting_results" xml:space="preserve">
<value>Erreur exportation résultats</value>
</data>
<data name="Histograms" xml:space="preserve">
<value>histogrammes</value>
</data>
</root>
+4 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;CEVAK_40;LANG_CS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -31,7 +31,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;CEVAK_40;LANG_CS</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>
@@ -254,6 +255,7 @@
</Compile>
<EmbeddedResource Include="Resources\Strings.cs.resx" />
<EmbeddedResource Include="Resources\Strings.de.resx" />
<EmbeddedResource Include="Resources\Strings.fr.resx" />
<EmbeddedResource Include="Resources\Strings.it.resx" />
<EmbeddedResource Include="Resources\Strings.pl.resx">
<SubType>Designer</SubType>
+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
}
}
}
+14 -10
View File
@@ -1,14 +1,12 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TBF", "TBF\TBF.csproj", "{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}"
ProjectSection(ProjectDependencies) = postProject
{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF} = {EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}
{0C0A1F4D-1363-4544-A7C5-196C76D26CCA} = {0C0A1F4D-1363-4544-A7C5-196C76D26CCA}
EndProjectSection
EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "TBFSetup", "TBFSetup\TBFSetup.vdproj", "{4890DE5C-9F68-40D7-B075-92C8EAB79833}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Results", "Results\Results.csproj", "{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Config", "Config\Config.csproj", "{743DF7DB-C7B6-42EB-986D-0F485E5588E4}"
@@ -52,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
@@ -74,12 +74,6 @@ Global
{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}.Release|Mixed Platforms.Build.0 = Release|x86
{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}.Release|x86.ActiveCfg = Release|x86
{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}.Release|x86.Build.0 = Release|x86
{4890DE5C-9F68-40D7-B075-92C8EAB79833}.Debug|Any CPU.ActiveCfg = Debug
{4890DE5C-9F68-40D7-B075-92C8EAB79833}.Debug|Mixed Platforms.ActiveCfg = Debug
{4890DE5C-9F68-40D7-B075-92C8EAB79833}.Debug|x86.ActiveCfg = Debug
{4890DE5C-9F68-40D7-B075-92C8EAB79833}.Release|Any CPU.ActiveCfg = Release
{4890DE5C-9F68-40D7-B075-92C8EAB79833}.Release|Mixed Platforms.ActiveCfg = Release
{4890DE5C-9F68-40D7-B075-92C8EAB79833}.Release|x86.ActiveCfg = Release
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{9D0DCC88-DC81-47EB-9FDD-4C3907871BFB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
@@ -210,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
@@ -471,17 +471,20 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
///
void UpdateExclamation(int uiCtrlPos) /// uiCtrlPos = 0 .. TextBoxesCount-1
{
try
{
double startVolumeLtr = Utils.ParseUDouble(startTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
double endVolumeLtr = Utils.ParseUDouble(endTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
double err = 100.0 * (endVolumeLtr - startVolumeLtr - refVolume) / refVolume;
exclamations[uiCtrlPos].Visible = (err < warningLimLo) || (err > warningLimHi);
}
catch
{
exclamations[uiCtrlPos].Visible = false;
}
if ((mode == Tst.End) || (mode == Tst.Both))
{
try
{
double startVolumeLtr = Utils.ParseUDouble(startTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
double endVolumeLtr = Utils.ParseUDouble(endTextBoxes[uiCtrlPos].Text) * regReaders[phys2wm[uiCtrlPos] - 1].LtrsPerPulse;
double err = 100.0 * (endVolumeLtr - startVolumeLtr - refVolume) / refVolume;
exclamations[uiCtrlPos].Visible = (err < warningLimLo) || (warningLimHi < err);
}
catch
{
exclamations[uiCtrlPos].Visible = 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;
}
+1 -1
View File
@@ -19,7 +19,7 @@ namespace TBF.BenchControl.Elde
EnduranceCycleStop = 13,
}
#if FUZHOU_300 || IZRAEL_200 || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL || BADGER_VELKA_TRAT || PUCHONG_200 || SLM_50 || GENESIS || MALTA_WSD25 || SLM_END || WARSAW_END || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || DEWA_300 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
#if FUZHOU_300 || IZRAEL_200 || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL || BADGER_VELKA_TRAT || PUCHONG_200 || SLM_50 || GENESIS || MALTA_WSD25 || SLM_END || WARSAW_END || BERLIN || SLM_150 || PETERSBURG_50 || PETERSBURG_200 || DEWA_300 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50 || ALZIR_25
public enum StatusP : ulong
{
RefFlowMeterMask = 0x7, /// bits 0,1,2
+144 -152
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Text;
@@ -18,6 +18,8 @@ namespace TBF.BenchControl.Elde
private static readonly ILog log = LogManager.GetLogger(typeof(ControlBoardDev));
public override string ToString() { return string.Format("ControlBoard({0})", Cfg.ToString(1)); }
const int FiltersCount = 8;
readonly ControlBoardCfg controlBoardCfg;
///
@@ -43,7 +45,9 @@ namespace TBF.BenchControl.Elde
public StatusP StatusP { get { return controlCom.StatusP; } }
public int EtPulses(int wmNr1) { return controlCom.EtPulses(wmNr1); }
public int EtPulsesK { get { return controlCom.EtPulsesK; } }
public UInt16 WMeterPulses(int wmNr1) { return controlCom.WMeterPulses(wmNr1); }
public int EtPulses2 { get { return controlCom.EtPulses2; } } /// DEWA_300: pulses from I12
public int EtPulses3 { get { return controlCom.EtPulses3; } } /// DEWA_300: pulses from I13
public UInt16 WMeterPulses(int wmNr1) { return controlCom.WMeterPulses(wmNr1); }
public int WMeterReference(int wmNr0) { return controlCom.WMeterReference(wmNr0); }
public uint RegulValveDAC(int rvNr0) { return controlCom.RegulValveDAC(rvNr0); }
public float Pressure(int prsNr0) { return controlCom.Pressure(prsNr0); }
@@ -77,48 +81,22 @@ namespace TBF.BenchControl.Elde
bool previousEmergencyStop;
private int flowmeterNr4DiverterTest;
private bool scheduleDiverterToTank;
private bool scheduleDiverterToSink;
private bool scheduleReadDiverterTransition;
private bool pumpPowerChanged;
///
public void DiverterToTank(int flowmeterNr)
public void DiverterToTank(int flowMtrNr)
{
if (!scheduleDiverterToSink && !scheduleReadDiverterTransition && !emergencyStop)
{
flowmeterNr4DiverterTest = flowmeterNr;
scheduleDiverterToTank = true;
}
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Start, flowMtrNr, int.MaxValue, int.MaxValue, TestMethods.Diverter | TestMethods.Synchro, StopDevs.None));
}
///
public void DiverterToSink(int flowmeterNr)
public void DiverterToSink(int flowMtrNr)
{
if (!scheduleDiverterToTank && !scheduleReadDiverterTransition && !emergencyStop)
{
flowmeterNr4DiverterTest = flowmeterNr;
scheduleDiverterToSink = true;
}
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Stop, 0, 0, 0, TestMethods.Diverter,
StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation));
}
///
public void ReadDiverterTransition(int flowmeterNr)
public void ReadDiverterTransition(int flowMtrNr)
{
if (!scheduleDiverterToTank && !scheduleDiverterToSink && !emergencyStop)
{
flowmeterNr4DiverterTest = flowmeterNr;
scheduleReadDiverterTransition = true;
}
cbCommandQueue.Enqueue(new SendCommandArgs(Command.ReadDivTransition, flowMtrNr, 0, 0, TestMethods.Diverter, 0));
}
/// <summary> State of valves sent out - buffered by the last SendCommand() </summary>
public UInt128 Route { get { return benchModelRoute; } }
UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
///
/// Initialization data updated by constructors of children components
/// and sent to 'controlCom2panel' by SendCalibData() method.
@@ -150,10 +128,14 @@ namespace TBF.BenchControl.Elde
{100,500}, {100,500}, {100,500}, {100,500} };
public byte[] MeretRS485Address = new byte[4];
public float[] EtCalib = new float[8] { 1, 1, 1, 1, 1, 1, 1, 1 };
#elif MUNICH || TORINO_50 || BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || TORUN_50 || CEVAK_40 || TURA_IPERL || TURA_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
#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)
@@ -175,21 +157,22 @@ namespace TBF.BenchControl.Elde
public uint[] BalanceRange = new uint[2];
///
/// Private values sent by the last SendCommand()
///
bool sendCommandFlag;
Command cmd;
int refNr;
Queue<SendCommandArgs> cbCommandQueue;
/// <summary>
/// Route: 128-bit word representing the current state of all valves and pumps
/// </summary>
public UInt128 Route { get { return benchModelRoute; } }
UInt128 benchModelRoute;
int totalRefPulses;
int massRefPulses;
TestMethods testMethods;
UInt128 valvesToInvert; /// Route = valesToInvert ^ RequiredRouteWithoutInvertedVlaves
readonly UInt128 routeMask; /// This mask masks out virtual valves, routeMask is set in the constructor
int[] filters;
float[] FMFreq;
int regConst;
int shortImp;
StopDevs stopDevs;
/// <summary>
@@ -212,6 +195,8 @@ namespace TBF.BenchControl.Elde
/// <param name="power">Power (0.0f .. 100.0f)</param>
public void SetFMFreq(int index, float power)
{
bool pumpPowerChanged = false;
#if DN100 || MUNICH || FUZHOU_150
if ((FMFreq == null) || (FMFreq.Length != 2))
{
@@ -232,20 +217,27 @@ namespace TBF.BenchControl.Elde
}
#endif
if (index >= 0 && index < FMFreq.Length && FMFreq[index] != power)
{
FMFreq[index] = power;
if (index >= 0 && index < FMFreq.Length)
{
if (FMFreq[index] != power)
{
FMFreq[index] = power;
pumpPowerChanged = true; /// Forces sending a command using Command.None
pumpPowerChanged = true; /// Forces sending a command using Command.None
log.DebugFormat("FMFreq=[{0}{1}{2}{3}{4}{5}]",
FMFreq[0].ToString(),
(FMFreq.Length > 1) ? ("," + FMFreq[1].ToString()) : "",
(FMFreq.Length > 2) ? ("," + FMFreq[2].ToString()) : "",
(FMFreq.Length > 3) ? ("," + FMFreq[3].ToString()) : "",
(FMFreq.Length > 4) ? ("," + FMFreq[4].ToString()) : "",
(FMFreq.Length > 5) ? ("," + FMFreq[5].ToString()) : "");
}
string s = string.Format("FMFreq=[{0}{1}{2}{3}{4}{5}]", FMFreq[0].ToString(),
(FMFreq.Length > 1) ? ("," + FMFreq[1].ToString()) : "",
(FMFreq.Length > 2) ? ("," + FMFreq[2].ToString()) : "",
(FMFreq.Length > 3) ? ("," + FMFreq[3].ToString()) : "",
(FMFreq.Length > 4) ? ("," + FMFreq[4].ToString()) : "",
(FMFreq.Length > 5) ? ("," + FMFreq[5].ToString()) : "");
log.Warn(s);
}
}
else
{
log.ErrorFormat("Wrong FM pump: index = {0}, power = {1}", index, power);
}
}
@@ -290,6 +282,9 @@ namespace TBF.BenchControl.Elde
{
controlBoardCfg = cfg as ControlBoardCfg;
cbCommandQueue = new Queue<SendCommandArgs>();
lastSentFilters = new uint[FiltersCount];
#if DN100 || MUNICH || FUZHOU_150
FMFreq = new float[2] { 0, 0 }; /// Nr. of pumps: Fuzhou150=2, Fuzhou300=6, newer=6
#elif SLM_END || WARSAW_END
@@ -328,7 +323,7 @@ namespace TBF.BenchControl.Elde
#else /// all newer benches
ControlComponent_Torino2015.UserControl1 ctrlBrdComponent,
#endif
UInt128 valvesToInvert,
UInt128 valvesToInvert,
double[] tankCapacities)
{
this.valvesToInvert = valvesToInvert;
@@ -377,7 +372,9 @@ namespace TBF.BenchControl.Elde
log.FatalFormat("Successfully initialized device {0}", ToString());
}
/// <summary>Run this device</summary>
/// <summary>
/// Run this device
/// </summary>
public void RunDeviceBefore()
{
if (DebugLevel == DebugMode.Simulate) return;
@@ -398,95 +395,99 @@ namespace TBF.BenchControl.Elde
{
UiBridge.Bridge.OnEmergencyStopChanged(this,UiBridge.EmergencyStopEventArgs.State.CloseForm);
}
if (emergencyStop)
{
/// SendCommand() arguments to clear the emergency stop state
sendCommandFlag = true;
this.refNr = 0;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.cmd = Command.Stop;
this.testMethods = 0;
this.stopDevs = StopDevs.All;
}
else if (scheduleDiverterToTank)
{
/// Reset all SendCommand() arguments
sendCommandFlag = true;
this.cmd = Command.Start;
this.refNr = flowmeterNr4DiverterTest;
this.totalRefPulses = int.MaxValue;
this.massRefPulses = int.MaxValue;
this.testMethods = TestMethods.Diverter;
this.stopDevs = 0;
scheduleDiverterToTank = false;
}
else if (scheduleDiverterToSink)
{
/// Reset all SendCommand() arguments
sendCommandFlag = true;
this.cmd = Command.Stop;
this.refNr = flowmeterNr4DiverterTest;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.testMethods = TestMethods.Diverter;
this.stopDevs = StopDevs.Diverter;
scheduleDiverterToSink = false;
}
else if (scheduleReadDiverterTransition)
{
/// Reset all SendCommand() arguments
sendCommandFlag = true;
this.cmd = Command.ReadDivTransition;
this.refNr = flowmeterNr4DiverterTest;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.testMethods = TestMethods.Diverter;
this.stopDevs = 0;
scheduleReadDiverterTransition = false;
}
else if (pumpPowerChanged)
{
/// Reset all SendCommand() arguments
sendCommandFlag = true;
this.cmd = Command.None;
pumpPowerChanged = false;
}
else
{
/// Reset all SendCommand() arguments
sendCommandFlag = false;
this.cmd = Command.None;
this.refNr = 0;
this.totalRefPulses = 0;
this.massRefPulses = 0;
this.testMethods = 0;
this.stopDevs = 0;
}
if (this.filters == null) this.filters = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, };
}
/// <summary>Run this device</summary>
///
/// Used in RunDeviceAfter() when sending commands
///
UInt128 lastSentRoute;
uint[] lastSentFilters;
float[] lastSentFMFreq;
int lastsentRegConst;
int lastSentShortImp;
/// <summary>
/// Run this device
/// </summary>
public void RunDeviceAfter()
{
if (DebugLevel == DebugMode.Simulate) return;
UpdateWeights();
uint[] uintFilters = new uint[8];
for (int i = 0; i < 8; i++)
/// Modify queue in case of emergency stop
if (emergencyStop && !previousEmergencyStop)
{
uintFilters[i] = (filters.Length > i) ? (uint)filters[i] : uintFilters[i - 1];
/// SendCommand() arguments to clear the emergency stop state
cbCommandQueue.Clear();
cbCommandQueue.Enqueue(new SendCommandArgs(Command.Stop, 0, 0, 0, 0, StopDevs.All));
}
///
if (sendCommandFlag)
/// Prepare uintFilters array and evaluate changes
uint[] uintFilters = new uint[FiltersCount];
uintFilters[0] = (filters != null && filters.Length > 0) ? (uint)filters[0] : 0;
bool filtersAreDifferent = (uintFilters[0] != lastSentFilters[0]);
for (int i = 1; i < FiltersCount; i++)
{
controlCom.SendCommand(cmd, refNr, (benchModelRoute & routeMask),
totalRefPulses, massRefPulses, testMethods,
uintFilters, FMFreq, regConst, shortImp, stopDevs);
uintFilters[i] = (filters != null && filters.Length > i) ? (uint)filters[i] : uintFilters[i - 1];
filtersAreDifferent |= (uintFilters[i] != lastSentFilters[i]);
}
/// Evaluate FMFreq changes
bool fmFreqsAreDifferent = false;
if ((FMFreq == null) || (lastSentFMFreq == null) || (FMFreq.Length != lastSentFMFreq.Length))
{
fmFreqsAreDifferent = true;
}
else
{
for (int i = 0; i < FMFreq.Length; i++)
{
if (FMFreq[i] != lastSentFMFreq[i])
{
fmFreqsAreDifferent = true;
break;
}
}
}
if (cbCommandQueue.Count > 0)
{
///
/// There is a command in the queue
///
controlCom.SendCommand(cbCommandQueue.Dequeue(), (benchModelRoute & routeMask), uintFilters, FMFreq, regConst, shortImp);
lastSentRoute = (benchModelRoute & routeMask);
lastsentRegConst = regConst;
lastSentShortImp = shortImp;
/// Deep copy of arrays lastSentFilters and lastSentFMFreq
if ((lastSentFilters == null) || (lastSentFilters.Length != uintFilters.Length)) lastSentFilters = new uint[(uintFilters == null) ? 0 : uintFilters.Length];
for (int i = 0; i < lastSentFilters.Length; i++) lastSentFilters[i] = uintFilters[i];
if ((lastSentFMFreq == null) || (lastSentFMFreq.Length != FMFreq.Length)) lastSentFMFreq = new float[(FMFreq == null) ? 0 : FMFreq.Length];
for (int i = 0; i < lastSentFMFreq.Length; i++) lastSentFMFreq[i] = FMFreq[i];
}
else if (((benchModelRoute & routeMask) != lastSentRoute) ||
filtersAreDifferent ||
fmFreqsAreDifferent ||
(lastsentRegConst != regConst) ||
(lastSentShortImp != shortImp))
{
///
/// Command queue is mepty, but 'route', pump frequency, PID coef., filters or shortImp have changed
///
controlCom.SendCommand(new SendCommandArgs(Command.None, 0, 0, 0, 0, 0), (benchModelRoute & routeMask), uintFilters, FMFreq, regConst, shortImp);
lastSentRoute = (benchModelRoute & routeMask);
lastsentRegConst = regConst;
lastSentShortImp = shortImp;
/// Deep copy of arrays lastSentFilters and lastSentFMFreq
if ((lastSentFilters == null) || (lastSentFilters.Length != uintFilters.Length)) lastSentFilters = new uint[(uintFilters == null) ? 0 : uintFilters.Length];
for (int i = 0; i < lastSentFilters.Length; i++) lastSentFilters[i] = uintFilters[i];
if ((lastSentFMFreq == null) || (lastSentFMFreq.Length != FMFreq.Length)) lastSentFMFreq = new float[(FMFreq == null) ? 0 : FMFreq.Length];
for (int i = 0; i < lastSentFMFreq.Length; i++) lastSentFMFreq[i] = FMFreq[i];
}
controlCom.RunDeviceAfter();
@@ -510,25 +511,17 @@ namespace TBF.BenchControl.Elde
/// </summary>
/// <param name="cmd">See ControlBoard.Command enum</param>
/// <param name="refFlowmtrNr">Number of the etalon/reference (1..5)</param>
/// <param name="route">Route: 64-bit installation specific number</param>
/// <param name="route">State of valves, 128-bit word</param>
/// <param name="totalRefPulses">kolko impulzov ma trvat skuska</param>
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
/// <param name="filterConstant">0 = No filtering (0..255)</param>
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
public void SendCommand(Command cmd, int refFlowmtrNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods, StopDevs stopDevs)
public void SendCommand(Command cmd, int refFlowmtrNr, int totalRefPulses, int massRefPulses,
TestMethods testMethods, StopDevs stopDevs)
{
this.cmd = cmd;
this.refNr = refFlowmtrNr;
this.benchModelRoute = route;
this.totalRefPulses = totalRefPulses;
this.massRefPulses = massRefPulses;
this.testMethods = testMethods;
this.stopDevs = stopDevs;
sendCommandFlag = true;
cbCommandQueue.Enqueue(new SendCommandArgs(cmd, refFlowmtrNr, totalRefPulses, massRefPulses, testMethods, stopDevs));
}
/// <summary>
@@ -543,7 +536,6 @@ namespace TBF.BenchControl.Elde
benchModelRoute = (((benchModelRoute ^ valvesToInvert) | valvesToOpen) & (~valvesToClose)) ^ valvesToInvert;
foreach (var extV in extendedValves) extV.UpdateRoute(ref benchModelRoute);
log.DebugFormat("SetValves(x,x), new route = {0}", Utils.RouteToStr(benchModelRoute));
sendCommandFlag = true;
return oldRoute ^ benchModelRoute;
}
+18 -18
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -28,6 +28,8 @@ namespace TBF.BenchControl.Elde
}
public int EtPulsesK { get { return 1; } }
public int EtPulses2 { get { return 0; } }
public int EtPulses3 { get { return 0; } }
double[] errFactor = new double[Config.Data.WMsCount + 1]; /// Internal
double[] wMeterPulsesF = new double[Config.Data.WMsCount + 1]; /// Internal
@@ -167,7 +169,7 @@ namespace TBF.BenchControl.Elde
/// </summary>
/// <param name="cmd">See ControlBoard.Command enum</param>
/// <param name="refFlowmtrNr">Number of the etalon/reference (1..5)</param>
/// <param name="route">Route: 64-bit installation specific number</param>
/// <param name="route">State of valves, 128-bit word</param>
/// <param name="refPulses">kolko impulzov ma trvat skuska</param>
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
/// <param name="filterConstant">0 = No filtering (0..255)</param>
@@ -175,17 +177,15 @@ namespace TBF.BenchControl.Elde
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
public void SendCommand(Command cmd, int refFlowmtrNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
public void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
{
log.InfoFormat("SendCommand(Cmd={0},Ref#={1},Route={2} {3} {4} {5},TotalPls={6},MassPls={7},TstM={8},filt={9},FM=[{10}{11}{12}{13}{14}{15}],Reg={16},ShrtImp={17},Stop={18})",
cmd, refFlowmtrNr, /// 0, 1
((route >> 48) & 0xFFFF).ToString("X4"), /// 2
((route >> 32) & 0xFFFF).ToString("X4"), /// 3
((route >> 16) & 0xFFFF).ToString("X4"), /// 4
(route & 0xFFFF).ToString("X4"), /// 5
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 6, 7, 8, 9
sendCommandArgs.Cmd, sendCommandArgs.RefFlowmtrNr, /// 0, 1
((route >> 48) & 0xFFFF).ToString("X4"), /// 2
((route >> 32) & 0xFFFF).ToString("X4"), /// 3
((route >> 16) & 0xFFFF).ToString("X4"), /// 4
(route & 0xFFFF).ToString("X4"), /// 5
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 6, 7, 8, 9
fmFreq[0].ToString(), /// 10
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 11
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 12
@@ -197,8 +197,8 @@ namespace TBF.BenchControl.Elde
/// Simulation
///
Command lastCmd = this.cmd;
this.cmd = cmd;
this.refFlowmtrNr = refFlowmtrNr;
this.cmd = sendCommandArgs.Cmd;
this.refFlowmtrNr = sendCommandArgs.RefFlowmtrNr;
#if FUZHOU_300
///
@@ -212,14 +212,14 @@ namespace TBF.BenchControl.Elde
log.DebugFormat("SendCommand route = {0}", Utils.RouteToStr(route));
#endif
TestBenchSim.SimRoute = this.simRoute = route;
this.totalRefPulses = totalRefPulses;
this.massRefPulses = massRefPulses;
this.testMethods = testMethods;
this.filterConstants = filterConstants;
this.totalRefPulses = sendCommandArgs.TotalRefPulses;
this.massRefPulses = sendCommandArgs.MassRefPulses;
this.testMethods = sendCommandArgs.TestMethods;
this.stopDevs = sendCommandArgs.StopDevs;
this.filterConstants = filterConstants;
this.FMFreq = fmFreq;
this.regConst = regConst;
this.shortImp = shortImp;
this.stopDevs = stopDevs;
#pragma warning disable
statusP = (StatusP)(((ulong)statusP & (ulong)0xFFFFFFFFFFFFFFF8L) | (ulong)refFlowmtrNr);
+113 -84
View File
@@ -20,36 +20,42 @@ namespace TBF.BenchControl.Elde
public StatusP StatusP { get { return (StatusP)ctrlBrdComponent.StatusP; } }
#if DN100 || MUNICH || FUZHOU_150
public double ReferenceFreq { get { return 1000.0f * ctrlBrdComponent.referenceFreq; } } /// In [Hz] 0..2500, nom.=2000
public double ReferenceFreq { get { return 1000.0f * ctrlBrdComponent.referenceFreq; } } /// Returns in [Hz] 0..2500, nom.=2000
public double ReferenceFreqs(int i) { return 0; }
#else /// all newer benches
#else
/// All newer benches
public double ReferenceFreq { get { return 1000.0 * ctrlBrdComponent.referenceFreq[0]; } } /// Returns in [Hz] 0..2500, nom.=2000
///
/// <summary>
/// In case of I11, I12
/// referenceFreq[0] = I11 + I12
/// referenceFreq[1] = I11
/// referenceFreq[2] = I12
/// cBrd.referenceFreq[0] = I11 + I12
/// cBrd.referenceFreq[1] = I11
/// cBrd.referenceFreq[2] = I12
/// otherwise
/// referenceFreq[0] = I2 or I3 or I4
/// cBrd.referenceFreq[0] = I2 or I3 or I4
/// </summary>
public double ReferenceFreq { get { return 1000.0 * ctrlBrdComponent.referenceFreq[0]; } } /// In [Hz] 0..2500, nom.=2000 ///
/// <returns>Reference frequency in Hz</returns>
public double ReferenceFreqs(int i)
{
if ((i >= 0) && (i < ctrlBrdComponent.referenceFreq.Length))
{
return 1000.0 * ctrlBrdComponent.referenceFreq[0]; /// In [Hz] 0..2500, nom.=2000
}
else return 0;
return ((i >= 0) && (i < ctrlBrdComponent.referenceFreq.Length)) ? (1000.0 * ctrlBrdComponent.referenceFreq[i]) : 0;
}
#endif
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; } }
#endif
#if DEWA_300
public int EtPulses2 { get { return (int)ctrlBrdComponent.EtPulses2; } }
public int EtPulses3 { get { return (int)ctrlBrdComponent.EtPulses3; } }
#else
public int EtPulses2 { get { return 0; } }
public int EtPulses3 { get { return 0; } }
#endif
public UInt16 WMeterPulses(int wmNr1) { return (UInt16)ctrlBrdComponent.wMeterPuls[wmNr1]; }
public int WMeterReference(int wmNr0) { return (int)ctrlBrdComponent.wMeterReference[wmNr0]; }
@@ -63,7 +69,7 @@ namespace TBF.BenchControl.Elde
}
public float Pressure(int prsNr0) { return ctrlBrdComponent.pressure[prsNr0]; }
public float Temperature(int tmpNr0) { return ctrlBrdComponent.temperature[tmpNr0]; }
public float Temperature(int tmpNr0) { return (tmpNr0 >= 0 && tmpNr0 < ctrlBrdComponent.temperature.Length) ? ctrlBrdComponent.temperature[tmpNr0] : 0; }
public RegulValveState RegulValveState(int rvNr1) { return (RegulValveState)ctrlBrdComponent.rValveStatus[rvNr1 - 1]; }
#if GENESIS || BERLIN || PETERSBURG_200 || DEWA_300
public UInt128 RRoute { get { return ((UInt128)ctrlBrdComponent.rRouteH << 64) | (UInt128)ctrlBrdComponent.rRoute; } }
@@ -71,7 +77,7 @@ namespace TBF.BenchControl.Elde
public UInt128 RRoute { get { return ctrlBrdComponent.rRoute; } }
#endif
#if GENESIS || KEMPNO_50 || KRAKOW_50 || BAHRAIN_50 || BADGER_STREDNA_TRAT || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50 || DEWA_300 || PUCHONG_200 || TURA_IPERL_NEW
#if GENESIS || KEMPNO_50 || KRAKOW_50 || BAHRAIN_50 || BADGER_STREDNA_TRAT || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50 || DEWA_300 || PUCHONG_200 || TURA_IPERL_NEW || ALZIR_25
public uint DivTime(int id) { return ctrlBrdComponent.divTime[id]; }
public void SetDivLimit(int divNo, uint limLoPct, uint limHiPct)
{
@@ -104,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];
@@ -131,7 +137,7 @@ namespace TBF.BenchControl.Elde
public uint[] WMeterCont { get { return new uint[3]; } } /// Dummy
#endif
#if KEMPNO_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || FUZHOU_100 || CEVAK_200 || IZRAEL_50
#if KEMPNO_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || FUZHOU_100 || CEVAK_200 || IZRAEL_50 || ALZIR_25
public float ValveOpenCloseTime { get { return ctrlBrdComponent.ValveMoveTime[0]; } }
#else
public float ValveOpenCloseTime { get { return 0.001f; } }
@@ -254,7 +260,7 @@ namespace TBF.BenchControl.Elde
ctrlBrdComponent.ExternalCom = true;
#if SENTEC || CEVAK_200 || FUZHOU_100 || IZRAEL_25
#if SENTEC || CEVAK_200 || FUZHOU_100 || IZRAEL_25 || ALZIR_25
ctrlBrdComponent.SendCalibData(rvCalib, meretA, (byte)usedCom, tempCalib, etCalib, divEdge, balanceRange, meretProtocol);
#else
ctrlBrdComponent.SendCalibData(rvCalib, meretA, (byte)usedCom, tempCalib, etCalib, divEdge, balanceRange);
@@ -301,63 +307,35 @@ namespace TBF.BenchControl.Elde
/// <summary>
/// Sends a command to the control board.
/// </summary>
/// <param name="cmd">See ControlBoard.Command enum</param>
/// <param name="refFlowMeterNr">Reference flow meter number (1..5)</param>
/// <param name="route">Route: 64-bit installation specific number</param>
/// <param name="refPulses">Test duration as a number of reference flow meter pulses</param>
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
/// <param name="filterConstants">0 = No filtering (0..255)</param>
/// <param name="FMFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
/// <param name="regConst">Coefficient used to control the regulation valve (1..100)</param>
/// <param name="sendCommandArgs">Arguments</param>
/// <param name="route">State of valves, 128-bit word</param>
/// <param name="filterConstants">Array with length=8 of filter costants (0..255, 0 = no filtering)</param>
/// <param name="fmFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
/// <param name="regConst">PID coefficient for flow control</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
public void SendCommand(Command cmd, int refFlowMeterNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
public void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
{
if (Program.MainWnd.InvokeRequired)
{
/// When SendCommand(...) called from the worker thread
object[] args = new object[] { cmd, refFlowMeterNr, route, totalRefPulses, massRefPulses,
testMethods, filterConstants, fmFreq, regConst, shortImp, stopDevs };
Program.MainWnd.Invoke((SendCommandDlgt)DoSendCommand, args); /// Component was created in UI thread - use Invoke()
/// From another thread ... use Invoke()
Program.MainWnd.Invoke((SendCommandDlgt)DoSendCommand, new object[] { sendCommandArgs, route, filterConstants, fmFreq, regConst, shortImp });
}
else
{
/// When SendCommand(...) called from the UI thread
DoSendCommand(cmd, refFlowMeterNr, route, totalRefPulses, massRefPulses, testMethods,
filterConstants, fmFreq, regConst, shortImp, stopDevs);
/// Call DoSendCommand() directly
DoSendCommand(sendCommandArgs, route, filterConstants, fmFreq, regConst, shortImp);
}
}
///
delegate void SendCommandDlgt(Command cmd, int refFlowmtrNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
delegate void SendCommandDlgt(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp);
///
private void DoSendCommand(Command cmd, int refFlowMeterNr, UInt128 route,
int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs)
private void DoSendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp)
{
//TBF.UiBridge.Bridge.OnLog(this, string.Format("{0} SendCommand({1}, {2}, {3}, {4}, {5}, {6}, [{7},{8}], {9}, {10}, {11})\r\n",
// DateTime.Now.ToLongTimeString(),
// cmd,
// refFlowMeterNr,
// route.ToString("X"),
// totalRefPulses,
// testMethods,
// filterConstant,
// fmFreq[0],
// fmFreq[1],
// regConst,
// shortImp,
// stopDevs));
#if FUZHOU_300
///
/// The following code deals with the situation that all FM controlled pumps share bit #39.
/// In settings the bits of pumps should be sent as follows: P1=50, P2=51, P3=52, P4=53, P5=54 and P7=55
/// (in FUZHOU_300 the FM pump bit should be set set to value FMIndex+50).
/// (in FUZHOU_300 the FM pump bit should be set to value FMIndex+50).
///
bool bit39 = (route & 0x00FC000000000000) != 0; /// true if any of bits 50 through 55 is set
route = route & 0xFF03FFFFFFFFFFFF;
@@ -374,49 +352,100 @@ namespace TBF.BenchControl.Elde
route = route & (~(((UInt128)1) << 80));
#endif
log.InfoFormat("DoSendCommand(Cmd={0},Ref#={1},Route={2},TotalPls={3},MassPls={4},TM={5},filt={6},FM=[{7}{8}{9}{10}{11}{12}],Reg={13},ShrtImp={14},Stop={15})",
cmd, /// 0
refFlowMeterNr, /// 1
Utils.RouteToStr(route), /// 2
totalRefPulses, massRefPulses, testMethods, filterConstants, /// 3, 4, 5, 6
log.InfoFormat("DoSendCommand(Cmd={0},Ref#={1},Route={2},TotalPls={3},MassPls={4},TM={5},filt={6},FM=[{7}{8}{9}{10}{11}{12}],Reg={13},ShrtImp={14},Stop={15})",
sendCommandArgs.Cmd, /// 0
sendCommandArgs.RefFlowmtrNr, /// 1
Utils.RouteToStr(route), /// 2
sendCommandArgs.TotalRefPulses,
sendCommandArgs.MassRefPulses,
sendCommandArgs.TestMethods,
filterConstants, /// 3, 4, 5, 6
fmFreq[0].ToString(), /// 7
(fmFreq.Length > 1) ? ("," + fmFreq[1].ToString()) : "", /// 8
(fmFreq.Length > 2) ? ("," + fmFreq[2].ToString()) : "", /// 9
(fmFreq.Length > 3) ? ("," + fmFreq[3].ToString()) : "", /// 10
(fmFreq.Length > 4) ? ("," + fmFreq[4].ToString()) : "", /// 11
(fmFreq.Length > 5) ? ("," + fmFreq[5].ToString()) : "", /// 12
regConst, shortImp, stopDevs); /// 13, 14, 15
regConst, /// 13
shortImp, /// 14
sendCommandArgs.StopDevs); /// 15
#if DN100 || MUNICH
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq[0], (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)route,
(uint)sendCommandArgs.TotalRefPulses,
(uint)sendCommandArgs.TestMethods,
Convert.ToSingle(filterConstants[0]),
fmFreq[0],
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#elif BADGER_MALA_TRAT || BADGER_VELKA_TRAT || FUZHOU_50 || FUZHOU_150 || FUZHOU_300 || IZRAEL_200 || TORINO_50 || TORUN_50 || CEVAK_40 || MURES_40
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, (uint)totalRefPulses, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)route,
(uint)sendCommandArgs.TotalRefPulses,
(uint)sendCommandArgs.TestMethods,
Convert.ToSingle(filterConstants[0]),
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#elif BERLIN || SLM_150 || PETERSBURG_200
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF), (ulong)(route >> 64), pulsesArr, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF),
(ulong)(route >> 64),
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
(uint)sendCommandArgs.TestMethods,
Convert.ToSingle(filterConstants[0]),
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#elif GENESIS || DEWA_300
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF), (ulong)(route >> 64), pulsesArr, (uint)testMethods,
filterConstants, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
#elif JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, pulsesArr, (uint)testMethods,
filterConstants, fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)(route & (UInt128)0xFFFFFFFFFFFFFFFF),
(ulong)(route >> 64),
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
(uint)sendCommandArgs.TestMethods,
filterConstants,
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#elif JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || SENTEC || FUZHOU_100 || CEVAK_200 || IZRAEL_50 || ALZIR_25
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)route,
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
(uint)sendCommandArgs.TestMethods,
filterConstants,
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#else /// if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL || MALTA_WSD25 || SLM_50 || SLM_END || WARSAW_END || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || RUM_MOB || KRAKOW_50 || BADGER_STREDNA_TRAT || PUCHONG_200
uint[] pulsesArr = new uint[] { (uint)totalRefPulses, (uint)massRefPulses };
ctrlBrdComponent.SendCommand((uint)cmd, (byte)refFlowMeterNr, (ulong)route, pulsesArr, (uint)testMethods,
Convert.ToSingle(filterConstants[0]), fmFreq, (uint)regConst, (uint)shortImp, (uint)stopDevs);
ctrlBrdComponent.SendCommand((uint)sendCommandArgs.Cmd,
(byte)sendCommandArgs.RefFlowmtrNr,
(ulong)route,
new uint[] { (uint)sendCommandArgs.TotalRefPulses, (uint)sendCommandArgs.MassRefPulses },
(uint)sendCommandArgs.TestMethods,
Convert.ToSingle(filterConstants[0]),
fmFreq,
(uint)regConst,
(uint)shortImp,
(uint)sendCommandArgs.StopDevs);
#endif
log.DebugFormat("DoSendCommand() Route = {0}", Utils.RouteToStr(route));
if (lastRoute != route) /// This is to update the MainWnd status bar on changes only
if (lastRoute != route) /// This is to update the MainWnd status bar on changes only
{
UInt128 rRoute = RRoute;
Program.MainWnd.UpdateRoute(string.Format("{0} ({1})", Utils.RouteToStr(route), Utils.RouteToStr(rRoute)));
lastRoute = route;
lastRoute = route;
}
}
+2 -2
View File
@@ -56,7 +56,7 @@ namespace TBF.BenchControl.Elde
public void Start()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(commandOnStartOp, 0, controlBoard.Route, 0, 0, testMethod, StopDevs.None);
controlBoard.SendCommand(commandOnStartOp, 0, 0, 0, testMethod, StopDevs.None);
opState = OpState.StartingCommand;
}
@@ -99,7 +99,7 @@ namespace TBF.BenchControl.Elde
if (commandOnStopOp != Command.None)
{
controlBoard.SyncRoute();
controlBoard.SendCommand(commandOnStopOp, 0, controlBoard.Route, 0, 0, testMethod, StopDevs.None);
controlBoard.SendCommand(commandOnStopOp, 0, 0, 0, testMethod, StopDevs.None);
}
}
}
@@ -17,6 +17,15 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
readonly ControlBoardDev controlBoard;
public int Position
{
get
{
int firstDigitPos = Name.IndexOfAny(new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' });
int position;
return (firstDigitPos < 0) ? 0 : (int.TryParse(Name.Substring(firstDigitPos), out position) ? position : 0);
}
}
public Config.Entities.RegisterReaderType RegisterReaderType { get { return Config.Entities.RegisterReaderType.Manual; } }
public double PulsesPerLtr { get { return registerReaderCfg.ProcParams.PulsesPerLtr; } }
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); } }
@@ -22,8 +22,6 @@ namespace TBF.BenchControl.Elde.FlowMeter
public double LtrPerPulseCorrected(double flow, int rangeIx)
{
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
/// Apply correction
var rangeCorrections = new List<Config.Entities.MeasurementCorrection>();
foreach (var corr in Corrections)
@@ -28,22 +28,67 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
public double NominalFlow { get { return nominalFlow; } }
public double LtrPerPulse { get { return ltrPerPulse; } }
double[] refFreq;
double[] refFreq; /// 0..sum, 1..I11, 2..I12, 3..I13
int[] refPulses;
public double LtrPerPulseCorrected(double flow, int rangeIx)
{
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
log.DebugFormat("LtrPerPulseCorrected({0}, {1}) started", flow, rangeIx);
refFreq[0] = controlBoard.ReferenceFreqs(0);
refFreq[1] = controlBoard.ReferenceFreqs(1);
refFreq[2] = controlBoard.ReferenceFreqs(2);
refFreq[3] = controlBoard.ReferenceFreqs(3);
log.DebugFormat("refFreq[] = ({0}, {1}, {2}, {3})", refFreq[0], refFreq[1], refFreq[2], refFreq[3]);
refFreq[1] = refFreq[0] - refFreq[2] - refFreq[3];
double ltrPerPulseCorrected = 0;
if (flowMeter1 != null) ltrPerPulseCorrected += refFreq[1] * flowMeter1.LtrPerPulseCorrected(flow * refFreq[1] / refFreq[0], rangeIx);
if (flowMeter2 != null) ltrPerPulseCorrected += refFreq[2] * flowMeter2.LtrPerPulseCorrected(flow * refFreq[2] / refFreq[0], rangeIx);
if (flowMeter3 != null) ltrPerPulseCorrected += refFreq[3] * flowMeter3.LtrPerPulseCorrected(flow * refFreq[3] / refFreq[0], rangeIx);
return ltrPerPulseCorrected / refFreq[0];
refPulses[0] = controlBoard.EtPulses(0);
refPulses[2] = controlBoard.EtPulses2;
refPulses[3] = controlBoard.EtPulses3;
refPulses[1] = refPulses[0] - refPulses[2] - refPulses[3];
log.DebugFormat("refPulses[] = ({0}, {1}, {2}, {3})", refPulses[0], refPulses[1], refPulses[2], refPulses[3]);
double flow1, flow2, flow3;
double contribution1, contribution2, contribution3;
if (refPulses[0] != 0)
{
/// Division by zero prevented inside this 'if'
double ltrPerPulseCorrected = 0;
if (flowMeter1 != null)
{
double ratio = (double)refPulses[flowMeter1.Idx1] / (double)refPulses[0];
flow1 = flow * ratio;
contribution1 = flowMeter1.LtrPerPulseCorrected(flow1, rangeIx) * ratio;
ltrPerPulseCorrected += contribution1;
log.DebugFormat("flowmeter1 = {0}, flow1 = {1}, contribution1 = {2}", flowMeter1.Name, flow1, contribution1);
}
if (flowMeter2 != null)
{
double ratio = (double)refPulses[flowMeter2.Idx1] / (double)refPulses[0];
flow2 = flow * ratio;
contribution2 = flowMeter2.LtrPerPulseCorrected(flow2, rangeIx) * ratio;
ltrPerPulseCorrected += contribution2;
log.DebugFormat("flowmeter2 = {0}, flow2 = {1}, contribution2 = {2}", flowMeter2.Name, flow2, contribution2);
}
if (flowMeter3 != null)
{
double ratio = (double)refPulses[flowMeter3.Idx1] / (double)refPulses[0];
flow3 = flow * ratio;
contribution3 = flowMeter3.LtrPerPulseCorrected(flow3, rangeIx) * ratio;
ltrPerPulseCorrected += contribution3;
log.DebugFormat("flowmeter3 = {0}, flow3 = {1}, contribution3 = {2}", flowMeter3.Name, flow3, contribution3);
}
log.DebugFormat("LtrPerPulseCorrected() returns {0}", ltrPerPulseCorrected);
return ltrPerPulseCorrected;
}
else
{
log.DebugFormat("LtrPerPulseCorrected() returns 1");
return 1;
}
}
@@ -56,7 +101,9 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
public FlowMeter()
{
}
refFreq = new double[4];
refPulses = new int[4];
}
public FlowMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
@@ -80,6 +127,7 @@ namespace TBF.BenchControl.Elde.FlowMeterDewa
ltrPerPulse = nominalFlow / (flowMetersCount * 7200.0); /// Nominal freq. is flowMetersCount * 2000 Hz (2000, 4000 or 6000 Hz)
refFreq = new double[4];
refPulses = new int[4];
log.Debug(this.ToString());
}
@@ -22,8 +22,6 @@ namespace TBF.BenchControl.Elde.FlowMeterTriplet
public double LtrPerPulseCorrected(double flow, int rangeIx)
{
if (flow < 0.1 * NominalFlow) return LtrPerPulse; /// No correction for small flow
/// Apply correction
double correctedFlow = Config.Formulas.CorrectedValue(flow, Corrections);
return (LtrPerPulse * correctedFlow / flow);
+11 -15
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2015 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using Dirichlet.Numerics;
@@ -11,7 +11,9 @@ namespace TBF.BenchControl.Elde
StatusP StatusP { get; }
int EtPulses(int wmNr1);
int EtPulsesK { get; }
UInt16 WMeterPulses(int wmNr1);
int EtPulses2 { get; }
int EtPulses3 { get; }
UInt16 WMeterPulses(int wmNr1);
int WMeterReference(int wmNr0);
uint RegulValveDAC(int rvNr0);
float Pressure(int prsNr0);
@@ -59,19 +61,13 @@ namespace TBF.BenchControl.Elde
/// <summary>
/// Updates a command that is regularly sent to the control board by SendCommand.
/// </summary>
/// <param name="cmd">See ControlBoard.Command enum</param>
/// <param name="refNr">Number of the etalon/reference (1..5)</param>
/// <param name="route">Route: 64-bit installation specific number</param>
/// <param name="totalRefPulses">Kolko impulzov ma trvat skuska</param>
/// <param name="massRefPulses">Pri 'MassAndContinue' metode kolko impulzov ma trvat mass measurement</param>
/// <param name="testMethods">See ControlBoard.TestMethods enum</param>
/// <param name="filterConstant">0 = No filtering (0..255)</param>
/// <param name="FMFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
/// <param name="regConst">Coefficient used to control reg. valves (1..100)</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
/// <param name="stopDevs">What to stop</param>
void SendCommand(Command cmd, int refNr, UInt128 route, int totalRefPulses, int massRefPulses, TestMethods testMethods,
uint[] filterConstants, float[] fmFreq, int regConst, int shortImp, StopDevs stopDevs);
/// <param name="sendCommandArgs">Arguments, see SendCommandArgs class</param>
/// <param name="route">State of valves, 128-bit word</param>
/// <param name="filterConstants">Array with length=8 of filter costants (0..255, 0 = no filtering)</param>
/// <param name="fmFreq">Freq.inverter control (not applicable in DT100, Munich)</param>
/// <param name="regConst">PID coefficient for flow control</param>
/// <param name="shortImp">0 = default value, 1 = spec. processing of very short pulses</param>
void SendCommand(SendCommandArgs sendCommandArgs, UInt128 route, uint[] filterConstants, float[] fmFreq, int regConst, int shortImp);
/// <summary>
/// Control of regulating valves.
@@ -132,7 +132,7 @@ namespace TBF.BenchControl.Elde
void SendCommand()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(Command.ReadDivTransition, 0, controlBoard.Route, 0, 0, 0, StopDevs.None);
controlBoard.SendCommand(Command.ReadDivTransition, 0, 0, 0, 0, StopDevs.None);
cmdSent = true;
}
@@ -110,13 +110,12 @@ namespace TBF.BenchControl.Elde.RegisterReader
wmPulses = lastPulses;
wmRefPulses = (int)controlBoard.EtPulses(Position);
log.DebugFormat("{0}:ReadPulses() completed, wmPulses={1} wmRefPulses={2} cb.EtPulses(0)={3}", Name, wmPulses, wmRefPulses, (int)controlBoard.EtPulses(0));
log.DebugFormat("{0}:ReadPulses() completed, wmPulses={1} wmRefPulses={2}", Name, wmPulses, wmRefPulses);
}
/// <summary>Start this operation</summary>
public void Start()
{
log.DebugFormat("{0}:Start()", Name);
lastPulsesValid = false;
ReadPulses();
}
@@ -125,7 +124,6 @@ namespace TBF.BenchControl.Elde.RegisterReader
/// <returns>eventDone</returns>
public Event Run()
{
log.DebugFormat("{0}:Run()", Name);
ReadPulses();
return Event.ReadRegisterDone;
}
@@ -133,7 +131,6 @@ namespace TBF.BenchControl.Elde.RegisterReader
/// <summary>Stop this operation</summary>
public void Stop()
{
log.DebugFormat("{0}:Stop()", Name);
ReadPulses();
}
}
@@ -108,14 +108,9 @@ namespace TBF.BenchControl.Elde.RegulValve
#endif
if (Idx1 < ControlBoard.RegValveCalib.GetLength(0))
{
#if IZRAEL_25
{
this.ControlBoard.RegValveCalib[adcChannel, 0] = (uint)DacValueClosed;
this.ControlBoard.RegValveCalib[adcChannel, 1] = (uint)DacValueOpen;
#else
this.ControlBoard.RegValveCalib[Idx1 - 1, 0] = (uint)DacValueClosed;
this.ControlBoard.RegValveCalib[Idx1 - 1, 1] = (uint)DacValueOpen;
#endif
}
else
{
+31 -34
View File
@@ -198,16 +198,17 @@ namespace TBF.BenchControl.Elde.RegulValve
opState = OpState.ValveMoveToFlow1;
}
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
/// Start flow measurement
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, int.MaxValue, int.MaxValue, 0, 0); /// TestMethods=0, StopDevs=0
}
/// <summary>Run this operation</summary>
/// <returns>
/// Event.None, Event.FlowReached, Event.RegulValveTimeOut, Event.OpArgumentError
/// Event.OpArgumentError
/// Event.Starting
/// Event.Busy
/// Event.FlowReached
/// Event.RegulValveTimeOut
/// </returns>
public Event Run()
{
@@ -246,17 +247,14 @@ namespace TBF.BenchControl.Elde.RegulValve
opState = OpState.ValveMoveToFlow1;
}
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
return Event.None;
/// Start flow measurement
controlBoard.SendCommand(Command.Start, flowMeter.Idx1, int.MaxValue, int.MaxValue, 0, 0); /// TestMethods=0, StopDevs=0
return Event.Starting;
}
else if (opState == OpState.ValveMoveToPosition1)
{
opState = OpState.ValveMoveToPosition2;
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToPosition2) /// Move to position
{
@@ -266,7 +264,7 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValve.StableTime);
opState = OpState.SettingPosition;
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToPosition3)
{
@@ -278,14 +276,14 @@ namespace TBF.BenchControl.Elde.RegulValve
{
opState = OpState.SettingPosition;
}
return Event.None;
return Event.Starting;
}
else if (opState == OpState.CheckStatePosition) /// Verify
{
if (((ulong)controlBoard.StatusP & (ulong)StatusP.RefPulsesMsrmnt) == 0)
{
opState = OpState.SendCommandAgain;
return Event.None;
return Event.Starting;
}
else if (controlBoard.RegulValveState(regulValveNr) != RegulValveState.DacValueRegul)
{
@@ -298,12 +296,12 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValveNr, targetPositionLo, targetPositionHi, regulValve.StableTime);
opState = OpState.ValveMoveToPosition3;
return Event.None;
return Event.Starting;
}
else
{
opState = OpState.SettingPosition;
return Event.None;
return Event.Starting;
}
}
else if (opState == OpState.SettingPosition)
@@ -313,12 +311,12 @@ namespace TBF.BenchControl.Elde.RegulValve
{
opState = OpState.ValveMoveToFlow1;
}
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToFlow1)
{
opState = OpState.ValveMoveToFlow2;
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToFlow2) /// Move to flow
{
@@ -340,7 +338,7 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValve.StableTime);
opState = OpState.ValveMoveToFlow3;
return Event.None;
return Event.Starting;
}
else if (opState == OpState.ValveMoveToFlow3)
{
@@ -352,7 +350,7 @@ namespace TBF.BenchControl.Elde.RegulValve
{
opState = OpState.SettingFlow;
}
return Event.None;
return Event.Starting;
}
else if (opState == OpState.CheckStateFlow) /// Verify the flow setting
{
@@ -360,7 +358,7 @@ namespace TBF.BenchControl.Elde.RegulValve
(controlBoard.RegulValveState(regulValveNr) & RegulValveState.PwOrFreqRegul) != RegulValveState.PwOrFreqRegul)
{
opState = OpState.SendCommandAgain;
return Event.None;
return Event.Starting;
}
else if (controlBoard.RegulValveState(regulValveNr) != RegulValveState.PwOrFreqRegul)
{
@@ -375,12 +373,12 @@ namespace TBF.BenchControl.Elde.RegulValve
regulValveNr, freqLo, freqHi, regulValve.StableTime);
opState = OpState.ValveMoveToFlow3;
return Event.None;
return Event.Starting;
}
else
{
opState = OpState.SettingFlow;
return Event.None;
return Event.Busy;
}
}
else if (opState == OpState.SettingFlow)
@@ -423,7 +421,7 @@ namespace TBF.BenchControl.Elde.RegulValve
else
{
log.InfoFormat("flow = {0} m3/h (lo={1}, hi={2}, FLOW_OK_TIMER={3}s)", flow, currentReqFlowLo, currentReqFlowHi, flowWithinBoundsTime);
return Event.None;
return Event.Busy;
}
}
else if (StateMachine.Time > expireTime)
@@ -434,7 +432,7 @@ namespace TBF.BenchControl.Elde.RegulValve
{
log.InfoFormat("flow = {0} m3/h (lo={1}, hi={2})", flow, currentReqFlowLo, currentReqFlowHi);
flowWithinBoundsTime = 0;
return Event.None;
return Event.Busy;
}
}
else /// opState == OpState.FlowReached
@@ -447,14 +445,13 @@ namespace TBF.BenchControl.Elde.RegulValve
/// <summary>Start this operation</summary>
public void Stop()
{
opState = OpState.Idle;
if (!leaveMeasurementRunning)
{
/// Stop measurement
controlBoard.SendCommand(Command.Stop, flowMeter.Idx1, 50000, 50000, 0, StopDevs.RegValveRegulation); /// TestMethods=0
}
if (leaveMeasurementRunning) return;
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeter.Idx1, controlBoard.Route, 50000, 50000, tm, sd);
opState = OpState.Idle;
}
}
}
@@ -212,8 +212,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
}
/// <summary>Run this operation</summary>
@@ -262,8 +261,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
log.DebugFormat(" return Event.None");
return Event.None;
}
@@ -479,7 +477,7 @@ namespace TBF.BenchControl.Elde.RegulValveCoax
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route, 50000, 50000, tm, sd);
controlBoard.SendCommand(Command.Stop, flowMeterNr, 50000, 50000, tm, sd);
log.WarnFormat("Stop() SendCommand(Stop, {0}, ...)", flowMeterNr);
}
@@ -217,8 +217,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
TestMethods tm = 0;
StopDevs sd = 0;
// '_regulValve.RegulValveTandemCfg.PidCoef' replaced by a casted operation parameter 'pidCoef'
controlBoard.SendCommand(Command.Start, flowMeterNr, controlBoard.Route,
int.MaxValue, int.MaxValue, tm, sd);
controlBoard.SendCommand(Command.Start, flowMeterNr, int.MaxValue, int.MaxValue, tm, sd);
}
/// <summary>Run this operation</summary>
@@ -371,7 +370,7 @@ namespace TBF.BenchControl.Elde.RegulValveTandem
/// Stop measurement
TestMethods tm = 0;
StopDevs sd = StopDevs.RegValveRegulation;
controlBoard.SendCommand(Command.Stop, flowMeterNr, controlBoard.Route, 50000, 50000, tm, sd);
controlBoard.SendCommand(Command.Stop, flowMeterNr, 50000, 50000, tm, sd);
}
}
}
+33
View File
@@ -0,0 +1,33 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using Dirichlet.Numerics;
namespace TBF.BenchControl.Elde
{
public class SendCommandArgs
{
public Command Cmd;
public int RefFlowmtrNr;
public int TotalRefPulses;
public int MassRefPulses;
public TestMethods TestMethods;
public StopDevs StopDevs;
public SendCommandArgs()
{
}
public SendCommandArgs(Command cmd, int refFlowmtrNr, int totalRefPulses, int massRefPulses,
TestMethods testMethods, StopDevs stopDevs)
{
Cmd = cmd;
RefFlowmtrNr = refFlowmtrNr;
TotalRefPulses = totalRefPulses;
MassRefPulses = massRefPulses;
TestMethods = testMethods;
StopDevs = stopDevs;
}
}
}
+1 -2
View File
@@ -125,8 +125,7 @@ namespace TBF.BenchControl.Elde
log.InfoFormat("Start() : SendCommand(Cmd.Start, {0}, route, {1}, {1}, {2}, Stop.None)",
flowMeterIdxAndDiv, totalRefPulses, testMethod);
controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, controlBoard.Route,
totalRefPulses, massRefPulses, testMethod, StopDevs.None);
controlBoard.SendCommand(Command.Start, flowMeterIdxAndDiv, totalRefPulses, massRefPulses, testMethod, StopDevs.None);
}
/// <summary>Start this operation</summary>
@@ -35,12 +35,7 @@ namespace TBF.BenchControl.Elde
void SendStopFlowRegulationCommand()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(Command.Stop,
flowMeterNr, /// ref. flowmeter number
controlBoard.Route, /// route
0, 0, /// ref. pulses
0,
StopDevs.RegValveRegulation);
controlBoard.SendCommand(Command.Stop, flowMeterNr, 0, 0, 0, StopDevs.RegValveRegulation);
}
+1 -5
View File
@@ -43,11 +43,7 @@ namespace TBF.BenchControl.Elde
void SendStopCommand()
{
controlBoard.SyncRoute();
controlBoard.SendCommand(Command.Stop,
0, /// ref. flowmeter number
controlBoard.Route, /// route
0, 0, /// ref. pulses
TestMethods.Diverter,
controlBoard.SendCommand(Command.Stop, 0, 0, 0, TestMethods.Diverter,
StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation);
}
+1
View File
@@ -73,6 +73,7 @@ namespace TBF.BenchControl
public enum Event
{
None = 0,
Starting, /// During initial phase of some process, sending a command to a device, etc.
Busy, /// Useful when waiting in state until at least one is busy (all are done)
Done, /// Useful when waiting in state until the first is done, the rest miht still be busy
MakeSecondPass, /// Test completed OK but 2nd pass (evaluation) is required
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using TBF.BenchControl.Generic;
using TBF.Boxes;
@@ -10,6 +10,7 @@ namespace TBF.BenchControl.GenericDevices
{
Config.Entities.RegisterReaderType RegisterReaderType { get; }
int Position { get; }
double PulsesPerLtr { get; } /// [imp/l] ... water meter or volume measurement part of a heat meter
double LtrsPerPulse { get; } /// [l/imp]
+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);
}
}
}
@@ -32,9 +32,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
this.GetType().Namespace.Substring(17),
CameraCfg.Name,
CameraCfg.HardwareAddress,
ipAddress == null ? "not detected" : ipAddress.ToString(),
string.IsNullOrEmpty(cpuSerialNr) ? "not detected" : cpuSerialNr,
string.IsNullOrEmpty(sdCardVer) ? "not detected" : sdCardVer);
CameraCfg.DebugLevel == DebugMode.Simulate ? "simulated" : ((ipAddress == null) ? "not detected" : ipAddress.ToString()),
CameraCfg.DebugLevel == DebugMode.Simulate ? "simulated" : (string.IsNullOrEmpty(cpuSerialNr) ? "not detected" : cpuSerialNr),
CameraCfg.DebugLevel == DebugMode.Simulate ? "simulated" : (string.IsNullOrEmpty(sdCardVer) ? "not detected" : sdCardVer));
}
@@ -161,13 +161,16 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
{
cameraIdx = GetCameraIdx();
if (CameraCfg.DebugLevel == DebugMode.Simulate) return;
if (CameraCfg.DebugLevel == DebugMode.Simulate)
{
UiBridge.Bridge.OnCameraInfo(this.cameraIdx, string.Format("{0} s/n {1} si simulated", Name, CameraCfg.HardwareAddress));
return;
}
/// Detect a camera
bool cameraDetected = DetectCamera(CameraCfg.HardwareAddress % 100, ref ipAddress, true,
out cpuHardware, out cpuRevision, out cpuSerialNr, out sdCardVer);
if (CameraCfg.DebugLevel == DebugMode.AutoDetect)
{
CameraCfg.DebugLevel = cameraDetected ? DebugMode.DetectedOn : DebugMode.DetectedOff;
@@ -219,46 +222,55 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
public void StopDevice()
{
running = false;
if ((CameraCfg.DebugLevel != DebugMode.Simulate) && (CameraCfg.DebugLevel != DebugMode.DetectedOff))
{
running = false;
stopScpThreadFlag = true;
stopRtpListenerFlag = true;
stopMsrmntListenerFlag = true;
stopScpThreadFlag = true;
stopRtpListenerFlag = true;
stopMsrmntListenerFlag = true;
if (Telnet != null)
{
Telnet.Dispose();
Telnet = null;
}
if (Telnet != null)
{
Telnet.Dispose();
Telnet = null;
}
}
}
public void StopDevice2()
{
if (scpThread != null) scpThread.Join(50);
if (rtpListenerThread != null) rtpListenerThread.Join(50);
if (msrmntListenerThread != null) msrmntListenerThread.Join(50);
if ((CameraCfg.DebugLevel != DebugMode.Simulate) && (CameraCfg.DebugLevel != DebugMode.DetectedOff))
{
if (scpThread != null) scpThread.Join(50);
if (rtpListenerThread != null) rtpListenerThread.Join(50);
if (msrmntListenerThread != null) msrmntListenerThread.Join(50);
if (rtpUdpClient != null)
{
rtpUdpClient.Close();
rtpUdpClient = null;
}
if (rtpUdpClient != null)
{
rtpUdpClient.Close();
rtpUdpClient = null;
}
if (msrmntUdpClient != null)
{
msrmntUdpClient.Close();
msrmntUdpClient = null;
}
if (msrmntUdpClient != null)
{
msrmntUdpClient.Close();
msrmntUdpClient = null;
}
}
}
public void RunDeviceBefore()
{
if (sha1sumResponse != null && !sha1sumResponseProcessed)
{
scpThread = new Thread(new ThreadStart(ScpWorker));
scpThread.Start();
sha1sumResponseProcessed = true;
if ((CameraCfg.DebugLevel != DebugMode.Simulate) && (CameraCfg.DebugLevel != DebugMode.DetectedOff))
{
if (sha1sumResponse != null && !sha1sumResponseProcessed)
{
scpThread = new Thread(new ThreadStart(ScpWorker));
scpThread.Start();
sha1sumResponseProcessed = true;
}
}
}
public void RunDeviceAfter() { }
@@ -50,10 +50,13 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
grabImageCommandSent = false;
transferringGrabbedImage = false;
telnet.promptReceivedHandler += delegate(object sndr, PromptReceivedEventArgs a)
{
OnPromptReceived(sndr, a);
};
if (camera.DebugLevel == DebugMode.Normal || camera.DebugLevel == DebugMode.DetectedOn)
{
telnet.promptReceivedHandler += delegate(object sndr, PromptReceivedEventArgs a)
{
OnPromptReceived(sndr, a);
};
}
}
void OnPromptReceived(object sndr, PromptReceivedEventArgs a)
@@ -65,33 +68,58 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
public void Start()
{
if (camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.Simulate) return;
grabImageCommandSent = false;
transferringGrabbedImage = false;
if (File.Exists(imgFileNames[0])) File.Delete(imgFileNames[0]);
if ((imgFileNames != null) && (imgFileNames.Length > 0) && File.Exists(imgFileNames[0]))
{
///
/// An image specified, (1) delete previous image, (2) check if this is a simulation
///
File.Delete(imgFileNames[0]);
if (camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.Simulate || camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.DetectedOff)
{
///
/// Camera is in simulation mode => create a simulated image
///
File.Copy(string.Format("{0}\\Pictures\\sample.jpg", Program.ExecutableDir), imgFileNames[0]);
}
}
}
public Event Run()
{
if (camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.Simulate) return Event.None;
if (imgFileNames.Length < 1 || imgFileNames[0] == null)
if ((imgFileNames == null) || (imgFileNames.Length < 1) || (imgFileNames[0] == null))
{
return Event.GrabPassed;
///
/// No images to be grabbed => Done
///
return Event.GrabPassed;
}
else if (!grabImageCommandSent)
else if (camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.Simulate ||
camera.CameraCfg.DebugLevel == Config.Entities.DebugMode.DetectedOff)
{
///
/// Camera is in simulation mode => create a simulated image and complete
///
return Event.GrabPassed;
}
else if (!grabImageCommandSent)
{
///
/// Normal operation, no command sent yet => (1) wait until telnet state = Inactive, (2) send a command
///
if (camera.Running && (telnet.State == TelnetClient.TelnetState.Inactive))
{
//
// State variables
//
///
/// State variables
///
response = null;
//
// Prepare command
//
///
/// Prepare a command
///
int rotation = 0;
if (imageRotation == ImageRotation.Deg90)
rotation = 90;
@@ -119,7 +147,10 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
}
else if (grabPassed)
{
if (transferringGrabbedImage)
///
/// Normal operation, grab passed => transfer/transferring the image
///
if (transferringGrabbedImage)
{
/// Grab passed and image transfer is in progress
return Event.GrabPassed;
@@ -138,12 +169,17 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
}
else if (grabFailed)
{
/// Grab failed, there in no image to transfer
///
/// Normal operation, grab failed => there in no image to transfer
///
return Event.GrabFailed;
}
else if (response != null)
{
if (response.Contains("completed"))
///
/// Normal operation
///
if (response.Contains("completed"))
{
grabPassed = true;
@@ -33,6 +33,15 @@ namespace TBF.BenchControl.Network.Camera.Roi
///
public GenericDevices.ICamera Camera { get { return NetCamera as GenericDevices.ICamera; } }
public int Position
{
get
{
int firstDigitPos = Name.IndexOfAny(new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' });
int position;
return (firstDigitPos < 0) ? 0 : (int.TryParse(Name.Substring(firstDigitPos), out position) ? position : 0);
}
}
public Config.Entities.RegisterReaderType RegisterReaderType { get { return Config.Entities.RegisterReaderType.Camera; } }
public double PulsesPerLtr { get { return RoiCfg.ProcParams.PulsesPerLtr; } }
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); } }
@@ -30,6 +30,15 @@ namespace TBF.BenchControl.Network.Camera.RoiForFixedStart
public readonly CLP1611.Camera NetCamera;
public GenericDevices.ICamera Camera { get { return NetCamera as GenericDevices.ICamera; } }
public int Position
{
get
{
int firstDigitPos = Name.IndexOfAny(new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' });
int position;
return (firstDigitPos < 0) ? 0 : (int.TryParse(Name.Substring(firstDigitPos), out position) ? position : 0);
}
}
public Config.Entities.RegisterReaderType RegisterReaderType { get { return Config.Entities.RegisterReaderType.Manual; } }
public double PulsesPerLtr { get { return roiCfg.ProcParams.PulsesPerLtr; } }
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); } }
@@ -127,17 +136,11 @@ namespace TBF.BenchControl.Network.Camera.RoiForFixedStart
public IOperation GrabImageOp(string imageFileName)
{
if (NetCamera != null)
{
/// TODO: Implement support for sharing one camera by multiple ROI-s
return NetCamera.GrabImagesOp(new string[] { imageFileName }, roiCfg.BlackAndWhite, roiCfg.LowResolution, roiCfg.ImageRotation);
}
else
return null;
return GrabImageOp(imageFileName, roiCfg.BlackAndWhite, roiCfg.LowResolution, roiCfg.ImageRotation);
}
public IOperation GrabImageOp(string imageFileName, bool blackAndWhite,
bool lowResolution, Config.Entities.ImageRotation imageRotation)
public IOperation GrabImageOp(string imageFileName,
bool blackAndWhite, bool lowResolution, Config.Entities.ImageRotation imageRotation)
{
if (NetCamera != null)
{
@@ -17,8 +17,8 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public IComponentCfgCtrl GetControl() { return new TracingCfgCtrl(); }
public string Workplace;
public string ConnStr;
public string ConnStr2;
public string NetAdapter;
public bool CheckPreviousRecords;
public bool SaveTracingRecords;
@@ -28,9 +28,9 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
MonitoringCfg()
{
ParentName = string.Empty;
Workplace = "WR10";
NetAdapter = string.Empty;
ConnStr = "SERVER=10.42.128.16; DATABASE=sledovanie2019; UID=vyroba2019; PASSWORD=qwerty; CHARSET=utf8;";
ConnStr = "server=10.42.128.16; database=sledovanie2020; uid=vyroba2020; pwd=qwerty; charset=utf8;";
ConnStr2 = "server=10.42.128.16; database=sledovanie2019; uid=vyroba2019; pwd=qwerty; charset=utf8;";
CheckPreviousRecords = true;
SaveTracingRecords = true;
}
@@ -44,12 +44,12 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public string ToString(int i)
{
return string.Format("Name={0}, Workplace={1}, CheckPreviousRecords={2}, SaveTracingRecords={3}, ConnStr={4}",
return string.Format("Name={0}, CheckPrev.={1}, SaveRecords={2}, ConnStr={3}, , ConnStr2={4}",
Name,
Workplace,
CheckPreviousRecords,
SaveTracingRecords,
ConnStr);
ConnStr,
ConnStr2);
}
}
}
@@ -35,7 +35,14 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public const string WorkstepName = "Test_bench";
MonitoringCfg tracingCfg;
string workplace { get { return tracingCfg.Workplace; } }
string workplace
{
get
{
TBF.BenchControl.GenericDevices.IBenchInfo benchInfo = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
return (benchInfo != null) ? benchInfo.TestBenchName : "TestBench";
}
}
readonly IPAddress ipAddress;
readonly IPAddress netMask;
@@ -69,11 +76,16 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
Results.Entities.Batch batch;
ISessionFactory sessionFactory; /// Factory to create database sessions that is initialized in the constructor
ISessionFactory sessionFactory; /// Factory to create database sessions that is initialized in the constructor
IList<Process> processes;
Dictionary<int, Process> processDictionary;
Dictionary<int, IList<Workstep>> workstepsDictionary;
ISessionFactory sessionFactory2; /// Factory to create database sessions that is initialized in the constructor
IList<Process> processes2;
Dictionary<int, Process> processDictionary2;
Dictionary<int, IList<Workstep>> workstepsDictionary2;
///
/// Previous workstep verification info
///
@@ -118,6 +130,19 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<TracingDB.Entities.Process>())
.ExposeConfiguration(TracingDB.DB.BuildSchema)
.BuildSessionFactory();
///
/// Session factory 2 is used to create the 2nd database sessions
///
if (!string.IsNullOrEmpty(tracingCfg.ConnStr2))
{
sessionFactory2 = FluentNHibernate.Cfg.Fluently.Configure()
.Database(FluentNHibernate.Cfg.Db.MySQLConfiguration.Standard.ConnectionString(tracingCfg.ConnStr2))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<TracingDB.Entities.Process>())
.ExposeConfiguration(TracingDB.DB.BuildSchema)
.BuildSessionFactory();
}
///
/// Register this test bench in the tracing DB for approx. 2 weeks
///
@@ -283,6 +308,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
{
Retv retVal = Retv.Error;
bool isAtLeastOneNOK = false;
using (ISession session = sessionFactory.OpenSession())
{
for (int i = 0; i < waterMeters.Length; i++)
@@ -291,22 +317,45 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
if ((wm != null) && !wm.Disabled)
{
CheckPreviousRecordOfSingleWM(session, wm);
CheckPreviousRecordOfSingleWM(session, wm, 1);
if (wm.LastRecordIsNok)
{
isAtLeastOneNOK = true;
}
}
}
retVal = Retv.OK;
}
if (isAtLeastOneNOK && (sessionFactory2 != null))
{
using (ISession session2 = sessionFactory2.OpenSession())
{
for (int i = 0; i < waterMeters.Length; i++)
{
Results.Entities.WaterMeter wm = waterMeters[i];
if ((wm != null) && !wm.Disabled && wm.LastRecordIsNok)
{
CheckPreviousRecordOfSingleWM(session2, wm, 2);
}
}
retVal = Retv.OK;
}
}
return retVal;
}
Retv CheckPreviousRecordOfSingleWM(ISession session, Results.Entities.WaterMeter wm)
Retv CheckPreviousRecordOfSingleWM(ISession session, Results.Entities.WaterMeter wm, int sessionId)
{
if (string.IsNullOrEmpty(wm.SerialNr))
{
/// S/N is missing
wm.ProcessId = 0;
wm.SessionId = 0;
wm.LastRecordIsNok = false; /// OK, this is an RFID comm. error, not a production tracing error
return Retv.OK;
}
@@ -338,6 +387,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
{
/// No records found
wm.ProcessId = 0;
wm.SessionId = sessionId;
wm.LastRecordIsNok = true; /// NOK
///
return Retv.OK;
@@ -396,7 +446,8 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
wm.ProcessId = currentProcess.Id;
wm.LastRecordIsNok = true; /// NOK (=default if no matching record found)
wm.SessionId = sessionId;
wm.LastRecordIsNok = true; /// NOK (=default if no matching record found)
foreach (var rslt in results)
{
if ((verifiedWorkstep.Id == (int)rslt[1]) && (processId == (int)rslt[2]))
@@ -420,6 +471,10 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
{
ITransaction transaction = null;
ISession session = null;
///
/// Save to regular tracing DB
///
try
{
session = sessionFactory.OpenSession();
@@ -428,15 +483,16 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
int writtenRecordsCount = 0;
foreach (var wMtr in batch.WaterMeters)
{
writtenRecordsCount += SaveSingleWM2DB(session, wMtr);
if (wMtr.SessionId == 1)
{
writtenRecordsCount += SaveSingleWM2DB(session, wMtr);
}
}
transaction.Commit();
session.Flush();
log.ErrorFormat("Batch {0}: {1} of {2} watermeters written to production tracing DB",
log.ErrorFormat("Batch {0}: {1} of {2} watermeters written to the regular production tracing DB",
batch.BatchNr, writtenRecordsCount, batch.WaterMeters.Count);
return Retv.OK;
}
catch (Exception exc)
{
@@ -455,7 +511,54 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
session.Dispose();
}
}
}
if (sessionFactory2 != null)
{
///
/// Save to alternative tracing DB
///
transaction = null;
session = null;
try
{
session = sessionFactory2.OpenSession();
transaction = session.BeginTransaction();
int writtenRecordsCount = 0;
foreach (var wMtr in batch.WaterMeters)
{
if (wMtr.SessionId == 2)
{
writtenRecordsCount += SaveSingleWM2DB(session, wMtr);
}
}
transaction.Commit();
session.Flush();
log.ErrorFormat("Batch {0}: {1} of {2} watermeters written to the alternative production tracing DB",
batch.BatchNr, writtenRecordsCount, batch.WaterMeters.Count);
}
catch (Exception exc)
{
if (transaction != null && !transaction.WasCommitted) transaction.Rollback();
log.WarnFormat("Failed to write results of batch {0} to production tracing DB: {1}",
batch.BatchNr, exc.Message);
return Retv.Error;
}
finally
{
if (session != null)
{
session.Close();
session.Dispose();
}
}
}
return Retv.OK;
}
/// <summary>
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
/// Copyright (c) 2018-2019 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
@@ -46,8 +46,8 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
workplaceTextBox.Text = config.Workplace;
connStrTextBox.Text = config.ConnStr;
connStr2TextBox.Text = config.ConnStr2;
checkPreviousRecordsCheckBox.Checked = config.CheckPreviousRecords;
saveTracingRecordsCheckBox.Checked = config.SaveTracingRecords;
@@ -102,8 +102,8 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
public void Unlock()
{
nameTextBox.Enabled = true;
workplaceTextBox.Enabled = true;
connStrTextBox.Enabled = true;
connStr2TextBox.Enabled = true;
netAdapterComboBox.Enabled = true;
checkPreviousRecordsCheckBox.Enabled = true;
saveTracingRecordsCheckBox.Enabled = true;
@@ -126,8 +126,8 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
}
flags |= UpdateDifferent(ref config.Workplace, workplaceTextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
flags |= UpdateDifferent(ref config.ConnStr, connStrTextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
flags |= UpdateDifferent(ref config.ConnStr2, connStr2TextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
flags |= UpdateDifferent(ref config.CheckPreviousRecords, checkPreviousRecordsCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
flags |= UpdateDifferent(ref config.SaveTracingRecords, saveTracingRecordsCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
@@ -34,81 +34,64 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.workplaceTextBox = new System.Windows.Forms.TextBox();
this.workplaceLabel = new System.Windows.Forms.Label();
this.connStrTextBox = new System.Windows.Forms.TextBox();
this.connStrLabel = new System.Windows.Forms.Label();
this.saveTracingRecordsCheckBox = new System.Windows.Forms.CheckBox();
this.checkPreviousRecordsCheckBox = new System.Windows.Forms.CheckBox();
this.netAdapterLabel = new System.Windows.Forms.Label();
this.netAdapterComboBox = new System.Windows.Forms.ComboBox();
this.connStr2TextBox = new System.Windows.Forms.TextBox();
this.connStr2Label = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(110, 41);
this.nameTextBox.Location = new System.Drawing.Point(117, 32);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
this.nameTextBox.Size = new System.Drawing.Size(326, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(15, 44);
this.nameLabel.Location = new System.Drawing.Point(5, 35);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.Size = new System.Drawing.Size(38, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
this.nameLabel.Text = "Name:";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(107, 19);
this.classNameLabel.Location = new System.Drawing.Point(114, 10);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// workplaceTextBox
//
this.workplaceTextBox.Enabled = false;
this.workplaceTextBox.Location = new System.Drawing.Point(110, 67);
this.workplaceTextBox.Name = "workplaceTextBox";
this.workplaceTextBox.Size = new System.Drawing.Size(146, 20);
this.workplaceTextBox.TabIndex = 4;
//
// workplaceLabel
//
this.workplaceLabel.AutoSize = true;
this.workplaceLabel.Location = new System.Drawing.Point(15, 70);
this.workplaceLabel.Name = "workplaceLabel";
this.workplaceLabel.Size = new System.Drawing.Size(59, 13);
this.workplaceLabel.TabIndex = 3;
this.workplaceLabel.Text = "Workplace";
//
// connStrTextBox
//
this.connStrTextBox.Enabled = false;
this.connStrTextBox.Location = new System.Drawing.Point(110, 93);
this.connStrTextBox.Location = new System.Drawing.Point(8, 74);
this.connStrTextBox.Name = "connStrTextBox";
this.connStrTextBox.Size = new System.Drawing.Size(327, 20);
this.connStrTextBox.TabIndex = 6;
this.connStrTextBox.Size = new System.Drawing.Size(435, 20);
this.connStrTextBox.TabIndex = 4;
//
// connStrLabel
//
this.connStrLabel.AutoSize = true;
this.connStrLabel.Location = new System.Drawing.Point(15, 96);
this.connStrLabel.Location = new System.Drawing.Point(5, 58);
this.connStrLabel.Name = "connStrLabel";
this.connStrLabel.Size = new System.Drawing.Size(89, 13);
this.connStrLabel.TabIndex = 5;
this.connStrLabel.Text = "Connection string";
this.connStrLabel.Size = new System.Drawing.Size(92, 13);
this.connStrLabel.TabIndex = 3;
this.connStrLabel.Text = "Connection string:";
//
// saveTracingRecordsCheckBox
//
this.saveTracingRecordsCheckBox.AutoSize = true;
this.saveTracingRecordsCheckBox.Enabled = false;
this.saveTracingRecordsCheckBox.Location = new System.Drawing.Point(110, 177);
this.saveTracingRecordsCheckBox.Location = new System.Drawing.Point(117, 221);
this.saveTracingRecordsCheckBox.Name = "saveTracingRecordsCheckBox";
this.saveTracingRecordsCheckBox.Size = new System.Drawing.Size(177, 17);
this.saveTracingRecordsCheckBox.TabIndex = 10;
@@ -119,7 +102,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
//
this.checkPreviousRecordsCheckBox.AutoSize = true;
this.checkPreviousRecordsCheckBox.Enabled = false;
this.checkPreviousRecordsCheckBox.Location = new System.Drawing.Point(110, 154);
this.checkPreviousRecordsCheckBox.Location = new System.Drawing.Point(117, 199);
this.checkPreviousRecordsCheckBox.Name = "checkPreviousRecordsCheckBox";
this.checkPreviousRecordsCheckBox.Size = new System.Drawing.Size(138, 17);
this.checkPreviousRecordsCheckBox.TabIndex = 9;
@@ -129,37 +112,55 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
// netAdapterLabel
//
this.netAdapterLabel.AutoSize = true;
this.netAdapterLabel.Location = new System.Drawing.Point(15, 122);
this.netAdapterLabel.Location = new System.Drawing.Point(5, 147);
this.netAdapterLabel.Name = "netAdapterLabel";
this.netAdapterLabel.Size = new System.Drawing.Size(86, 13);
this.netAdapterLabel.Size = new System.Drawing.Size(89, 13);
this.netAdapterLabel.TabIndex = 7;
this.netAdapterLabel.Text = "Network adapter";
this.netAdapterLabel.Text = "Network adapter:";
//
// netAdapterComboBox
//
this.netAdapterComboBox.Enabled = false;
this.netAdapterComboBox.FormattingEnabled = true;
this.netAdapterComboBox.Location = new System.Drawing.Point(110, 119);
this.netAdapterComboBox.Location = new System.Drawing.Point(8, 163);
this.netAdapterComboBox.Name = "netAdapterComboBox";
this.netAdapterComboBox.Size = new System.Drawing.Size(327, 21);
this.netAdapterComboBox.TabIndex = 11;
this.netAdapterComboBox.Size = new System.Drawing.Size(435, 21);
this.netAdapterComboBox.TabIndex = 8;
//
// connStr2TextBox
//
this.connStr2TextBox.Enabled = false;
this.connStr2TextBox.Location = new System.Drawing.Point(8, 118);
this.connStr2TextBox.Name = "connStr2TextBox";
this.connStr2TextBox.Size = new System.Drawing.Size(434, 20);
this.connStr2TextBox.TabIndex = 6;
//
// connStr2Label
//
this.connStr2Label.AutoSize = true;
this.connStr2Label.Location = new System.Drawing.Point(5, 102);
this.connStr2Label.Name = "connStr2Label";
this.connStr2Label.Size = new System.Drawing.Size(101, 13);
this.connStr2Label.TabIndex = 5;
this.connStr2Label.Text = "Connection string 2:";
//
// TracingCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.connStr2TextBox);
this.Controls.Add(this.connStr2Label);
this.Controls.Add(this.netAdapterComboBox);
this.Controls.Add(this.netAdapterLabel);
this.Controls.Add(this.saveTracingRecordsCheckBox);
this.Controls.Add(this.checkPreviousRecordsCheckBox);
this.Controls.Add(this.connStrTextBox);
this.Controls.Add(this.connStrLabel);
this.Controls.Add(this.workplaceTextBox);
this.Controls.Add(this.workplaceLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "TracingCfgCtrl";
this.Size = new System.Drawing.Size(450, 230);
this.Size = new System.Drawing.Size(450, 250);
this.Load += new System.EventHandler(this.WriterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
@@ -171,13 +172,13 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.TextBox workplaceTextBox;
private System.Windows.Forms.Label workplaceLabel;
private System.Windows.Forms.TextBox connStrTextBox;
private System.Windows.Forms.Label connStrLabel;
private System.Windows.Forms.CheckBox saveTracingRecordsCheckBox;
private System.Windows.Forms.CheckBox checkPreviousRecordsCheckBox;
private System.Windows.Forms.Label netAdapterLabel;
private System.Windows.Forms.ComboBox netAdapterComboBox;
private System.Windows.Forms.TextBox connStr2TextBox;
private System.Windows.Forms.Label connStr2Label;
}
}
@@ -136,7 +136,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
/// <param name="wmTypeId">Water meter type Id</param>
/// <param name="wmTypeRevision">Water meter type revision</param>
/// <returns>SensusTestInfos array</returns>
IList<SensusTestInfo> GetOracleTestInfo(OracleConnection conn, int wmTypeId, out int wmTypeRevision)
public static IList<SensusTestInfo> GetOracleTestInfo(OracleConnection conn, int wmTypeId, out int wmTypeRevision, out string wzTyp, out string metrolKlasse, out string zulasszeichen, out string materialNr, out double q3, out DateTime timeStamp, out string remark)
{
///
/// Read 'incomplete' TestInfo from Oracle database containing only flowId-s ad qBezeichnung-s
@@ -147,7 +147,15 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
/// For a given 'wmTypeId' find the most recent active 'wmTypeRevision'
///
wmTypeRevision = -1;
OracleCommand cmd = new OracleCommand("select REV_WZTYP from VT_WZTYP_SD where ANBID=4 and ID_WZTyp=:1 and AKTIV=:2", conn);
wzTyp = string.Empty;
metrolKlasse = string.Empty;
zulasszeichen = string.Empty;
materialNr = string.Empty;
q3 = 0;
timeStamp = DateTime.MinValue;
remark = string.Empty;
OracleCommand cmd = new OracleCommand("select REV_WZTYP, WZTYP, METROLKLASSE, ZULASSZEICHEN, MATERIALNR, QMAX, AENDERUNGSDATUM, BEMERKUNG from VT_WZTYP_SD where ANBID=4 and ID_WZTyp=:1 and AKTIV=:2", conn);
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wmTypeId }); ///:1
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 1 }); ///:2
///
@@ -155,12 +163,19 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
while (dr.Read())
{
wmTypeRevision = dr.GetInt32(0);
wzTyp = dr.GetString(1);
metrolKlasse = dr.GetString(2);
zulasszeichen = dr.GetString(3);
materialNr = dr.GetString(4);
q3 = dr.GetDouble(5);
timeStamp = dr.GetDateTime(6);
remark = dr.GetString(7);
}
dr.Close();
if (wmTypeRevision == -1) return null; /// No 'wmTypeRevision' found
cmd = new OracleCommand("select PruefungsNr, PosFehlerKalt, QBezeichnung from VT_PRUEFPUNKT_SOLL_SD where ANBID=4 and ID_WZTyp=:1 and Rev_WZTyp=:2", conn);
cmd = new OracleCommand("select PRUEFUNGSNR, Q_SOLL, PRUEFZEIT, POSFEHLERKALT, NEGFEHLERKALT, PRUEFBEREICHMIN, PRUEFBEREICHMAX, QBEZEICHNUNG from VT_PRUEFPUNKT_SOLL_SD where ANBID=4 and ID_WZTyp=:1 and Rev_WZTyp=:2", conn);
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wmTypeId }); ///:1
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wmTypeRevision }); ///:2
///
@@ -168,9 +183,19 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
while (dr.Read())
{
int pruefungsNr = dr.GetInt32(0);
double errLimHi = dr.GetDouble(1);
string qBezeichnung = dr.GetString(2);
oraDbTinfos.Add(new SensusTestInfo(null, pruefungsNr, qBezeichnung, 0, null, 0, null, Range.Undefined));
double flow = Config.Units.ConvertFrom(Unit.lph, dr.GetDouble(1));
int testTime = dr.GetInt32(2);
double errLimHi = dr.GetDouble(3);
double errLimLo = dr.GetDouble(4);
int flowRangeMin = dr.GetInt32(5);
int flowRangeMax = dr.GetInt32(6);
string qBezeichnung = dr.GetString(7);
Range rng = (flowRangeMin == 90 && flowRangeMax == 100) ? Range.R90_100 :
((flowRangeMin == 95 && flowRangeMax == 105) ? Range.R95_105 :
((flowRangeMin == 100 && flowRangeMax == 110) ? Range.R100_110 : Range.Undefined));
oraDbTinfos.Add(new SensusTestInfo(pruefungsNr, qBezeichnung, flow, testTime, errLimLo, errLimHi, rng));
}
dr.Close();
@@ -356,7 +381,14 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
/// Currnet test info. is not walid => Get a new one from Oracle and SensusTestInfo table
///
int wmTR;
IList<SensusTestInfo> rti = GetOracleTestInfo(conn, wm.WaterMeterData.WMTypeId, out wmTR);
string wzTypStr;
string metroKlasse;
string zulasszeichen;
string materialNr;
double q3 = 0;
DateTime timeStamp;
string remark;
IList<SensusTestInfo> rti = GetOracleTestInfo(conn, wm.WaterMeterData.WMTypeId, out wmTR, out wzTypStr, out metroKlasse, out zulasszeichen, out materialNr, out q3, out timeStamp, out remark);
if (rti != null)
{
@@ -629,8 +661,9 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
int maxpruefindexLowPart = ReadMaxPruefindex(conn, wm);
int MAX_Pruefindex = 100 * dbCfg.TestBenchId + maxpruefindexLowPart + 1;
TBF.BenchControl.GenericDevices.IBenchInfo benchInfo = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
int testBenchID = (benchInfo != null) ? benchInfo.TestBenchId : 1;
int MAX_Pruefindex = 100 * testBenchID + maxpruefindexLowPart + 1;
int Hydr_Pruefung;
if (wm.Passed)
@@ -721,7 +754,14 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
if ((oracleTestInfo == null) || (wmTypeId != b.WaterMeters[0].WaterMeterData.WMTypeId) || (wmTypeRevision == 0) || (procedureSignature != procedureSignatureSB.ToString()))
{
int wmTR = 0;
IList<SensusTestInfo> ti = GetOracleTestInfo(conn, b.WaterMeters[0].WaterMeterData.WMTypeId, out wmTR);
string wzTypStr;
string metroKlasse;
string zulasszeichen;
string materialNr;
double q3 = 0;
DateTime timeStamp;
string remark;
IList<SensusTestInfo> ti = GetOracleTestInfo(conn, b.WaterMeters[0].WaterMeterData.WMTypeId, out wmTR, out wzTypStr, out metroKlasse, out zulasszeichen, out materialNr, out q3, out timeStamp, out remark);
if (ti != null)
{
@@ -34,7 +34,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public IComponentCfgCtrl GetControl() { return new DatabaseCfgCtrl(); }
public int TestBenchId;
public DBUsed DBUsed;
public int Baujahr; /// Written to the database
public bool ReadStartInfo;
@@ -48,7 +47,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
{
Name = "Sensus-Oracle-DB";
ParentName = string.Empty;
TestBenchId = 1;
DBUsed = DBUsed.Test;
Baujahr = 2015;
ReadStartInfo = true;
@@ -65,9 +63,8 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public string ToString(int i)
{
return string.Format("Name={0}, BenchId={1}, DB={2}, Bjahr={3}, RdStartInfo={4}, SaveRslts={5}, StartInfoRqrd={6}, TestMode={7}",
return string.Format("Name={0}, DB={1}, Bjahr={2}, RdStartInfo={3}, SaveRslts={4}, StartInfoRqrd={5}, TestMode={6}",
Name,
TestBenchId,
DBUsed,
Baujahr,
ReadStartInfo,
@@ -47,7 +47,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
benchIdTextBox.Text = config.TestBenchId.ToString();
dbUsedComboBox.Text = config.DBUsed.ToString();
baujahrTextBox.Text = config.Baujahr.ToString();
readStartInfoCheckBox.Checked = config.ReadStartInfo;
@@ -59,7 +58,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
public void Unlock()
{
nameTextBox.Enabled = true;
benchIdTextBox.Enabled = true;
dbUsedComboBox.Enabled = true;
baujahrTextBox.Enabled = true;
readStartInfoCheckBox.Enabled = true;
@@ -72,13 +70,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
int tmp;
if (!int.TryParse(benchIdTextBox.Text, out tmp) || tmp <= 0)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Test bench ID'";
}
int tmp;
if (!int.TryParse(baujahrTextBox.Text, out tmp) || tmp < 2015 || tmp > 2099)
{
flags |= CfgUpdateFlags.Error;
@@ -105,13 +97,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
flags |= CfgUpdateFlags.RestartRqrd;
}
int benchId = int.Parse(benchIdTextBox.Text);
if (config.TestBenchId != benchId)
{
config.TestBenchId = benchId;
flags |= CfgUpdateFlags.RestartRqrd;
}
int baujahr = int.Parse(baujahrTextBox.Text);
if (config.Baujahr != baujahr)
{
@@ -36,8 +36,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
this.classNameLabel = new System.Windows.Forms.Label();
this.readStartInfoCheckBox = new System.Windows.Forms.CheckBox();
this.saveResultsCheckBox = new System.Windows.Forms.CheckBox();
this.benchIdTextBox = new System.Windows.Forms.TextBox();
this.benchIdLabel = new System.Windows.Forms.Label();
this.dbUsedComboBox = new System.Windows.Forms.ComboBox();
this.dbUsedLabel = new System.Windows.Forms.Label();
this.baujahrTextBox = new System.Windows.Forms.TextBox();
@@ -49,7 +47,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(110, 30);
this.nameTextBox.Location = new System.Drawing.Point(110, 55);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
this.nameTextBox.TabIndex = 2;
@@ -57,7 +55,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(19, 33);
this.nameLabel.Location = new System.Drawing.Point(19, 58);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
@@ -66,7 +64,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(107, 8);
this.classNameLabel.Location = new System.Drawing.Point(107, 27);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
@@ -94,28 +92,11 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
this.saveResultsCheckBox.Text = "Save results";
this.saveResultsCheckBox.UseVisualStyleBackColor = true;
//
// benchIdTextBox
//
this.benchIdTextBox.Enabled = false;
this.benchIdTextBox.Location = new System.Drawing.Point(110, 53);
this.benchIdTextBox.Name = "benchIdTextBox";
this.benchIdTextBox.Size = new System.Drawing.Size(57, 20);
this.benchIdTextBox.TabIndex = 4;
//
// benchIdLabel
//
this.benchIdLabel.AutoSize = true;
this.benchIdLabel.Location = new System.Drawing.Point(19, 56);
this.benchIdLabel.Name = "benchIdLabel";
this.benchIdLabel.Size = new System.Drawing.Size(76, 13);
this.benchIdLabel.TabIndex = 3;
this.benchIdLabel.Text = "Test Bench ID";
//
// dbUsedComboBox
//
this.dbUsedComboBox.Enabled = false;
this.dbUsedComboBox.FormattingEnabled = true;
this.dbUsedComboBox.Location = new System.Drawing.Point(110, 76);
this.dbUsedComboBox.Location = new System.Drawing.Point(110, 79);
this.dbUsedComboBox.Name = "dbUsedComboBox";
this.dbUsedComboBox.Size = new System.Drawing.Size(145, 21);
this.dbUsedComboBox.TabIndex = 6;
@@ -123,7 +104,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// dbUsedLabel
//
this.dbUsedLabel.AutoSize = true;
this.dbUsedLabel.Location = new System.Drawing.Point(19, 78);
this.dbUsedLabel.Location = new System.Drawing.Point(19, 81);
this.dbUsedLabel.Name = "dbUsedLabel";
this.dbUsedLabel.Size = new System.Drawing.Size(79, 13);
this.dbUsedLabel.TabIndex = 5;
@@ -132,7 +113,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// baujahrTextBox
//
this.baujahrTextBox.Enabled = false;
this.baujahrTextBox.Location = new System.Drawing.Point(110, 100);
this.baujahrTextBox.Location = new System.Drawing.Point(110, 104);
this.baujahrTextBox.Name = "baujahrTextBox";
this.baujahrTextBox.Size = new System.Drawing.Size(57, 20);
this.baujahrTextBox.TabIndex = 8;
@@ -140,7 +121,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
// baujahrLabel
//
this.baujahrLabel.AutoSize = true;
this.baujahrLabel.Location = new System.Drawing.Point(19, 103);
this.baujahrLabel.Location = new System.Drawing.Point(19, 107);
this.baujahrLabel.Name = "baujahrLabel";
this.baujahrLabel.Size = new System.Drawing.Size(43, 13);
this.baujahrLabel.TabIndex = 7;
@@ -178,8 +159,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
this.Controls.Add(this.baujahrLabel);
this.Controls.Add(this.dbUsedComboBox);
this.Controls.Add(this.dbUsedLabel);
this.Controls.Add(this.benchIdTextBox);
this.Controls.Add(this.benchIdLabel);
this.Controls.Add(this.saveResultsCheckBox);
this.Controls.Add(this.readStartInfoCheckBox);
this.Controls.Add(this.nameTextBox);
@@ -200,8 +179,6 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.CheckBox readStartInfoCheckBox;
private System.Windows.Forms.CheckBox saveResultsCheckBox;
private System.Windows.Forms.TextBox benchIdTextBox;
private System.Windows.Forms.Label benchIdLabel;
private System.Windows.Forms.ComboBox dbUsedComboBox;
private System.Windows.Forms.Label dbUsedLabel;
private System.Windows.Forms.TextBox baujahrTextBox;
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2017 Sensus Metering Systems
/// Copyright (c) 2013-2020 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -126,9 +126,10 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
/// </summary>
/// <param name="time">Date and time</param>
/// <returns>File name</returns>
string GetFilename(string destinationPath, DateTime time)
string GetFilename(string destinationPath, Results.Entities.Batch batch)
{
string directory = destinationPath; /// Ends with "\\";
DateTime time = batch.EndTime;
switch (writerCfg.YearFolders)
{
@@ -186,8 +187,15 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
try
{
if (string.IsNullOrEmpty(writerCfg.FileNameFormat)) throw new Exception();
return directory + string.Format(writerCfg.FileNameFormat, time);
if (string.IsNullOrEmpty(writerCfg.FileNameFormat))
{
return string.Format("{0}{1:yyMMdd-HHmm}.txt", directory, time);
}
else
{
TBF.BenchControl.GenericDevices.IBenchInfo bi = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
return directory + string.Format(writerCfg.FileNameFormat, batch.EndTime, batch.StartTime, batch.BatchNr, bi.TestBenchName, bi.TestBenchId);
}
}
catch
{
@@ -251,7 +259,7 @@ namespace TBF.BenchControl.Output.FileWriters.Basic
StreamWriter writer = StreamWriter.Null;
try
{
writer = File.AppendText(GetFilename(destination, batch.EndTime));
writer = File.AppendText(GetFilename(destination, batch));
WriteRsltsEx(batch, writer);
log.WarnFormat("Batch {0} written by {1} to file {2}", batch.BatchNr, Name, destination);
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2017 Sensus Metering Systems
/// Copyright (c) 2016-2020 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -124,9 +124,10 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
/// </summary>
/// <param name="time">Date and time</param>
/// <returns>File name</returns>
string GetFilename(string destinationPath, DateTime time)
string GetFilename(string destinationPath, Results.Entities.Batch batch)
{
string directory = destinationPath; /// Ends with "\\";
DateTime time = batch.EndTime;
switch (writerCfg.YearFolders)
{
@@ -184,8 +185,15 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
try
{
if (string.IsNullOrEmpty(writerCfg.FileNameFormat)) throw new Exception();
return directory + string.Format(writerCfg.FileNameFormat, time);
if (string.IsNullOrEmpty(writerCfg.FileNameFormat))
{
return string.Format("{0}{1:yyMMdd-HHmm}.txt", directory, time);
}
else
{
TBF.BenchControl.GenericDevices.IBenchInfo bi = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
return directory + string.Format(writerCfg.FileNameFormat, batch.EndTime, batch.StartTime, batch.BatchNr, bi.TestBenchName, bi.TestBenchId);
}
}
catch
{
@@ -247,7 +255,7 @@ namespace TBF.BenchControl.Output.FileWriters.Enhanced
StreamWriter writer = StreamWriter.Null;
try
{
writer = File.AppendText(GetFilename(destination, batch.EndTime));
writer = File.AppendText(GetFilename(destination, batch));
WriteRsltsEx(batch, writer);
log.WarnFormat("Batch {0} written by {1} to file {2}", batch.BatchNr, Name, destination);
}
@@ -177,11 +177,12 @@ namespace TBF.BenchControl.Output.FileWriters.IperlLogger
/// Obtain one representative water meter data
Results.Entities.WaterMeter wm0 = null;
foreach (var m in batch.WaterMeters)
foreach (var wm in batch.WaterMeters)
{
if (m != null)
if ((wm != null) && (wm.CompleteTestInfos != null) && (wm.WaterMeterData != null))
//if ((wm != null) && wm.PassedFromTests())
{
wm0 = m;
wm0 = wm;
break;
}
}
@@ -104,9 +104,10 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
/// </summary>
/// <param name="time">Date and time</param>
/// <returns>File name</returns>
string GetFilename(string destinationPath, DateTime time, int wmPosition)
string GetFilename(string destinationPath, Results.Entities.Batch batch, Results.Entities.WaterMeter wm)
{
string directory = destinationPath; /// Ends with "\\";
DateTime time = batch.EndTime;
switch (writerCfg.YearFolders)
{
@@ -164,12 +165,19 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
try
{
if (string.IsNullOrEmpty(writerCfg.FileNameFormat)) throw new Exception();
return directory + string.Format(writerCfg.FileNameFormat, time, wmPosition);
if (string.IsNullOrEmpty(writerCfg.FileNameFormat))
{
return string.Format("{0}{1:yyMMdd-HHmm}-{2:D2}.xml", directory, time, wm.WMPosition);
}
else
{
TBF.BenchControl.GenericDevices.IBenchInfo bi = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
return directory + string.Format(writerCfg.FileNameFormat, batch.EndTime, batch.StartTime, batch.BatchNr, bi.TestBenchName, bi.TestBenchId, wm.WMPosition, wm.SerialNr);
}
}
catch
{
return string.Format("{0}{1:yyMMdd-HHmm}-{2:D2}.xml", directory, time, wmPosition);
return string.Format("{0}{1:yyMMdd-HHmm}-{2:D2}.xml", directory, time, wm.WMPosition);
}
}
@@ -225,7 +233,7 @@ namespace TBF.BenchControl.Output.FileWriters.Xml
StreamWriter writer = StreamWriter.Null;
try
{
writer = File.AppendText(GetFilename(destination, batch.EndTime, wm.WMPosition));
writer = File.AppendText(GetFilename(destination, batch, wm));
WriteWM(writer, wm);
log.WarnFormat("Batch {0}/watermeter {1} written by {2} to file {3}", batch.BatchNr, wm.WMPosition, Name, destination);
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -110,9 +110,10 @@ namespace TBF.BenchControl.Output.FileWriters.XmlBatch
/// </summary>
/// <param name="time">Date and time</param>
/// <returns>File name</returns>
string GetFilename(string destinationPath, DateTime time)
string GetFilename(string destinationPath, Results.Entities.Batch batch)
{
string directory = destinationPath; /// Ends with "\\";
DateTime time = batch.EndTime;
switch (writerCfg.YearFolders)
{
@@ -170,8 +171,15 @@ namespace TBF.BenchControl.Output.FileWriters.XmlBatch
try
{
if (string.IsNullOrEmpty(writerCfg.FileNameFormat)) throw new Exception();
return directory + string.Format(writerCfg.FileNameFormat, time);
if (string.IsNullOrEmpty(writerCfg.FileNameFormat))
{
return string.Format("{0}{1:yyMMdd-HHmm}.xml", directory, time);
}
else
{
TBF.BenchControl.GenericDevices.IBenchInfo bi = TBF.BenchControl.Sequences.ProcessData.BenchInfo;
return directory + string.Format(writerCfg.FileNameFormat, batch.EndTime, batch.StartTime, batch.BatchNr, bi.TestBenchName, bi.TestBenchId);
}
}
catch
{
@@ -230,7 +238,7 @@ namespace TBF.BenchControl.Output.FileWriters.XmlBatch
StreamWriter writer = StreamWriter.Null;
try
{
writer = File.AppendText(GetFilename(destination, batch.EndTime));
writer = File.AppendText(GetFilename(destination, batch));
WriteBatch(writer);
log.WarnFormat("Batch {0} written by {1} to file {2}", batch.BatchNr, Name, destination);
}
@@ -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);
}
}
}

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