|
@ -1,8 +1,10 @@ |
|
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel; |
|
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel; |
|
|
|
|
|
using SunlightCentralizedControlManagement_SCCM_.WindowsView; |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Data; |
|
|
using System.Data; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
|
|
|
using System.Net; |
|
|
using System.Text; |
|
|
using System.Text; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using System.Windows; |
|
|
using System.Windows; |
|
@ -18,6 +20,7 @@ using System.Windows.Threading; |
|
|
using System.Xml.Linq; |
|
|
using System.Xml.Linq; |
|
|
using TouchSocket.Core; |
|
|
using TouchSocket.Core; |
|
|
using TouchSocket.Sockets; |
|
|
using TouchSocket.Sockets; |
|
|
|
|
|
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep; |
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar; |
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar; |
|
|
|
|
|
|
|
|
namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
namespace SunlightCentralizedControlManagement_SCCM_.View |
|
@ -58,10 +61,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
|
|
|
|
|
|
private void Gridstep_SelectionChanged(object sender, SelectionChangedEventArgs e) |
|
|
private void Gridstep_SelectionChanged(object sender, SelectionChangedEventArgs e) |
|
|
{ |
|
|
{ |
|
|
Insert.IsEnabled = true; |
|
|
int rownum = Gridstep.SelectedIndex;//获取鼠标选中行并定义变量
|
|
|
edit.IsEnabled = true; |
|
|
if (rownum != -1)//判断鼠标定位是否有效
|
|
|
|
|
|
{ |
|
|
|
|
|
ID = (Gridstep.Columns[2].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第0列,
|
|
|
|
|
|
Numder = (Gridstep.Columns[3].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第1列,
|
|
|
|
|
|
P1 = (Gridstep.Columns[6].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第6列,
|
|
|
|
|
|
P2 = (Gridstep.Columns[7].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第7列,
|
|
|
|
|
|
P3 = (Gridstep.Columns[8].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第8列,
|
|
|
|
|
|
P4 = (Gridstep.Columns[9].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第9列,
|
|
|
|
|
|
P5 = (Gridstep.Columns[10].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第10列,
|
|
|
|
|
|
} |
|
|
Paused.IsEnabled = true; |
|
|
Paused.IsEnabled = true; |
|
|
Resume.IsEnabled = true; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void ListViewItem_DyeingMachine(object sender, MouseButtonEventArgs e) |
|
|
private void ListViewItem_DyeingMachine(object sender, MouseButtonEventArgs e) |
|
@ -106,6 +117,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString()); |
|
|
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString()); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
Insert.IsEnabled = true; |
|
|
|
|
|
edit.IsEnabled = true; |
|
|
|
|
|
Paused.IsEnabled = true; |
|
|
|
|
|
Resume.IsEnabled = true; |
|
|
}//暂停
|
|
|
}//暂停
|
|
|
private void ListViewItem_Stop(object sender, MouseButtonEventArgs e) |
|
|
private void ListViewItem_Stop(object sender, MouseButtonEventArgs e) |
|
|
{ |
|
|
{ |
|
@ -121,15 +136,47 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
}//停止
|
|
|
}//停止
|
|
|
private void ListViewItem_edit(object sender, MouseButtonEventArgs e) |
|
|
private void ListViewItem_edit(object sender, MouseButtonEventArgs e) |
|
|
{ |
|
|
{ |
|
|
|
|
|
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } |
|
|
|
|
|
if (ID == null) ID = TechnologicalProcess.Rows.Count.ToString(); |
|
|
|
|
|
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5); |
|
|
|
|
|
viewstop.data = ID; |
|
|
|
|
|
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); |
|
|
|
|
|
viewstop.ShowDialog(); |
|
|
}//编辑
|
|
|
}//编辑
|
|
|
|
|
|
string Numder = null; |
|
|
|
|
|
string ID = null; |
|
|
|
|
|
string P1 = "0", P2 = "0", P3 = "0", P4 = "0", P5 = "0"; |
|
|
|
|
|
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
|
|
|
|
|
{ |
|
|
|
|
|
Dictionary<string, object> dat_821 = new Dictionary<string, object>(); |
|
|
|
|
|
dat_821.Clear(); |
|
|
|
|
|
dat_821.Add("INSTRUCTION", "EDIT"); |
|
|
|
|
|
dat_821.Add("StepID", e.StepID); |
|
|
|
|
|
dat_821.Add("StepName", e.StepNAME); |
|
|
|
|
|
dat_821.Add("ParameterName", e.PNAME); |
|
|
|
|
|
dat_821.Add("Parameter1", e.P1); |
|
|
|
|
|
dat_821.Add("Parameter2", e.P2); |
|
|
|
|
|
dat_821.Add("Parameter3", e.P3); |
|
|
|
|
|
dat_821.Add("Parameter4", e.P4); |
|
|
|
|
|
dat_821.Add("Parameter5", e.P5); |
|
|
|
|
|
dat_821.Add("ID", ID); |
|
|
|
|
|
|
|
|
|
|
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First(); |
|
|
|
|
|
int index = Convert.ToInt16(drEmployee.Field<object>("ID")); |
|
|
|
|
|
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index) + dat_821.ToJsonString()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void ListViewItem_Jump(object sender, MouseButtonEventArgs e) |
|
|
private void ListViewItem_Jump(object sender, MouseButtonEventArgs e) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
}//跳步
|
|
|
}//跳步
|
|
|
private void ListViewItem_Insert(object sender, MouseButtonEventArgs e) |
|
|
private void ListViewItem_Insert(object sender, MouseButtonEventArgs e) |
|
|
{ |
|
|
{ |
|
|
|
|
|
if (ID == null) ID = (TechnologicalProcess.Rows.Count-1).ToString(); |
|
|
|
|
|
ViewStep viewstop = new ViewStep(null, "0", "0", "0", "0", "0"); |
|
|
|
|
|
viewstop.data = ID; |
|
|
|
|
|
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); |
|
|
|
|
|
viewstop.ShowDialog(); |
|
|
}//插入
|
|
|
}//插入
|
|
|
private void ListViewItem_Delete(object sender, MouseButtonEventArgs e) |
|
|
private void ListViewItem_Delete(object sender, MouseButtonEventArgs e) |
|
|
{ |
|
|
{ |
|
@ -183,9 +230,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC831" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index)); |
|
|
MainWindowViewModel.MachiensTcpClient[index].SendAsync("SC831" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", index)); |
|
|
if (TechnologicalProcess.Rows.Count > 0) |
|
|
if (TechnologicalProcess.Rows.Count > 0) |
|
|
{ |
|
|
{ |
|
|
Gridstep.ItemsSource = TechnologicalProcess.DefaultView; |
|
|
DataView dataView = TechnologicalProcess.DefaultView; |
|
|
|
|
|
if (Gridstep.ItemsSource != dataView) |
|
|
|
|
|
{ |
|
|
|
|
|
Gridstep.ItemsSource = dataView; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
Gridstep.ItemsSource = null; |
|
|
Gridstep.ItemsSource = null; |
|
|
} |
|
|
} |
|
|