GenericTest and RecordProessing modifications for Laser in Nanjing, ver. 3.0.1

This commit is contained in:
Milan Hanajik
2022-01-17 10:26:56 +01:00
parent 2eaf2b044c
commit d42ad8c5cf
15 changed files with 304 additions and 176 deletions
+2 -2
View File
@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// 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("RFPowerCommon")]
[assembly: AssemblyTitle("RecordProcessing")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RFPowerCommon")]
[assembly: AssemblyProduct("RecordProcessing")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
+3 -1
View File
@@ -20,6 +20,7 @@ namespace RecordProcessing
CommTest, /// Communication test of water meter
FlowtubeTestHe, /// Flowtube test with Helium
FlowtubeTestAir, /// Flowtube test with air
LaserNanjing, /// Laser markig in Xylem Nanjing
Count
}
@@ -226,7 +227,8 @@ namespace RecordProcessing
case RecordType.CommTest: record = CommTestRecord.FromFile(fileName); break;
case RecordType.FlowtubeTestHe: record = FlowtubeTestHeRecord.FromFile(fileName); break;
case RecordType.FlowtubeTestAir: record = FlowtubeTestAirRecord.FromFile(fileName); break;
default: record = null; break;
case RecordType.LaserNanjing: record = LaserNanjingRecord.FromFile(fileName); break;
default: record = null; break;
}
/// Process data extracted from the file
+2 -1
View File
@@ -8,7 +8,7 @@
<ProjectGuid>{67BD7A8F-0FED-4FDE-B875-78D5A2BC9B2C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RFPowerCommon</RootNamespace>
<RootNamespace>RecordProcessing</RootNamespace>
<AssemblyName>RFPowerCommon</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
@@ -61,6 +61,7 @@
<Compile Include="Records\CommTestRecord.cs" />
<Compile Include="Records\FlowtubeTestAirRecord.cs" />
<Compile Include="Records\FlowtubeTestHeRecord.cs" />
<Compile Include="Records\LaserNanjingRecord.cs" />
<Compile Include="Records\RFTestPrintDocument.cs">
<SubType>Component</SubType>
</Compile>
@@ -0,0 +1,91 @@
///
/// Copyright (c) 2022 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.IO;
using System.Text;
using log4net;
namespace RecordProcessing.Records
{
public class LaserNanjingRecord : IRecord
{
static readonly ILog log = LogManager.GetLogger(typeof(LaserNanjingRecord));
public bool CanSaveRecordToOracle() { return false; }
public bool SaveRecordToOracle(Oracle.DataAccess.Client.OracleConnection oraConn) { return false; }
public bool CanPrintRecord() { return false; }
public bool PrintRecord() { return false; }
public static string Path;
public string FileName { get { return fileName; } }
public string SN { get { return sn; } set { sn = value; } }
public DateTime TimeStamp { get { return timeStamp; } }
public Status Status { get { return status; } }
public string Remark { get { return string.Empty; } }
public string ResultStr { get { return string.Empty; } }
string fileName;
string sn;
DateTime timeStamp;
Status status;
string remark;
public LaserNanjingRecord()
{
sn = null;
status = Status.Interrupted;
}
/// <summary>
/// Load a record from an xml-file
/// </summary>
/// <param name="fileName">xml-filename</param>
/// <returns>Record or null</returns>
public static LaserNanjingRecord FromFile(string fileName)
{
try
{
string bareFileName = System.IO.Path.GetFileName(fileName).Replace(".csv", "");
LaserNanjingRecord record = new LaserNanjingRecord();
record.fileName = bareFileName;
record.timeStamp = DateTime.Now;
using (StreamReader iStream = new StreamReader(fileName))
{
string firstLine = iStream.ReadLine();
while (true)
{
string nextLine = iStream.ReadLine();
if (nextLine == null) break;
string[] fields = nextLine.Split(',');
if (fields.Length >= 6)
{
record.sn = fields[1];
record.status = (fields[5] == "OK") ? Status.Passed : Status.Failed;
}
}
log.InfoFormat("Succesfully parsed: {0}", record);
return record;
}
}
catch (Exception exc)
{
log.ErrorFormat("Cannot open or parse file {0}: {1}", fileName, exc.Message);
return null;
}
}
public override string ToString()
{
return string.Format("File={0} Housing s/n={1}, Rslt={2}", fileName, sn, status);
}
}
}
-3
View File
@@ -2,15 +2,12 @@
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Xml;
using Gma.QrCodeNet.Encoding;
using log4net;
using NHibernate;
using Oracle.DataAccess.Client;
using System.Drawing;
namespace RecordProcessing.Records
{