Results.ItemID : Procedure_description, Test_bench_name, Address1-5 and respective WMeterRsltItemSpec added, ver. 2.18.995

This commit is contained in:
Milan Hanajik 2018-09-13 16:33:22 +02:00
parent 4fad9925ec
commit 81cb0eae64
13 changed files with 167 additions and 20 deletions

View File

@ -27,8 +27,8 @@ namespace Results
public Batch Batch;
public WaterMeter[] WaterMeters;
public static BatchResults NewFromProcedure(int batchNr, int benchId, string user, int userNr, string programVer,
Config.Entities.Procedure procedure,
public static BatchResults NewFromProcedure(int batchNr, int benchId, string benchName, string a1, string a2, string a3, string a4, string a5,
string user, int userNr, string programVer, Config.Entities.Procedure procedure,
WaterMeterData[] waterMeterDatas, int[] waterMeterParts, double densityCorr)
{
BatchResults d = new BatchResults(waterMeterDatas.Length);
@ -37,8 +37,14 @@ namespace Results
/// Create new batch
d.Batch = new Batch()
{
TestBenchId = benchId,
BatchNr = batchNr,
BatchNr = batchNr,
TestBenchId = benchId,
TestBenchName = benchName,
Address1 = a1,
Address2 = a2,
Address3 = a3,
Address4 = a4,
Address5 = a5,
ProgramVersion = programVer,
UserName = user,
UserNumber = userNr,

View File

@ -11,7 +11,13 @@ namespace Results.Entities
public virtual int Id { get; protected set; }
public virtual int BatchNr { get; set; }
public virtual int TestBenchId { get; set; }
public virtual string ProgramVersion { get; set; }
public virtual string TestBenchName { get; set; } /// CEVAK, not mapped to DB
public virtual string Address1 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address2 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address3 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address4 { get; set; } /// CEVAK, not mapped to DB
public virtual string Address5 { get; set; } /// CEVAK, not mapped to DB
public virtual string ProgramVersion { get; set; }
public virtual string UserName { get; set; }
public virtual int UserNumber { get; set; }
public virtual string ProcedureName { get; set; }

View File

@ -71,7 +71,7 @@ namespace Results
Pulse__liter, /// 61 Water meter constant (pulses per liter) specific for one test
Reference_pulses_ni, /// 62 Reference pulses gated for specific meter (synchro method)
Reference_energy, /// 63
Test_bench_ID, /// 64
Bench_ID, /// 64 Test bench ID (int) obtained from a component implementing IBenchInfo
Program_version, /// 65
User_name, /// 66
User_nr, /// 67
@ -253,6 +253,14 @@ namespace Results
ConstMasterRaw, /// 219 ConstMaster (like 194) uncorrected
Reference_error_corr, /// 220 Reference flow meter error after correction using correction curve
Proc_description, /// 221 Procedure description (CEVAK, not mapped to DB)
Bench_name, /// 222 'Test bench name' (string) obtained from a component implementing IBenchInfo
Bench_address1, /// 223 'Address 1' from IBenchInfo
Bench_address2, /// 224 'Address 2' from IBenchInfo
Bench_address3, /// 225 'Address 3' from IBenchInfo
Bench_address4, /// 226 'Address 4' from IBenchInfo
Bench_address5, /// 227 'Address 5' from IBenchInfo
Count,
}
}

View File

@ -57,10 +57,21 @@ namespace Results.Output.Printers
}
/// <summary>
/// Returns true when table has either rows or columns count == 0
/// </summary>
/// <returns>true when empty</returns>
public bool IsEmpty()
{
return (RowsCount == 0 || Rows[0].Length == 0);
}
public SizeF Measure(System.Drawing.Printing.PrintPageEventArgs e)
{
SizeF retVal = new SizeF(0, 0);
if (RowsCount == 0) return retVal;
if (IsEmpty()) return retVal; /// Empty table => zero Size
float[] columnWidth = new float[ColumnsCount];
float[] rowHeight = new float[RowsCount];
@ -117,10 +128,10 @@ namespace Results.Output.Printers
public float Draw(System.Drawing.Printing.PrintPageEventArgs e, float left, float top)
{
if (RowsCount == 0) return top;
if (IsEmpty()) return top; /// Empty table
int tblColumnsCount = Rows[0].Length;
float[] columnWidth = new float[tblColumnsCount];
float[] columnPos = new float[tblColumnsCount];
float[] vertLinePos = new float[tblColumnsCount + 1];

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.990.0")]
[assembly: AssemblyFileVersion("2.18.990.0")]
[assembly: AssemblyVersion("2.18.995.0")]
[assembly: AssemblyFileVersion("2.18.995.0")]

View File

@ -69,6 +69,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Address.
/// </summary>
internal static string Address {
get {
return ResourceManager.GetString("Address", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Alignment.
/// </summary>
@ -123,6 +132,24 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Bench ID.
/// </summary>
internal static string Bench_ID {
get {
return ResourceManager.GetString("Bench_ID", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Bench name.
/// </summary>
internal static string Bench_name {
get {
return ResourceManager.GetString("Bench_name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cancel.
/// </summary>
@ -636,6 +663,15 @@ namespace Results.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Procedure description.
/// </summary>
internal static string Procedure_description {
get {
return ResourceManager.GetString("Procedure_description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Producer.
/// </summary>

View File

@ -213,4 +213,43 @@
<data name="Unit" xml:space="preserve">
<value>Jednotka</value>
</data>
<data name="Approval" xml:space="preserve">
<value>Schválení</value>
</data>
<data name="Bench" xml:space="preserve">
<value>Stanice</value>
</data>
<data name="Density" xml:space="preserve">
<value>Hustota</value>
</data>
<data name="Density_correction" xml:space="preserve">
<value>Korekce hustoty</value>
</data>
<data name="End" xml:space="preserve">
<value>Konec</value>
</data>
<data name="Procedure" xml:space="preserve">
<value>Procedura</value>
</data>
<data name="Procedure_description" xml:space="preserve">
<value>Popis procedury</value>
</data>
<data name="Start" xml:space="preserve">
<value>Začátek</value>
</data>
<data name="User" xml:space="preserve">
<value>Uživatel</value>
</data>
<data name="User_description" xml:space="preserve">
<value>Popis uživatele</value>
</data>
<data name="Bench_ID" xml:space="preserve">
<value>ID stanice</value>
</data>
<data name="Bench_name" xml:space="preserve">
<value>Jméno stanice</value>
</data>
<data name="Address" xml:space="preserve">
<value>Adresa</value>
</data>
</root>

View File

@ -723,4 +723,16 @@
<data name="Unit" xml:space="preserve">
<value>Unit</value>
</data>
<data name="Procedure_description" xml:space="preserve">
<value>Procedure description</value>
</data>
<data name="Bench_ID" xml:space="preserve">
<value>Bench ID</value>
</data>
<data name="Bench_name" xml:space="preserve">
<value>Bench name</value>
</data>
<data name="Address" xml:space="preserve">
<value>Address</value>
</data>
</root>

View File

@ -144,10 +144,11 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.Separator, "Separator", "", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => string.Empty));
/// Common
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_name, Strings.Test + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Name())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Procedure_name, Strings.Procedure, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.ProcedureName())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_number, Strings.Batch_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.BatchNr())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_method, Strings.Test_method + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Method())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_name, Strings.Test + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Name())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Procedure_name, Strings.Procedure, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.ProcedureName())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Proc_description, Strings.Procedure_description, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.ProcedureDescription)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Batch_number, Strings.Batch_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.BatchNr())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_method, Strings.Test_method + "()", Quantity.String, ItemCategory.TestData, (w, t, u, f, p) => FormatStr(f, (w.GetTestRslt(t) == null) ? "" : w.GetTestRslt(t).Method())));
///
/// Volume
@ -375,8 +376,14 @@ namespace Results
AllItems.Add(new WMeterRsltItemSpec(ItemID.End_state_aux, Strings.EndState_aux, Quantity.String, ItemCategory.MeterResult, (w, t, u, f, p) => FormatStr(f, w.EndStateAux)));
/// Batch info
AllItems.Add(new WMeterRsltItemSpec(ItemID.Test_bench_ID, Strings.Bench, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.TestBenchId.ToString())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Program_version, Strings.Ver, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.ProgramVersion)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_ID, Strings.Bench_ID, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.TestBenchId.ToString())));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_name, Strings.Bench_name, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.TestBenchName) ? w.Batch.TestBenchName : "")));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address1, Strings.Address + " 1", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address1) ? w.Batch.Address1 : "")));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address2, Strings.Address + " 2", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address2) ? w.Batch.Address2 : "")));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address3, Strings.Address + " 3", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address3) ? w.Batch.Address3 : "")));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address4, Strings.Address + " 4", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address4) ? w.Batch.Address4 : "")));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Bench_address5, Strings.Address + " 5", Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, !string.IsNullOrEmpty(w.Batch.Address5) ? w.Batch.Address5 : "")));
AllItems.Add(new WMeterRsltItemSpec(ItemID.Program_version, Strings.Ver, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, w.Batch.ProgramVersion)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.User_nr, Strings.User_nr, Quantity.Number, ItemCategory.Other, (w, t, u, f, p) => FormatInt(f, w.Batch.UserNumber)));
AllItems.Add(new WMeterRsltItemSpec(ItemID.User_name, Strings.User, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, Users.Entities.User.EncodedStrToUserName(w.Batch.UserName))));
AllItems.Add(new WMeterRsltItemSpec(ItemID.User_description, Strings.User_description, Quantity.String, ItemCategory.Other, (w, t, u, f, p) => FormatStr(f, Users.Entities.User.EncodedStrToFullName(w.Batch.UserName))));

View File

@ -23,6 +23,11 @@ namespace TBF.BenchControl.BenchInfo.Extended
public string TestBenchName { get { return myCfg.TestBenchName; } }
public int TestBenchId { get { return myCfg.TestBenchId; } }
public string Address1 { get { return myCfg.Address1; } }
public string Address2 { get { return myCfg.Address2; } }
public string Address3 { get { return myCfg.Address3; } }
public string Address4 { get { return myCfg.Address4; } }
public string Address5 { get { return myCfg.Address5; } }
public RemoteDBUse RemoteDBUse { get { return myCfg.RemoteDBUse; } }
public Component()

View File

@ -23,6 +23,11 @@ namespace TBF.BenchControl.BenchInfo.Munich
public string TestBenchName { get { return benchInfoCfg.TestBenchName; } }
public int TestBenchId { get { return benchInfoCfg.TestBenchId; } }
public string Address1 { get { return string.Empty; } }
public string Address2 { get { return string.Empty; } }
public string Address3 { get { return string.Empty; } }
public string Address4 { get { return string.Empty; } }
public string Address5 { get { return string.Empty; } }
public RemoteDBUse RemoteDBUse { get { return RemoteDBUse.LocalDBOnly; } }
public Component()

View File

@ -1,6 +1,5 @@
///
/// Copyright (c) 2015 Sensus Metering Systems
/// Author: Milan Hanajík
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
///
using Config.Entities;
using TBF.BenchControl.Generic;
@ -14,6 +13,11 @@ namespace TBF.BenchControl.GenericDevices
{
string TestBenchName { get; }
int TestBenchId { get; }
string Address1 { get; }
string Address2 { get; }
string Address3 { get; }
string Address4 { get; }
string Address5 { get; }
RemoteDBUse RemoteDBUse { get; }
}
}

View File

@ -1455,7 +1455,13 @@ namespace TBF.BenchControl.Sequences
/// Prepare empty results
return Results.BatchResults.NewFromProcedure(newBatchNr,
(BenchInfo != null) ? BenchInfo.TestBenchId : 1,
Users.GlobalData.CurrentUser.ToEncodedStr(),
(BenchInfo != null) ? BenchInfo.TestBenchName : "testbench",
(BenchInfo != null) ? BenchInfo.Address1 : string.Empty,
(BenchInfo != null) ? BenchInfo.Address2 : string.Empty,
(BenchInfo != null) ? BenchInfo.Address3 : string.Empty,
(BenchInfo != null) ? BenchInfo.Address4 : string.Empty,
(BenchInfo != null) ? BenchInfo.Address5 : string.Empty,
Users.GlobalData.CurrentUser.ToEncodedStr(),
Users.GlobalData.CurrentUser.Number,
Program.Version,
StateMachine.Procedure,
@ -1480,6 +1486,8 @@ namespace TBF.BenchControl.Sequences
if (oriBatch == null) return;
batchResults.Batch.StartTime = oriBatch.StartTime;
batchResults.Batch.TestBenchId = (BenchInfo != null) ? BenchInfo.TestBenchId : 1;
batchResults.Batch.TestBenchName = (BenchInfo != null) ? BenchInfo.TestBenchName : "testbench";
foreach (var testRslt in batchResults.Batch.TestRslts)
{