CordoPoloto
This commit is contained in:
parent
900d4f3b0c
commit
d129a5574c
@ -155,7 +155,7 @@
|
||||
</site>
|
||||
<site name="MeterProcessState" id="2">
|
||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\LAA_PRODUCTION\Common\Service\MeterProcessState" />
|
||||
<virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:56011:localhost" />
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
<Reference Include="GLWpfControl, Version=3.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OpenTK.GLWpfControl.3.3.0\lib\net452\GLWpfControl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" />
|
||||
<Reference Include="OpenTK, Version=3.3.1.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OpenTK.3.3.1\lib\net20\OpenTK.dll</HintPath>
|
||||
</Reference>
|
||||
@ -117,6 +118,7 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="PlotableTestResults.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@ -157,10 +159,18 @@
|
||||
<Project>{29617814-313E-409E-AA5D-59C78A9D4DF1}</Project>
|
||||
<Name>StreamingProtocol</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logic\ProductionOrderCore\ProductionOrderCore.csproj">
|
||||
<Project>{6D2777BB-7A88-466D-A49B-3266F9BF0160}</Project>
|
||||
<Name>ProductionOrderCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Metrology\Measurements\Measurements.csproj">
|
||||
<Project>{6CCDB656-C676-4360-BABA-C4596AAD175D}</Project>
|
||||
<Name>Measurements</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SoftwareAccessHelper\SoftwareAccessHelper.csproj">
|
||||
<Project>{A33E3C6D-EAAE-4A20-A0EE-F9E6922FD029}</Project>
|
||||
<Name>SoftwareAccessHelper</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\SkiaSharp.NativeAssets.macOS.2.88.8\build\net462\SkiaSharp.NativeAssets.macOS.targets" Condition="Exists('..\packages\SkiaSharp.NativeAssets.macOS.2.88.8\build\net462\SkiaSharp.NativeAssets.macOS.targets')" />
|
||||
|
||||
@ -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<IMeasurementRecord>();
|
||||
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<PlotableTestResults>(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<List<IMeasurementRecord>>();
|
||||
listOfData.Add(new List<IMeasurementRecord>());
|
||||
listOfData.Add(new List<IMeasurementRecord>());
|
||||
listOfData.Add(new List<IMeasurementRecord>());
|
||||
listOfData.Add(new List<IMeasurementRecord>());
|
||||
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<List<double>> Lines = new List<List<double>>();
|
||||
Lines.Add(new List<double>());
|
||||
Lines.Add(new List<double>());
|
||||
Lines.Add(new List<double>());
|
||||
Lines.Add(new List<double>());
|
||||
|
||||
|
||||
List<List<ushort>> Errors = new List<List<ushort>>();
|
||||
Errors.Add(new List<ushort>());
|
||||
Errors.Add(new List<ushort>());
|
||||
Errors.Add(new List<ushort>());
|
||||
Errors.Add(new List<ushort>());
|
||||
|
||||
|
||||
List<double> Syncmarks = new List<double>();
|
||||
|
||||
List<double> Linescale = new List<double>();
|
||||
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<Tuple<ScottPlot.Color, ScottPlot.Color>> colors = new List<Tuple<ScottPlot.Color, ScottPlot.Color>>();
|
||||
|
||||
colors.Add(new Tuple<ScottPlot.Color, ScottPlot.Color>(ScottPlot.Colors.Blue, ScottPlot.Colors.DarkBlue));
|
||||
colors.Add(new Tuple<ScottPlot.Color, ScottPlot.Color>(ScottPlot.Colors.Brown, ScottPlot.Colors.DarkGoldenRod));
|
||||
colors.Add(new Tuple<ScottPlot.Color, ScottPlot.Color>(ScottPlot.Colors.Yellow, ScottPlot.Colors.DarkKhaki));
|
||||
colors.Add(new Tuple<ScottPlot.Color, ScottPlot.Color>(ScottPlot.Colors.Violet, ScottPlot.Colors.DarkViolet));
|
||||
|
||||
List<List<double>> FinLines = new List<List<double>>();
|
||||
FinLines.Add(new List<double>());
|
||||
FinLines.Add(new List<double>());
|
||||
FinLines.Add(new List<double>());
|
||||
FinLines.Add(new List<double>());
|
||||
|
||||
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();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
68
Common/CordoPlot/PlotableTestResults.cs
Normal file
68
Common/CordoPlot/PlotableTestResults.cs
Normal file
@ -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<IMeasurementRecord> measurementRecords = new List<IMeasurementRecord>();
|
||||
|
||||
|
||||
}
|
||||
public class PlotableTestResults : TestResults
|
||||
{
|
||||
private List<List<IMeasurementRecord>> ListOfRecords = new List<List<IMeasurementRecord>>();
|
||||
private List<TestPointResult> testPointResults = new List<TestPointResult>();
|
||||
public PlotableTestResults()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public System.Boolean HasResults { get; internal set; } = false;
|
||||
|
||||
public bool MapDataPoints(List<List<IMeasurementRecord>> 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -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<decimal>();
|
||||
|
||||
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("<div style=\"display: inline-block; width: 120px;\">", "}").Split('}'))
|
||||
{
|
||||
if (item.Contains("°C</div>"))
|
||||
{
|
||||
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}");
|
||||
|
||||
@ -1 +1 @@
|
||||
8fbe991b217e7692af4817ad205b768685aa5a72
|
||||
c43c40a030005a8f189e6179faf40a6d42bfef5c
|
||||
|
||||
@ -123,6 +123,7 @@
|
||||
<Compile Include="ProcessState\PressureTestResult.cs" />
|
||||
<Compile Include="ProgrammingParameters.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TestResults\TestBenchResult.cs" />
|
||||
<Compile Include="TestResults\PressureResultData.cs" />
|
||||
<Compile Include="TestResults\PressureTestPoints.cs" />
|
||||
<Compile Include="Vako\DbAdapter.cs" />
|
||||
|
||||
@ -138,7 +138,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
|
||||
{
|
||||
if (Meter.Region == "NA")
|
||||
{
|
||||
currentProcessState = ProductionProcessState.Error;
|
||||
//currentProcessState = ProductionProcessState.Error;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@ -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<String> connectionString = new Lazy<String>(()
|
||||
=>
|
||||
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
|
||||
);
|
||||
}
|
||||
public static readonly Lazy<String> ConnectionString = new Lazy<String>(()
|
||||
=> 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<double>()
|
||||
});
|
||||
|
||||
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<TestPointDetail>();
|
||||
tr.TestPointsChannels = new List<ChnlTestPoint>();
|
||||
tr.TestPointsMain = new List<TestPoint>();
|
||||
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; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
1babc7d629fd8c486aff20f4990c117c2e58a68f
|
||||
65d75c3322f8a137c69963cfdc0cb6f1ffacf62a
|
||||
|
||||
Loading…
Reference in New Issue
Block a user