Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
ff59c77d54
5 files changed
+113
-23
No files matched your search
+13
@@ -1,4 +1,7 @@
|
|||||||
using DyeingComputer.UserClass;
|
using DyeingComputer.UserClass;
|
||||||
|
using LiveChartsCore;
|
||||||
|
using LiveChartsCore.SkiaSharpView;
|
||||||
|
using SkiaSharp;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -55,6 +58,16 @@ namespace DyeingComputer
|
|||||||
base.OnStartup(e);
|
base.OnStartup(e);
|
||||||
AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly;
|
AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly;
|
||||||
this.DispatcherUnhandledException += App_DispatcherUnhandledException;
|
this.DispatcherUnhandledException += App_DispatcherUnhandledException;
|
||||||
|
|
||||||
|
LiveCharts.Configure(config => config.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('温')));
|
||||||
|
LiveCharts.Configure(config => config.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('度')));
|
||||||
|
LiveCharts.Configure(config => config.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('水')));
|
||||||
|
LiveCharts.Configure(config => config.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('位')));
|
||||||
|
LiveCharts.Configure(config => config.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('主')));
|
||||||
|
LiveCharts.Configure(config => config.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('附')));
|
||||||
|
LiveCharts.Configure(config => config.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('料')));
|
||||||
|
LiveCharts.Configure(config => config.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('药')));
|
||||||
|
LiveCharts.Configure(config => config.HasGlobalSKTypeface(SKFontManager.Default.MatchCharacter('缸')));
|
||||||
}
|
}
|
||||||
|
|
||||||
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "DyeingComputer.ini");
|
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "DyeingComputer.ini");
|
||||||
|
|||||||
@@ -5,12 +5,13 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
|
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
|
||||||
xmlns:viewmodel="clr-namespace:DyeingComputer.ViewModel"
|
xmlns:viewmodel="clr-namespace:DyeingComputer.ViewModel"
|
||||||
d:DataContext="{d:DesignInstance Type=viewmodel:CurveDiagramViewModel}"
|
|
||||||
mc:Ignorable="d" Loaded="UserControl_Loaded"
|
mc:Ignorable="d" Loaded="UserControl_Loaded"
|
||||||
d:DesignHeight="630" d:DesignWidth="1280" VerticalAlignment="Top">
|
d:DataContext="{d:DesignInstance Type=viewmodel:CurveDiagramViewModel}"
|
||||||
|
d:DesignHeight="630" d:DesignWidth="1280">
|
||||||
<Grid>
|
<Grid>
|
||||||
<lvc:PieChart x:Name="OscChart" Series="{Binding Series}">
|
<lvc:CartesianChart x:Name="OscChart" MinWidth="1280" MinHeight="600"
|
||||||
|
Series="{Binding Series}"
|
||||||
</lvc:PieChart>
|
YAxes="{Binding YAxes}"
|
||||||
|
XAxes="{Binding XAxes}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -46,24 +46,15 @@ namespace DyeingComputer.View
|
|||||||
{
|
{
|
||||||
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where DYELOT = '" + MainWindowViewModel.WorkNumder + "'", null).Tables[0];
|
CDB = SQLiteHelpers.ExecuteDataSet("select * from Chart where DYELOT = '" + MainWindowViewModel.WorkNumder + "'order by Time", null).Tables[0];
|
||||||
SQLiteHelpers.Close();
|
SQLiteHelpers.Close();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
OscChart.Series = new ISeries[] { new LineSeries<double>
|
|
||||||
{
|
|
||||||
Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
|
|
||||||
Fill = null
|
|
||||||
} };
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,20 +8,93 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using static DyeingComputer.UserClass.SqliteHelper;
|
using static DyeingComputer.UserClass.SqliteHelper;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using LiveChartsCore.Kernel.Sketches;
|
||||||
|
using LiveChartsCore.SkiaSharpView.Painting;
|
||||||
|
using ScottPlot.Colormaps;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Media.TextFormatting;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace DyeingComputer.ViewModel
|
namespace DyeingComputer.ViewModel
|
||||||
{
|
{
|
||||||
public class CurveDiagramViewModel : ObservableObject
|
public partial class CurveDiagramViewModel : ObservableObject//ViewModelBase
|
||||||
{
|
{
|
||||||
|
public ISeries[] Series { get; set; } =
|
||||||
public ISeries[] Series { get; set; } = new ISeries[]
|
|
||||||
{
|
{
|
||||||
new LineSeries<double>
|
new LineSeries<double>
|
||||||
{
|
{
|
||||||
Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
|
Name = Properties.Resources.Temperature +"1",
|
||||||
Fill = null
|
Values = new double[] { 5, 0, 1000, 0, 5, 0 },
|
||||||
|
Fill = null,
|
||||||
|
GeometrySize = 0,
|
||||||
|
// use the line smoothness property to control the curve
|
||||||
|
// it goes from 0 to 1
|
||||||
|
// where 0 is a straight line and 1 the most curved
|
||||||
|
LineSmoothness = 1,
|
||||||
|
ScalesYAt = 0,
|
||||||
|
},
|
||||||
|
new LineSeries<double>
|
||||||
|
{
|
||||||
|
Name = Properties.Resources.Temperature +"2",
|
||||||
|
Values = new double[] { 7, 2, 7, 2, 7, 2 ,6,67,5,66,56,5},
|
||||||
|
Fill = null,
|
||||||
|
GeometrySize = 0,
|
||||||
|
LineSmoothness = 1,
|
||||||
|
ScalesYAt = 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
new LineSeries<double>
|
||||||
|
{
|
||||||
|
Name = Properties.Resources.Flowmeter,
|
||||||
|
Values = new double[] { 7, 2, 7, 5467,6,67,5,66,56,5},
|
||||||
|
Fill = null,
|
||||||
|
GeometrySize = 0,
|
||||||
|
LineSmoothness = 1,
|
||||||
|
ScalesYAt = 1,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// You can use the DateTimeAxis class to define a date time based axis
|
||||||
|
|
||||||
|
// The first parameter is the time between each point, in this case 1 day
|
||||||
|
// you can also use 1 year, 1 month, 1 hour, 1 minute, 1 second, 1 millisecond, etc
|
||||||
|
// The second parameter is a function that receives the value and returns the label
|
||||||
|
public Axis[] XAxes { get; set; } =
|
||||||
|
{ new DateTimeAxis(TimeSpan.FromSeconds(5) , date => date.ToString("yyyy-MM-dd HH:mm:ss")) };
|
||||||
|
|
||||||
|
private static readonly SKColor s_blue = new SKColor(25, 118, 210);
|
||||||
|
private static readonly SKColor s_red = new SKColor(229, 57, 53);
|
||||||
|
private static readonly SKColor s_yellow = new SKColor(198, 167, 0);
|
||||||
|
|
||||||
|
public ICartesianAxis[] YAxes { get; set; } ={
|
||||||
|
new Axis //“units” 和 “tens” 系列将在此轴上缩放
|
||||||
|
{
|
||||||
|
Name = Properties.Resources.Temperature +" ( °C )",
|
||||||
|
NameTextSize = 24,
|
||||||
|
NamePaint = new SolidColorPaint(s_blue),
|
||||||
|
NamePadding = new LiveChartsCore.Drawing.Padding(0, 20),
|
||||||
|
Padding = new LiveChartsCore.Drawing.Padding(0, 0, 20, 0),
|
||||||
|
TextSize = 16,
|
||||||
|
LabelsPaint = new SolidColorPaint(s_blue),
|
||||||
|
TicksPaint = new SolidColorPaint(s_blue),
|
||||||
|
SubticksPaint = new SolidColorPaint(s_blue),
|
||||||
|
DrawTicksPath = true
|
||||||
|
},
|
||||||
|
new Axis // the "hundreds" series will be scaled on this axis
|
||||||
|
{
|
||||||
|
Name = Properties.Resources.Flowmeter +" ( L )",
|
||||||
|
NameTextSize = 24,
|
||||||
|
NamePaint = new SolidColorPaint(s_red),
|
||||||
|
NamePadding = new LiveChartsCore.Drawing.Padding(0, 20),
|
||||||
|
Padding = new LiveChartsCore.Drawing.Padding(20, 0, 0, 0),
|
||||||
|
TextSize = 16,
|
||||||
|
LabelsPaint = new SolidColorPaint(s_red),
|
||||||
|
TicksPaint = new SolidColorPaint(s_red),
|
||||||
|
SubticksPaint = new SolidColorPaint(s_red),
|
||||||
|
DrawTicksPath = true,
|
||||||
|
ShowSeparatorLines = false,
|
||||||
|
Position = LiveChartsCore.Measure.AxisPosition.End
|
||||||
|
}, };
|
||||||
|
|
||||||
public CurveDiagramViewModel()
|
public CurveDiagramViewModel()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,9 +67,9 @@ namespace DyeingComputer.ViewModel
|
|||||||
Sys_workSTEPID = -1;
|
Sys_workSTEPID = -1;
|
||||||
WorkNumder = "----------";
|
WorkNumder = "----------";
|
||||||
SYS_SET(); //crbl
|
SYS_SET(); //crbl
|
||||||
CountDown(); //启动循环任务
|
|
||||||
SQL_data(); //读数据库
|
SQL_data(); //读数据库
|
||||||
UPort(); //启动串口
|
UPort(); //启动串口
|
||||||
|
CountDown(); //启动循环任务
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int MT05;//主缸排水延时
|
private static int MT05;//主缸排水延时
|
||||||
@@ -118,6 +118,9 @@ namespace DyeingComputer.ViewModel
|
|||||||
MT40 = Convert.ToInt16(Selet_con("MT40"));//
|
MT40 = Convert.ToInt16(Selet_con("MT40"));//
|
||||||
MT41 = Convert.ToInt16(Selet_con("MT41"));//
|
MT41 = Convert.ToInt16(Selet_con("MT41"));//
|
||||||
MU01 = Convert.ToInt16(Selet_con("MU01"));//呼叫操作员
|
MU01 = Convert.ToInt16(Selet_con("MU01"));//呼叫操作员
|
||||||
|
MS01 = Convert.ToDouble(Selet_con("MS01"));
|
||||||
|
MS02 = Convert.ToDouble(Selet_con("MS02"));
|
||||||
|
MS03 = Convert.ToDouble(Selet_con("MS03"));
|
||||||
|
|
||||||
S16 = Convert.ToInt16(Selet_sys("S16"));//工作信息
|
S16 = Convert.ToInt16(Selet_sys("S16"));//工作信息
|
||||||
SM01 = Convert.ToInt16(Selet_sys("SM01"));//FG
|
SM01 = Convert.ToInt16(Selet_sys("SM01"));//FG
|
||||||
@@ -234,7 +237,16 @@ namespace DyeingComputer.ViewModel
|
|||||||
LOG_view();
|
LOG_view();
|
||||||
IO_view();
|
IO_view();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Name_err.ToString();
|
if (!string.IsNullOrEmpty(Name_err.ToString()))
|
||||||
|
{
|
||||||
|
Status_Str = Name_err.ToString();
|
||||||
|
if (Alert_red) { Alert_red = false; Alert_bell = false; }//关报警
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Alert_red = !Alert_red;
|
||||||
|
Alert_bell = !Alert_bell;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void Tick_Event_5S(object sender, EventArgs e)//Tick_Event周期执行事件5S
|
void Tick_Event_5S(object sender, EventArgs e)//Tick_Event周期执行事件5S
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user