LU logging added to SensusOracle DB (content of logging to be completed).

This commit is contained in:
Milan Hanajik
2016-02-08 16:34:37 +01:00
parent 3407b51c27
commit 1278a2365d
4 changed files with 404 additions and 60 deletions
@@ -22,15 +22,13 @@ namespace TBF.BenchControl.DB.SensusOracle
public class Database : ComponentBase, IOperation, GenericDevices.IResultsWriter, Generic.IDevice
{
private static readonly ILog log = LogManager.GetLogger(typeof(Database));
public override string ToString() { return string.Format("ResultsWriters.Basic({0})", Cfg.ToString(1)); }
public override string ToString() { return string.Format("Sensus-Oracle-Database({0})", Cfg.ToString(1)); }
const int Anbid_StaraTura = 4;
readonly DatabaseCfg dbCfg;
string separatorStr;
OracleConnection conn; /// Oracle database connection
/// <summary>
/// Result items to print
/// </summary>
@@ -41,9 +39,9 @@ namespace TBF.BenchControl.DB.SensusOracle
/// </summary>
Results.Entities.Batch batch;
StreamWriter writer;
bool batchDataSaved; /// This is to save batch data (VT_PRUEFREIHE_PD) only once
OracleConnection conn; /// Oracle database connection
StreamWriter writer; /// Results to disk
StreamWriter logger; /// Logs specified by LU
public Database() {}
@@ -126,7 +124,7 @@ namespace TBF.BenchControl.DB.SensusOracle
/// </summary>
/// <param name="time">Date and time</param>
/// <returns>File name</returns>
string GetFilename(DateTime time)
string GetFileName(DateTime time)
{
string directory = dbCfg.DestinationPath; /// Ends with "\\";
Directory.CreateDirectory(directory);
@@ -139,24 +137,7 @@ namespace TBF.BenchControl.DB.SensusOracle
if (dbCfg.MonthFolders)
{
string monthStr /* = now.Month.ToString("D2")*/;
switch (time.Month)
{
default:
case 1: monthStr = "January"; break;
case 2: monthStr = "February"; break;
case 3: monthStr = "March"; break;
case 4: monthStr = "April"; break;
case 5: monthStr = "May"; break;
case 6: monthStr = "June"; break;
case 7: monthStr = "July"; break;
case 8: monthStr = "August"; break;
case 9: monthStr = "September"; break;
case 10: monthStr = "October"; break;
case 11: monthStr = "November"; break;
case 12: monthStr = "December"; break;
}
directory = string.Format("{0}{1}\\", directory, monthStr);
directory = string.Format("{0}{1}\\", directory, time.Month.ToString("D2"));
Directory.CreateDirectory(directory);
}
@@ -170,6 +151,39 @@ namespace TBF.BenchControl.DB.SensusOracle
time.Month.ToString("D2"), time.Day.ToString("D2"), time.Hour.ToString("D2"), time.Minute.ToString("D2"));
}
/// <summary>
/// Returns a file name derived from a DateTime structure.
/// Creates directories on this path as a side effect.
/// </summary>
/// <param name="time">Date and time</param>
/// <returns>File name</returns>
string GetLogFileName(DateTime time)
{
string directory = dbCfg.LogFolderPath; /// Ends with "\\";
Directory.CreateDirectory(directory);
if (dbCfg.YearFolders)
{
directory = string.Format("{0}{1}\\", directory, time.Year.ToString());
Directory.CreateDirectory(directory);
}
if (dbCfg.MonthFolders)
{
directory = string.Format("{0}{1}\\", directory, time.Month.ToString("D2"));
Directory.CreateDirectory(directory);
}
if (dbCfg.DayFolders)
{
directory = string.Format("{0}{1}\\", directory, time.Day.ToString("D2"));
Directory.CreateDirectory(directory);
}
return string.Format("{0}{1}_{2}.log", directory, time.Hour.ToString("D2"), time.Minute.ToString("D2"));
}
/// <summary>
/// Writes the test cycle results into a file, Events: Event.ResultsWritten
/// </summary>
@@ -189,14 +203,21 @@ namespace TBF.BenchControl.DB.SensusOracle
rsltItems = Results.ItemSpec.FromStrArray(Program.LocalSettings.RsltItems_Disk_CombinedWM);
}
try
{
writer = new StreamWriter(System.IO.File.Create(GetFilename(batch.EndTime)));
}
string fname = GetFileName(batch.EndTime);
try { writer = new StreamWriter(System.IO.File.Create(fname)); }
catch
{
writer = null;
}
{
writer = null;
log.ErrorFormat("Was not able to open results file {0}", fname);
}
fname = GetLogFileName(batch.StartTime);
try { logger = new StreamWriter(System.IO.File.Create(fname)); }
catch
{
logger = null;
log.ErrorFormat("Was not able to open LU log file {0}", fname);
}
return this;
}
@@ -219,8 +240,9 @@ namespace TBF.BenchControl.DB.SensusOracle
if (WriteResultsToDatabase(batch) == Retv.Error) anyError = true;
}
#endif
if (WriteResultsToDisk(batch) == Retv.Error) anyError = true;
WriteResultsToDisk(batch);
WriteLogsToDisk(batch);
if (anyError)
{
@@ -445,6 +467,267 @@ namespace TBF.BenchControl.DB.SensusOracle
}
public Retv WriteLogsToDisk(Results.Entities.Batch batch)
{
if (logger == null) return Retv.Error;
try
{
logger.WriteLine("[Wasserzähler-Daten]");
logger.WriteLine(string.Format("PruefPunkte={0}", 3));
logger.WriteLine(string.Format("Typ={0}", 3)); /// iP 020 Q3_4 R160 A XXXX
logger.WriteLine(string.Format("MetroKlasse={0}", batch.WaterMeters[0].WaterMeterData.MetrologicalClass)); /// R160
logger.WriteLine(string.Format("Zulassungszeichen={0}", batch.WaterMeters[0].WaterMeterData.ApprovalInfo)); /// DE-12-MI001-PTB010
logger.WriteLine(string.Format("Qn={0}", batch.WaterMeters[0].WaterMeterData.Qn)); /// 4,0
logger.WriteLine(string.Format("Impulsrate={0}", 3)); /// 50,000
logger.WriteLine(string.Format("WZid={0}", 3)); /// 1242
logger.WriteLine(string.Format("RevWzTyp={0}", 3)); /// 1
logger.WriteLine(string.Format("RevPruefstandWzTyp={0}", 3)); /// 2
logger.WriteLine(string.Format("Durchfluss-5={0}", 3)); /// 0,0
logger.WriteLine(string.Format("Prüfzeit-5={0}", 3)); /// 0
logger.WriteLine(string.Format("Prüfbereich100_110-5={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMin-5={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMax-5={0}", 3)); /// 0
logger.WriteLine(string.Format("QBezeichnung-5={0}", 3)); ///
logger.WriteLine(string.Format("Durchfluss-4={0}", 3)); /// 0,0
logger.WriteLine(string.Format("Prüfzeit-4={0}", 3)); /// 0
logger.WriteLine(string.Format("Prüfbereich100_110-4={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMin-4={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMax-4={0}", 3)); /// 0
logger.WriteLine(string.Format("QBezeichnung-4={0}", 3)); ///
logger.WriteLine(string.Format("Durchfluss-3={0}", 3)); /// 0,0
logger.WriteLine(string.Format("Prüfzeit-3={0}", 3)); /// 0
logger.WriteLine(string.Format("Prüfbereich100_110-3={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMin-3={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMax-3={0}", 3)); /// 0
logger.WriteLine(string.Format("QBezeichnung-3={0}", 3)); ///
logger.WriteLine(string.Format("Durchfluss-2={0}", 3)); /// 0,0
logger.WriteLine(string.Format("Prüfzeit-2={0}", 3)); /// 0
logger.WriteLine(string.Format("Prüfbereich100_110-2={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMin-2={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMax-2={0}", 3)); /// 0
logger.WriteLine(string.Format("QBezeichnung-2={0}", 3)); ///
logger.WriteLine(string.Format("Durchfluss-1={0}", 3)); /// 4000,0
logger.WriteLine(string.Format("Prüfzeit-1={0}", 3)); /// 500
logger.WriteLine(string.Format("Prüfbereich100_110-1={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMin-1={0}", 3)); /// 90
logger.WriteLine(string.Format("PrüfbereichMax-1={0}", 3)); /// 100
logger.WriteLine(string.Format("QBezeichnung-1={0}", 3)); /// Just
logger.WriteLine(string.Format("Durchfluss0={0}", 3)); /// 0,0
logger.WriteLine(string.Format("Prüfzeit0={0}", 3)); /// 0
logger.WriteLine(string.Format("Prüfbereich100_1100={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMin0={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMax0={0}", 3)); /// 0
logger.WriteLine(string.Format("QBezeichnung0={0}", 3)); ///
logger.WriteLine(string.Format("Durchfluss1={0}", 3)); /// 25,0
logger.WriteLine(string.Format("Prüfzeit1={0}", 3)); /// 500
logger.WriteLine(string.Format("Prüfbereich100_1101={0}", 3)); /// 1
logger.WriteLine(string.Format("PrüfbereichMin1={0}", 3)); /// 100
logger.WriteLine(string.Format("PrüfbereichMax1={0}", 3)); /// 110
logger.WriteLine(string.Format("QBezeichnung1={0}", 3)); /// Q1
logger.WriteLine(string.Format("PosFehlergrenze1={0}", 3)); /// 5,0
logger.WriteLine(string.Format("NegFehlergrenze1={0}", 3)); /// -5,0
logger.WriteLine(string.Format("PosFehlergrenzeWarm1={0}", 3)); /// 0,0
logger.WriteLine(string.Format("NegFehlergrenzeWarm1={0}", 3)); /// 0,0
logger.WriteLine(string.Format("Durchfluss2={0}", 3)); /// 40,0
logger.WriteLine(string.Format("Prüfzeit2={0}", 3)); /// 400
logger.WriteLine(string.Format("Prüfbereich100_1102={0}", 3)); /// 1
logger.WriteLine(string.Format("PrüfbereichMin2={0}", 3)); /// 100
logger.WriteLine(string.Format("PrüfbereichMax2={0}", 3)); /// 110
logger.WriteLine(string.Format("QBezeichnung2={0}", 3)); /// Q2
logger.WriteLine(string.Format("PosFehlergrenze2={0}", 3)); /// 2,0
logger.WriteLine(string.Format("NegFehlergrenze2={0}", 3)); /// -2,0
logger.WriteLine(string.Format("PosFehlergrenzeWarm2={0}", 3)); /// 0,0
logger.WriteLine(string.Format("NegFehlergrenzeWarm2={0}", 3)); /// 0,0
logger.WriteLine(string.Format("Durchfluss3={0}", 3)); /// 0,0
logger.WriteLine(string.Format("Prüfzeit3={0}", 3)); /// 0
logger.WriteLine(string.Format("Prüfbereich100_1103={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMin3={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMax3={0}", 3)); /// 0
logger.WriteLine(string.Format("QBezeichnung3={0}", 3)); ///
logger.WriteLine(string.Format("PosFehlergrenze3={0}", 3)); /// 0,0
logger.WriteLine(string.Format("NegFehlergrenze3={0}", 3)); /// 0,0
logger.WriteLine(string.Format("PosFehlergrenzeWarm3={0}", 3)); /// 0,0
logger.WriteLine(string.Format("NegFehlergrenzeWarm3={0}", 3)); /// 0,0
logger.WriteLine(string.Format("Durchfluss4={0}", 3)); /// 0,0
logger.WriteLine(string.Format("Prüfzeit4={0}", 3)); /// 0
logger.WriteLine(string.Format("Prüfbereich100_1104={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMin4={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMax4={0}", 3)); /// 0
logger.WriteLine(string.Format("QBezeichnung4={0}", 3)); ///
logger.WriteLine(string.Format("PosFehlergrenze4={0}", 3)); /// 0,0
logger.WriteLine(string.Format("NegFehlergrenze4={0}", 3)); /// 0,0
logger.WriteLine(string.Format("PosFehlergrenzeWarm4={0}", 3)); /// 0,0
logger.WriteLine(string.Format("NegFehlergrenzeWarm4={0}", 3)); /// 0,0
logger.WriteLine(string.Format("Durchfluss5={0}", 3)); /// 4000,0
logger.WriteLine(string.Format("Prüfzeit5={0}", 3)); /// 100
logger.WriteLine(string.Format("Prüfbereich100_1105={0}", 3)); /// 0
logger.WriteLine(string.Format("PrüfbereichMin5={0}", 3)); /// 90
logger.WriteLine(string.Format("PrüfbereichMax5={0}", 3)); /// 100
logger.WriteLine(string.Format("QBezeichnung5={0}", 3)); /// Q3
logger.WriteLine(string.Format("PosFehlergrenze5={0}", 3)); /// 1,3
logger.WriteLine(string.Format("NegFehlergrenze5={0}", 3)); /// -0,8
logger.WriteLine(string.Format("PosFehlergrenzeWarm5={0}", 3)); /// 0,0
logger.WriteLine(string.Format("NegFehlergrenzeWarm5={0}", 3)); /// 0,0
logger.WriteLine(string.Format("GetriebeImpulse={0}", 3)); /// 2,000
logger.WriteLine(string.Format("OptikAufsetzen={0}", 3)); /// 0
logger.WriteLine(string.Format("Warm_Kalt={0}", 3)); /// 0
logger.WriteLine(string.Format("Füllzeit={0}", 3)); /// 0
logger.WriteLine(string.Format("EvakVorneZeit={0}", 3)); /// 0
logger.WriteLine(string.Format("EvakHintenZeit={0}", 3)); /// 90
logger.WriteLine(string.Format("Spüllzeit={0}", 3)); /// 60
logger.WriteLine(string.Format("Spüldurchfluss={0}", 3)); /// 5000,0
logger.WriteLine(string.Format("Abpresszeit={0}", 3)); /// 60
logger.WriteLine(string.Format("Abpressdruck={0}", 3)); /// 0,0
logger.WriteLine(string.Format("Entwässerzeit={0}", 3)); /// 10
logger.WriteLine(string.Format("DinA4_Format={0}", 3)); /// 0
logger.WriteLine(string.Format("Netzwerk_Format={0}", 3)); /// 0
logger.WriteLine(string.Format("Zählernr_Format={0}", 3)); /// 1
logger.WriteLine(string.Format("WZ_Gruppe={0}", 3)); /// 24
logger.WriteLine(string.Format("MittelwertTiefe={0}", 3)); /// 1
logger.WriteLine(string.Format("EndKriterium={0}", 3)); /// 0
logger.WriteLine(string.Format("Justieren={0}", 3)); /// 1
logger.WriteLine(string.Format("Bemerkung={0}", 3)); ///
logger.WriteLine(string.Format("Gesamtprüfzeit={0}", 3)); /// 2042
logger.WriteLine(string.Format("Gegenprüfung={0}", 3)); /// 0
logger.WriteLine(string.Format("Geändert_von={0}", 3)); /// 4459
logger.WriteLine(string.Format("Geändert_am={0}", 3)); /// 29.05.2015 13:46:17
for (int i = 0; i < batch.WaterMeters.Count; i++)
{
Results.Entities.WaterMeter wMtr = batch.WaterMeters[i];
logger.WriteLine(string.Empty);
logger.WriteLine(string.Format("[Zählerdaten_{0}]", i + 1));
logger.WriteLine(string.Format("geprüft={0}", 3)); /// 1
logger.WriteLine(string.Format("Zählernummer={0}", wMtr.SerialNrEx));
logger.WriteLine(string.Format("FertigsNr={0}", wMtr.SerialNr));
logger.WriteLine(string.Format("bestanden={0}", 3)); /// 1
logger.WriteLine(string.Format("Prüfflag={0}", 3)); /// 96
logger.WriteLine(string.Format("FestWertWZ={0}", 3)); /// 0
logger.WriteLine(string.Format("Dicht={0}", 3)); /// 1
logger.WriteLine(string.Format("PrüfIndex={0}", 3)); /// 7301
logger.WriteLine(string.Format("GeprüftIndex={0}", 3)); /// 1
logger.WriteLine(string.Format("Q-1bestanden={0}", 3)); /// 1
logger.WriteLine(string.Format("Durchfluss-1={0}", 3)); /// 3963,38404
logger.WriteLine(string.Format("Fehler-1={0}", 3)); /// 2,12605
logger.WriteLine(string.Format("ZeitImpulse-1={0}", 3)); /// 494,00012
logger.WriteLine(string.Format("Impulse-1={0}", 3)); /// 0
logger.WriteLine(string.Format("Volumen-1={0}", 3)); /// 543,86450
logger.WriteLine(string.Format("KorrFehler-1={0}", 3)); /// 2,12605
logger.WriteLine(string.Format("KorrDurchfluss-1={0}", 3)); /// 3963,38416
logger.WriteLine(string.Format("Q-1KorrBestanden={0}", 3)); /// 0
logger.WriteLine(string.Format("Anfangsstand-1={0}", 3)); /// 205,82450
logger.WriteLine(string.Format("Endstand-1={0}", 3)); /// 749,68900
logger.WriteLine(string.Format("QMittelwert-1={0}", 3)); /// 3963,38416
logger.WriteLine(string.Format("QStandardAbweichung-1={0}", 3)); /// 23,80341
logger.WriteLine(string.Format("ImpedanzMittelwert-1={0}", 3)); /// 0,00000
logger.WriteLine(string.Format("AusfallGrund-1={0}", 3)); /// 0
logger.WriteLine(string.Format("Q1bestanden={0}", 3)); /// 1
logger.WriteLine(string.Format("Durchfluss1={0}", 3)); /// 26,91235
logger.WriteLine(string.Format("Fehler1={0}", 3)); /// 0,05011
logger.WriteLine(string.Format("ZeitImpulse1={0}", 3)); /// 501,12683
logger.WriteLine(string.Format("Impulse1={0}", 3)); /// 0
logger.WriteLine(string.Format("Volumen1={0}", 3)); /// 3,74625
logger.WriteLine(string.Format("KorrFehler1={0}", 3)); /// 0,05223
logger.WriteLine(string.Format("KorrDurchfluss1={0}", 3)); /// 26,91292
logger.WriteLine(string.Format("Q1KorrBestanden={0}", 3)); /// 1
logger.WriteLine(string.Format("Anfangsstand1={0}", 3)); /// 977,83375
logger.WriteLine(string.Format("Endstand1={0}", 3)); /// 981,58000
logger.WriteLine(string.Format("QMittelwert1={0}", 3)); /// 26,91292
logger.WriteLine(string.Format("QStandardAbweichung1={0}", 3)); /// 3,61664
logger.WriteLine(string.Format("ImpedanzMittelwert1={0}", 3)); /// 0,00000
logger.WriteLine(string.Format("AusfallGrund1={0}", 3)); /// 0
logger.WriteLine(string.Format("Q2bestanden={0}", 3)); /// 1
logger.WriteLine(string.Format("Durchfluss2={0}", 3)); /// 42,06588
logger.WriteLine(string.Format("Fehler2={0}", 3)); /// 0,52480
logger.WriteLine(string.Format("ZeitImpulse2={0}", 3)); /// 400,75000
logger.WriteLine(string.Format("Impulse2={0}", 3)); /// 0
logger.WriteLine(string.Format("Volumen2={0}", 3)); /// 4,68275
logger.WriteLine(string.Format("KorrFehler2={0}", 3)); /// 0,52028
logger.WriteLine(string.Format("KorrDurchfluss2={0}", 3)); /// 42,06399
logger.WriteLine(string.Format("Q2KorrBestanden={0}", 3)); /// 1
logger.WriteLine(string.Format("Anfangsstand2={0}", 3)); /// 971,36300
logger.WriteLine(string.Format("Endstand2={0}", 3)); /// 976,04575
logger.WriteLine(string.Format("QMittelwert2={0}", 3)); /// 42,06399
logger.WriteLine(string.Format("QStandardAbweichung2={0}", 3)); /// 3,52892
logger.WriteLine(string.Format("ImpedanzMittelwert2={0}", 3)); /// 0,00000
logger.WriteLine(string.Format("AusfallGrund2={0}", 3)); /// 0
logger.WriteLine(string.Format("Q5bestanden={0}", 3)); /// 1
logger.WriteLine(string.Format("Durchfluss5={0}", 3)); /// 3886,53959
logger.WriteLine(string.Format("Fehler5={0}", 3)); /// 0,31667
logger.WriteLine(string.Format("ZeitImpulse5={0}", 3)); /// 101,12317
logger.WriteLine(string.Format("Impulse5={0}", 3)); /// 0
logger.WriteLine(string.Format("Volumen5={0}", 3)); /// 109,17200
logger.WriteLine(string.Format("KorrFehler5={0}", 3)); /// 0,31421
logger.WriteLine(string.Format("KorrDurchfluss5={0}", 3)); /// 3886,44444
logger.WriteLine(string.Format("Q5KorrBestanden={0}", 3)); /// 1
logger.WriteLine(string.Format("Anfangsstand5={0}", 3)); /// 853,41800
logger.WriteLine(string.Format("Endstand5={0}", 3)); /// 962,59000
logger.WriteLine(string.Format("QMittelwert5={0}", 3)); /// 3886,44444
logger.WriteLine(string.Format("QStandardAbweichung5={0}", 3)); /// 25,63481
logger.WriteLine(string.Format("ImpedanzMittelwert5={0}", 3)); /// 0,00000
logger.WriteLine(string.Format("AusfallGrund5={0}", 3)); /// 0
logger.WriteLine(string.Format("AusfallGrundGesamt={0}", 3)); /// 0
logger.WriteLine(string.Format("AuftragNum={0}", wMtr.PurchaseOrder));
logger.WriteLine(string.Format("MaterialNum={0}", 3)); /// 38140500
logger.WriteLine(string.Format("Prefix={0}", "8SEN01")); ///
logger.WriteLine(string.Format("Suffix={0}", 3)); ///
logger.WriteLine(string.Format("Palette={0}", 0)); /// 0
logger.WriteLine(string.Format("Umkarton={0}", 0)); /// 0
logger.WriteLine(string.Format("ZNr_komplett={0}", 3)); ///
logger.WriteLine(string.Format("OptikBewertung={0}", "0,00000")); /// 0,00000
logger.WriteLine(string.Format("IdProduziert={0}", 3)); /// 61
logger.WriteLine(string.Format("Calibration_alt={0}", 3)); /// 3746
logger.WriteLine(string.Format("Calibration={0}", 3)); /// 3675
logger.WriteLine(string.Format("Firmware={0}", 3)); /// 05.66
logger.WriteLine(string.Format("FlexFlowFehler={0}", 3)); /// 0
logger.WriteLine(string.Format("FlexFlowAuftrag={0}", 3)); /// 4248189
logger.WriteLine(string.Format("JustierWert={0}", 3)); /// 0,2
logger.WriteLine(string.Format("Corrected2Hz={0}", 0)); /// 0
logger.WriteLine(string.Format("Q2Corrected={0}", wMtr.Q2CorrectionDone ? 1 : 0)); /// 0
logger.WriteLine(string.Format("Q2CorrectionRight={0}", 3)); /// 0
logger.WriteLine(string.Format("Q2CorrectionLeft={0}", 3)); /// 0
logger.WriteLine(string.Format("Q2CorrectionFlowRight={0}", 3)); /// 0
logger.WriteLine(string.Format("FlowDirectionRight={0}", 3)); /// 0
logger.WriteLine(string.Format("Position={0}", wMtr.WMPosition)); /// 1
}
logger.WriteLine(string.Empty);
logger.WriteLine(string.Format("[allgemein]")); ///
logger.WriteLine(string.Format("Prüfer={0}", 6)); /// 1047
logger.WriteLine(string.Format("PrüferID={0}", 6)); /// 246
logger.WriteLine(string.Format("AuftragKompakt={0}", 3)); /// 4248189
logger.WriteLine(string.Format("VariantenCode={0}", 3)); /// IPRO04CMECAZDKAMMXB1AA2011201101AEUAA1XX314NM1XXXLX
logger.WriteLine(string.Format("SollStückzahl={0}", 3)); /// 1000
logger.WriteLine(string.Format("IstStückzahl={0}", 3)); /// 61
logger.WriteLine(string.Format("Bemerkung={0}", 3)); /// §
logger.WriteLine(string.Format("BetriebsArt={0}", 3)); /// C
logger.WriteLine(string.Format("BuchstabenVorEtikett={0}", 3)); /// 8SEN01
logger.WriteLine(string.Format("BuchstabenNachEtikett={0}", 3));///
logger.WriteLine(string.Format("StehenderStartStop={0}", 3)); /// 0
logger.WriteLine(string.Format("ID_WzPruefreihe={0}", 3)); /// 2583
logger.WriteLine(string.Format("ID_Pruefstand={0}", 3)); /// 18004
logger.WriteLine(string.Format("DichteKorrektur={0}", 3)); /// 0,00000
logger.WriteLine(string.Format("LuftauftriebsKorrekturfaktor={0}", 3)); /// 1,00100
logger.WriteLine(string.Format("ProgrammVersion={0}", 3)); /// 2.18b
logger.WriteLine(string.Format("LetzteAenderung={0}", 3)); /// 13.11.2015
logger.WriteLine(string.Format("QuarzTakt={0}", 3)); /// 1953,125
/// Close the file
logger.Close();
logger = null;
}
catch (Exception exc)
{
log.ErrorFormat("Results not saved to disk: {0}", exc.Message);
return Retv.Error;
}
return Retv.OK; /// OK
}
#if IPERLST
public Retv WriteResultsToDatabase(Results.Entities.Batch batch)
{
@@ -38,6 +38,7 @@ namespace TBF.BenchControl.DB.SensusOracle
public DBUsed DBUsed;
public int Baujahr; /// Written to the database
public string DestinationPath; /// Directory path into which the results will be saved
public string LogFolderPath; /// Directory path into which the results will be saved
public bool YearFolders;
public bool MonthFolders;
public bool DayFolders;
@@ -54,6 +55,7 @@ namespace TBF.BenchControl.DB.SensusOracle
DBUsed = DBUsed.Test;
Baujahr = 2015;
DestinationPath = Program.HomeDir + "Results\\";
LogFolderPath = Program.HomeDir + "Logs\\";
YearFolders = true;
MonthFolders = true;
DayFolders = false;
@@ -69,12 +71,13 @@ namespace TBF.BenchControl.DB.SensusOracle
public string ToString(int i)
{
return string.Format("Name={0}, BenchId={1}, DBUsed={2}, Baujahr={3}, Path={4}, Y={5}, M={6}, D={7}, Elim.Spaces={8}, Separator={9}",
return string.Format("Name={0}, BenchId={1}, DBUsed={2}, Baujahr={3}, Results={4}, Logs={5}, Y={6}, M={7}, D={8}, Elim.spaces={9}, Separator={10}",
Name,
TestBenchId,
DBUsed,
Baujahr,
DestinationPath,
LogFolderPath,
YearFolders,
MonthFolders,
DayFolders,
@@ -57,6 +57,7 @@ namespace TBF.BenchControl.DB.SensusOracle
dbUsedComboBox.Text = config.DBUsed.ToString();
baujahrTextBox.Text = config.Baujahr.ToString();
destinationTextBox.Text = config.DestinationPath;
logsFolderTextBox.Text = config.LogFolderPath;
yearFoldersCheckBox.Checked = config.YearFolders;
monthFoldersCheckBox.Checked = config.MonthFolders;
dayFoldersCheckBox.Checked = config.DayFolders;
@@ -72,6 +73,8 @@ namespace TBF.BenchControl.DB.SensusOracle
baujahrTextBox.Enabled = true;
destinationTextBox.Enabled = true;
destinationButton.Enabled = true;
logsFolderTextBox.Enabled = true;
logsFolderButton.Enabled = true;
yearFoldersCheckBox.Enabled = true;
monthFoldersCheckBox.Enabled = true;
dayFoldersCheckBox.Enabled = true;
@@ -153,6 +156,13 @@ namespace TBF.BenchControl.DB.SensusOracle
flags = CfgUpdateFlags.RestartRqrd;
}
if (config.LogFolderPath != logsFolderTextBox.Text)
{
config.LogFolderPath = logsFolderTextBox.Text;
if (!config.LogFolderPath.EndsWith("\\")) config.LogFolderPath += "\\";
flags = CfgUpdateFlags.RestartRqrd;
}
if (yearFoldersCheckBox.Checked != config.YearFolders)
{
config.YearFolders = yearFoldersCheckBox.Checked;
@@ -187,5 +197,15 @@ namespace TBF.BenchControl.DB.SensusOracle
return flags;
}
private void destinationButton_Click(object sender, EventArgs e)
{
}
private void logsFolderButton_Click(object sender, EventArgs e)
{
}
}
}
@@ -50,12 +50,15 @@ namespace TBF.BenchControl.DB.SensusOracle
this.dbUsedLabel = new System.Windows.Forms.Label();
this.baujahrTextBox = new System.Windows.Forms.TextBox();
this.baujahrLabel = new System.Windows.Forms.Label();
this.logsFolderButton = new System.Windows.Forms.Button();
this.logsFolderTextBox = new System.Windows.Forms.TextBox();
this.logsFolderLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(110, 33);
this.nameTextBox.Location = new System.Drawing.Point(110, 30);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
this.nameTextBox.TabIndex = 2;
@@ -63,7 +66,7 @@ namespace TBF.BenchControl.DB.SensusOracle
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(19, 36);
this.nameLabel.Location = new System.Drawing.Point(19, 33);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
@@ -81,7 +84,7 @@ namespace TBF.BenchControl.DB.SensusOracle
// destinationTextBox
//
this.destinationTextBox.Enabled = false;
this.destinationTextBox.Location = new System.Drawing.Point(110, 131);
this.destinationTextBox.Location = new System.Drawing.Point(110, 117);
this.destinationTextBox.Name = "destinationTextBox";
this.destinationTextBox.Size = new System.Drawing.Size(145, 20);
this.destinationTextBox.TabIndex = 10;
@@ -89,41 +92,42 @@ namespace TBF.BenchControl.DB.SensusOracle
// destinationLabel
//
this.destinationLabel.AutoSize = true;
this.destinationLabel.Location = new System.Drawing.Point(19, 134);
this.destinationLabel.Location = new System.Drawing.Point(19, 120);
this.destinationLabel.Name = "destinationLabel";
this.destinationLabel.Size = new System.Drawing.Size(60, 13);
this.destinationLabel.Size = new System.Drawing.Size(71, 13);
this.destinationLabel.TabIndex = 9;
this.destinationLabel.Text = "Destination";
this.destinationLabel.Text = "Results folder";
//
// dayFoldersCheckBox
//
this.dayFoldersCheckBox.AutoSize = true;
this.dayFoldersCheckBox.Enabled = false;
this.dayFoldersCheckBox.Location = new System.Drawing.Point(207, 157);
this.dayFoldersCheckBox.Location = new System.Drawing.Point(207, 166);
this.dayFoldersCheckBox.Name = "dayFoldersCheckBox";
this.dayFoldersCheckBox.Size = new System.Drawing.Size(79, 17);
this.dayFoldersCheckBox.TabIndex = 14;
this.dayFoldersCheckBox.TabIndex = 17;
this.dayFoldersCheckBox.Text = "Day folders";
this.dayFoldersCheckBox.UseVisualStyleBackColor = true;
//
// destinationButton
//
this.destinationButton.Enabled = false;
this.destinationButton.Location = new System.Drawing.Point(261, 131);
this.destinationButton.Location = new System.Drawing.Point(261, 117);
this.destinationButton.Name = "destinationButton";
this.destinationButton.Size = new System.Drawing.Size(30, 20);
this.destinationButton.TabIndex = 11;
this.destinationButton.Text = "...";
this.destinationButton.UseVisualStyleBackColor = true;
this.destinationButton.Click += new System.EventHandler(this.destinationButton_Click);
//
// yearFoldersCheckBox
//
this.yearFoldersCheckBox.AutoSize = true;
this.yearFoldersCheckBox.Enabled = false;
this.yearFoldersCheckBox.Location = new System.Drawing.Point(23, 157);
this.yearFoldersCheckBox.Location = new System.Drawing.Point(23, 166);
this.yearFoldersCheckBox.Name = "yearFoldersCheckBox";
this.yearFoldersCheckBox.Size = new System.Drawing.Size(82, 17);
this.yearFoldersCheckBox.TabIndex = 12;
this.yearFoldersCheckBox.TabIndex = 15;
this.yearFoldersCheckBox.Text = "Year folders";
this.yearFoldersCheckBox.UseVisualStyleBackColor = true;
//
@@ -131,10 +135,10 @@ namespace TBF.BenchControl.DB.SensusOracle
//
this.monthFoldersCheckBox.AutoSize = true;
this.monthFoldersCheckBox.Enabled = false;
this.monthFoldersCheckBox.Location = new System.Drawing.Point(111, 157);
this.monthFoldersCheckBox.Location = new System.Drawing.Point(111, 166);
this.monthFoldersCheckBox.Name = "monthFoldersCheckBox";
this.monthFoldersCheckBox.Size = new System.Drawing.Size(90, 17);
this.monthFoldersCheckBox.TabIndex = 13;
this.monthFoldersCheckBox.TabIndex = 16;
this.monthFoldersCheckBox.Text = "Month folders";
this.monthFoldersCheckBox.UseVisualStyleBackColor = true;
//
@@ -142,35 +146,35 @@ namespace TBF.BenchControl.DB.SensusOracle
//
this.eliminateSpacesCheckBox.AutoSize = true;
this.eliminateSpacesCheckBox.Enabled = false;
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(111, 205);
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(111, 208);
this.eliminateSpacesCheckBox.Name = "eliminateSpacesCheckBox";
this.eliminateSpacesCheckBox.Size = new System.Drawing.Size(165, 17);
this.eliminateSpacesCheckBox.TabIndex = 17;
this.eliminateSpacesCheckBox.TabIndex = 20;
this.eliminateSpacesCheckBox.Text = "Eliminate spaces in each field";
this.eliminateSpacesCheckBox.UseVisualStyleBackColor = true;
//
// separatorLabel
//
this.separatorLabel.AutoSize = true;
this.separatorLabel.Location = new System.Drawing.Point(19, 182);
this.separatorLabel.Location = new System.Drawing.Point(19, 188);
this.separatorLabel.Name = "separatorLabel";
this.separatorLabel.Size = new System.Drawing.Size(53, 13);
this.separatorLabel.TabIndex = 15;
this.separatorLabel.TabIndex = 18;
this.separatorLabel.Text = "Separator";
//
// separatorComboBox
//
this.separatorComboBox.Enabled = false;
this.separatorComboBox.FormattingEnabled = true;
this.separatorComboBox.Location = new System.Drawing.Point(110, 179);
this.separatorComboBox.Location = new System.Drawing.Point(110, 185);
this.separatorComboBox.Name = "separatorComboBox";
this.separatorComboBox.Size = new System.Drawing.Size(146, 21);
this.separatorComboBox.TabIndex = 16;
this.separatorComboBox.TabIndex = 19;
//
// benchIdTextBox
//
this.benchIdTextBox.Enabled = false;
this.benchIdTextBox.Location = new System.Drawing.Point(110, 57);
this.benchIdTextBox.Location = new System.Drawing.Point(110, 51);
this.benchIdTextBox.Name = "benchIdTextBox";
this.benchIdTextBox.Size = new System.Drawing.Size(57, 20);
this.benchIdTextBox.TabIndex = 4;
@@ -178,7 +182,7 @@ namespace TBF.BenchControl.DB.SensusOracle
// benchIdLabel
//
this.benchIdLabel.AutoSize = true;
this.benchIdLabel.Location = new System.Drawing.Point(19, 60);
this.benchIdLabel.Location = new System.Drawing.Point(19, 54);
this.benchIdLabel.Name = "benchIdLabel";
this.benchIdLabel.Size = new System.Drawing.Size(76, 13);
this.benchIdLabel.TabIndex = 3;
@@ -188,7 +192,7 @@ namespace TBF.BenchControl.DB.SensusOracle
//
this.dbUsedComboBox.Enabled = false;
this.dbUsedComboBox.FormattingEnabled = true;
this.dbUsedComboBox.Location = new System.Drawing.Point(110, 81);
this.dbUsedComboBox.Location = new System.Drawing.Point(110, 73);
this.dbUsedComboBox.Name = "dbUsedComboBox";
this.dbUsedComboBox.Size = new System.Drawing.Size(145, 21);
this.dbUsedComboBox.TabIndex = 6;
@@ -196,7 +200,7 @@ namespace TBF.BenchControl.DB.SensusOracle
// dbUsedLabel
//
this.dbUsedLabel.AutoSize = true;
this.dbUsedLabel.Location = new System.Drawing.Point(19, 84);
this.dbUsedLabel.Location = new System.Drawing.Point(19, 76);
this.dbUsedLabel.Name = "dbUsedLabel";
this.dbUsedLabel.Size = new System.Drawing.Size(79, 13);
this.dbUsedLabel.TabIndex = 5;
@@ -205,7 +209,7 @@ namespace TBF.BenchControl.DB.SensusOracle
// baujahrTextBox
//
this.baujahrTextBox.Enabled = false;
this.baujahrTextBox.Location = new System.Drawing.Point(110, 106);
this.baujahrTextBox.Location = new System.Drawing.Point(110, 95);
this.baujahrTextBox.Name = "baujahrTextBox";
this.baujahrTextBox.Size = new System.Drawing.Size(57, 20);
this.baujahrTextBox.TabIndex = 8;
@@ -213,16 +217,47 @@ namespace TBF.BenchControl.DB.SensusOracle
// baujahrLabel
//
this.baujahrLabel.AutoSize = true;
this.baujahrLabel.Location = new System.Drawing.Point(19, 109);
this.baujahrLabel.Location = new System.Drawing.Point(19, 98);
this.baujahrLabel.Name = "baujahrLabel";
this.baujahrLabel.Size = new System.Drawing.Size(43, 13);
this.baujahrLabel.TabIndex = 7;
this.baujahrLabel.Text = "Baujahr";
//
// logsFolderButton
//
this.logsFolderButton.Enabled = false;
this.logsFolderButton.Location = new System.Drawing.Point(261, 139);
this.logsFolderButton.Name = "logsFolderButton";
this.logsFolderButton.Size = new System.Drawing.Size(30, 20);
this.logsFolderButton.TabIndex = 14;
this.logsFolderButton.Text = "...";
this.logsFolderButton.UseVisualStyleBackColor = true;
this.logsFolderButton.Click += new System.EventHandler(this.logsFolderButton_Click);
//
// logsFolderTextBox
//
this.logsFolderTextBox.Enabled = false;
this.logsFolderTextBox.Location = new System.Drawing.Point(110, 139);
this.logsFolderTextBox.Name = "logsFolderTextBox";
this.logsFolderTextBox.Size = new System.Drawing.Size(145, 20);
this.logsFolderTextBox.TabIndex = 13;
//
// logsFolderLabel
//
this.logsFolderLabel.AutoSize = true;
this.logsFolderLabel.Location = new System.Drawing.Point(19, 142);
this.logsFolderLabel.Name = "logsFolderLabel";
this.logsFolderLabel.Size = new System.Drawing.Size(59, 13);
this.logsFolderLabel.TabIndex = 12;
this.logsFolderLabel.Text = "Logs folder";
//
// DatabaseCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.logsFolderButton);
this.Controls.Add(this.logsFolderTextBox);
this.Controls.Add(this.logsFolderLabel);
this.Controls.Add(this.baujahrTextBox);
this.Controls.Add(this.baujahrLabel);
this.Controls.Add(this.dbUsedComboBox);
@@ -269,5 +304,8 @@ namespace TBF.BenchControl.DB.SensusOracle
private System.Windows.Forms.Label dbUsedLabel;
private System.Windows.Forms.TextBox baujahrTextBox;
private System.Windows.Forms.Label baujahrLabel;
private System.Windows.Forms.Button logsFolderButton;
private System.Windows.Forms.TextBox logsFolderTextBox;
private System.Windows.Forms.Label logsFolderLabel;
}
}