diff --git a/View/DyeingPlanView.xaml.cs b/View/DyeingPlanView.xaml.cs index 36ddbcf..a98b912 100644 --- a/View/DyeingPlanView.xaml.cs +++ b/View/DyeingPlanView.xaml.cs @@ -341,9 +341,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View DatSteps(dat); Grid_data.ItemsSource = dat.DefaultView; - + if (ID == null) ID = dat.Rows.Count.ToString(); - ViewStep viewstop = new ViewStep(null, null, null, null, null, null); + ViewStep viewstop = new ViewStep(null, "0", "0", "0", "0", "0"); viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked); viewstop.data = ID; viewstop.ShowDialog(); diff --git a/View/MonitorView.xaml b/View/MonitorView.xaml index 18d381f..7096876 100644 --- a/View/MonitorView.xaml +++ b/View/MonitorView.xaml @@ -97,7 +97,7 @@ - + + + + + + + diff --git a/View/MonitorView.xaml.cs b/View/MonitorView.xaml.cs index 54eff93..16155bb 100644 --- a/View/MonitorView.xaml.cs +++ b/View/MonitorView.xaml.cs @@ -256,10 +256,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View viewstop.data = ID; viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(edit_ButtonClicked); viewstop.ShowDialog(); - }//编辑 - string Numder = null; - string ID = null; - string P1 = "0", P2 = "0", P3 = "0", P4 = "0", P5 = "0"; + }//编辑 private void edit_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果 { @@ -360,6 +357,66 @@ namespace SunlightCentralizedControlManagement_SCCM_.View MainWindowViewModel.TechnologicalProcess_bool = true; } }//删除 + string Numder = null; + string ID = null; + string P1, P2, P3, P4, P5; + + private void MenuItem_edit(object sender, RoutedEventArgs e)//右键编辑 + { + int rownum = Gridstep.SelectedIndex;//获取鼠标选中行并定义变量 + 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列, + if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; } + ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5); + viewstop.data = ID; + viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(edit_ButtonClicked); + viewstop.ShowDialog(); + } + } + private void MenuItem_Insert(object sender, RoutedEventArgs e)//右键插入 + { + int rownum = Gridstep.SelectedIndex;//获取鼠标选中行并定义变量 + if (rownum != -1)//判断鼠标定位是否有效 + { + ID = (Gridstep.Columns[2].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位列, + + ViewStep viewstop = new ViewStep(null, "0", "0", "0", "0", "0"); + viewstop.data = ID; + viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Insert_ButtonClicked); + viewstop.ShowDialog(); + } + } + private void MenuItem_Delete(object sender, RoutedEventArgs e)//右键删除 + { + int rownum = Gridstep.SelectedIndex;//获取鼠标选中行并定义变量 + if (rownum != -1)//判断鼠标定位是否有效 + { + ID = (Gridstep.Columns[2].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第0列, + if (!string.IsNullOrEmpty(machine)) + { + Dictionary dat_821 = new Dictionary(); + dat_821.Clear(); + dat_821.Add("INSTRUCTION", "DELETE"); + dat_821.Add("ID", ID); + DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First(); + int index = Convert.ToInt16(drEmployee.Field("ID")); + MainWindowViewModel.stringQueue.Enqueue(new MainWindowViewModel.QueueString + { + ID = index, + DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString() + }); + + MainWindowViewModel.TechnologicalProcess_bool = true; + } + } + } public void CountDown() {