步骤编辑相关修改
This commit is contained in:
commit
4f9195c552
13 files changed
+2386
-307
No files matched your search
+39
-15
@@ -33,8 +33,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
/// ProductionPlanningEdit.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DyeingPlanView : UserControl
|
||||
{
|
||||
DataTable ProgramName = new DataTable();
|
||||
{
|
||||
DataTable ProgramName = new DataTable();
|
||||
DataTable WorkOrder =new DataTable();
|
||||
DataTable dat = new DataTable();
|
||||
DataTable TEMPTable = new DataTable();
|
||||
@@ -310,7 +310,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
|
||||
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(Numder, dat.Select("STEP = " + ID).First());
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
@@ -335,8 +335,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
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(null, "0", "0", "0", "0", "0");
|
||||
ViewStep viewstop = new ViewStep(Numder, dat.Select("STEP = " + ID).First());
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
@@ -369,7 +370,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
|
||||
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(Numder, dat.Select("STEP = " + ID).First());
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
@@ -377,27 +378,50 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
}
|
||||
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
||||
{
|
||||
int i = dat.Rows.Count;
|
||||
int n = StrToInt.To16Convert10(ID);
|
||||
if (e.Mode)
|
||||
int n = Convert.ToInt16(ID);
|
||||
ID = null;
|
||||
if (e.PNAME != "")
|
||||
{
|
||||
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["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter5"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter1_S1"] = e.Row_DAT.Field<double>("Parameter1_S1");
|
||||
dr["Parameter2_S1"] = e.Row_DAT.Field<double>("Parameter2_S1");
|
||||
dr["Parameter3_S1"] = e.Row_DAT.Field<double>("Parameter3_S1");
|
||||
dr["Parameter4_S1"] = e.Row_DAT.Field<double>("Parameter4_S1");
|
||||
dr["Parameter5_S1"] = e.Row_DAT.Field<double>("Parameter5_S1");
|
||||
dr["Parameter1_S2"] = e.Row_DAT.Field<double>("Parameter1_S2");
|
||||
dr["Parameter2_S2"] = e.Row_DAT.Field<double>("Parameter2_S2");
|
||||
dr["Parameter3_S2"] = e.Row_DAT.Field<double>("Parameter3_S2");
|
||||
dr["Parameter4_S2"] = e.Row_DAT.Field<double>("Parameter4_S2");
|
||||
dr["Parameter5_S2"] = e.Row_DAT.Field<double>("Parameter5_S2");
|
||||
dr["Parameter1_S3"] = e.Row_DAT.Field<double>("Parameter1_S3");
|
||||
dr["Parameter2_S3"] = e.Row_DAT.Field<double>("Parameter2_S3");
|
||||
dr["Parameter3_S3"] = e.Row_DAT.Field<double>("Parameter3_S3");
|
||||
dr["Parameter4_S3"] = e.Row_DAT.Field<double>("Parameter4_S3");
|
||||
dr["Parameter5_S3"] = e.Row_DAT.Field<double>("Parameter5_S3");
|
||||
dr["StepName_S1"] = e.Row_DAT.Field<string>("StepName_S1");
|
||||
dr["StepName_S2"] = e.Row_DAT.Field<string>("StepName_S2");
|
||||
dr["StepName_S3"] = e.Row_DAT.Field<string>("StepName_S3");
|
||||
dr["StepID_S1"] = e.Row_DAT.Field<string>("StepID_S1");
|
||||
dr["StepID_S2"] = e.Row_DAT.Field<string>("StepID_S2");
|
||||
dr["StepID_S3"] = e.Row_DAT.Field<string>("StepID_S3");
|
||||
dr.EndEdit();
|
||||
Grid_data.SelectedIndex = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dat.Rows.RemoveAt(Convert.ToInt32(ID) - 1);
|
||||
MainWindowViewModel.dt_TP.Rows.RemoveAt(n - 1);
|
||||
DatSteps(dat);
|
||||
}
|
||||
Grid_data.SelectedIndex = -1;
|
||||
}
|
||||
Grid_data.ItemsSource = dat.DefaultView;
|
||||
}
|
||||
private void TEMP()
|
||||
|
||||
+105
-32
@@ -362,26 +362,55 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
}//停止
|
||||
private void ListViewItem_edit(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
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;
|
||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||
if (ID == null) ID = MainWindowViewModel.dt_TP.Rows.Count.ToString();
|
||||
ViewStep viewstop = new ViewStep(Numder, MainWindowViewModel.dt_TP.Select("STEP = " + ID).First());
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(edit_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
}//编辑
|
||||
private void edit_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
||||
{
|
||||
|
||||
DataRow dataRow = MainWindowViewModel.dt_TP.NewRow();
|
||||
dataRow.BeginEdit();
|
||||
dataRow.ItemArray = e.Row_DAT.ItemArray;
|
||||
dataRow.EndEdit();
|
||||
MainWindowViewModel.dt_TP.Rows.InsertAt(dataRow, Convert.ToInt16(ID) - 1);
|
||||
DatSteps(MainWindowViewModel.dt_TP);
|
||||
TechnologicalProcess_View = ToObservableCollection<TechnologicalP>(MainWindowViewModel.dt_TP);
|
||||
|
||||
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("Parameter1", e.Row_DAT.Field<double>("Parameter1"));
|
||||
dat_821.Add("Parameter2", e.Row_DAT.Field<double>("Parameter2"));
|
||||
dat_821.Add("Parameter3", e.Row_DAT.Field<double>("Parameter3"));
|
||||
dat_821.Add("Parameter4", e.Row_DAT.Field<double>("Parameter4"));
|
||||
dat_821.Add("Parameter5", e.Row_DAT.Field<double>("Parameter5"));
|
||||
dat_821.Add("Parameter1_S1", e.Row_DAT.Field<double>("Parameter1_S1"));
|
||||
dat_821.Add("Parameter2_S1", e.Row_DAT.Field<double>("Parameter2_S1"));
|
||||
dat_821.Add("Parameter3_S1", e.Row_DAT.Field<double>("Parameter3_S1"));
|
||||
dat_821.Add("Parameter4_S1", e.Row_DAT.Field<double>("Parameter4_S1"));
|
||||
dat_821.Add("Parameter5_S1", e.Row_DAT.Field<double>("Parameter5_S1"));
|
||||
dat_821.Add("Parameter1_S2", e.Row_DAT.Field<double>("Parameter1_S2"));
|
||||
dat_821.Add("Parameter2_S2", e.Row_DAT.Field<double>("Parameter2_S2"));
|
||||
dat_821.Add("Parameter3_S2", e.Row_DAT.Field<double>("Parameter3_S2"));
|
||||
dat_821.Add("Parameter4_S2", e.Row_DAT.Field<double>("Parameter4_S2"));
|
||||
dat_821.Add("Parameter5_S2", e.Row_DAT.Field<double>("Parameter5_S2"));
|
||||
dat_821.Add("Parameter1_S3", e.Row_DAT.Field<double>("Parameter1_S3"));
|
||||
dat_821.Add("Parameter2_S3", e.Row_DAT.Field<double>("Parameter2_S3"));
|
||||
dat_821.Add("Parameter3_S3", e.Row_DAT.Field<double>("Parameter3_S3"));
|
||||
dat_821.Add("Parameter4_S3", e.Row_DAT.Field<double>("Parameter4_S3"));
|
||||
dat_821.Add("Parameter5_S3", e.Row_DAT.Field<double>("Parameter5_S3"));
|
||||
dat_821.Add("StepName_S1", e.Row_DAT.Field<string>("StepName_S1"));
|
||||
dat_821.Add("StepName_S2", e.Row_DAT.Field<string>("StepName_S2"));
|
||||
dat_821.Add("StepName_S3", e.Row_DAT.Field<string>("StepName_S3"));
|
||||
dat_821.Add("StepID_S1", e.Row_DAT.Field<string>("StepID_S1"));
|
||||
dat_821.Add("StepID_S2", e.Row_DAT.Field<string>("StepID_S2"));
|
||||
dat_821.Add("StepID_S3", e.Row_DAT.Field<string>("StepID_S3"));
|
||||
dat_821.Add("ID", ID);
|
||||
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
@@ -391,7 +420,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
ID = index,
|
||||
DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
||||
});
|
||||
|
||||
TechnologicalProcess_bool = true;
|
||||
}
|
||||
private void ListViewItem_Jump(object sender, MouseButtonEventArgs e)
|
||||
@@ -425,25 +453,55 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
}//跳步
|
||||
private void ListViewItem_Insert(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
ViewStep viewstop = new ViewStep(null, "0", "0", "0", "0", "0");
|
||||
viewstop.data = ID;
|
||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||
if (ID == null) ID = MainWindowViewModel.dt_TP.Rows.Count.ToString();
|
||||
ViewStep viewstop = new ViewStep(Numder, MainWindowViewModel.dt_TP.Select("STEP = " + ID).First());
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Insert_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
}//插入
|
||||
private void Insert_ButtonClicked(object sender, AddressUpdateEventArgs e)//cr返回结果
|
||||
private void Insert_ButtonClicked(object sender, AddressUpdateEventArgs e)//插入返回结果
|
||||
{
|
||||
TechnologicalProcess_bool = true;
|
||||
DataRow dataRow = MainWindowViewModel.dt_TP.NewRow();
|
||||
dataRow.BeginEdit();
|
||||
dataRow.ItemArray = e.Row_DAT.ItemArray;
|
||||
dataRow.EndEdit();
|
||||
MainWindowViewModel.dt_TP.Rows.InsertAt(dataRow, Convert.ToInt16( ID )- 1);
|
||||
DatSteps(MainWindowViewModel.dt_TP);
|
||||
TechnologicalProcess_View = ToObservableCollection<TechnologicalP>(MainWindowViewModel.dt_TP);
|
||||
|
||||
Dictionary<string, object> dat_821 = new Dictionary<string, object>();
|
||||
dat_821.Clear();
|
||||
dat_821.Add("INSTRUCTION", "INSERT");
|
||||
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("Parameter1", e.Row_DAT.Field<double>("Parameter1"));
|
||||
dat_821.Add("Parameter2", e.Row_DAT.Field<double>("Parameter2"));
|
||||
dat_821.Add("Parameter3", e.Row_DAT.Field<double>("Parameter3"));
|
||||
dat_821.Add("Parameter4", e.Row_DAT.Field<double>("Parameter4"));
|
||||
dat_821.Add("Parameter5", e.Row_DAT.Field<double>("Parameter5"));
|
||||
dat_821.Add("Parameter1_S1", e.Row_DAT.Field<double>("Parameter1_S1"));
|
||||
dat_821.Add("Parameter2_S1", e.Row_DAT.Field<double>("Parameter2_S1"));
|
||||
dat_821.Add("Parameter3_S1", e.Row_DAT.Field<double>("Parameter3_S1"));
|
||||
dat_821.Add("Parameter4_S1", e.Row_DAT.Field<double>("Parameter4_S1"));
|
||||
dat_821.Add("Parameter5_S1", e.Row_DAT.Field<double>("Parameter5_S1"));
|
||||
dat_821.Add("Parameter1_S2", e.Row_DAT.Field<double>("Parameter1_S2"));
|
||||
dat_821.Add("Parameter2_S2", e.Row_DAT.Field<double>("Parameter2_S2"));
|
||||
dat_821.Add("Parameter3_S2", e.Row_DAT.Field<double>("Parameter3_S2"));
|
||||
dat_821.Add("Parameter4_S2", e.Row_DAT.Field<double>("Parameter4_S2"));
|
||||
dat_821.Add("Parameter5_S2", e.Row_DAT.Field<double>("Parameter5_S2"));
|
||||
dat_821.Add("Parameter1_S3", e.Row_DAT.Field<double>("Parameter1_S3"));
|
||||
dat_821.Add("Parameter2_S3", e.Row_DAT.Field<double>("Parameter2_S3"));
|
||||
dat_821.Add("Parameter3_S3", e.Row_DAT.Field<double>("Parameter3_S3"));
|
||||
dat_821.Add("Parameter4_S3", e.Row_DAT.Field<double>("Parameter4_S3"));
|
||||
dat_821.Add("Parameter5_S3", e.Row_DAT.Field<double>("Parameter5_S3"));
|
||||
dat_821.Add("StepName_S1", e.Row_DAT.Field<string>("StepName_S1"));
|
||||
dat_821.Add("StepName_S2", e.Row_DAT.Field<string>("StepName_S2"));
|
||||
dat_821.Add("StepName_S3", e.Row_DAT.Field<string>("StepName_S3"));
|
||||
dat_821.Add("StepID_S1", e.Row_DAT.Field<string>("StepID_S1"));
|
||||
dat_821.Add("StepID_S2", e.Row_DAT.Field<string>("StepID_S2"));
|
||||
dat_821.Add("StepID_S3", e.Row_DAT.Field<string>("StepID_S3"));
|
||||
dat_821.Add("ID", ID);
|
||||
|
||||
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
|
||||
@@ -453,6 +511,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
ID = index,
|
||||
DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
||||
});
|
||||
|
||||
}
|
||||
private void ListViewItem_Delete(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
@@ -470,7 +529,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
||||
});
|
||||
|
||||
TechnologicalProcess_bool = true;
|
||||
MainWindowViewModel.dt_TP.Select("Step="+ID).First().Delete();
|
||||
MainWindowViewModel.dt_TP.AcceptChanges();
|
||||
DatSteps(MainWindowViewModel.dt_TP);
|
||||
TechnologicalProcess_View = ToObservableCollection<TechnologicalP>(MainWindowViewModel.dt_TP);
|
||||
}
|
||||
}//删除
|
||||
string Numder = null;
|
||||
@@ -484,15 +546,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
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;
|
||||
|
||||
if (ID == null) ID = MainWindowViewModel.dt_TP.Rows.Count.ToString();
|
||||
ViewStep viewstop = new ViewStep(Numder, MainWindowViewModel.dt_TP.Select("STEP = " + ID).First());
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(edit_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
}
|
||||
}
|
||||
@@ -503,9 +561,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
{
|
||||
ID = (Gridstep.Columns[2].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位列,
|
||||
|
||||
ViewStep viewstop = new ViewStep(null, "0", "0", "0", "0", "0");
|
||||
viewstop.data = ID;
|
||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||
if (ID == null) ID = MainWindowViewModel.dt_TP.Rows.Count.ToString();
|
||||
ViewStep viewstop = new ViewStep(Numder, MainWindowViewModel.dt_TP.Select("STEP = " + ID).First());
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Insert_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
}
|
||||
}
|
||||
@@ -529,7 +589,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
DAT = "SC821" + MainWindowViewModel.Selet_Machines(MainWindowViewModel.Machines, "SYSKEY", "ID='" + index + "'") + dat_821.ToJsonString()
|
||||
});
|
||||
|
||||
TechnologicalProcess_bool = true;
|
||||
MainWindowViewModel.dt_TP.Select("Step=" + ID).First().Delete();
|
||||
MainWindowViewModel.dt_TP.AcceptChanges();
|
||||
DatSteps(MainWindowViewModel.dt_TP);
|
||||
TechnologicalProcess_View = ToObservableCollection<TechnologicalP>(MainWindowViewModel.dt_TP);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -716,7 +779,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
public string DYELOT { get; set; }
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
|
||||
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
|
||||
{
|
||||
try
|
||||
@@ -768,6 +830,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
}
|
||||
catch (Exception) { return null; }
|
||||
}
|
||||
public void DatSteps(DataTable db)//行号刷新
|
||||
{
|
||||
int a = db.Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
DataRow dr = db.Rows[i];
|
||||
dr.BeginEdit();
|
||||
dr["Step"] = i + 1;
|
||||
dr.EndEdit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -422,7 +422,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
|
||||
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(Numder, dat.Select("STEP = " + ID).First());
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
@@ -434,15 +434,36 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
int n = StrToInt.To16Convert10(ID);
|
||||
|
||||
DataRow dr = dat.Rows[n - 1];
|
||||
dr.BeginEdit();
|
||||
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["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter5"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter1_S1"] = e.Row_DAT.Field<double>("Parameter1_S1");
|
||||
dr["Parameter2_S1"] = e.Row_DAT.Field<double>("Parameter2_S1");
|
||||
dr["Parameter3_S1"] = e.Row_DAT.Field<double>("Parameter3_S1");
|
||||
dr["Parameter4_S1"] = e.Row_DAT.Field<double>("Parameter4_S1");
|
||||
dr["Parameter5_S1"] = e.Row_DAT.Field<double>("Parameter5_S1");
|
||||
dr["Parameter1_S2"] = e.Row_DAT.Field<double>("Parameter1_S2");
|
||||
dr["Parameter2_S2"] = e.Row_DAT.Field<double>("Parameter2_S2");
|
||||
dr["Parameter3_S2"] = e.Row_DAT.Field<double>("Parameter3_S2");
|
||||
dr["Parameter4_S2"] = e.Row_DAT.Field<double>("Parameter4_S2");
|
||||
dr["Parameter5_S2"] = e.Row_DAT.Field<double>("Parameter5_S2");
|
||||
dr["Parameter1_S3"] = e.Row_DAT.Field<double>("Parameter1_S3");
|
||||
dr["Parameter2_S3"] = e.Row_DAT.Field<double>("Parameter2_S3");
|
||||
dr["Parameter3_S3"] = e.Row_DAT.Field<double>("Parameter3_S3");
|
||||
dr["Parameter4_S3"] = e.Row_DAT.Field<double>("Parameter4_S3");
|
||||
dr["Parameter5_S3"] = e.Row_DAT.Field<double>("Parameter5_S3");
|
||||
dr["StepName_S1"] = e.Row_DAT.Field<string>("StepName_S1");
|
||||
dr["StepName_S2"] = e.Row_DAT.Field<string>("StepName_S2");
|
||||
dr["StepName_S3"] = e.Row_DAT.Field<string>("StepName_S3");
|
||||
dr["StepID_S1"] = e.Row_DAT.Field<string>("StepID_S1");
|
||||
dr["StepID_S2"] = e.Row_DAT.Field<string>("StepID_S2");
|
||||
dr["StepID_S3"] = e.Row_DAT.Field<string>("StepID_S3");
|
||||
dr.EndEdit();
|
||||
|
||||
Grid_data.ItemsSource = dat.DefaultView;
|
||||
|
||||
+104
-25
@@ -11,18 +11,24 @@
|
||||
d:DesignHeight="630" d:DesignWidth="1280">
|
||||
<UserControl.Resources>
|
||||
<ConvertMoels:RowToIndexConverter x:Key="RowToIndexConverter"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<DataGrid x:Name="Grid" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=90}"
|
||||
PreviewMouseLeftButtonUp="Grid_PreviewMouseLeftButtonUp" MouseDoubleClick="Grid_MouseDoubleClick"
|
||||
Background="White" HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9"
|
||||
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" FontSize="15"
|
||||
Grid.ColumnSpan="2" CanUserResizeRows="False" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column" SelectionMode="Single"
|
||||
Margin="0,0,0,60">
|
||||
<ConvertMoels:StatexmlConvert x:Key="StatexmlConvert"/>
|
||||
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
|
||||
<ConvertMoels:BoolToVisidilityConvert x:Key="BoolToVisidilityConvert"/>
|
||||
<ConvertMoels:StatenToImageConvert x:Key="StatenToImageConvert"/>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<DataGrid x:Name="Grid_step" AlternationCount="2" MouseDoubleClick="Grid_MouseDoubleClick"
|
||||
MouseLeftButtonUp="Grid_PreviewMouseLeftButtonUp"
|
||||
d:ItemsSource="{d:SampleData ItemCount=90}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" Background="White"
|
||||
GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" BorderBrush="{x:Null}"
|
||||
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" CanUserAddRows="True">
|
||||
<DataGrid.RowStyle >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="IsHitTestVisible" Value="{Binding DataContext.IsInteractive,
|
||||
RelativeSource={RelativeSource AncestorType=DataGrid}}"/>
|
||||
<Setter Property="Height" Value="100" />
|
||||
<Setter Property="FontSize" Value="25" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||
@@ -32,42 +38,115 @@
|
||||
<Setter Property="Background" Value="#FFF0F0F0" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="False"/>
|
||||
<DataTrigger Binding="{Binding RUN}" Value="1">
|
||||
<Setter Property="Background" Value="#FF00D6FF"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding RUN}" Value="2">
|
||||
<Setter Property="Background" Value="Yellow"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding RUN}" Value="9">
|
||||
<Setter Property="Background" Value="Red"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="DataGridCell">
|
||||
<Style TargetType="{x:Type DataGridCell}">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="MinWidth" Value="20"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#FFC0C0C0"/>
|
||||
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
|
||||
<Setter Property="Background" Value="#FF00D6FF"/>
|
||||
<Setter Property="BorderBrush" Value="#FF00D6FF"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTextColumn Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding Program}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}" Width="60" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="100" Binding="{Binding StepID}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="300" Binding="{Binding StepName}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="*" Binding="{Binding ParameterName}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Binding="{Binding Step}"
|
||||
Width="80" IsReadOnly="True">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="0" MinWidth="0"
|
||||
MaxWidth="0" Binding="{Binding StepID}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="0" MinWidth="0"
|
||||
MaxWidth="0" Binding="{Binding StepName}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="0" MinWidth="0"
|
||||
MaxWidth="0" Binding="{Binding ParameterName}" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Binding="{Binding Parameter1}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding Parameter2}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding Parameter3}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding Parameter4}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding Parameter5}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding Parameter6}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding Parameter7}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding Parameter8}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding Parameter9}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding Parameter10}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTextColumn Binding="{Binding StepTime}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||
<DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="100" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Image Source="{Binding Path=StepID,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="{x:Static lang:Resources.Directives}" Width="600" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<Border BorderBrush="#FFC9C9C9" BorderThickness="0,0,0,0.5">
|
||||
<TextBlock Height="50" >
|
||||
<Run Text="{x:Static lang:Resources.Function}"/>
|
||||
<Run Text=":"/>
|
||||
<Run Text="{Binding StepName}"/>
|
||||
</TextBlock>
|
||||
</Border>
|
||||
<Border BorderBrush="#FFC9C9C9" BorderThickness="0,0.5,0,0">
|
||||
<TextBlock Height="50" >
|
||||
<Run Text="{x:Static lang:Resources.ParameterSet}"/>
|
||||
<Run Text=":"/>
|
||||
<Run Text="{Binding ParameterName}"/>
|
||||
</TextBlock>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Image Source="{Binding Path=StepID_S1,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Image Source="{Binding Path=StepID_S2,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Header="{x:Static lang:Resources.Subroutine}" Width="100" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Image Source="{Binding Path=StepID_S3 ,Converter={StaticResource StatenToImageConvert}}" Height="100" Width="100"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Remark}" Binding="{Binding Remark}"
|
||||
Width="*" IsReadOnly="True">
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="TextWrapping" Value="Wrap"/>
|
||||
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<StackPanel x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,400,0">
|
||||
|
||||
@@ -47,8 +47,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
Programgroup_sql();
|
||||
}
|
||||
|
||||
DataSet sql; //内存数据缓存
|
||||
|
||||
// DataSet sql; //内存数据缓存
|
||||
DataTable Step;
|
||||
string ProgramID;
|
||||
string ProgramNAME;
|
||||
string Numder = null;
|
||||
@@ -58,34 +58,25 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
public void Programgroup_sql()
|
||||
{
|
||||
string sql_script = "select * from ProgramSteps where ProgramID='" + ProgramID + "' order by Step asc";
|
||||
|
||||
if (sql != null) sql.Clear(); //清空缓存
|
||||
sql = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
|
||||
//sql.Tables[0].Rows.Add(datatable_t);
|
||||
DataRow dr = sql.Tables[0].NewRow();//添加表数据
|
||||
dr["ProgramID"] = ProgramID;
|
||||
dr["Program"] = ProgramNAME;
|
||||
sql.Tables[0].Rows.Add(dr);
|
||||
Dat();
|
||||
if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
||||
Step = MainWindowViewModel.SQLiteHelpers.ExecuteDataSet(sql_script, null).Tables[0]; //读取计划表写入缓存
|
||||
Grid_step.ItemsSource = Step.DefaultView; //转换显示计划表
|
||||
}
|
||||
|
||||
public void Dat()//行号刷新
|
||||
public void Dat(DataTable dat)//行号刷新
|
||||
{
|
||||
int a = sql.Tables[0].Rows.Count;
|
||||
int a = dat.Rows.Count;
|
||||
for (int i = 0; i < a; i++)
|
||||
{
|
||||
DataRow dr = sql.Tables[0].Rows[i];
|
||||
DataRow dr = dat.Rows[i];
|
||||
dr.BeginEdit();
|
||||
dr["Step"] = i + 1;
|
||||
dr.EndEdit();
|
||||
}
|
||||
dat.AcceptChanges();
|
||||
}
|
||||
|
||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)//打开页面时的操作
|
||||
{
|
||||
if (ID == null) ID = sql.Tables[0].Rows.Count.ToString();
|
||||
Grid.SelectedIndex = Convert.ToInt32(ID)-1;
|
||||
}
|
||||
public static T GetVisualChild<T>(Visual parent) where T : Visual
|
||||
{
|
||||
@@ -112,17 +103,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
edit.IsEnabled = true;
|
||||
Insert.IsEnabled = true;
|
||||
Delete.IsEnabled = true;
|
||||
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
int rownum = Grid_step.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
ID = (Grid.Columns[2].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||
Numder = (Grid.Columns[3].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
P1 = (Grid.Columns[6].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第6列,
|
||||
P2 = (Grid.Columns[7].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第7列,
|
||||
P3 = (Grid.Columns[8].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第8列,
|
||||
P4 = (Grid.Columns[9].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第9列,
|
||||
P5 = (Grid.Columns[10].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第10列,
|
||||
StepTime = (Grid.Columns[16].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//
|
||||
ID = (Grid_step.Columns[2].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||
Numder = (Grid_step.Columns[3].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
P1 = (Grid_step.Columns[6].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第6列,
|
||||
P2 = (Grid_step.Columns[7].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第7列,
|
||||
P3 = (Grid_step.Columns[8].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第8列,
|
||||
P4 = (Grid_step.Columns[9].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第9列,
|
||||
P5 = (Grid_step.Columns[10].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第10列,
|
||||
StepTime = (Grid_step.Columns[16].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,21 +122,21 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
edit.IsEnabled = true;
|
||||
Insert.IsEnabled = true;
|
||||
Delete.IsEnabled = true;
|
||||
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
int rownum = Grid_step.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
if (rownum != -1)//判断鼠标定位是否有效
|
||||
{
|
||||
ID = (Grid.Columns[2].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||
Numder = (Grid.Columns[3].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
P1 = (Grid.Columns[6].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第6列,
|
||||
P2 = (Grid.Columns[7].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第7列,
|
||||
P3 = (Grid.Columns[8].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第8列,
|
||||
P4 = (Grid.Columns[9].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第9列,
|
||||
P5 = (Grid.Columns[10].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第10列,
|
||||
StepTime = (Grid.Columns[16].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//
|
||||
ID = (Grid_step.Columns[2].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第0列,
|
||||
Numder = (Grid_step.Columns[3].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第1列,
|
||||
P1 = (Grid_step.Columns[6].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第6列,
|
||||
P2 = (Grid_step.Columns[7].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第7列,
|
||||
P3 = (Grid_step.Columns[8].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第8列,
|
||||
P4 = (Grid_step.Columns[9].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第9列,
|
||||
P5 = (Grid_step.Columns[10].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//定位第10列,
|
||||
StepTime = (Grid_step.Columns[16].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//
|
||||
|
||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||
if (ID == null) ID = sql.Tables[0].Rows.Count.ToString();
|
||||
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5);
|
||||
if (ID == null) ID = Step.Rows.Count.ToString();
|
||||
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
@@ -163,42 +154,41 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
Insert.IsEnabled = false;
|
||||
Delete.IsEnabled = false;
|
||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||
if (ID == null) ID = sql.Tables[0].Rows.Count.ToString();
|
||||
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5);
|
||||
if (ID == null) ID = Step.Rows.Count.ToString();
|
||||
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
|
||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||
viewstop.data = ID;
|
||||
viewstop.ShowDialog();
|
||||
}
|
||||
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
||||
{
|
||||
int i = sql.Tables[0].Rows.Count;
|
||||
int i = Step.Rows.Count;
|
||||
int n = StrToInt.To16Convert10(ID);
|
||||
if (i == n)
|
||||
{
|
||||
DataRow dr_ = sql.Tables[0].NewRow();//添加表数据
|
||||
DataRow dr_ = Step.NewRow();//添加表数据
|
||||
dr_["ProgramID"] = ProgramID;
|
||||
dr_["Program"] = ProgramNAME;
|
||||
sql.Tables[0].Rows.Add(dr_);
|
||||
Dat();
|
||||
Step.Rows.Add(dr_);
|
||||
Dat(Step);
|
||||
ID = (n + 1).ToString();
|
||||
}
|
||||
|
||||
int steptime=0;//时间秒
|
||||
int steptime = 0;//时间秒
|
||||
string[] time_D = { "001", "013", "015", "017", "065" };
|
||||
string[] time_J = { "031", "093" };
|
||||
string[] time_T = { "054", "055","056" };
|
||||
foreach (var item in time_D)
|
||||
string[] time_T = { "054", "055", "056" };
|
||||
foreach (var item in time_D)
|
||||
{
|
||||
if (item == e.StepID)
|
||||
{
|
||||
steptime = Convert.ToUInt16(e.P3)*60;
|
||||
steptime = Convert.ToUInt16(e.Row_DAT.Field<double>("Parameter3")) * 60;
|
||||
}
|
||||
}
|
||||
foreach (var item in time_J)
|
||||
{
|
||||
if (item == e.StepID)
|
||||
{
|
||||
steptime = Convert.ToUInt16(e.P1) * 60;
|
||||
steptime = Convert.ToUInt16(e.Row_DAT.Field<double>("Parameter1")) * 60;
|
||||
}
|
||||
}
|
||||
foreach (var item in time_T)
|
||||
@@ -208,25 +198,46 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
steptime = 5;
|
||||
}
|
||||
}
|
||||
if (steptime==0)
|
||||
if (steptime == 0)
|
||||
{
|
||||
steptime = 300;
|
||||
}
|
||||
|
||||
DataRow dr = sql.Tables[0].Rows[n - 1];
|
||||
|
||||
DataRow dr = Step.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["StepTime"] =steptime;//
|
||||
dr["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
|
||||
dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter2");
|
||||
dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter3");
|
||||
dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter4");
|
||||
dr["Parameter5"] = e.Row_DAT.Field<double>("Parameter5");
|
||||
dr["Parameter1_S1"] = e.Row_DAT.Field<double>("Parameter1_S1");
|
||||
dr["Parameter2_S1"] = e.Row_DAT.Field<double>("Parameter2_S1");
|
||||
dr["Parameter3_S1"] = e.Row_DAT.Field<double>("Parameter3_S1");
|
||||
dr["Parameter4_S1"] = e.Row_DAT.Field<double>("Parameter4_S1");
|
||||
dr["Parameter5_S1"] = e.Row_DAT.Field<double>("Parameter5_S1");
|
||||
dr["Parameter1_S2"] = e.Row_DAT.Field<double>("Parameter1_S2");
|
||||
dr["Parameter2_S2"] = e.Row_DAT.Field<double>("Parameter2_S2");
|
||||
dr["Parameter3_S2"] = e.Row_DAT.Field<double>("Parameter3_S2");
|
||||
dr["Parameter4_S2"] = e.Row_DAT.Field<double>("Parameter4_S2");
|
||||
dr["Parameter5_S2"] = e.Row_DAT.Field<double>("Parameter5_S2");
|
||||
dr["Parameter1_S3"] = e.Row_DAT.Field<double>("Parameter1_S3");
|
||||
dr["Parameter2_S3"] = e.Row_DAT.Field<double>("Parameter2_S3");
|
||||
dr["Parameter3_S3"] = e.Row_DAT.Field<double>("Parameter3_S3");
|
||||
dr["Parameter4_S3"] = e.Row_DAT.Field<double>("Parameter4_S3");
|
||||
dr["Parameter5_S3"] = e.Row_DAT.Field<double>("Parameter5_S3");
|
||||
dr["StepName_S1"] = e.Row_DAT.Field<string>("StepName_S1");
|
||||
dr["StepName_S2"] = e.Row_DAT.Field<string>("StepName_S2");
|
||||
dr["StepName_S3"] = e.Row_DAT.Field<string>("StepName_S3");
|
||||
dr["StepID_S1"] = e.Row_DAT.Field<string>("StepID_S1");
|
||||
dr["StepID_S2"] = e.Row_DAT.Field<string>("StepID_S2");
|
||||
dr["StepID_S3"] = e.Row_DAT.Field<string>("StepID_S3");
|
||||
dr["StepTime"] = steptime;//
|
||||
dr.EndEdit();
|
||||
|
||||
Grid.ItemsSource = sql.Tables[0].DefaultView;
|
||||
Grid_step.ItemsSource = Step.DefaultView;
|
||||
}
|
||||
|
||||
private void ListViewItem_Insert(object sender, System.Windows.Input.MouseButtonEventArgs e)//插入事件
|
||||
@@ -235,14 +246,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
Insert.IsEnabled = false;
|
||||
Delete.IsEnabled = false; int d = 0;
|
||||
if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
|
||||
DataRow dr = sql.Tables[0].NewRow();//添加表数据
|
||||
DataRow dr = Step.NewRow();//添加表数据
|
||||
dr["ProgramID"] = ProgramID;
|
||||
dr["Program"] = ProgramNAME;
|
||||
sql.Tables[0].Rows.InsertAt(dr, d - 1);
|
||||
Step.Rows.InsertAt(dr, d - 1);
|
||||
ID = null;
|
||||
|
||||
Dat();
|
||||
Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
||||
Dat(Step);
|
||||
Grid_step.ItemsSource = Step.DefaultView; //转换显示计划表
|
||||
}
|
||||
|
||||
private void ListViewItem_Save(object sender, System.Windows.Input.MouseButtonEventArgs e)//保存事件
|
||||
@@ -253,14 +264,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
int r = 0;
|
||||
MainWindowViewModel.SQLiteHelpers.Delete("ProgramSteps", "ProgramID = '" + ProgramID + "'", null);
|
||||
DataTable data_t = new DataTable();
|
||||
data_t = sql.Tables[0].Clone();
|
||||
data_t = Step.Clone();
|
||||
|
||||
int a = sql.Tables[0].Rows.Count;
|
||||
int a = Step.Rows.Count;
|
||||
for (int i = 0; i < a - 1; i++)
|
||||
{
|
||||
data_t.Clear();//清空
|
||||
|
||||
DataRow dt = sql.Tables[0].Rows[i];//行转换
|
||||
DataRow dt = Step.Rows[i];//行转换
|
||||
DataRow dr = data_t.NewRow();
|
||||
dr.ItemArray = dt.ItemArray;
|
||||
data_t.Rows.InsertAt(dr, 0);
|
||||
@@ -268,7 +279,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
r = MainWindowViewModel.SQLiteHelpers.InsertData("ProgramSteps", MainWindowViewModel.SQLiteHelpers.DataTableToDictionary(data_t));//行插入
|
||||
}
|
||||
|
||||
int time =Convert.ToUInt16( sql.Tables[0].Compute("sum(StepTime)", ""))/60;
|
||||
int time =Convert.ToUInt16( Step.Compute("sum(StepTime)", ""))/60;
|
||||
string time_ =DateTime.Parse( TimeSpan.FromMinutes(time).ToString()).ToString("HH:mm");// DateTime.Parse(time.ToString()).ToString("HH:mm");
|
||||
Dictionary<string, object> Program_Step = new Dictionary<string, object>();//缓存函数
|
||||
Program_Step.Add("Step", a - 1);
|
||||
@@ -289,15 +300,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
Delete.IsEnabled = false;
|
||||
|
||||
int d = 0;
|
||||
int a = sql.Tables[0].Rows.Count;
|
||||
int a = Step.Rows.Count;
|
||||
|
||||
if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
|
||||
if (a != d)//如果删除不是最后一行执行
|
||||
{
|
||||
sql.Tables[0].Rows.RemoveAt(d - 1);
|
||||
|
||||
Dat();
|
||||
Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
|
||||
Step.Rows.RemoveAt(d - 1);
|
||||
Dat(Step);
|
||||
Grid_step.ItemsSource = Step.DefaultView; //转换显示计划表
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user