diff --git a/Common/.vs/config/applicationhost.config b/Common/.vs/config/applicationhost.config index 883679a3..de10b180 100644 --- a/Common/.vs/config/applicationhost.config +++ b/Common/.vs/config/applicationhost.config @@ -155,7 +155,7 @@ - + diff --git a/Common/CordoPlot/CordoPlot.csproj b/Common/CordoPlot/CordoPlot.csproj index 002b73e3..e9998329 100644 --- a/Common/CordoPlot/CordoPlot.csproj +++ b/Common/CordoPlot/CordoPlot.csproj @@ -40,6 +40,7 @@ ..\packages\OpenTK.GLWpfControl.3.3.0\lib\net452\GLWpfControl.dll + ..\packages\OpenTK.3.3.1\lib\net20\OpenTK.dll @@ -117,6 +118,7 @@ + Code @@ -157,10 +159,18 @@ {29617814-313E-409E-AA5D-59C78A9D4DF1} StreamingProtocol + + {6D2777BB-7A88-466D-A49B-3266F9BF0160} + ProductionOrderCore + {6CCDB656-C676-4360-BABA-C4596AAD175D} Measurements + + {A33E3C6D-EAAE-4A20-A0EE-F9E6922FD029} + SoftwareAccessHelper + diff --git a/Common/CordoPlot/MainWindow.xaml.cs b/Common/CordoPlot/MainWindow.xaml.cs index e34238b5..64f3a28f 100644 --- a/Common/CordoPlot/MainWindow.xaml.cs +++ b/Common/CordoPlot/MainWindow.xaml.cs @@ -1,20 +1,14 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; using Xylem.Common.CommonCore.Consts; +using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords; using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.StreamingProtocol; +using Xylem.Common.Logic.ProductionOrderCore.TestResults; +using Xylem.Common.Logic.SoftwareAccessHelper; using Xylem.Common.Metrology.Measurements; namespace CordoPlot @@ -28,115 +22,301 @@ namespace CordoPlot { InitializeComponent(); } - + private void Button_Click(Object sender, RoutedEventArgs e) { - - var dialog = new Microsoft.Win32.OpenFileDialog(); - dialog.FileName = "led"; // Default file name - dialog.DefaultExt = ".log"; // Default file extension - dialog.Filter = "Text documents (.log)|*.log"; // Filter files by extension - - // Show open file dialog box - bool? result = dialog.ShowDialog(); - - // Process open file dialog box results - if (result == true) + try { - // Open document - string filename = dialog.FileName; - var AllLines = File.ReadAllLines(filename); - var listOfData = new List(); - var decoder = new StreamingDecoder(); - var currentSyncmark = SyncMarkRecord.DecodeEveryPackage; - //DecodeMsg - foreach (var line in AllLines) + + var dialog = new Microsoft.Win32.OpenFileDialog(); + dialog.FileName = "led"; // Default file name + dialog.DefaultExt = ".log"; // Default file extension + dialog.Filter = "Text documents (.log)|*.log"; // Filter files by extension + + // Show open file dialog box + bool? result = dialog.ShowDialog(); + + // Process open file dialog box results + if (result == true) { - decoder = new StreamingDecoder(); + //lade testresult from webservise + // Open document + string filename = dialog.FileName; + PlotableTestResults testBenchresults = new PlotableTestResults(); + var AllLines = File.ReadAllLines(filename); - if (line.Contains("|")) + //LedRawData__Slot_7_SN24712962_PG2016079130.log + if (filename.Contains("_SN") && filename.Contains("_PG")) { + var sn = filename.Substring(filename.LastIndexOf("_SN") +3, filename.LastIndexOf("_PG") - filename.LastIndexOf("_SN") - 3); + var pg = filename.Substring(filename.LastIndexOf("_PG") +3, filename.LastIndexOf(".log") - filename.LastIndexOf("_PG") - 3); + testBenchresults = JsonConvert.DeserializeObject(LocalWebRequest.GetRequest($"http://10.49.40.25/MeterProcessState/api/TestBench/GetTestResults?SerialNr={sn}&TestRunNr={pg}")); + testBenchresults.HasResults = true; + } - var t = line.Split('|'); - DateTime recived = DateTime.Now; - DateTime.TryParse(t[0], out recived); - if (t[1].Contains("@")) - { - decoder.DecodeMsg(t[1].Trim()); - IMeasurementRecord recordToAdd; - if (decoder.DataBendDetectTest != null && decoder.DataBendDetectTest.IsValid) - { - decoder.DataBendDetectTest.ReceivedTime = recived; - decoder.DataBendDetectTest.SyncMarkRecord = currentSyncmark; - recordToAdd = decoder.DataBendDetectTest ; - } - else if (decoder.DataCalib != null && decoder.DataCalib.IsValid) - { - decoder.DataCalib.ReceivedTime = recived; - decoder.DataCalib.SyncMarkRecord = currentSyncmark; - recordToAdd = decoder.DataCalib; - } - else if (decoder.DataFlowTest != null && decoder.DataFlowTest.IsValid) - { - decoder.DataFlowTest.ReceivedTime = recived; - decoder.DataFlowTest.SyncMarkRecord = currentSyncmark; - recordToAdd = decoder.DataFlowTest; - } - else - { - //No valid data - continue; - } - listOfData.Add(recordToAdd); + var listOfData = new List>(); + listOfData.Add(new List()); + listOfData.Add(new List()); + listOfData.Add(new List()); + listOfData.Add(new List()); + var decoder = new StreamingDecoder(); + var currentSyncmark = SyncMarkRecord.DecodeEveryPackage; + //DecodeMsg + foreach (var line in AllLines) + { + decoder = new StreamingDecoder(); - } - else + if (line.Contains("|")) { - if (line.Contains("Mark next incoming record as")) + + var t = line.Split('|'); + DateTime recived = DateTime.Now; + DateTime.TryParse(t[0], out recived); + if (t[1].Contains("@")) { - if (line.Contains("Mark next incoming record as SyncStart")) + decoder.DecodeMsg(t[1].Trim()); + IMeasurementRecord recordToAdd; + if (decoder.DataBendDetectTest != null && decoder.DataBendDetectTest.IsValid) { - currentSyncmark = SyncMarkRecord.SyncStart; + decoder.DataBendDetectTest.ReceivedTime = recived; + decoder.DataBendDetectTest.SyncMarkRecord = currentSyncmark; + recordToAdd = decoder.DataBendDetectTest; } - else if (line.Contains("Mark next incoming record as DecodeIntermediate")) + else if (decoder.DataCalib != null && decoder.DataCalib.IsValid) { - currentSyncmark = SyncMarkRecord.DecodeIntermediate; + decoder.DataCalib.ReceivedTime = recived; + decoder.DataCalib.SyncMarkRecord = currentSyncmark; + recordToAdd = decoder.DataCalib; + listOfData[recordToAdd.GetChannel()].Add(recordToAdd); } - else if (line.Contains("Mark next incoming record as SkipDecoding")) + else if (decoder.DataFlowTest != null && decoder.DataFlowTest.IsValid) { - currentSyncmark = SyncMarkRecord.SkipDecoding; - } - else if (line.Contains("Mark next incoming record as SyncEnd")) - { - currentSyncmark = SyncMarkRecord.SyncEnd; + decoder.DataFlowTest.ReceivedTime = recived; + decoder.DataFlowTest.SyncMarkRecord = currentSyncmark; + recordToAdd = decoder.DataFlowTest; + listOfData[0].Add(recordToAdd); } else { - currentSyncmark = SyncMarkRecord.DecodeEveryPackage; + //No valid data + continue; } + } + else + { + if (line.Contains("Mark next incoming record as")) + { + if (line.Contains("Mark next incoming record as SyncStart")) + { + currentSyncmark = SyncMarkRecord.SyncStart; + } + else if (line.Contains("Mark next incoming record as DecodeIntermediate")) + { + currentSyncmark = SyncMarkRecord.DecodeIntermediate; + } + else if (line.Contains("Mark next incoming record as SkipDecoding")) + { + currentSyncmark = SyncMarkRecord.SkipDecoding; + } + else if (line.Contains("Mark next incoming record as SyncEnd")) + { + currentSyncmark = SyncMarkRecord.SyncEnd; + } + else + { + currentSyncmark = SyncMarkRecord.DecodeEveryPackage; + } + + } + } + + } + //FlowTestRecord + } + + + testBenchresults.MapDataPoints(listOfData); + + List> Lines = new List>(); + Lines.Add(new List()); + Lines.Add(new List()); + Lines.Add(new List()); + Lines.Add(new List()); + + + List> Errors = new List>(); + Errors.Add(new List()); + Errors.Add(new List()); + Errors.Add(new List()); + Errors.Add(new List()); + + + List Syncmarks = new List(); + + List Linescale = new List(); + foreach (var dataItem in listOfData) + { + foreach (var item in dataItem) + { + if (item is FlowTestRecord flow) + { + Lines.First().Add(flow.GetVolumeCm()); + Errors.First().Add(0); + Linescale.Add(flow.GetTimeS()); + if (item.GetDataSyncMark() == SyncMarkRecord.SyncStart || item.GetDataSyncMark() == SyncMarkRecord.SyncEnd) + { + Syncmarks.Add(flow.GetTimeS()); + } + } + if (item is CalibrationRecord cal) + { + if (Linescale.Any()) + { + Lines[cal.Channel].Add(cal.GetVolumeCm()); + Errors[cal.Channel].Add(cal.Validation); + if (item.GetDataSyncMark() == SyncMarkRecord.SyncStart || item.GetDataSyncMark() == SyncMarkRecord.SyncEnd) + { + Syncmarks.Add(cal.GetTimeS()); + } + } + } + } + } + List> colors = new List>(); + + colors.Add(new Tuple(ScottPlot.Colors.Blue, ScottPlot.Colors.DarkBlue)); + colors.Add(new Tuple(ScottPlot.Colors.Brown, ScottPlot.Colors.DarkGoldenRod)); + colors.Add(new Tuple(ScottPlot.Colors.Yellow, ScottPlot.Colors.DarkKhaki)); + colors.Add(new Tuple(ScottPlot.Colors.Violet, ScottPlot.Colors.DarkViolet)); + + List> FinLines = new List>(); + FinLines.Add(new List()); + FinLines.Add(new List()); + FinLines.Add(new List()); + FinLines.Add(new List()); + + var linecounter = 0; + var counter = 0; + var intiVol = 0.0; + foreach (var lines in Lines) + { + counter = 0; + foreach (var line in lines) + { + if (!FinLines[linecounter].Any()) + { + FinLines[linecounter].Add(0); + intiVol = Lines[linecounter][counter]; + } + else + { + var addVol = line - intiVol; + var dutOverflowVolumeCm = listOfData[linecounter].First().GetOverflowVolumeCm(); + //an overflow is detected when absolute volume difference is higher than 1/2 of the OverflowVolumeCm + if (Math.Abs(addVol - FinLines[linecounter].Last()) > (0.5 * dutOverflowVolumeCm)) + { + //if the overflow has been detected the end volume is higher than the start volume + //indicates the negative flow direction + if (addVol > FinLines[linecounter].Last()) + { + //negative overflow + intiVol -= dutOverflowVolumeCm; + //LoggerMeasurement.Info($"Slot:{Slot}, Channel: {IntermediateRecord.GetChannel()} - has negative overflow. currentVolumeQm ({currentVolumeQm}) - lastVolumeQm ({lastVolumeQm}). current accuOverflowVolume is {_accuDutOverflowVolumeCm}"); + } + else + { + //positive overflow + intiVol += dutOverflowVolumeCm; + //LoggerMeasurement.Info($"Slot:{Slot}, Channel: {IntermediateRecord.GetChannel()} - has positive overflow. currentVolumeQm ({currentVolumeQm}) - lastVolumeQm ({lastVolumeQm}). current accuOverflowVolume is {_accuDutOverflowVolumeCm}"); + } + } + addVol = line - intiVol; + + FinLines[linecounter].Add(addVol); + + + } + + + + counter = counter + 1; + + + } + linecounter = 1 + linecounter; + } + + + for (int i = 0; i <= 3; i++) + { + + for (int add = FinLines[i].Count; add < Linescale.Count; add++) + { + FinLines[i].Add(0); + } + + for (int add = Errors[i].Count; add < Linescale.Count; add++) + { + Errors[i].Add(0); + } + } + + + WpfPlot1.Plot.Add.Scatter(Linescale.ToArray(), FinLines[0].ToArray(), colors[0].Item1); + WpfPlot1.Plot.Add.Scatter(Linescale.ToArray(), FinLines[1].ToArray(), colors[1].Item1); + WpfPlot1.Plot.Add.Scatter(Linescale.ToArray(), FinLines[2].ToArray(), colors[2].Item1); + WpfPlot1.Plot.Add.Scatter(Linescale.ToArray(), FinLines[3].ToArray(), colors[3].Item1); + + for (int i = 0; i <= 3; i++) + { + var cordHelp = 0; + foreach (var item in Errors[i]) + { + + if (item != 0) + { + WpfPlot1.Plot.Add.Marker(Linescale[cordHelp], FinLines[i][cordHelp], ScottPlot.MarkerShape.Cross, 10, colors[1].Item2); + } + cordHelp = cordHelp + 1; + } } - - //FlowTestRecord - } - foreach (var item in collection ) - { + foreach (var syncm in Syncmarks) + { + WpfPlot1.Plot.Add.VerticalLine(syncm, 2, ScottPlot.Colors.DarkGray); + } + + WpfPlot1.Plot.Axes.AutoScale(); + + //for (int i = 0; i <= 3; i++) + //{ + + // WpfPlot1.Plot.Add.Scatter(Lines[i].ToArray(), Linescale.ToArray(), colors[i].Item1); + // WpfPlot1.Plot.Add.Scatter(Errors[i].ToArray(), Linescale.ToArray(), colors[i].Item2); + + //} + + + + + + WpfPlot1.Refresh(); } + } + catch (Exception ex) + { } - double[] dataX = { 1, 2, 3, 4, 5 }; - double[] dataY = { 1, 4, 9, 16, 25 }; - WpfPlot1.Plot.Add.Scatter(dataX, dataY); - WpfPlot1.Refresh(); + } } diff --git a/Common/CordoPlot/PlotableTestResults.cs b/Common/CordoPlot/PlotableTestResults.cs new file mode 100644 index 00000000..e673e995 --- /dev/null +++ b/Common/CordoPlot/PlotableTestResults.cs @@ -0,0 +1,68 @@ +using System.Collections.Generic; +using System.Linq; +using Xylem.Common.Logic.ProductionOrderCore.TestResults; +using Xylem.Common.Metrology.Measurements; + +namespace CordoPlot +{ + public class TestPointResult + { + public int? Chnl { get; internal set; } = null; + public int TestNr { get; internal set; } + public List measurementRecords = new List(); + + + } + public class PlotableTestResults : TestResults + { + private List> ListOfRecords = new List>(); + private List testPointResults = new List(); + public PlotableTestResults() + { + + } + + + public System.Boolean HasResults { get; internal set; } = false; + + public bool MapDataPoints(List> listOfRecords) + { + ListOfRecords = listOfRecords; + var CurrentTestPoint = 0; + var CurrentChnl = -1; + var testPointLocked = false; + foreach (var allChnlItems in this.ListOfRecords) + { + CurrentChnl = CurrentChnl + 1; + CurrentTestPoint = 0; + foreach (var item in allChnlItems) + { + + if (!testPointLocked && item.GetDataSyncMark() == Xylem.Common.CommonCore.Consts.SyncMarkRecord.SyncStart) + { + + testPointLocked = true; + testPointResults.Add(new TestPointResult()); + testPointResults.Last().Chnl = CurrentChnl; + testPointResults.Last().TestNr = CurrentTestPoint; + + CurrentTestPoint = CurrentTestPoint + 1; + } + if (testPointLocked) + { + testPointResults.Last().measurementRecords.Add(item); + if (item.GetDataSyncMark() == Xylem.Common.CommonCore.Consts.SyncMarkRecord.SyncEnd) + { + + testPointLocked = false; + } + } + } + } + + return true; + } + } + + +} diff --git a/Common/CordonelPreadjustmentUi/MeterStateControl.cs b/Common/CordonelPreadjustmentUi/MeterStateControl.cs index 1a272dec..4b3c911f 100644 --- a/Common/CordonelPreadjustmentUi/MeterStateControl.cs +++ b/Common/CordonelPreadjustmentUi/MeterStateControl.cs @@ -88,35 +88,7 @@ namespace CordonelPreadjustmentUi { try { - if (MeterTempMode == TempMode.CalcTof) - { - //Qickfiyx für 2016 statt der flansche auf die p150 ip thermometer - var ret = new List(); - HttpClient client = new HttpClient(); // actually only one object should be created by Application - string page = client.GetStringAsync("http://10.49.41.36/de/user.htm?Sess=").Result; - - foreach (var item in page.Replace("
", "}").Split('}')) - { - if (item.Contains("°C
")) - { - decimal d = 0; - if (decimal.TryParse(item.Replace("°C<", "§").Split('§')[0], out d)) - { - ret.Add(d); - } - ; - - } - //°C - } - if (ret.Count == 2) - { - - SetTemperature((ret.Sum() / 2), false); - return; - } - } var cRecords = Meter.CurrentRecords.ToList(); Log($"cRecords.Count={cRecords.Count}"); diff --git a/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache b/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache index 8d4994b0..d110f5fc 100644 --- a/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache +++ b/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -8fbe991b217e7692af4817ad205b768685aa5a72 +c43c40a030005a8f189e6179faf40a6d42bfef5c diff --git a/Common/Logic/ProductionOrderCore/ProductionOrderCore.csproj b/Common/Logic/ProductionOrderCore/ProductionOrderCore.csproj index a4ea1815..a37953e0 100644 --- a/Common/Logic/ProductionOrderCore/ProductionOrderCore.csproj +++ b/Common/Logic/ProductionOrderCore/ProductionOrderCore.csproj @@ -123,6 +123,7 @@ + diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs index 6a9c78c2..f340aba3 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs @@ -138,7 +138,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions { if (Meter.Region == "NA") { - currentProcessState = ProductionProcessState.Error; + //currentProcessState = ProductionProcessState.Error; } // diff --git a/Common/Service/MeterProcessState/Controllers/TestBenchController.cs b/Common/Service/MeterProcessState/Controllers/TestBenchController.cs index b0a5ab9c..9b525551 100644 --- a/Common/Service/MeterProcessState/Controllers/TestBenchController.cs +++ b/Common/Service/MeterProcessState/Controllers/TestBenchController.cs @@ -3,14 +3,25 @@ using global::Common.SqlExtensions; using System; + using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Net; + using System.Text; using System.Web.Http; + using Xylem.Common.Logic.ProductionOrderCore.TestResults; + using Xylem.Common.Logic.ServiceCore; [RoutePrefix("api/TestBench")] public class TestBenchController : ApiController { + public static class GlobalConfig + { + public static Lazy connectionString = new Lazy(() + => + System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString + ); + } public static readonly Lazy ConnectionString = new Lazy(() => ConfigurationManager.ConnectionStrings["default"].ConnectionString); @@ -65,7 +76,7 @@ [Route("GetMeterInfoForTestBench"), HttpGet] public IHttpActionResult GetMeterInfoForTestBench(String PcbID) { - var str = $@" + var str = $@" SELECT DISTINCT [MapPcbIdToSerialNumber_SerialNumber] AS [SerialNr] , [MapOrder].[CordonelAssignedPicking_FertigungsAuftragsNr] AS [FertigungsNr] @@ -197,7 +208,8 @@ Offset = x.GetValue() }); - return this.Json(offset); + return this. + (offset); } [HttpPost] @@ -250,13 +262,156 @@ return this.BadRequest("Invalid data."); } - public class CordonelCalibration + + + [Route("GetTestResults"), HttpGet] + public IHttpActionResult GetTestResults(int SerialNr, int TestRunNr) { - public int PcbId { get; set; } - - public int TestRunNr { get; set; } - - public double Offset { get; set; } + using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value)) + { + var sb = new StringBuilder(); + sb.AppendLine($@" + Select + p.PruefgangNr, + p.PruefstationNr, + p.Datum, + p.Typ , + p.Nennweite , + p.Nenntemperatur , + p.Lufttemperatur , + p.LuftDruck, + p.RelativeFeuchte, + p.Vorlauftemperatur, + p.Anzahl, "); + + + + for (int i = 1; i < 10; i++) + { + sb.AppendLine($"p.PP{i}_Zeit,"); + + sb.AppendLine($"p.PP{i}_Soll , "); + sb.AppendLine($"p.PP{i}_Ist , "); + sb.AppendLine($"p.PP{i}_RefZSerienNr , "); + sb.AppendLine($"p.PP{i}_RefFehl , "); + sb.AppendLine($"p.PP{i}_Ist_V , "); + sb.AppendLine($"p.PP{i}_Waage , "); + sb.AppendLine($"p.PP{i}_Info , "); + + + sb.AppendLine($"f.PP{i}_Fehler as PP{i}DisplayError,"); + + + + sb.AppendLine($"f1.PP{i}_Fehler as PP{i}Chnl_1_Error,"); + sb.AppendLine($"f1.PP{i}_TimeS as PP{i}Chnl_1_TimeS,"); + sb.AppendLine($"f1.PP{i}_VolumeQm as PP{i}Chnl_1_VolumeQm, "); + + + + sb.AppendLine($"f2.PP{i}_Fehler as PP{i}Chnl_2_Error,"); + sb.AppendLine($"f2.PP{i}_TimeS as PP{i}Chnl_2_TimeS,"); + sb.AppendLine($"f2.PP{i}_VolumeQm as PP{i}Chnl_2_VolumeQm, "); + + + sb.AppendLine($"f3.PP{i}_Fehler as PP{i}Chnl_3_Error,"); + sb.AppendLine($"f3.PP{i}_TimeS as PP{i}Chnl_3_TimeS,"); + sb.AppendLine($"f3.PP{i}_VolumeQm as PP{i}Chnl_3_VolumeQm, "); + } + + sb.AppendLine($@" + p.Bemerkung + from Pruefgang p + inner + join Prueffehler f on f.PruefgangNr = p.PruefgangNr and f.SerienNr = {SerialNr} + inner join PrueffehlerGenesisPfade f1 on f1.PruefgangNr = p.PruefgangNr and f1.SerienNr = {SerialNr} and f1.Pfad = 1 + inner join PrueffehlerGenesisPfade f2 on f2.PruefgangNr = p.PruefgangNr and f2.SerienNr = {SerialNr} and f2.Pfad = 2 + inner join PrueffehlerGenesisPfade f3 on f3.PruefgangNr = p.PruefgangNr and f3.SerienNr = {SerialNr} and f3.Pfad = 3 + where p.PruefgangNr = {TestRunNr}"); + + var dt = dataacces.ExecuteQuery(sb.ToString()); + + + if (dt.Rows.Count != 1) + { + return this.Content(HttpStatusCode.BadRequest, new string[] { }); + } + var tr = new TestResults(); + tr.Serialnr = SerialNr; + tr.TestRunNr = TestRunNr; + + + //Convert.ToInt32( + var dr = dt.Rows[0]; + tr.TestBenchNr = Convert.ToInt32(dr["PruefstationNr"]); + tr.Date = Convert.ToDateTime(dr["Datum"]); + tr.MeterType = dt.Rows[0]["Typ"].ToString(); + tr.MeterSize = Convert.ToInt32(dr["Nennweite"]); + tr.AirTempC = Convert.ToDouble(dr["Lufttemperatur"]); + tr.AirPressure = Convert.ToDouble(dr["LuftDruck"]); + tr.AirHumanity = Convert.ToDouble(dr["RelativeFeuchte"]); + tr.WaterTempC = Convert.ToDouble(dr["Vorlauftemperatur"]); + tr.TotalMeters = Convert.ToInt32(dr["Anzahl"]); + tr.Remark = dr["Bemerkung"].ToString(); + + tr.Details = new List(); + tr.TestPointsChannels = new List(); + tr.TestPointsMain = new List(); + for (int i = 1; i < 10; i++) + { + try + { + var d = new TestPointDetail(); + + if (dr[$"PP{i}_Soll"] is DBNull) + { + continue; + } + d.TimeS = Convert.ToDouble(dr[$"PP{i}_Zeit"]); + d.FlowTargetQmh = Convert.ToDouble(dr[$"PP{i}_Soll"]); + d.FlowrateQmh = Convert.ToDouble(dr[$"PP{i}_Ist"]); + d.VolumeQm = Convert.ToDouble(dr[$"PP{i}_Ist_V"]); + d.Info = dr[$"PP{i}_Info"].ToString(); + d.Scale = Convert.ToBoolean(dr[$"PP{i}_Waage"]); + + tr.Details.Add(d); + var m = new TestPoint(); + m.TestPointNr = i; + + m.Error = Convert.ToDouble(dr[$"PP{i}DisplayError"]); + tr.TestPointsMain.Add(m); + + for (int z = 1; z < 3; z++) + { + var c = new ChnlTestPoint(); + c.TestPointNr = i; + c.ChanlNr = z; + c.Error = Convert.ToDouble(dr[$"PP{i}Chnl_{z}_Error"]); + c.TimeS = Convert.ToDouble(dr[$"PP{i}Chnl_{z}_TimeS"]); + c.VolumenQm = Convert.ToDouble(dr[$"PP{i}Chnl_{z}_VolumeQm"]); + tr.TestPointsChannels.Add(c); + } + } + catch (Exception ex) + { + + } + + + + } + + return this.Content(HttpStatusCode.OK, tr); } } + + public class CordonelCalibration + { + public int PcbId { get; set; } + + public int TestRunNr { get; set; } + + public double Offset { get; set; } + } +} } diff --git a/Common/Tools/Tools.JsonToXlsHelper/obj/Debug/Tools.JsonToXlsHelper.csproj.CoreCompileInputs.cache b/Common/Tools/Tools.JsonToXlsHelper/obj/Debug/Tools.JsonToXlsHelper.csproj.CoreCompileInputs.cache index 550809f9..84b6b3be 100644 --- a/Common/Tools/Tools.JsonToXlsHelper/obj/Debug/Tools.JsonToXlsHelper.csproj.CoreCompileInputs.cache +++ b/Common/Tools/Tools.JsonToXlsHelper/obj/Debug/Tools.JsonToXlsHelper.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -1babc7d629fd8c486aff20f4990c117c2e58a68f +65d75c3322f8a137c69963cfdc0cb6f1ffacf62a