ResultsPrinter.Cevak implemented, bug fixes in ResultsPrinter.Basic. Bug fixes in EntryForms (Purchase order via UpdateTestResultss(..)), version 2.2.222.

This commit is contained in:
Milan Hanajik
2016-02-19 14:25:59 +01:00
parent 4ab889b43e
commit 2cab985bd0
16 changed files with 93 additions and 107 deletions
@@ -20,10 +20,10 @@ namespace TBF.BenchControl.BenchInfo.Polska
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString() { return string.Format("BenchInfoEx({0})", Cfg.ToString(1)); }
readonly ComponentCfg benchInfoCfg;
public readonly ComponentCfg BenchInfoCfg;
public string TestBenchName { get { return benchInfoCfg.TestBenchName; } }
public int TestBenchId { get { return benchInfoCfg.TestBenchId; } }
public string TestBenchName { get { return BenchInfoCfg.TestBenchName; } }
public int TestBenchId { get { return BenchInfoCfg.TestBenchId; } }
public Component()
{
@@ -32,7 +32,7 @@ namespace TBF.BenchControl.BenchInfo.Polska
public Component(ComponentCfg cfg)
: base(cfg)
{
benchInfoCfg = cfg;
BenchInfoCfg = cfg;
log.Debug(this.ToString());
}
}
@@ -61,7 +61,7 @@ namespace TBF.BenchControl.BenchInfo.Polska
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(113, 24);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(88, 20);
this.nameTextBox.Size = new System.Drawing.Size(180, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
@@ -240,7 +240,7 @@ namespace TBF.BenchControl.BenchInfo.Polska
this.benchNameTextBox.Enabled = false;
this.benchNameTextBox.Location = new System.Drawing.Point(113, 44);
this.benchNameTextBox.Name = "benchNameTextBox";
this.benchNameTextBox.Size = new System.Drawing.Size(57, 20);
this.benchNameTextBox.Size = new System.Drawing.Size(180, 20);
this.benchNameTextBox.TabIndex = 4;
//
// benchNameLabel
@@ -264,14 +264,16 @@ namespace TBF.BenchControl.DataEntry.Combined
currentOp = CurrentOp.None;
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="testResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults results)
{
/// Nothing to be done
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
}
}
}
}
}
@@ -255,23 +255,16 @@ namespace TBF.BenchControl.DataEntry.Standard
currentOp = CurrentOp.None;
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="testResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults results)
{
/// Nothing to be done
//for (int i = 0; i < results.WMPositionsCount; i++)
//{
// if (results.Batch.WaterMeters[i] == null || results.Batch.WaterMeters[i].Compound()) continue;
// results.Batch.WaterMeters[i].SerialNr = SerialNr(i);
// results.Batch.WaterMeters[i].Disabled = Disabled(i);
// results.Batch.WaterMeters[i].EndState = WMCycleEndState(i);
//}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
}
}
}
}
@@ -252,23 +252,16 @@ namespace TBF.BenchControl.DataEntry.Standard12
currentOp = CurrentOp.None;
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="testResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults results)
{
/// Nothing to be done
//for (int i = 0; i < results.WMPositionsCount; i++)
//{
// if (results.Batch.WaterMeters[i] == null || results.Batch.WaterMeters[i].Compound()) continue;
// results.Batch.WaterMeters[i].SerialNr = SerialNr(i);
// results.Batch.WaterMeters[i].Disabled = Disabled(i);
// results.Batch.WaterMeters[i].EndState = WMCycleEndState(i);
//}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
}
}
}
}
@@ -255,20 +255,13 @@ namespace TBF.BenchControl.DataEntry.Standard24
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="testResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults results)
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
/// Nothing to be done
//for (int i = 0; i < results.WMPositionsCount; i++)
//{
// if (results.Batch.WaterMeters[i] == null || results.Batch.WaterMeters[i].Compound()) continue;
// results.Batch.WaterMeters[i].SerialNr = SerialNr(i);
// results.Batch.WaterMeters[i].Disabled = Disabled(i);
// results.Batch.WaterMeters[i].EndState = WMCycleEndState(i);
//}
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
}
}
}
}
@@ -252,23 +252,16 @@ namespace TBF.BenchControl.DataEntry.Standard48
currentOp = CurrentOp.None;
}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="testResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults results)
{
/// Nothing to be done
//for (int i = 0; i < results.WMPositionsCount; i++)
//{
// if (results.Batch.WaterMeters[i] == null || results.Batch.WaterMeters[i].Compound()) continue;
// results.Batch.WaterMeters[i].SerialNr = SerialNr(i);
// results.Batch.WaterMeters[i].Disabled = Disabled(i);
// results.Batch.WaterMeters[i].EndState = WMCycleEndState(i);
//}
/// <summary>
/// Updates test results with the information collected in watermeters.
/// </summary>
/// <param name="batchResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled) wm.PurchaseOrder = PurchaseOrder;
}
}
}
}
@@ -222,7 +222,7 @@ namespace TBF.BenchControl.DataEntry.iPerl
/// <param name="waterMeters">Watermetes with information entered in the forms</param>
/// <param name="testResults">Test results to be updated with the information</param>
public void UpdateTestResults(Results.BatchResults batchResults)
{
{
foreach (var wm in batchResults.WaterMeters)
{
if (wm != null && !wm.Disabled)
@@ -309,6 +309,7 @@ namespace TBF.BenchControl.Elde
}
/// Increment water meters
float flowLtrPerSec = TestBenchSim.GetSimFlow() / 1800.0f;
for (int i = 1; i <= Config.Data.WMsCount; i++)
{
float wmPulsesPerLiter = 0;
@@ -318,7 +319,7 @@ namespace TBF.BenchControl.Elde
{
wmPulsesPerLiter = (float)BenchControl.Sequences.ProcessData.RegisterReaders[i-1].PulsesPerLtr;
}
wMeterPulsesF[i] += errFactor[i] * pwFactor * ((float)rand.Next(100) + 450.0f) * wmPulsesPerLiter * TestBenchSim.GetSimFlow() / 1800.0f;
wMeterPulsesF[i] += errFactor[i] * pwFactor * ((float)rand.Next(100) + 450.0f) * wmPulsesPerLiter * flowLtrPerSec;
wMeterPulses[i] = (UInt16)wMeterPulsesF[i];
}
@@ -19,12 +19,11 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
public float EndWMState;
public double PulsesPerLtr { get { return (double)registerReaderCfg.ProcParams.PulsesPerLtr; } }
public double LtrsPerPulse { get { return ltrsPerPulse; } }
readonly double ltrsPerPulse;
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); ; } }
public int WMPulses { get { return wmPulses; } }
public int WMRefPulses { get { return wmRefPulses; } }
public double WMVolume { get { return ltrsPerPulse * (double)wmPulses; } }
public double WMVolume { get { return LtrsPerPulse * (double)wmPulses; } }
int wmPulses;
int wmRefPulses;
@@ -41,7 +40,6 @@ namespace TBF.BenchControl.Elde.FixedStartRegisterReader
: base(cfg)
{
registerReaderCfg = cfg;
ltrsPerPulse = (cfg.ProcParams.PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / cfg.ProcParams.PulsesPerLtr);
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
@@ -18,12 +18,11 @@ namespace TBF.BenchControl.Elde.RegisterReader
public int Position { get { return registerReaderCfg.Position; } } /// 1 .. inf
///
public double PulsesPerLtr { get { return (double)registerReaderCfg.ProcParams.PulsesPerLtr; } }
public double LtrsPerPulse { get { return ltrsPerPulse; } }
readonly double ltrsPerPulse;
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); ; } }
public int WMPulses { get { return wmPulses; } }
public int WMRefPulses { get { return wmRefPulses; } }
public double WMVolume { get { return ltrsPerPulse * (double)wmPulses; } }
public double WMVolume { get { return LtrsPerPulse * (double)wmPulses; } }
int wmPulses;
int wmRefPulses;
@@ -44,7 +43,6 @@ namespace TBF.BenchControl.Elde.RegisterReader
: base(cfg)
{
registerReaderCfg = cfg;
ltrsPerPulse = (cfg.ProcParams.PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / cfg.ProcParams.PulsesPerLtr);
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
@@ -97,7 +97,7 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
nrPages = 1 + batch.WaterMeters.Count / nrWMsOnNextPage;
nrPages = 1 + (batch.WaterMeters.Count - nrWMsOnFirstPage + nrWMsOnNextPage - 1) / nrWMsOnNextPage;
pageNr = 1;
nextWMNr = 0;
@@ -298,6 +298,7 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
int testsCount = 0;
foreach (var mtr in wm.MeterTestRslts)
{
testsCount++;
for (int i = 0; i < rsltItems.Count; i++)
{
string itemText;
@@ -327,7 +328,6 @@ namespace TBF.BenchControl.ResultsPrinters.Basic
/// TODO: How to print colors?
}
testsCount++;
PrintAt(e, (int)columnPos[i], top + 30 + SpacingOne * testsCount, itemText);
}
}
@@ -33,6 +33,7 @@ namespace TBF.BenchControl.ResultsPrinters.Cevak
/// Data to print
///
Results.Entities.Batch batch;
TBF.BenchControl.BenchInfo.Polska.Component benchInfo;
///
/// Items to print
@@ -55,15 +56,17 @@ namespace TBF.BenchControl.ResultsPrinters.Cevak
/// <param name="textToPrint">Text to be printed</param>
public PrintDocumentCevak(Results.Entities.Batch batch,
PageOrientation pageOrientation,
int topMrgn)
int topMrgn,
TBF.BenchControl.BenchInfo.Polska.Component benchInfo)
{
this.batch = batch;
this.benchInfo = benchInfo;
DefaultPageSettings.Landscape = (pageOrientation == PageOrientation.Landscape);
TitleY = topMrgn; /// Depends on the size of the header
HdrTop = TitleY + 60;
BodyTop = HdrTop + 160;
BodyTop = HdrTop + 230;
if (batch.WaterMeters[0].Compound())
{
@@ -97,7 +100,7 @@ namespace TBF.BenchControl.ResultsPrinters.Cevak
nrWMsOnFirstPage = (printHeight - BodyTop + TitleY - 2 * SpacingOne) / wmSectionHeight;
nrWMsOnNextPage = (printHeight - 2 * SpacingOne) / wmSectionHeight;
nrPages = 1 + batch.WaterMeters.Count / nrWMsOnNextPage;
nrPages = 1 + (batch.WaterMeters.Count - nrWMsOnFirstPage + nrWMsOnNextPage - 1) / nrWMsOnNextPage;
pageNr = 1;
nextWMNr = 0;
@@ -164,18 +167,24 @@ namespace TBF.BenchControl.ResultsPrinters.Cevak
string[] leftColumn = new string[]
{
"Batch number: ",
"Date and time: ",
"Procedure:",
Strings.User_,
"Ambient temperature: ",
"Ambient pressure: ",
"Ambient humidity: ",
"Protokol č.: ",
"Zákazník: ",
"Datum a čas: ",
"Procedura: ",
"Popis procedury: ",
"Zkoušející: ",
"Název zkušební stanice: ",
"Zkušební SW, č. verze: ",
"Metodika: ", /// BenchAdresa 1
"Okolní teplota: ",
"Okolní tlak: ",
"Relativní vlhkost: ",
};
string[] rightColumn = new string[]
{
batch.BatchNr.ToString(),
batch.WaterMeters[0].PurchaseOrder,
//batch.EndTime.ToShortDateString() + " " + batch.EndTime.ToShortTimeString(),
string.Format("{0}.{1}.{2} {3}:{4}", batch.EndTime.Year.ToString("D4"),
batch.EndTime.Month.ToString("D2"),
@@ -183,7 +192,11 @@ namespace TBF.BenchControl.ResultsPrinters.Cevak
batch.EndTime.Hour.ToString("D2"),
batch.EndTime.Minute.ToString("D2")),
batch.ProcedureName,
batch.ProcedureDescription,
User.CurrentUser.Name,
benchInfo.TestBenchName,
string.Format("Test Bench Framework ver.{0}", batch.ProgramVersion),
benchInfo.BenchInfoCfg.Address1,
batch.AmbientTempAve().ToString("F1") + " °C",
batch.AmbientPressAve().ToString("F0") + " mbar",
batch.AmbientHumiAve().ToString("F0") + " %",
@@ -222,7 +235,7 @@ namespace TBF.BenchControl.ResultsPrinters.Cevak
///----------
/// Footer
///----------
PrintAt(e, leftMargin, topMargin + printHeight - SpacingOne, string.Format("{0} {1}/{2}", Strings.Page, pageNr++, nrPages));
PrintAt(e, leftMargin, topMargin + printHeight - SpacingOne, string.Format("str. {1}/{2}", Strings.Page, pageNr++, nrPages));
}
@@ -274,7 +287,7 @@ namespace TBF.BenchControl.ResultsPrinters.Cevak
int tableLeftX = (int)columnPos[0];
int tableRightX = (int)columnPos[rsltItems.Count] - 20;
string wmText = string.Format("Water meter {0}", printedWMNr);
string wmText = string.Format("Vodoměr {0}", printedWMNr);
PrintAt(e, 100, top, wmText);
if (!string.IsNullOrEmpty(wm.SerialNr))
{
@@ -298,6 +311,7 @@ namespace TBF.BenchControl.ResultsPrinters.Cevak
int testsCount = 0;
foreach (var mtr in wm.MeterTestRslts)
{
testsCount++;
for (int i = 0; i < rsltItems.Count; i++)
{
string itemText;
@@ -327,7 +341,6 @@ namespace TBF.BenchControl.ResultsPrinters.Cevak
/// TODO: How to print colors?
}
testsCount++;
PrintAt(e, (int)columnPos[i], top + 30 + SpacingOne * testsCount, itemText);
}
}
@@ -46,9 +46,9 @@ namespace TBF.BenchControl.ResultsPrinters.Cevak
{
if (batch.WaterMeters.Count > 0)
{
new PrintDocumentCevak(batch,
printerCfg.PageOrientation,
printerCfg.TopMargin).Print();
TBF.BenchControl.BenchInfo.Polska.Component benchInfo =
BenchControl.Sequences.ProcessData.BenchInfo as TBF.BenchControl.BenchInfo.Polska.Component;
new PrintDocumentCevak(batch, printerCfg.PageOrientation, printerCfg.TopMargin, benchInfo).Print();
}
}