任务计划修改增加图表
This commit is contained in:
1 parent
5e64b1a3cb
commit
6188bfb6ef
10 files changed
+352
-62
No files matched your search
@@ -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">
|
||||
<Grid Background="White" Cursor="">
|
||||
<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}"
|
||||
VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<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"
|
||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
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 >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Height" Value="25" />
|
||||
@@ -97,6 +97,7 @@
|
||||
<ContextMenu>
|
||||
<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.Delete}" Click="MenuItem_Delete"/>
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
<DataGrid.Columns>
|
||||
@@ -120,10 +121,13 @@
|
||||
</DataGrid.Columns>
|
||||
</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 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" />
|
||||
</Button>
|
||||
|
||||
<Grid Background="White" Margin="10,500,300,60" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="250" Width="400">
|
||||
<ContentControl x:Name="Picture"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
+125
-53
@@ -37,6 +37,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
DataTable ProgramName = new DataTable();
|
||||
DataTable WorkOrder =new DataTable();
|
||||
DataTable dat = new DataTable();
|
||||
DataTable TEMPTable = new DataTable();
|
||||
public string WorkOrder_n;
|
||||
public DyeingPlanView()
|
||||
{
|
||||
@@ -48,6 +49,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
comboBoxMachine.ItemsSource = MainWindowViewModel.Machines.AsEnumerable().Select(rowdata => rowdata.Field<string>("name")).ToList();//转换机台
|
||||
comboBoxProgram.ItemsSource = ProgramName.AsEnumerable().Select(rowdata => rowdata.Field<string>("ProgramName")).ToList();//转换工艺代码
|
||||
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)
|
||||
{
|
||||
@@ -80,7 +84,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
comboBoxDyelot.IsEnabled = false;
|
||||
}
|
||||
|
||||
|
||||
string color_ = "#FF336FA8";
|
||||
private void Button_Click(object sender, RoutedEventArgs e)//保存按钮
|
||||
{
|
||||
@@ -216,7 +219,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public void DatSteps(DataTable db)//行号刷新
|
||||
{
|
||||
int a = db.Rows.Count;
|
||||
@@ -248,9 +250,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
dat.Clear();
|
||||
string text = comboBoxProgram.Text;
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
string[] sArray = Regex.Split(text, @"\+", RegexOptions.IgnoreCase);
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
@@ -271,32 +273,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
}//插入工单不为空时载入细节信息
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
DatSteps(dat);
|
||||
Grid_data.ItemsSource = dat.DefaultView;//显示
|
||||
Grid_data.ItemsSource = dat.DefaultView;
|
||||
|
||||
TEMP();
|
||||
}
|
||||
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 ID = null;
|
||||
string P1, P2, P3, P4, P5;
|
||||
@@ -327,7 +312,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
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;
|
||||
if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
|
||||
@@ -338,18 +323,28 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
dr["Program"] = ProgramNAME;
|
||||
dat.Rows.InsertAt(dr, d - 1);
|
||||
|
||||
Dat();
|
||||
DatSteps(dat);
|
||||
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();
|
||||
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.data = ID;
|
||||
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)
|
||||
{
|
||||
int rownum = Grid_data.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
@@ -374,33 +369,110 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
||||
{
|
||||
int i = dat.Rows.Count;
|
||||
int n = StrToInt.To16Convert10(ID);
|
||||
|
||||
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++)
|
||||
int n = StrToInt.To16Convert10(ID);
|
||||
if (e.Mode)
|
||||
{
|
||||
DataRow dr = dat.Rows[i];
|
||||
DataRow dr = dat.Rows[n - 1];
|
||||
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();
|
||||
}
|
||||
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)//输入事件
|
||||
{
|
||||
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
|
||||
|
||||
@@ -217,8 +217,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
steptime = 300;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DataRow dr = sql.Tables[0].Rows[n - 1];
|
||||
dr.BeginEdit();
|
||||
dr["StepID"] = e.StepID;
|
||||
|
||||
Reference in new issue
Block a user