任务计划修改增加图表
This commit is contained in:
1 parent
5e64b1a3cb
commit
6188bfb6ef
10 files changed
+345
-55
No files matched your search
@@ -124,9 +124,13 @@
|
|||||||
<Compile Include="UserClass\StrToInt.cs" />
|
<Compile Include="UserClass\StrToInt.cs" />
|
||||||
<Compile Include="UserClass\SubItem.cs" />
|
<Compile Include="UserClass\SubItem.cs" />
|
||||||
<Compile Include="UserClass\UserControlMenuItem.cs" />
|
<Compile Include="UserClass\UserControlMenuItem.cs" />
|
||||||
|
<Compile Include="ViewModel\CurveTempModel.cs" />
|
||||||
<Compile Include="ViewModel\CurveDiagramViewModel.cs" />
|
<Compile Include="ViewModel\CurveDiagramViewModel.cs" />
|
||||||
<Compile Include="ViewModel\MainWindowViewModel.cs" />
|
<Compile Include="ViewModel\MainWindowViewModel.cs" />
|
||||||
<Compile Include="ViewModel\ViewModelLocator.cs" />
|
<Compile Include="ViewModel\ViewModelLocator.cs" />
|
||||||
|
<Compile Include="View\CurveTemp.xaml.cs">
|
||||||
|
<DependentUpon>CurveTemp.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="View\CurveDiagram.xaml.cs">
|
<Compile Include="View\CurveDiagram.xaml.cs">
|
||||||
<DependentUpon>CurveDiagram.xaml</DependentUpon>
|
<DependentUpon>CurveDiagram.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -218,6 +222,10 @@
|
|||||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Page Include="View\CurveTemp.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="View\CurveDiagram.xaml">
|
<Page Include="View\CurveDiagram.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.CurveTemp"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View"
|
||||||
|
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
|
||||||
|
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
|
||||||
|
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance Type=viewmodel:CurveTempModel}"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="400">
|
||||||
|
<Grid>
|
||||||
|
<lvc:CartesianChart x:Name="OscChart" EasingFunction="{x:Null}" ZoomMode="X"
|
||||||
|
Series="{Binding Series}" YAxes="{Binding YAxes}" XAxes="{Binding XAxes}" Margin="0,0,0,0"/>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
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;
|
||||||
|
|
||||||
|
namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// CurveDiagram.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class CurveTemp : UserControl
|
||||||
|
{
|
||||||
|
public static DataTable dataTable;
|
||||||
|
public CurveTemp(DataTable db)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
dataTable = db;
|
||||||
|
|
||||||
|
DataContext = new CurveTempModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
d:DesignHeight="900" d:DesignWidth="1100">
|
d:DesignHeight="900" d:DesignWidth="1100">
|
||||||
<Grid Background="White" Cursor="">
|
<Grid Background="White" Cursor="">
|
||||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,30,10,0" x:Name="comboBoxWorkOrder" VerticalAlignment="Top" Width="270"
|
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,30,10,0" x:Name="comboBoxWorkOrder" VerticalAlignment="Top" Width="270"
|
||||||
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxMachine_DropDownClosed" />
|
FontSize="15" IsEditable="True" BorderBrush="#FF673AB7" DropDownClosed="comboBoxMachine_DropDownClosed" KeyDown="comboBoxWorkOrder_KeyDown"/>
|
||||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}"
|
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,30,280,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.orders}"
|
||||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,80,10,0" x:Name="comboBoxDyelot" VerticalAlignment="Top" Width="270"
|
<ComboBox HorizontalAlignment="Left" Height="30" Margin="140,80,10,0" x:Name="comboBoxDyelot" VerticalAlignment="Top" Width="270"
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
GridLinesVisibility="All" ColumnHeaderHeight="40" MouseDoubleClick="Grid_data_MouseDoubleClick"
|
GridLinesVisibility="All" ColumnHeaderHeight="40" MouseDoubleClick="Grid_data_MouseDoubleClick"
|
||||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
|
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
|
||||||
Margin="0,100,10,60" Width="600" HorizontalAlignment="Right" >
|
Margin="0,100,10,60" Width="600" HorizontalAlignment="Right" BorderBrush="#FFC9C9C9" FontSize="16" BorderThickness="5,5,5,5" >
|
||||||
<DataGrid.RowStyle >
|
<DataGrid.RowStyle >
|
||||||
<Style TargetType="{x:Type DataGridRow}">
|
<Style TargetType="{x:Type DataGridRow}">
|
||||||
<Setter Property="Height" Value="25" />
|
<Setter Property="Height" Value="25" />
|
||||||
@@ -97,6 +97,7 @@
|
|||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<MenuItem Header="{x:Static lang:Resources.edit}" Click="MenuItem_edit"/>
|
<MenuItem Header="{x:Static lang:Resources.edit}" Click="MenuItem_edit"/>
|
||||||
<MenuItem Header="{x:Static lang:Resources.Insert}" Click="MenuItem_Insert"/>
|
<MenuItem Header="{x:Static lang:Resources.Insert}" Click="MenuItem_Insert"/>
|
||||||
|
<MenuItem Header="{x:Static lang:Resources.Delete}" Click="MenuItem_Delete"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</DataGrid.ContextMenu>
|
</DataGrid.ContextMenu>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
@@ -120,10 +121,13 @@
|
|||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
||||||
|
|
||||||
<Button x:Name="Save" Content="{x:Static lang:Resources.Save}" HorizontalAlignment="Right" Height="35" Margin="450,0,50,10" VerticalAlignment="Bottom" Width="80" Click="Button_Click"/>
|
<Button x:Name="Save" Content="{x:Static lang:Resources.Save}" HorizontalAlignment="Right" Height="35" Margin="450,0,50,10" VerticalAlignment="Bottom" Width="80" Click="Button_Click"/>
|
||||||
<Button HorizontalAlignment="Left" Height="35" Margin="0,0,50,10" VerticalAlignment="Bottom" Width="60" Click="Button_Quit" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{x:Null}">
|
<Button HorizontalAlignment="Left" Height="35" Margin="0,0,50,10" VerticalAlignment="Bottom" Width="60" Click="Button_Quit" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{x:Null}">
|
||||||
<materialDesign:PackIcon Kind="ArrowRight" Foreground="#FF00204E" HorizontalAlignment="Center" VerticalAlignment="Center" Width="50" Height="35" />
|
<materialDesign:PackIcon Kind="ArrowRight" Foreground="#FF00204E" HorizontalAlignment="Center" VerticalAlignment="Center" Width="50" Height="35" />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Grid Background="White" Margin="10,500,300,60" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="250" Width="400">
|
||||||
|
<ContentControl x:Name="Picture"/>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
+119
-47
@@ -37,6 +37,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
DataTable ProgramName = new DataTable();
|
DataTable ProgramName = new DataTable();
|
||||||
DataTable WorkOrder =new DataTable();
|
DataTable WorkOrder =new DataTable();
|
||||||
DataTable dat = new DataTable();
|
DataTable dat = new DataTable();
|
||||||
|
DataTable TEMPTable = new DataTable();
|
||||||
public string WorkOrder_n;
|
public string WorkOrder_n;
|
||||||
public DyeingPlanView()
|
public DyeingPlanView()
|
||||||
{
|
{
|
||||||
@@ -48,6 +49,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
|
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
|
||||||
comboBoxProgram.ItemsSource = ProgramName.AsEnumerable().Select(rowdata => rowdata.Field<string>("ProgramName")).ToList();//转换工艺代码
|
comboBoxProgram.ItemsSource = ProgramName.AsEnumerable().Select(rowdata => rowdata.Field<string>("ProgramName")).ToList();//转换工艺代码
|
||||||
TEXTUSER.Text = MainWindow.user_;
|
TEXTUSER.Text = MainWindow.user_;
|
||||||
|
|
||||||
|
TEMPTable.Columns.Add("Time", Type.GetType("System.String"));
|
||||||
|
TEMPTable.Columns.Add("MST", Type.GetType("System.Double"));
|
||||||
}
|
}
|
||||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -80,7 +84,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
comboBoxDyelot.IsEnabled = false;
|
comboBoxDyelot.IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string color_ = "#FF336FA8";
|
string color_ = "#FF336FA8";
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)//保存按钮
|
private void Button_Click(object sender, RoutedEventArgs e)//保存按钮
|
||||||
{
|
{
|
||||||
@@ -216,7 +219,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
{
|
{
|
||||||
this.Visibility = Visibility.Collapsed;
|
this.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DatSteps(DataTable db)//行号刷新
|
public void DatSteps(DataTable db)//行号刷新
|
||||||
{
|
{
|
||||||
int a = db.Rows.Count;
|
int a = db.Rows.Count;
|
||||||
@@ -271,32 +273,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
}//插入工单不为空时载入细节信息
|
}//插入工单不为空时载入细节信息
|
||||||
SQLiteHelpers.Close(); //关闭连接
|
SQLiteHelpers.Close(); //关闭连接
|
||||||
DatSteps(dat);
|
DatSteps(dat);
|
||||||
Grid_data.ItemsSource = dat.DefaultView;//显示
|
Grid_data.ItemsSource = dat.DefaultView;
|
||||||
|
|
||||||
|
TEMP();
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
}//工艺修改事件
|
}//工艺修改事件
|
||||||
|
|
||||||
private void color_color_MouseDoubleClick(object sender, MouseButtonEventArgs e)//颜色
|
|
||||||
{
|
|
||||||
System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog();//使用调色盘控件ColorDialog
|
|
||||||
if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)//打开调色盘
|
|
||||||
{
|
|
||||||
|
|
||||||
System.Drawing.Color DColor = colorDialog.Color;////获取选中色彩信息
|
|
||||||
//System.Windows.Media.Color MColor = new System.Windows.Media.Color();//转换
|
|
||||||
System.Windows.Media.Color MColor = System.Windows.Media.Color.FromArgb(DColor.A, DColor.R, DColor.G, DColor.B);//转换并配置ARGB参数
|
|
||||||
// color_color.Background = new SolidColorBrush(MColor);//ARGB参数输出至Color的背景色
|
|
||||||
//string colorCode = string.Format("{0:X2}", DColor.B) + string.Format("{0:X2}", DColor.G) + string.Format("{0:X2}", DColor.R);//反向十六进制RGB
|
|
||||||
//string colorCode = string.Format("{0:X2}", DColor.R) + string.Format("{0:X2}", DColor.G) + string.Format("{0:X2}", DColor.B);//正向十六进制RGB
|
|
||||||
//ColorCode_SQL = Convert.ToInt32(colorCode, 16);//十六进制RGB转存储数值
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//string ProgramID;
|
|
||||||
//string ProgramNAME;
|
|
||||||
string Numder = null;
|
string Numder = null;
|
||||||
string ID = null;
|
string ID = null;
|
||||||
string P1, P2, P3, P4, P5;
|
string P1, P2, P3, P4, P5;
|
||||||
@@ -327,7 +312,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
if (rownum != -1)//判断鼠标定位是否有效
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
{
|
{
|
||||||
ID = (Grid_data.Columns[2].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第0列,
|
ID = (Grid_data.Columns[2].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位列,
|
||||||
|
|
||||||
int d = 0;
|
int d = 0;
|
||||||
if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
|
if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
|
||||||
@@ -338,18 +323,28 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
dr["Program"] = ProgramNAME;
|
dr["Program"] = ProgramNAME;
|
||||||
dat.Rows.InsertAt(dr, d - 1);
|
dat.Rows.InsertAt(dr, d - 1);
|
||||||
|
|
||||||
Dat();
|
DatSteps(dat);
|
||||||
Grid_data.ItemsSource = dat.DefaultView;
|
Grid_data.ItemsSource = dat.DefaultView;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
|
||||||
if (ID == null) ID = dat.Rows.Count.ToString();
|
if (ID == null) ID = dat.Rows.Count.ToString();
|
||||||
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5);
|
ViewStep viewstop = new ViewStep(null, null, null, null, null, null);
|
||||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||||
viewstop.data = ID;
|
viewstop.data = ID;
|
||||||
viewstop.ShowDialog();
|
viewstop.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void MenuItem_Delete(object sender, RoutedEventArgs e)//右键删除
|
||||||
|
{
|
||||||
|
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||||
|
{
|
||||||
|
ID = (Grid_data.Columns[2].GetCellContent(Grid_data.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||||
|
dat.Rows.RemoveAt( Convert.ToInt32(ID)-1);
|
||||||
|
|
||||||
|
DatSteps(dat);
|
||||||
|
Grid_data.ItemsSource = dat.DefaultView;
|
||||||
|
}
|
||||||
|
}
|
||||||
private void Grid_data_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
private void Grid_data_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
||||||
@@ -375,32 +370,109 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
{
|
{
|
||||||
int i = dat.Rows.Count;
|
int i = dat.Rows.Count;
|
||||||
int n = StrToInt.To16Convert10(ID);
|
int n = StrToInt.To16Convert10(ID);
|
||||||
|
if (e.Mode)
|
||||||
DataRow dr = dat.Rows[n - 1];
|
|
||||||
dr.BeginEdit();
|
|
||||||
dr["StepID"] = e.StepID;
|
|
||||||
dr["StepName"] = e.StepNAME;
|
|
||||||
dr["ParameterName"] = e.PNAME;
|
|
||||||
dr["Parameter1"] = e.P1;
|
|
||||||
dr["Parameter2"] = e.P2;
|
|
||||||
dr["Parameter3"] = e.P3;
|
|
||||||
dr["Parameter4"] = e.P4;
|
|
||||||
dr["Parameter5"] = e.P5;
|
|
||||||
dr.EndEdit();
|
|
||||||
|
|
||||||
Grid_data.ItemsSource = dat.DefaultView;
|
|
||||||
}
|
|
||||||
public void Dat()//行号刷新
|
|
||||||
{
|
|
||||||
int a = dat.Rows.Count;
|
|
||||||
for (int i = 0; i < a; i++)
|
|
||||||
{
|
{
|
||||||
DataRow dr = dat.Rows[i];
|
DataRow dr = dat.Rows[n - 1];
|
||||||
dr.BeginEdit();
|
dr.BeginEdit();
|
||||||
dr["Step"] = i + 1;
|
dr["StepID"] = e.StepID;
|
||||||
|
dr["StepName"] = e.StepNAME;
|
||||||
|
dr["ParameterName"] = e.PNAME;
|
||||||
|
dr["Parameter1"] = e.P1;
|
||||||
|
dr["Parameter2"] = e.P2;
|
||||||
|
dr["Parameter3"] = e.P3;
|
||||||
|
dr["Parameter4"] = e.P4;
|
||||||
|
dr["Parameter5"] = e.P5;
|
||||||
dr.EndEdit();
|
dr.EndEdit();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dat.Rows.RemoveAt(Convert.ToInt32(ID) - 1);
|
||||||
|
DatSteps(dat);
|
||||||
|
}
|
||||||
|
Grid_data.ItemsSource = dat.DefaultView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TEMP()
|
||||||
|
{
|
||||||
|
//处理计划温度图表
|
||||||
|
TEMPTable.Clear();
|
||||||
|
DataRow nrow = TEMPTable.NewRow();
|
||||||
|
string TIMET = "00:00:00";
|
||||||
|
Double MSTT = 30.0;
|
||||||
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
|
for (int i = 0; i < dat.Rows.Count; i++)
|
||||||
|
{
|
||||||
|
switch (dat.Rows[i][3].ToString())//步骤用时计算
|
||||||
|
{
|
||||||
|
case "001":
|
||||||
|
Double TT = MSTT;
|
||||||
|
Double TC;
|
||||||
|
TC = (Double)dat.Rows[i][7];
|
||||||
|
if (TC > 9.9 || TC < 0.1) TC = 9.9;//计算限制
|
||||||
|
MSTT = (Double)dat.Rows[i][6];
|
||||||
|
TT = Math.Abs(MSTT - TT) / TC * 60;
|
||||||
|
TIMET = Convert.ToDateTime(TIMET).AddSeconds(TT).ToString("HH:mm:ss");
|
||||||
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes((Double)dat.Rows[i][8]).ToString("HH:mm:ss");
|
||||||
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
|
break;
|
||||||
|
case "007":
|
||||||
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(5).ToString("HH:mm:ss");
|
||||||
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
|
break;
|
||||||
|
case "008":
|
||||||
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(5).ToString("HH:mm:ss");
|
||||||
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
|
break;
|
||||||
|
case "013":
|
||||||
|
break;
|
||||||
|
case "015":
|
||||||
|
break;
|
||||||
|
case "017":
|
||||||
|
break;
|
||||||
|
case "020":
|
||||||
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(5).ToString("HH:mm:ss");
|
||||||
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
|
break;
|
||||||
|
case "022":
|
||||||
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes(5).ToString("HH:mm:ss");
|
||||||
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
|
break;
|
||||||
|
case "031":
|
||||||
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][6]).ToString("HH:mm:ss");
|
||||||
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
|
break;
|
||||||
|
case "065":
|
||||||
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][8]).ToString("HH:mm:ss");
|
||||||
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
|
break;
|
||||||
|
case "091":
|
||||||
|
break;
|
||||||
|
case "093":
|
||||||
|
TIMET = Convert.ToDateTime(TIMET).AddMinutes((int)dat.Rows[i][6]).ToString("HH:mm:ss");
|
||||||
|
TEMPTable.Rows.Add(new object[] { TIMET, MSTT });
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Picture.Content = new View.CurveTemp(TEMPTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void comboBoxWorkOrder_KeyDown(object sender, KeyEventArgs e)//工单输入
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Enter)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//do what you want
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Tb_KeyTEXTClothWeight(object sender, TextCompositionEventArgs e)//输入事件
|
private void Tb_KeyTEXTClothWeight(object sender, TextCompositionEventArgs e)//输入事件
|
||||||
{
|
{
|
||||||
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
|
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
|
||||||
|
|||||||
@@ -218,7 +218,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
steptime = 300;
|
steptime = 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DataRow dr = sql.Tables[0].Rows[n - 1];
|
DataRow dr = sql.Tables[0].Rows[n - 1];
|
||||||
dr.BeginEdit();
|
dr.BeginEdit();
|
||||||
dr["StepID"] = e.StepID;
|
dr["StepID"] = e.StepID;
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
using LiveChartsCore.SkiaSharpView;
|
||||||
|
using LiveChartsCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
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;
|
||||||
|
using LiveChartsCore.Defaults;
|
||||||
|
using static System.Net.WebRequestMethods;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using DyeingComputer.Properties;
|
||||||
|
using LiveChartsCore.Measure;
|
||||||
|
using LiveChartsCore.Motion;
|
||||||
|
using SunlightCentralizedControlManagement_SCCM_.Properties;
|
||||||
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||||
|
using TouchSocket.Core;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Windows;
|
||||||
|
using SunlightCentralizedControlManagement_SCCM_.View;
|
||||||
|
|
||||||
|
namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||||
|
{
|
||||||
|
public partial class CurveTempModel : ObservableObject//ViewModelBase
|
||||||
|
{
|
||||||
|
public static ISeries[] Series { get; set; }
|
||||||
|
public static ObservableCollection<ObservableValue> ObservableValues { get; set; }
|
||||||
|
//x轴时间格式
|
||||||
|
public Axis[] XAxes { get; set; } =
|
||||||
|
{
|
||||||
|
new DateTimeAxis(TimeSpan.FromSeconds(5) , date => date.ToString("HH:mm"))
|
||||||
|
{
|
||||||
|
CrosshairLabelsBackground = SKColors.DarkGray.AsLvcColor(),
|
||||||
|
CrosshairLabelsPaint = new SolidColorPaint(SKColors.DarkSlateBlue, 1),
|
||||||
|
CrosshairPaint = new SolidColorPaint(SKColors.DarkSlateGray, 1),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
//颜色
|
||||||
|
private static readonly SKColor s_blue = new SKColor(25, 118, 210);
|
||||||
|
private static readonly SKColor s_blue_0 = new SKColor(25, 18, 210);
|
||||||
|
private static readonly SKColor s_blue_1 = new SKColor(25, 118, 170);
|
||||||
|
private static readonly SKColor s_blue_2 = new SKColor(25, 118, 130);
|
||||||
|
private static readonly SKColor s_blue_3 = new SKColor(25, 118, 90);
|
||||||
|
private static readonly SKColor s_blue_4 = new SKColor(25, 118, 50);
|
||||||
|
private static readonly SKColor s_red = new SKColor(229, 57, 53);
|
||||||
|
private static readonly SKColor s_red_1 = new SKColor(189, 57, 53);
|
||||||
|
private static readonly SKColor s_red_2 = new SKColor(149, 57, 53);
|
||||||
|
private static readonly SKColor s_red_3 = new SKColor(109, 57, 53);
|
||||||
|
private static readonly SKColor s_yellow = new SKColor(198, 167, 0);
|
||||||
|
public ICartesianAxis[] YAxes { get; set; } ={
|
||||||
|
new Axis //y在此轴上缩放
|
||||||
|
{
|
||||||
|
MinLimit =0,
|
||||||
|
MaxLimit =160,
|
||||||
|
Name = Properties.Resources.Temperature +" ( °C )",
|
||||||
|
NameTextSize = 15,
|
||||||
|
NamePaint = new SolidColorPaint(s_blue),
|
||||||
|
NamePadding = new LiveChartsCore.Drawing.Padding(0, 20),
|
||||||
|
Padding = new LiveChartsCore.Drawing.Padding(0, 0, 20, 0),
|
||||||
|
TextSize = 12,
|
||||||
|
LabelsPaint = new SolidColorPaint(s_blue),
|
||||||
|
TicksPaint = new SolidColorPaint(s_blue),
|
||||||
|
SubticksPaint = new SolidColorPaint(s_blue),
|
||||||
|
DrawTicksPath = true,
|
||||||
|
CrosshairSnapEnabled = true,
|
||||||
|
Position = LiveChartsCore.Measure.AxisPosition.Start
|
||||||
|
},//温度轴
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
private static Random _r = new Random();
|
||||||
|
private static ObservableCollection<DateTimePoint> MST_values;
|
||||||
|
static DataTable CDB = new DataTable();
|
||||||
|
private static int CDB_Count;//长度
|
||||||
|
|
||||||
|
public CurveTempModel()
|
||||||
|
{
|
||||||
|
CDB = View.CurveTemp.dataTable;
|
||||||
|
Curve();
|
||||||
|
}
|
||||||
|
public static void Curve()
|
||||||
|
{
|
||||||
|
CDB_Count = CDB.Rows.Count;
|
||||||
|
var MTT_items = new List<DateTimePoint>();
|
||||||
|
var MTL_items = new List<DateTimePoint>();
|
||||||
|
var MTH_items = new List<DateTimePoint>();
|
||||||
|
var MST_items = new List<DateTimePoint>();
|
||||||
|
var MUT_items = new List<DateTimePoint>();
|
||||||
|
var STTA_items = new List<DateTimePoint>();
|
||||||
|
var STLA_items = new List<DateTimePoint>();
|
||||||
|
var STTB_items = new List<DateTimePoint>();
|
||||||
|
var STLB_items = new List<DateTimePoint>();
|
||||||
|
var STTC_items = new List<DateTimePoint>();
|
||||||
|
var STLC_items = new List<DateTimePoint>();
|
||||||
|
for (var i = 0; i < CDB_Count; i++)
|
||||||
|
{
|
||||||
|
DateTime TIME = Convert.ToDateTime(CDB.Rows[i].Field<string>("Time"));
|
||||||
|
MST_items.Add(new DateTimePoint(TIME, CDB.Rows[i].Field<double>("MST")));
|
||||||
|
}
|
||||||
|
|
||||||
|
MST_values = new ObservableCollection<DateTimePoint>(MST_items);
|
||||||
|
|
||||||
|
Series = new ISeries[]
|
||||||
|
{
|
||||||
|
|
||||||
|
new LineSeries<DateTimePoint>
|
||||||
|
{
|
||||||
|
Name = Resources.Target + Resources.Temperature,
|
||||||
|
Values = MST_values,
|
||||||
|
Stroke = new SolidColorPaint(s_blue_0, 2),
|
||||||
|
GeometrySize = 0,
|
||||||
|
GeometryStroke = new SolidColorPaint(s_blue_0, 2),
|
||||||
|
Fill = null,
|
||||||
|
LineSmoothness = 0,
|
||||||
|
ScalesYAt = 0,
|
||||||
|
}, //目标温度
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,6 +29,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
|||||||
return ServiceLocator.Current.GetInstance<CurveDiagramViewModel>();
|
return ServiceLocator.Current.GetInstance<CurveDiagramViewModel>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public CurveTempModel CurveT
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ServiceLocator.Current.GetInstance<CurveTempModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
SQLiteHelpers.Open(); //打开数据库
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Delete("USER", "Name='" + name + "'", null);
|
SQLiteHelpers.Delete("USER", "Name='" + name + "'", null);
|
||||||
SQLiteHelpers.InsertData("USER", USER_new);// 执行插入
|
SQLiteHelpers.InsertData("USER", USER_new);// 执行插入
|
||||||
|
DataGriduser.ItemsSource = SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0].DefaultView;
|
||||||
SQLiteHelpers.Close();
|
SQLiteHelpers.Close();
|
||||||
|
_Name.Text = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
|
private void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
|
||||||
@@ -117,7 +119,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
SQLiteHelpers = new UserClass.SqliteHelper.SQLiteHelper(DBAddress); //数据库连接路径
|
SQLiteHelpers = new UserClass.SqliteHelper.SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
SQLiteHelpers.Open(); //打开数据库
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
SQLiteHelpers.Delete("USER", "Name='" + _Name.Text + "'", null);
|
SQLiteHelpers.Delete("USER", "Name='" + _Name.Text + "'", null);
|
||||||
|
DataGriduser.ItemsSource = SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0].DefaultView;
|
||||||
SQLiteHelpers.Close();
|
SQLiteHelpers.Close();
|
||||||
|
_Name.Text = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||||
{
|
{
|
||||||
@@ -30,6 +31,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
public delegate void AddressUpdateHandler(object sender, AddressUpdateEventArgs e);
|
public delegate void AddressUpdateHandler(object sender, AddressUpdateEventArgs e);
|
||||||
//声明一个更新Address的事件
|
//声明一个更新Address的事件
|
||||||
public event AddressUpdateHandler AddressUpdated;
|
public event AddressUpdateHandler AddressUpdated;
|
||||||
|
bool m = false;
|
||||||
|
|
||||||
public ViewStep(string Numder ,string P1D,string P2D,string P3D,string P4D,string P5D)
|
public ViewStep(string Numder ,string P1D,string P2D,string P3D,string P4D,string P5D)
|
||||||
{
|
{
|
||||||
@@ -38,6 +40,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
Form1_Load();
|
Form1_Load();
|
||||||
// FocusManager.SetFocusedElement(boxNAME, boxNAME);
|
// FocusManager.SetFocusedElement(boxNAME, boxNAME);
|
||||||
boxNAME.Focus();
|
boxNAME.Focus();
|
||||||
|
if(!String.IsNullOrEmpty(Numder))m= true;
|
||||||
boxNAME.Text = Numder;
|
boxNAME.Text = Numder;
|
||||||
|
|
||||||
P1.Text = P1D;
|
P1.Text = P1D;
|
||||||
@@ -200,14 +203,22 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
if (P4N.Visibility == Visibility.Visible) name += P4N.Text + ":[" + P4.Text + "]";
|
if (P4N.Visibility == Visibility.Visible) name += P4N.Text + ":[" + P4.Text + "]";
|
||||||
if (P5N.Visibility == Visibility.Visible) name += P5N.Text + ":[" + P5.Text + "]";
|
if (P5N.Visibility == Visibility.Visible) name += P5N.Text + ":[" + P5.Text + "]";
|
||||||
|
|
||||||
var args = new AddressUpdateEventArgs(data, boxNAME.Text, boxID.Text, name.ToString(), P1.Text, P2.Text, P3.Text, P4.Text, P5.Text);
|
var args = new AddressUpdateEventArgs(true,data, boxNAME.Text, boxID.Text, name.ToString(), P1.Text, P2.Text, P3.Text, P4.Text, P5.Text);
|
||||||
AddressUpdated(this, args);
|
AddressUpdated(this, args);
|
||||||
this.Close(); //关闭窗口
|
this.Close(); //关闭窗口
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NO_Click(object sender, RoutedEventArgs e)//关闭
|
private void NO_Click(object sender, RoutedEventArgs e)//关闭
|
||||||
{
|
{
|
||||||
this.Close(); //关闭窗口
|
if (m)
|
||||||
|
{ this.Close(); }
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string name = " ";
|
||||||
|
var args = new AddressUpdateEventArgs(false, data, boxNAME.Text, boxID.Text, name.ToString(), P1.Text, P2.Text, P3.Text, P4.Text, P5.Text);
|
||||||
|
AddressUpdated(this, args);
|
||||||
|
this.Close(); //关闭窗口
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Set(int a) //参数显示
|
private void Set(int a) //参数显示
|
||||||
@@ -527,8 +538,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
|
|
||||||
public class AddressUpdateEventArgs : System.EventArgs
|
public class AddressUpdateEventArgs : System.EventArgs
|
||||||
{
|
{
|
||||||
public AddressUpdateEventArgs(string dStep, string dStepID, string dStepNAME, string dPNAME, string dP1, string dP2, string dP3, string dP4, string dP5)
|
public AddressUpdateEventArgs(bool M, string dStep, string dStepID, string dStepNAME, string dPNAME, string dP1, string dP2, string dP3, string dP4, string dP5)
|
||||||
{
|
{
|
||||||
|
this.Mode = M;
|
||||||
this.StepID = dStepID;
|
this.StepID = dStepID;
|
||||||
this.Step = dStep;
|
this.Step = dStep;
|
||||||
this.StepNAME = dStepNAME;
|
this.StepNAME = dStepNAME;
|
||||||
@@ -540,6 +552,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
this.P5 = dP5;
|
this.P5 = dP5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Mode { get; set; }
|
||||||
public string Step { get; set; }
|
public string Step { get; set; }
|
||||||
public string StepID { get; set; }
|
public string StepID { get; set; }
|
||||||
public string StepNAME { get; set; }
|
public string StepNAME { get; set; }
|
||||||
|
|||||||
Reference in new issue
Block a user