cordo plot
This commit is contained in:
parent
7f3dd958eb
commit
71f3909c84
@ -176,6 +176,14 @@
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:50075:localhost" />
|
||||
</bindings>
|
||||
</site>
|
||||
<site name="MeterProcessState(3)" id="5">
|
||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||
<virtualDirectory path="/" physicalPath="E:\REPO\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:50076:localhost" />
|
||||
</bindings>
|
||||
</site>
|
||||
<siteDefaults>
|
||||
<!-- To enable logging, please change the below attribute "enabled" to "true" -->
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:CordoPlot"
|
||||
StartupUri="MainWindow.xaml">
|
||||
StartupUri="StartDialog.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
|
||||
@ -116,6 +116,13 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="StartDialog.xaml.cs">
|
||||
<DependentUpon>StartDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="GridCopy.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@ -124,10 +131,17 @@
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GridCopy.xaml.cs">
|
||||
<DependentUpon>GridCopy.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="StartDialog.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="PlotableTestResults.cs" />
|
||||
|
||||
13
Common/CordoPlot/GridCopy.xaml
Normal file
13
Common/CordoPlot/GridCopy.xaml
Normal file
@ -0,0 +1,13 @@
|
||||
<Window x:Class="CordoPlot.GridCopy"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ScottPlot="clr-namespace:ScottPlot.WPF;assembly=ScottPlot.WPF"
|
||||
xmlns:local="clr-namespace:CordoPlot"
|
||||
mc:Ignorable="d"
|
||||
Title="GridCopy" Height="450" Width="800">
|
||||
<Grid>
|
||||
<ScottPlot:WpfPlot x:Name="WpfPlot1" />
|
||||
</Grid>
|
||||
</Window>
|
||||
40
Common/CordoPlot/GridCopy.xaml.cs
Normal file
40
Common/CordoPlot/GridCopy.xaml.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using ScottPlot.WPF;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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.Shapes;
|
||||
|
||||
namespace CordoPlot
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für GridCopy.xaml
|
||||
/// </summary>
|
||||
public partial class GridCopy : Window
|
||||
{
|
||||
public GridCopy()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public WpfPlot Chart { get; internal set; }
|
||||
|
||||
public void ShowChart(List<Int32> lastListOfIndex, List<Object> lastListOfValues,string title)
|
||||
{
|
||||
WpfPlot1.Plot.Add.Scatter(lastListOfIndex.ToArray(), lastListOfValues.ToArray(), ScottPlot.Colors.Blue);
|
||||
WpfPlot1.Plot.Title(title);
|
||||
WpfPlot1.Plot.Axes.AutoScale();
|
||||
WpfPlot1.Refresh();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,13 +6,14 @@
|
||||
xmlns:ScottPlot="clr-namespace:ScottPlot.WPF;assembly=ScottPlot.WPF"
|
||||
xmlns:local="clr-namespace:CordoPlot"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
Title="MainWindow" Height="1000" Width="1000">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="10*" />
|
||||
<ColumnDefinition Width="80*"/>
|
||||
<ColumnDefinition Width="40*"/>
|
||||
<ColumnDefinition Width="10*" />
|
||||
<ColumnDefinition Width="71*" />
|
||||
<ColumnDefinition Width="572*"/>
|
||||
<ColumnDefinition Width="163*"/>
|
||||
<ColumnDefinition Width="171*"/>
|
||||
<ColumnDefinition Width="23*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
@ -24,15 +25,15 @@
|
||||
<Label x:Name="FileName" >
|
||||
|
||||
</Label>
|
||||
<Button Click="Button_Click" Grid.Row="0" Grid.Column="2" >File</Button>
|
||||
<ScottPlot:WpfPlot x:Name="WpfPlot1" Grid.Row="1" Grid.Column="1" />
|
||||
|
||||
<ScottPlot:WpfPlot x:Name="WpfPlot2" Grid.Row="2" Grid.Column="1" />
|
||||
|
||||
<ScottPlot:WpfPlot x:Name="WpfPlot3" Grid.Row="2" Grid.Column="2" />
|
||||
<Button Click="Button_Click" Grid.Row="0" Grid.Column="2" Margin="10,10,10,10" >File</Button>
|
||||
|
||||
|
||||
<Grid Grid.Column="2" Grid.Row="1">
|
||||
<ScottPlot:WpfPlot x:Name="WpfPlot2" Grid.Row="2" Margin="0,0,0,60" Grid.RowSpan="2" Grid.Column="1" />
|
||||
<Button Click="Button_Click_1" Grid.Row="3" Grid.Column="1" Margin="10,10,10,10" >CopyWindow</Button>
|
||||
<ScottPlot:WpfPlot x:Name="WpfPlot3" Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Margin="0,0,6,60" Grid.RowSpan="2" />
|
||||
|
||||
|
||||
<Grid Grid.Column="2" Grid.ColumnSpan="2" Margin="0,60,6,288" Grid.RowSpan="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="10*" />
|
||||
<ColumnDefinition Width="40*"/>
|
||||
@ -42,53 +43,57 @@
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="10*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="40*"/>
|
||||
<RowDefinition Height="100*"/>
|
||||
<RowDefinition Height="400*"/>
|
||||
<RowDefinition Height="10*"/>
|
||||
<RowDefinition Height="400*"/>
|
||||
<RowDefinition Height="10*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="1">Serialnr</TextBlock>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1">TestRunNr</TextBlock>
|
||||
<TextBlock Grid.Row="3" Grid.Column="1">TestBenchNr</TextBlock>
|
||||
<TextBlock Grid.Row="4" Grid.Column="1">Date</TextBlock>
|
||||
<TextBlock Grid.Row="5" Grid.Column="1">MeterSize</TextBlock>
|
||||
<TextBlock Grid.Row="6" Grid.Column="1">AirTempC</TextBlock>
|
||||
<TextBlock Grid.Row="7" Grid.Column="1">AirPressure</TextBlock>
|
||||
<TextBlock Grid.Row="8" Grid.Column="1">AirHumanity</TextBlock>
|
||||
<TextBlock Grid.Row="9" Grid.Column="1">WaterTempC</TextBlock>
|
||||
<TextBlock Grid.Row="10" Grid.Column="1">TotalMeters</TextBlock>
|
||||
<TextBlock Grid.Row="11" Grid.Column="1">Remark</TextBlock>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding Path=testBenchresults.Serialnr }"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="2" Text="{Binding Path=testBenchresults.TestRunNr}"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="2" Text="{Binding Path=testBenchresults.TestBenchNr}"/>
|
||||
<TextBlock Grid.Row="4" Grid.Column="2" Text="{Binding Path=testBenchresults.Date}"/>
|
||||
<TextBlock Grid.Row="5" Grid.Column="2" Text="{Binding Path=testBenchresults.MeterSize}"/>
|
||||
<TextBlock Grid.Row="6" Grid.Column="2" Text="{Binding Path=testBenchresults.AirTempC}"/>
|
||||
<TextBlock Grid.Row="7" Grid.Column="2" Text="{Binding Path=testBenchresults.AirPressure}"/>
|
||||
<TextBlock Grid.Row="8" Grid.Column="2" Text="{Binding Path=testBenchresults.AirHumanity}"/>
|
||||
<TextBlock Grid.Row="9" Grid.Column="2" Text="{Binding Path=testBenchresults.WaterTempC}"/>
|
||||
<TextBlock Grid.Row="10" Grid.Column="2" Text="{Binding Path=testBenchresults.TotalMeters}"/>
|
||||
<TextBlock Grid.Row="11" Grid.Column="2" Text="{Binding Path=testBenchresults.Remark}"/>
|
||||
|
||||
<TextBlock Grid.Row="12" Grid.Column="2" ></TextBlock>
|
||||
<DataGrid
|
||||
x:Name="dataGrid"
|
||||
Grid.Row="12"
|
||||
Grid.Column="1" Grid.ColumnSpan="2" SelectedCellsChanged="DataGrid_SelectedCellsChanged" />
|
||||
x:Name="dataGridInfo"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1" Grid.ColumnSpan="2" ItemsSource="{Binding}"/>
|
||||
|
||||
|
||||
<DataGrid
|
||||
x:Name="dataGridTestPoints"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1" Grid.ColumnSpan="2" SelectedCellsChanged="DataGrid_SelectedCellsChanged" />
|
||||
|
||||
|
||||
</Grid>
|
||||
<TabControl Margin="0,60,0,288" Grid.RowSpan="3" Grid.Column="1">
|
||||
<TabItem Header="ChartDisplay">
|
||||
<Grid Background="#FFE5E5E5">
|
||||
<ScottPlot:WpfPlot x:Name="WpfPlot1" />
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="DataDisplay">
|
||||
<Grid Background="#FFE5E5E5">
|
||||
|
||||
<DataGrid x:Name="dataGridDispl" ItemsSource="{Binding}" SelectionUnit="Cell" IsReadOnly="True" SelectedCellsChanged="dataGridchl1_SelectedCellsChanged" CurrentCellChanged="dataGridchl1_CurrentCellChanged" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="DataChnl1">
|
||||
<Grid Background="#FFE5E5E5">
|
||||
|
||||
<DataGrid x:Name="dataGridchl1" ItemsSource="{Binding}" SelectionUnit="Cell" IsReadOnly="True" SelectedCellsChanged="dataGridchl1_SelectedCellsChanged" CurrentCellChanged="dataGridchl1_CurrentCellChanged" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="DataChnl2">
|
||||
<Grid Background="#FFE5E5E5">
|
||||
|
||||
<DataGrid x:Name="dataGridchl2" ItemsSource="{Binding}" SelectionUnit="Cell" IsReadOnly="True" SelectedCellsChanged="dataGridchl1_SelectedCellsChanged" CurrentCellChanged="dataGridchl1_CurrentCellChanged" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="DataChnl3">
|
||||
<Grid Background="#FFE5E5E5">
|
||||
|
||||
<DataGrid x:Name="dataGridchl3" ItemsSource="{Binding}" SelectionUnit="Cell" IsReadOnly="True" SelectedCellsChanged="dataGridchl1_SelectedCellsChanged" CurrentCellChanged="dataGridchl1_CurrentCellChanged" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
|
||||
<!--DataContext="{Binding testBenchresults}">
|
||||
|
||||
@ -12,17 +12,53 @@ using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.StreamingProtocol;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
using Xylem.Common.Metrology.Measurements;
|
||||
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using ScottPlot;
|
||||
|
||||
namespace CordoPlot
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window , INotifyPropertyChanged
|
||||
public partial class MainWindow : Window, INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
|
||||
public DataTable dspData { get; set; }
|
||||
|
||||
public DataTable chnData1 { get; set; }
|
||||
|
||||
public DataTable chnData2 { get; set; }
|
||||
public DataTable chnData3 { get; set; }
|
||||
|
||||
|
||||
public String CSerialnr { get { return _CSerialnr; } set { _CSerialnr = value; OnPropertyChanged("CSerialnr"); } }
|
||||
public String CTestRunNr { get { return _CTestRunNr; } set { _CTestRunNr = value; OnPropertyChanged("CTestRunNr"); } }
|
||||
public String CTestBenchNr { get { return _CTestBenchNr; } set { _CTestBenchNr = value; OnPropertyChanged("CTestBenchNr"); } }
|
||||
public String CDate { get { return _CDate; } set { _CDate = value; OnPropertyChanged("CDate"); } }
|
||||
public String CMeterSize { get { return _CMeterSize; } set { _CMeterSize = value; OnPropertyChanged("CMeterSize"); } }
|
||||
public String CAirTempC { get { return _CAirTempC; } set { _CAirTempC = value; OnPropertyChanged("CAirTempC"); } }
|
||||
public String CAirPressure { get { return _CAirPressure; } set { _CAirPressure = value; OnPropertyChanged("CAirPressure"); } }
|
||||
public String CAirHumanity { get { return _CAirHumanity; } set { _CAirHumanity = value; OnPropertyChanged("CAirHumanity"); } }
|
||||
public String CWaterTempC { get { return _CWaterTempC; } set { _CWaterTempC = value; OnPropertyChanged("CWaterTempC"); } }
|
||||
public String CTotalMeters { get { return _CTotalMeters; } set { _CTotalMeters = value; OnPropertyChanged("CTotalMeters"); } }
|
||||
public String CRemark { get { return _CRemark; } set { _CRemark = value; OnPropertyChanged("CRemark"); } }
|
||||
|
||||
private String _CSerialnr { get; set; }
|
||||
private String _CTestRunNr { get; set; }
|
||||
private String _CTestBenchNr { get; set; }
|
||||
private String _CDate { get; set; }
|
||||
private String _CMeterSize { get; set; }
|
||||
private String _CAirTempC { get; set; }
|
||||
private String _CAirPressure { get; set; }
|
||||
private String _CAirHumanity { get; set; }
|
||||
private String _CWaterTempC { get; set; }
|
||||
private String _CTotalMeters { get; set; }
|
||||
private String _CRemark { get; set; }
|
||||
|
||||
protected void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
@ -73,13 +109,48 @@ namespace CordoPlot
|
||||
//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;
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
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://localhost:50075/api/TestBench/GetTestResults?SerialNr={sn}&TestRunNr={pg}", 10000));
|
||||
testBenchresults.HasResults = true;
|
||||
|
||||
dataGridTestPoints.ItemsSource = testBenchresults.TestPointsMain;
|
||||
dataGridTestPoints.Items.Refresh();
|
||||
|
||||
|
||||
DataTable MainInfoDt = new DataTable("DisplayData");
|
||||
|
||||
|
||||
MainInfoDt.Columns.Add("Prop", typeof(string));
|
||||
MainInfoDt.Columns.Add("Val", typeof(string));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MainInfoDt.Rows.Add("Serialnr", testBenchresults.Serialnr.ToString());
|
||||
MainInfoDt.Rows.Add("TestRunNr", testBenchresults.TestRunNr.ToString());
|
||||
MainInfoDt.Rows.Add("TestBenchNr", testBenchresults.TestBenchNr.ToString());
|
||||
MainInfoDt.Rows.Add("Date", testBenchresults.Date.ToString());
|
||||
MainInfoDt.Rows.Add("MeterSize", testBenchresults.MeterSize.ToString());
|
||||
MainInfoDt.Rows.Add("AirTempC", testBenchresults.AirTempC.ToString());
|
||||
MainInfoDt.Rows.Add("AirPressure", testBenchresults.AirPressure.ToString());
|
||||
MainInfoDt.Rows.Add("AirHumanity", testBenchresults.AirHumanity.ToString());
|
||||
MainInfoDt.Rows.Add("WaterTempC", testBenchresults.WaterTempC.ToString());
|
||||
MainInfoDt.Rows.Add("TotalMeters", testBenchresults.TotalMeters.ToString());
|
||||
MainInfoDt.Rows.Add("Remark", testBenchresults.Remark.ToString());
|
||||
dataGridInfo.DataContext = MainInfoDt.DefaultView;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
dataGrid.ItemsSource = testBenchresults.TestPointsMain;
|
||||
dataGrid.Items.Refresh();
|
||||
}
|
||||
|
||||
var listOfData = new List<List<IMeasurementRecord>>();
|
||||
@ -172,6 +243,32 @@ namespace CordoPlot
|
||||
|
||||
|
||||
testBenchresults.MapDataPoints(listOfData);
|
||||
StringBuilder sb;
|
||||
StringBuilder sbDetails;
|
||||
|
||||
|
||||
|
||||
DataTable dspDataRef;
|
||||
|
||||
DataTable chnData1Ref;
|
||||
|
||||
DataTable chnData2Ref;
|
||||
DataTable chnData3Ref;
|
||||
|
||||
|
||||
testBenchresults.PrepExprtDataPoints();
|
||||
|
||||
//dspData = dspDataRef;
|
||||
//chnData1 = chnData1Ref;
|
||||
//chnData2 = chnData2Ref;
|
||||
//chnData3 = chnData3Ref;
|
||||
dataGridDispl.DataContext = dspData.DefaultView;
|
||||
dataGridchl1.DataContext = chnData1.DefaultView;
|
||||
dataGridchl2.DataContext = chnData2.DefaultView;
|
||||
dataGridchl3.DataContext = chnData3.DefaultView;
|
||||
|
||||
//File.WriteAllText(filename + "Display.csv", sb.ToString());
|
||||
//File.WriteAllText(filename + "Details.csv", sbDetails.ToString());
|
||||
|
||||
List<List<double>> Lines = new List<List<double>>();
|
||||
Lines.Add(new List<double>());
|
||||
@ -301,7 +398,7 @@ namespace CordoPlot
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
var maxScale = Plotresults.Max(p => p.ScaleLine.Count);
|
||||
var AddScale = Plotresults.First(p => p.ScaleLine.Count == maxScale);
|
||||
var srtExport = new System.Text.StringBuilder();
|
||||
@ -328,7 +425,7 @@ namespace CordoPlot
|
||||
srtExport.AppendLine($"{exprHelpLine};{Plotresults[item.Item1].VolumeLine[exprLine]};");
|
||||
exprLine = exprLine + 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
WpfPlot1.Plot.Axes.AutoScale();
|
||||
WpfPlot1.Refresh();
|
||||
@ -350,16 +447,121 @@ namespace CordoPlot
|
||||
|
||||
if (di.Item is TestPoint tp)
|
||||
{
|
||||
|
||||
dataGridDispl.DataContext = dspData.AsEnumerable()
|
||||
.Where(row => row.Field<int>("TestNr") == tp.TestPointNr)
|
||||
.CopyToDataTable();
|
||||
|
||||
|
||||
dataGridchl1.DataContext = chnData1.AsEnumerable()
|
||||
.Where(row => row.Field<int>("TestNr") == tp.TestPointNr)
|
||||
.CopyToDataTable();
|
||||
|
||||
dataGridchl2.DataContext = chnData2.AsEnumerable()
|
||||
.Where(row => row.Field<int>("TestNr") == tp.TestPointNr)
|
||||
.CopyToDataTable();
|
||||
|
||||
dataGridchl3.DataContext = chnData3.AsEnumerable()
|
||||
.Where(row => row.Field<int>("TestNr") == tp.TestPointNr)
|
||||
.CopyToDataTable();
|
||||
|
||||
|
||||
|
||||
|
||||
var ChnlHelper = new List<Tuple<int, WpfPlot, int?>>();
|
||||
ChnlHelper.Add(new Tuple<int, WpfPlot, int?>(0, WpfPlot1, tp.TestPointNr -1 ));
|
||||
ChnlHelper.Add(new Tuple<int, WpfPlot, int?>(1, WpfPlot1, tp.TestPointNr -1));
|
||||
ChnlHelper.Add(new Tuple<int, WpfPlot, int?>(2, WpfPlot1, tp.TestPointNr -1 ));
|
||||
ChnlHelper.Add(new Tuple<int, WpfPlot, int?>(3, WpfPlot1, tp.TestPointNr -1));
|
||||
ChnlHelper.Add(new Tuple<int, WpfPlot, int?>(0, WpfPlot1, tp.TestPointNr - 1));
|
||||
ChnlHelper.Add(new Tuple<int, WpfPlot, int?>(1, WpfPlot1, tp.TestPointNr - 1));
|
||||
ChnlHelper.Add(new Tuple<int, WpfPlot, int?>(2, WpfPlot1, tp.TestPointNr - 1));
|
||||
ChnlHelper.Add(new Tuple<int, WpfPlot, int?>(3, WpfPlot1, tp.TestPointNr - 1));
|
||||
Plot(ChnlHelper);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
string lastTitle = "";
|
||||
List<int> lastListOfIndex = new List<int>();
|
||||
List<object> lastListOfValues = new List<object>();
|
||||
private void dataGridchl1_SelectedCellsChanged(Object sender, SelectedCellsChangedEventArgs e)
|
||||
{
|
||||
if (sender is DataGrid dg)
|
||||
{
|
||||
if (dg.CurrentColumn == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WpfPlot2.Reset();
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
var c = dg.CurrentColumn.DisplayIndex;
|
||||
|
||||
var currentIndex = dg.Items.IndexOf(dg.CurrentItem);
|
||||
|
||||
var listOfIndex = new List<int>();
|
||||
|
||||
var listOfValues = new List<object>();
|
||||
|
||||
Coordinates? mark = null;
|
||||
|
||||
var i = 0;
|
||||
foreach (var item in dg.Items)
|
||||
{
|
||||
if (item is DataRowView drw)
|
||||
{
|
||||
listOfIndex.Add(i);
|
||||
listOfValues.Add(drw[c]);
|
||||
if (i == currentIndex)
|
||||
{
|
||||
if (drw[c] is double d)
|
||||
{
|
||||
mark = new Coordinates(i, d);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
lastListOfValues = listOfValues;
|
||||
lastListOfIndex = listOfIndex;
|
||||
if (mark.HasValue)
|
||||
{
|
||||
|
||||
|
||||
var hs = WpfPlot2.Plot.Add.HorizontalSpan(mark.Value.X, mark.Value.X, ScottPlot.Colors.Gray);
|
||||
hs.LineStyle.Width = 1;
|
||||
hs.LineStyle.Pattern = LinePattern.Dashed;
|
||||
|
||||
}
|
||||
|
||||
WpfPlot2.Plot.Add.Scatter(listOfIndex.ToArray(), listOfValues.ToArray(), ScottPlot.Colors.Blue);
|
||||
|
||||
|
||||
WpfPlot2.Plot.Axes.AutoScale();
|
||||
lastTitle = dg.CurrentColumn.Header.ToString();
|
||||
WpfPlot2.Plot.Title(dg.CurrentColumn.Header.ToString());
|
||||
WpfPlot2.Refresh();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void dataGridchl1_CurrentCellChanged(Object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Button_Click_1(Object sender, RoutedEventArgs e)
|
||||
{
|
||||
var newWin = new GridCopy();
|
||||
newWin.ShowChart(lastListOfIndex, lastListOfValues, lastTitle);
|
||||
newWin.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ScottPlot;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.TestResults;
|
||||
using Xylem.Common.Metrology.Measurements;
|
||||
@ -11,7 +14,7 @@ namespace CordoPlot
|
||||
|
||||
public class PlotCalibrationRecord : CalibrationRecord
|
||||
{
|
||||
public PlotCalibrationRecord(CalibrationRecord c, int linenr)
|
||||
public PlotCalibrationRecord(CalibrationRecord c, int linenr)
|
||||
{
|
||||
base.AccuVolumeRaw = c.AccuVolumeRaw;
|
||||
base.AmplitudeDownV = c.AmplitudeDownV;
|
||||
@ -51,7 +54,7 @@ namespace CordoPlot
|
||||
|
||||
public class PlotFlowTestRecord : FlowTestRecord
|
||||
{
|
||||
public PlotFlowTestRecord(FlowTestRecord c , int linenr)
|
||||
public PlotFlowTestRecord(FlowTestRecord c, int linenr)
|
||||
{
|
||||
|
||||
base.Channel = 0;
|
||||
@ -95,7 +98,7 @@ namespace CordoPlot
|
||||
VolumeLine.Add(double.NaN);
|
||||
ScaleLine.Add(MaxSacle[i]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,9 +119,274 @@ namespace CordoPlot
|
||||
|
||||
}
|
||||
|
||||
|
||||
public System.String FileName { get; set; }
|
||||
public System.Boolean HasResults { get; internal set; } = false;
|
||||
|
||||
|
||||
public DataTable DisplayData { get; internal set; }
|
||||
public DataTable ChlData1 { get; internal set; }
|
||||
public DataTable ChlData2 { get; internal set; }
|
||||
public DataTable ChlData3 { get; internal set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public bool PrepExprtDataPoints()
|
||||
{
|
||||
DisplayData = new DataTable("DisplayData");
|
||||
|
||||
DisplayData.Columns.Add("TestNr", typeof(int));
|
||||
DisplayData.Columns.Add("FlowTargetQmh", typeof(double));
|
||||
DisplayData.Columns.Add("FlowrateQmh", typeof(double));
|
||||
DisplayData.Columns.Add("VolumeQm", typeof(double));
|
||||
DisplayData.Columns.Add("Info", typeof(string));
|
||||
DisplayData.Columns.Add("CALC!DurationS", typeof(double));
|
||||
DisplayData.Columns.Add("ReceivedTimeUtc", typeof(DateTimeOffset));
|
||||
DisplayData.Columns.Add("VolumeCm", typeof(double));
|
||||
DisplayData.Columns.Add("OverflowVolumeCm", typeof(double));
|
||||
DisplayData.Columns.Add("TimeS", typeof(double));
|
||||
DisplayData.Columns.Add("OverflowTimeS", typeof(double));
|
||||
DisplayData.Columns.Add("CRC", typeof(ushort));
|
||||
DisplayData.Columns.Add("IsValid", typeof(bool));
|
||||
DisplayData.Columns.Add("DecodedTimeUtc", typeof(DateTimeOffset));
|
||||
DisplayData.Columns.Add("SyncMarkRecord", typeof(SyncMarkRecord));
|
||||
DisplayData.Columns.Add("CALC!VolumenDiffFromStartQm", typeof(double));
|
||||
DisplayData.Columns.Add("CALC!FlowrateFromStartQmH", typeof(double));
|
||||
DisplayData.Columns.Add("CALC!ShortFlowrateQmH", typeof(double));
|
||||
|
||||
|
||||
ChlData1 = new DataTable("ChlData1");
|
||||
ChlData2 = new DataTable("ChlData2");
|
||||
ChlData3 = new DataTable("ChlData3");
|
||||
|
||||
foreach (var item in testPointResults.Where(f => f.Chnl == 0))
|
||||
{
|
||||
FlowTestRecord firstRecord = null;
|
||||
FlowTestRecord prevRecord = null;
|
||||
|
||||
|
||||
foreach (var raw in item.measurementRecords)
|
||||
{
|
||||
if (raw is FlowTestRecord ftr)
|
||||
{
|
||||
|
||||
if (firstRecord == null)
|
||||
{
|
||||
firstRecord = ftr;
|
||||
prevRecord = ftr;
|
||||
DisplayData.Rows.Add(
|
||||
item.TestNr + 1,
|
||||
this.Details[item.TestNr].FlowTargetQmh,
|
||||
this.Details[item.TestNr].FlowrateQmh,
|
||||
this.Details[item.TestNr].VolumeQm,
|
||||
this.Details[item.TestNr].Info,
|
||||
0,
|
||||
ftr.ReceivedTime,
|
||||
ftr.VolumeCm,
|
||||
ftr.OverflowVolumeCm,
|
||||
ftr.TimeS,
|
||||
ftr.OverflowTimeS,
|
||||
ftr.Crc,
|
||||
ftr.IsValid,
|
||||
ftr.DecodedTime,
|
||||
ftr.SyncMarkRecord,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
var volDiffStart = ftr.VolumeCm - firstRecord.VolumeCm;
|
||||
var volDiffprev = ftr.VolumeCm - prevRecord.VolumeCm;
|
||||
var timeDiffStart = ftr.TimeS - firstRecord.TimeS;
|
||||
var timeDiffprev = ftr.TimeS - prevRecord.TimeS;
|
||||
var ts = (ftr.ReceivedTime - firstRecord.ReceivedTime).TotalSeconds;
|
||||
DisplayData.Rows.Add(
|
||||
item.TestNr + 1,
|
||||
this.Details[item.TestNr].FlowTargetQmh,
|
||||
this.Details[item.TestNr].FlowrateQmh,
|
||||
this.Details[item.TestNr].VolumeQm,
|
||||
this.Details[item.TestNr].Info,
|
||||
ts,
|
||||
ftr.ReceivedTime,
|
||||
ftr.VolumeCm,
|
||||
ftr.OverflowVolumeCm,
|
||||
ftr.TimeS,
|
||||
ftr.OverflowTimeS,
|
||||
ftr.Crc,
|
||||
ftr.IsValid,
|
||||
|
||||
ftr.DecodedTime,
|
||||
ftr.SyncMarkRecord,
|
||||
volDiffStart,
|
||||
(volDiffStart / timeDiffStart) * 3600,
|
||||
(volDiffprev / timeDiffprev) * 3600
|
||||
);
|
||||
|
||||
|
||||
prevRecord = ftr;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
for (int i = 1; i <= 3; i++)
|
||||
{
|
||||
var lCounter = 0;
|
||||
DataTable dtChnl = ChlData3;
|
||||
if (i == 1)
|
||||
{
|
||||
dtChnl = ChlData1;
|
||||
}
|
||||
else if (i == 2)
|
||||
{
|
||||
dtChnl = ChlData2;
|
||||
}
|
||||
else if (i == 2)
|
||||
{
|
||||
dtChnl = ChlData3;
|
||||
}
|
||||
|
||||
dtChnl.Columns.Add("TestNr", typeof(int));
|
||||
dtChnl.Columns.Add("FlowTargetQmh", typeof(double));
|
||||
dtChnl.Columns.Add("FlowrateQmh", typeof(double));
|
||||
dtChnl.Columns.Add("VolumeQm", typeof(double));
|
||||
dtChnl.Columns.Add("Info", typeof(string));
|
||||
dtChnl.Columns.Add("CALC!DurationS", typeof(double));
|
||||
dtChnl.Columns.Add("ReceivedTimeUtc", typeof(DateTimeOffset));
|
||||
dtChnl.Columns.Add("Validation", typeof(ushort));
|
||||
dtChnl.Columns.Add("TotalTimeOfFlightS", typeof(double));
|
||||
dtChnl.Columns.Add("DeltaTimeOfFlightS", typeof(double));
|
||||
dtChnl.Columns.Add("RawTotalTimeOfFlight", typeof(int));
|
||||
dtChnl.Columns.Add("RawDeltaTimeOfFlight", typeof(int));
|
||||
dtChnl.Columns.Add("VolumeScaleRawPerMl", typeof(double));
|
||||
dtChnl.Columns.Add("VolumeFactorRawToQm", typeof(double));
|
||||
dtChnl.Columns.Add("DeltaVolumeRaw", typeof(double));
|
||||
dtChnl.Columns.Add("DeltaVolumeQm", typeof(double));
|
||||
dtChnl.Columns.Add("AccuVolumeRaw", typeof(double));
|
||||
dtChnl.Columns.Add("SampleIntervalS", typeof(double));
|
||||
dtChnl.Columns.Add("AmplitudeUpV", typeof(double));
|
||||
dtChnl.Columns.Add("AmplitudeDownV", typeof(double));
|
||||
dtChnl.Columns.Add("PulseWidthRatioUp", typeof(double));
|
||||
dtChnl.Columns.Add("PulseWidthRatioDown", typeof(double));
|
||||
dtChnl.Columns.Add("TemperatureRaw", typeof(double));
|
||||
dtChnl.Columns.Add("TemperaturePowFactor", typeof(double));
|
||||
dtChnl.Columns.Add("TemperatureDegC", typeof(double));
|
||||
dtChnl.Columns.Add("CALC!VolumenDiffFromStart", typeof(double));
|
||||
dtChnl.Columns.Add("CALC!FlowrateFromStart", typeof(double));
|
||||
dtChnl.Columns.Add("CALC!ShortFlowrate", typeof(double));
|
||||
|
||||
|
||||
|
||||
foreach (var item in testPointResults.Where(f => f.Chnl == i))
|
||||
{
|
||||
CalibrationRecord firstRecord = null;
|
||||
CalibrationRecord prevRecord = null;
|
||||
|
||||
foreach (var raw in item.measurementRecords)
|
||||
{
|
||||
if (raw is CalibrationRecord ftr)
|
||||
{
|
||||
|
||||
if (firstRecord == null)
|
||||
{
|
||||
firstRecord = ftr;
|
||||
prevRecord = ftr;
|
||||
|
||||
|
||||
dtChnl.Rows.Add(item.TestNr + 1,
|
||||
this.Details[item.TestNr].FlowTargetQmh,
|
||||
this.Details[item.TestNr].FlowrateQmh,
|
||||
this.Details[item.TestNr].VolumeQm,
|
||||
this.Details[item.TestNr].Info,
|
||||
0.0,
|
||||
ftr.ReceivedTime,
|
||||
ftr.Validation,
|
||||
ftr.TotalTimeOfFlightS,
|
||||
ftr.DeltaTimeOfFlightS,
|
||||
ftr.RawTotalTimeOfFlight,
|
||||
ftr.RawDeltaTimeOfFlight,
|
||||
ftr.VolumeScaleRawPerMl,
|
||||
ftr.VolumeFactorRawToQm,
|
||||
ftr.DeltaVolumeRaw,
|
||||
ftr.DeltaVolumeQm,
|
||||
ftr.AccuVolumeRaw,
|
||||
ftr.SampleIntervalS,
|
||||
ftr.AmplitudeUpV,
|
||||
ftr.AmplitudeDownV,
|
||||
ftr.PulseWidthRatioUp,
|
||||
ftr.PulseWidthRatioDown,
|
||||
ftr.TemperatureRaw,
|
||||
ftr.TemperaturePowFactor,
|
||||
ftr.TemperatureDegC,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
var volDiffStart = ftr.VolumeCm - firstRecord.VolumeCm;
|
||||
var volDiffprev = ftr.VolumeCm - prevRecord.VolumeCm;
|
||||
var timeDiffStart = ftr.TimeS - firstRecord.TimeS;
|
||||
var timeDiffprev = ftr.TimeS - prevRecord.TimeS;
|
||||
var ts = (ftr.ReceivedTime - firstRecord.ReceivedTime).TotalSeconds;
|
||||
|
||||
dtChnl.Rows.Add(item.TestNr + 1,
|
||||
this.Details[item.TestNr].FlowTargetQmh,
|
||||
this.Details[item.TestNr].FlowrateQmh,
|
||||
this.Details[item.TestNr].VolumeQm,
|
||||
this.Details[item.TestNr].Info,
|
||||
ts,
|
||||
ftr.ReceivedTime,
|
||||
ftr.Validation,
|
||||
ftr.TotalTimeOfFlightS,
|
||||
ftr.DeltaTimeOfFlightS,
|
||||
ftr.RawTotalTimeOfFlight,
|
||||
ftr.RawDeltaTimeOfFlight,
|
||||
ftr.VolumeScaleRawPerMl,
|
||||
ftr.VolumeFactorRawToQm,
|
||||
ftr.DeltaVolumeRaw,
|
||||
ftr.DeltaVolumeQm,
|
||||
ftr.AccuVolumeRaw,
|
||||
ftr.SampleIntervalS,
|
||||
ftr.AmplitudeUpV,
|
||||
ftr.AmplitudeDownV,
|
||||
ftr.PulseWidthRatioUp,
|
||||
ftr.PulseWidthRatioDown,
|
||||
ftr.TemperatureRaw,
|
||||
ftr.TemperaturePowFactor,
|
||||
ftr.TemperatureDegC,
|
||||
volDiffStart,
|
||||
(volDiffStart / timeDiffStart) * 3600,
|
||||
(volDiffprev / timeDiffprev) * 3600
|
||||
|
||||
);
|
||||
prevRecord = ftr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool MapDataPoints(List<List<IMeasurementRecord>> listOfRecords)
|
||||
{
|
||||
ListOfRecords = listOfRecords;
|
||||
@ -163,7 +431,7 @@ namespace CordoPlot
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public PlotResult Plot(int Chnl, int? TestNr = null)
|
||||
{
|
||||
//
|
||||
@ -178,7 +446,7 @@ namespace CordoPlot
|
||||
List<double> TofLines = new List<double>();
|
||||
List<double> AmplitudeUpVLines = new List<double>();
|
||||
List<double> AmplitudeDownVLines = new List<double>();
|
||||
|
||||
|
||||
|
||||
var linecounter = 0;
|
||||
var counter = 0;
|
||||
@ -209,14 +477,14 @@ namespace CordoPlot
|
||||
}
|
||||
else if (line is PlotFlowTestRecord disp)
|
||||
{
|
||||
|
||||
|
||||
//VolumeLine.Add(disp.LineNummer);
|
||||
}
|
||||
|
||||
|
||||
if (!VolumeLine.Any())
|
||||
{
|
||||
VolumeLine.Add(0);
|
||||
|
||||
|
||||
LastVolOrig = line.GetVolumeCm();
|
||||
intiVol = 0;
|
||||
}
|
||||
|
||||
32
Common/CordoPlot/StartDialog.xaml
Normal file
32
Common/CordoPlot/StartDialog.xaml
Normal file
@ -0,0 +1,32 @@
|
||||
<Window x:Class="CordoPlot.StartDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:CordoPlot"
|
||||
mc:Ignorable="d"
|
||||
Title="StartDialog" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="43*"/>
|
||||
<ColumnDefinition Width="523*"/>
|
||||
<ColumnDefinition Width="170*"/>
|
||||
<ColumnDefinition Width="64*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="62*"/>
|
||||
<RowDefinition Height="51*"/>
|
||||
<RowDefinition Height="41*"/>
|
||||
<RowDefinition Height="29*"/>
|
||||
<RowDefinition Height="43*"/>
|
||||
<RowDefinition Height="173*"/>
|
||||
<RowDefinition Height="35*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Button Click="Button_Click" Grid.Row="2" Margin="10,3,17,10" Content="Folder" Grid.Column="2" />
|
||||
<DataGrid Name="Fileoverview" ItemsSource="{Binding}" SelectionUnit="Cell" IsReadOnly="True" SelectedCellsChanged="Fileoverview_SelectedCellsChanged" CurrentCellChanged="Fileoverview_CurrentCellChanged" Grid.Column="1" HorizontalAlignment="Center" Height="266" Grid.Row="2" VerticalAlignment="Top" Width="503" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="0,10,0,0" Grid.RowSpan="4"/>
|
||||
|
||||
|
||||
<Label Name="lblProgress" Grid.Column="2" Margin="10,41,10,0" Grid.Row="2" Content="Open Files" Grid.RowSpan="2" FontSize="7"></Label>
|
||||
<ProgressBar Minimum="0" Maximum="100" Value="75" Name="pbStatus" Grid.Column="2" Margin="10,10,10,10" Grid.Row="4" />
|
||||
</Grid>
|
||||
</Window>
|
||||
259
Common/CordoPlot/StartDialog.xaml.cs
Normal file
259
Common/CordoPlot/StartDialog.xaml.cs
Normal file
@ -0,0 +1,259 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
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.Shapes;
|
||||
using Newtonsoft.Json;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für StartDialog.xaml
|
||||
/// </summary>
|
||||
public partial class StartDialog : Window
|
||||
{
|
||||
public StartDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
string[] FileNames;
|
||||
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
|
||||
dialog.Multiselect = true;
|
||||
bool? result = dialog.ShowDialog();
|
||||
|
||||
// Process open file dialog box results
|
||||
|
||||
|
||||
if (result == true)
|
||||
{
|
||||
TestResults = new List<PlotableTestResults>();
|
||||
FileNames = dialog.FileNames;
|
||||
|
||||
pbStatus.Maximum = dialog.FileNames.Length;
|
||||
|
||||
BackgroundWorker worker = new BackgroundWorker();
|
||||
worker.WorkerReportsProgress = true;
|
||||
worker.DoWork += worker_DoWork;
|
||||
|
||||
worker.ProgressChanged += worker_ProgressChanged;
|
||||
|
||||
worker.RunWorkerAsync();
|
||||
worker.RunWorkerCompleted += Worker_RunWorkerCompleted;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void Worker_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
DataTable MainInfoDt = new DataTable("DisplayData");
|
||||
|
||||
|
||||
MainInfoDt.Columns.Add("Nr", typeof(int));
|
||||
MainInfoDt.Columns.Add("File", typeof(string));
|
||||
MainInfoDt.Columns.Add("Status", typeof(bool));
|
||||
|
||||
|
||||
|
||||
var i = 0;
|
||||
foreach (PlotableTestResults row in TestResults)
|
||||
{
|
||||
i = i + 1;
|
||||
MainInfoDt.Rows.Add(i, row.FileName, row.HasResults);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Fileoverview.DataContext = MainInfoDt.DefaultView;
|
||||
|
||||
}
|
||||
|
||||
void worker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
var i = 0;
|
||||
foreach (var filename in FileNames)
|
||||
{
|
||||
|
||||
|
||||
|
||||
i = i + 1;
|
||||
(sender as BackgroundWorker).ReportProgress(i, $"({i}/{FileNames.Length}){filename}");
|
||||
PlotableTestResults testBenchresults = new PlotableTestResults();
|
||||
testBenchresults.FileName = filename;
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
var AllLines = File.ReadAllLines(filename);
|
||||
|
||||
//LedRawData__Slot_7_SN24712962_PG2016079130.log
|
||||
if (filename.Contains("_SN") && filename.Contains("_PG"))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
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://localhost:50076/api/TestBench/GetTestResults?SerialNr={sn}&TestRunNr={pg}", 10000));
|
||||
testBenchresults.HasResults = true;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
var linecounter = 0;
|
||||
foreach (var line in AllLines)
|
||||
{
|
||||
linecounter = linecounter + 1;
|
||||
decoder = new StreamingDecoder();
|
||||
|
||||
if (line.Contains("|"))
|
||||
{
|
||||
|
||||
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;
|
||||
var n = new PlotCalibrationRecord(decoder.DataCalib, linecounter);
|
||||
|
||||
listOfData[n.GetChannel()].Add(n);
|
||||
}
|
||||
else if (decoder.DataFlowTest != null && decoder.DataFlowTest.IsValid)
|
||||
{
|
||||
decoder.DataFlowTest.ReceivedTime = recived;
|
||||
decoder.DataFlowTest.SyncMarkRecord = currentSyncmark;
|
||||
var n = new PlotFlowTestRecord(decoder.DataFlowTest, linecounter);
|
||||
listOfData[n.GetChannel()].Add(n);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//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);
|
||||
|
||||
|
||||
|
||||
|
||||
testBenchresults.PrepExprtDataPoints();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
TestResults.Add(testBenchresults);
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||
{
|
||||
pbStatus.Value = e.ProgressPercentage;
|
||||
lblProgress.Content = (string)e.UserState;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public List<PlotableTestResults> TestResults { get; set; }
|
||||
|
||||
private void Fileoverview_SelectedCellsChanged(Object sender, SelectedCellsChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Fileoverview_CurrentCellChanged(Object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -635,15 +635,15 @@ namespace CordonelAssemblyLine.Model
|
||||
else sbMSG.AppendLine($"Restlaufzeit i.O.");
|
||||
|
||||
|
||||
//0,5%
|
||||
|
||||
|
||||
//if (genesisStatus.AlternativeRequiredBatteryLoadPercent != null &&
|
||||
// genesisStatus.AlternativeRequiredBatteryLoadPercent > requirements.MaxDrainedBatteryLoadPercentAssembly)
|
||||
//{
|
||||
// sbMSG.AppendLine($"{nameof(genesisStatus.AlternativeRequiredBatteryLoadPercent)}: " +
|
||||
// $"{genesisStatus.AlternativeRequiredBatteryLoadPercent} > " + $"{requirements.MaxDrainedBatteryLoadPercentAssembly}");
|
||||
// ret = false;
|
||||
//}
|
||||
if (genesisStatus.AlternativeRequiredBatteryLoadPercent != null &&
|
||||
genesisStatus.AlternativeRequiredBatteryLoadPercent > requirements.MaxDrainedBatteryLoadPercentAssembly)
|
||||
{
|
||||
sbMSG.AppendLine($"{nameof(genesisStatus.AlternativeRequiredBatteryLoadPercent)}: " +
|
||||
$"{genesisStatus.AlternativeRequiredBatteryLoadPercent} > " + $"{requirements.MaxDrainedBatteryLoadPercentAssembly}");
|
||||
ret = false;
|
||||
}
|
||||
//else sbMSG.AppendLine($"Alternative Batterieverbrauch Montage i.O.");
|
||||
// max bat verbrauch - MaxDrainedBatteryLoadPercentAssembly
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{D0C8D887-ED52-40AB-A069-90BCE0E801E2}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Xylem.Common.Ui.CordonelPreadjustmentUi</RootNamespace>
|
||||
<AssemblyName>Xylem.Common.Ui.CordonelPreadjustmentUi</AssemblyName>
|
||||
@ -149,9 +149,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<NoWin32Manifest>true</NoWin32Manifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
|
||||
@ -14,11 +14,11 @@ using static CordonelPreadjustmentUi.PreAdjustmentControl;
|
||||
|
||||
namespace CordonelPreadjustmentUi.Processes.Actions
|
||||
{
|
||||
public class OfflinePaswordItem
|
||||
public class TempFlanschPaswordItem
|
||||
{
|
||||
public OfflinePaswordItem()
|
||||
public TempFlanschPaswordItem()
|
||||
{ }
|
||||
public OfflinePaswordItem(String pcbID, String password)
|
||||
public TempFlanschPaswordItem(String pcbID, String password)
|
||||
{
|
||||
PcbID = pcbID;
|
||||
Password = password;
|
||||
@ -29,7 +29,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
|
||||
public String Password { get; set; }
|
||||
|
||||
|
||||
public int? Slot { get; set; }
|
||||
public int Slot { get; set; }
|
||||
|
||||
}
|
||||
public class LoginProcess : BaseProcess
|
||||
@ -60,11 +60,11 @@ namespace CordonelPreadjustmentUi.Processes.Actions
|
||||
if (pp.Setting.GetTempUseTempFlansh())
|
||||
{
|
||||
|
||||
String CurrentConfigDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ProgramConfig.GenesisBaseFolder, ProgramConfig.OfflineInfoFile);
|
||||
String CurrentConfigDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ProgramConfig.GenesisBaseFolder, "TempFlansch.json");
|
||||
|
||||
if (File.Exists(CurrentConfigDir))
|
||||
{
|
||||
var listOfOfflinePasswords = JsonConvert.DeserializeObject<List<OfflinePaswordItem>>(
|
||||
var listOfOfflinePasswords = JsonConvert.DeserializeObject<List<TempFlanschPaswordItem>>(
|
||||
File.ReadAllText(CurrentConfigDir));
|
||||
if (listOfOfflinePasswords != null)
|
||||
{
|
||||
|
||||
@ -452,7 +452,7 @@ namespace Opc.Ua.Security
|
||||
public System.Security.Cryptography.X509Certificates.X509Certificate2 Find(bool needPrivateKey)
|
||||
{
|
||||
Opc.Ua.CertificateIdentifier output = SecuredApplication.FromCertificateIdentifier(this);
|
||||
return output.Find(needPrivateKey);
|
||||
return output.Find(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -40,7 +40,7 @@ namespace Opc.Ua
|
||||
{
|
||||
if (useCache)
|
||||
{
|
||||
return Load(new X509Certificate2(encodedData), false);
|
||||
return Load(new X509Certificate2(encodedData), false, X509KeyStorageFlags.Exportable );
|
||||
}
|
||||
|
||||
return new X509Certificate2(encodedData);
|
||||
|
||||
@ -347,12 +347,20 @@
|
||||
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();
|
||||
try
|
||||
{
|
||||
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();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
tr.Remark = "temp nicht lesbar";
|
||||
}
|
||||
|
||||
|
||||
tr.Details = new List<TestPointDetail>();
|
||||
tr.TestPointsChannels = new List<ChnlTestPoint>();
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>56011</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:50075/</IISUrl>
|
||||
<IISUrl>http://localhost:50076/</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
|
||||
@ -37,7 +37,7 @@ namespace Siemens.UAClientHelper
|
||||
public UAClientHelperAPI()
|
||||
{
|
||||
// Creats the application configuration (containing the certificate) on construction
|
||||
mApplicationConfig = CreateClientConfiguration();
|
||||
// mApplicationConfig = CreateClientConfiguration();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user