Browse Source

修改步骤页面返回逻辑

master
sc 3 months ago
parent
commit
3f6ce1389b
  1. 6
      Properties/Resources.zh-TW.resx
  2. 31
      View/ProgramstepsView .xaml.cs
  3. 68
      View/TechnologicalProcessView.xaml.cs
  4. 37
      Windows/ViewStep.xaml
  5. 78
      Windows/ViewStep.xaml.cs

6
Properties/Resources.zh-TW.resx

@ -580,12 +580,12 @@
<value>總量</value> <value>總量</value>
</data> </data>
<data name="Muffling" xml:space="preserve"> <data name="Muffling" xml:space="preserve">
<value /> <value>靜音</value>
</data> </data>
<data name="ADD" xml:space="preserve"> <data name="ADD" xml:space="preserve">
<value /> <value>加色</value>
</data> </data>
<data name="Subroutine" xml:space="preserve"> <data name="Subroutine" xml:space="preserve">
<value /> <value>副功能</value>
</data> </data>
</root> </root>

31
View/ProgramstepsView .xaml.cs

@ -157,11 +157,32 @@ namespace DyeingComputer.View
dr["StepID"] = e.StepID; dr["StepID"] = e.StepID;
dr["StepName"] = e.StepNAME; dr["StepName"] = e.StepNAME;
dr["ParameterName"] = e.PNAME; dr["ParameterName"] = e.PNAME;
dr["Parameter1"] = e.P1; dr["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter2"] = e.P2; dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter3"] = e.P3; dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter4"] = e.P4; dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter5"] = e.P5; 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(); dr.EndEdit();
Grid.ItemsSource = sql.Tables[0].DefaultView; Grid.ItemsSource = sql.Tables[0].DefaultView;

68
View/TechnologicalProcessView.xaml.cs

@ -347,11 +347,32 @@ namespace DyeingComputer.View
dr["StepID"] = e.StepID; dr["StepID"] = e.StepID;
dr["StepName"] = e.StepNAME; dr["StepName"] = e.StepNAME;
dr["ParameterName"] = e.PNAME; dr["ParameterName"] = e.PNAME;
dr["Parameter1"] = e.P1; dr["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter2"] = e.P2; dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter3"] = e.P3; dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter4"] = e.P4; dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter5"] = e.P5; 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(); dr.EndEdit();
// MainWindowViewModel.dt_TP = sql.Tables[0]; // MainWindowViewModel.dt_TP = sql.Tables[0];
@ -379,8 +400,7 @@ namespace DyeingComputer.View
} }
SQLiteHelpers.Close(); //关闭连接 SQLiteHelpers.Close(); //关闭连接
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "STEP = " + n, APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "STEP = " + n,
"StepID=" + e.StepID + ";StepName=" + e.StepNAME + ";P1=" + e.P1 + "StepID=" + e.StepID + ";StepName=" + e.StepNAME + ";P=" + e.Row_DAT);
";P2=" + e.P2 + ";P3=" + e.P3 + ";P4=" + e.P4 + ";P5=" + e.P5);
MainWindowViewModel.User_Button = true; MainWindowViewModel.User_Button = true;
} }
public static void Dat()//行号刷新 public static void Dat()//行号刷新
@ -488,11 +508,32 @@ namespace DyeingComputer.View
dr["StepID"] = e.StepID; dr["StepID"] = e.StepID;
dr["StepName"] = e.StepNAME; dr["StepName"] = e.StepNAME;
dr["ParameterName"] = e.PNAME; dr["ParameterName"] = e.PNAME;
dr["Parameter1"] = e.P1; dr["Parameter1"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter2"] = e.P2; dr["Parameter2"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter3"] = e.P3; dr["Parameter3"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter4"] = e.P4; dr["Parameter4"] = e.Row_DAT.Field<double>("Parameter1");
dr["Parameter5"] = e.P5; 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(); dr.EndEdit();
// MainWindowViewModel.dt_TP = sql.Tables[0]; // MainWindowViewModel.dt_TP = sql.Tables[0];
@ -522,8 +563,7 @@ namespace DyeingComputer.View
} }
SQLiteHelpers.Close(); //关闭连接 SQLiteHelpers.Close(); //关闭连接
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "STEP = " + n, APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "STEP = " + n,
"StepID=" + e.StepID + ";StepName=" + e.StepNAME + ";P1=" + e.P1 + "StepID=" + e.StepID + ";StepName=" + e.StepNAME + ";P=" + e.Row_DAT);
";P2=" + e.P2 + ";P3=" + e.P3 + ";P4=" + e.P4 + ";P5=" + e.P5);
MainWindowViewModel.User_Button = true; MainWindowViewModel.User_Button = true;
} }
private void ProgramgroupView_Jump_Click(object sender, RoutedEventArgs e) private void ProgramgroupView_Jump_Click(object sender, RoutedEventArgs e)

37
Windows/ViewStep.xaml

@ -11,9 +11,9 @@
Title="SUNLIGHT 800" Height="800" Width="600"> Title="SUNLIGHT 800" Height="800" Width="600">
<Grid FocusManager.FocusedElement="{Binding ElementName=box}" > <Grid FocusManager.FocusedElement="{Binding ElementName=box}" >
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="260"/> <RowDefinition Height="300"/>
<RowDefinition/> <RowDefinition/>
<RowDefinition Height="70"/> <RowDefinition Height="50"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border Grid.Row="1" BorderThickness="5,5,5,5" BorderBrush="#FFABABAB"/> <Border Grid.Row="1" BorderThickness="5,5,5,5" BorderBrush="#FFABABAB"/>
<Grid Grid.Row="0"> <Grid Grid.Row="0">
@ -72,20 +72,20 @@
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP5" InputMethod.IsInputMethodEnabled="False" Text="0" PreviewTextInput="Tb_KeyP5" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" /> FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
</Grid> </Grid>
<Grid Grid.Row="1"> <Grid Grid.Row="1">
<TextBlock x:Name="Sub" Text="{x:Static lang:Resources.Subroutine}" HorizontalAlignment="Left" <TextBlock x:Name="Sub" Text="{x:Static lang:Resources.Subroutine}" HorizontalAlignment="Left"
Height="40" Margin="210,20,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="380" Height="40" Margin="210,20,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="360"
FontSize="25" Background="#FFEFEEEE"/> FontSize="25" Background="#FFEFEEEE"/>
<Image x:Name="imageP1" Source="/Lmage/ADD.jpg" HorizontalAlignment="Left" Height="125" <Image x:Name="imageP1" Source="/Lmage/ADD.jpg" HorizontalAlignment="Left" Height="125"
Margin="10,10,0,0" VerticalAlignment="Top" Width="125" Opacity="0.4" Margin="20,10,0,0" VerticalAlignment="Top" Width="125" Opacity="0.4"
MouseLeftButtonDown="imageP1_MouseLeftButtonDown" MouseLeftButtonUp="imageP1_MouseLeftButtonUp"/> MouseLeftButtonDown="imageP1_MouseLeftButtonDown" MouseLeftButtonUp="imageP1_MouseLeftButtonUp"/>
<Image x:Name="imageP2" Source="/Lmage/ADD.jpg" HorizontalAlignment="Left" Height="125" <Image x:Name="imageP2" Source="/Lmage/ADD.jpg" HorizontalAlignment="Left" Height="125"
Margin="10,150,0,0" VerticalAlignment="Top" Width="125" Opacity="0.4" Margin="20,145,0,0" VerticalAlignment="Top" Width="125" Opacity="0.4"
MouseLeftButtonDown="imageP2_MouseLeftButtonDown" MouseLeftButtonUp="imageP2_MouseLeftButtonUp"/> MouseLeftButtonDown="imageP2_MouseLeftButtonDown" MouseLeftButtonUp="imageP2_MouseLeftButtonUp"/>
<Image x:Name="imageP3" Source="/Lmage/ADD.jpg" HorizontalAlignment="Left" Height="125" <Image x:Name="imageP3" Source="/Lmage/ADD.jpg" HorizontalAlignment="Left" Height="125"
Margin="10,290,0,0" VerticalAlignment="Top" Width="125" Opacity="0.4" Margin="20,280,0,0" VerticalAlignment="Top" Width="125" Opacity="0.4"
MouseLeftButtonDown="imageP3_MouseLeftButtonDown" MouseLeftButtonUp="imageP3_MouseLeftButtonUp"/> MouseLeftButtonDown="imageP3_MouseLeftButtonDown" MouseLeftButtonUp="imageP3_MouseLeftButtonUp"/>
<TextBlock Text="{x:Static lang:Resources.Code}" HorizontalAlignment="Left" Height="30" <TextBlock Text="{x:Static lang:Resources.Code}" HorizontalAlignment="Left" Height="30"
Margin="210,70,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" Margin="210,70,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150"
@ -97,8 +97,7 @@
VerticalAlignment="Top" Width="230" FontSize="20" SelectionChanged="boxIDp_SelectionChanged"/> VerticalAlignment="Top" Width="230" FontSize="20" SelectionChanged="boxIDp_SelectionChanged"/>
<TextBox x:Name="boxNAMEp" HorizontalAlignment="Right" Height="30" Margin="0,70,10,0" <TextBox x:Name="boxNAMEp" HorizontalAlignment="Right" Height="30" Margin="0,70,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
TextChanged="TextBox_TextChanged" PreviewTextInput="Tb_KeyPress" IsReadOnly="True" FontSize="20" HorizontalContentAlignment="Right" MaxLength="3"/>
InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" MaxLength="3"/>
<TextBlock x:Name="P1NP" HorizontalAlignment="Left" Height="30" Margin="210,170,0,0" <TextBlock x:Name="P1NP" HorizontalAlignment="Left" Height="30" Margin="210,170,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/> Background="#FFEFEEEE" Visibility="Hidden"/>
@ -127,20 +126,20 @@
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP4" InputMethod.IsInputMethodEnabled="False" Text="0" PreviewTextInput="Tb_KeyP4" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" /> FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
<TextBlock x:Name="P5NP" HorizontalAlignment="Left" Height="30" Margin="210,310,0,0" <TextBlock x:Name="P5NP" HorizontalAlignment="Left" Height="30" Margin="210,310,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/> Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P5P" HorizontalAlignment="Right" Height="30" Margin="0,310,10,0" <TextBox x:Name="P5P" HorizontalAlignment="Right" Height="30" Margin="0,310,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP5" InputMethod.IsInputMethodEnabled="False" Text="0" PreviewTextInput="Tb_KeyP5" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" /> FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
</Grid> </Grid>
<Button Grid.Row="2" x:Name="yes" Content="{x:Static lang:Resources.YES}" <Button Grid.Row="2" x:Name="yes" Content="{x:Static lang:Resources.YES}"
HorizontalAlignment="Right" Height="35" Margin="0,0,200,20" HorizontalAlignment="Right" Height="35" Margin="0,0,200,5"
VerticalAlignment="Bottom" Width="80" Click="YES_Click"/> VerticalAlignment="Bottom" Width="80" Click="YES_Click"/>
<Button Grid.Row="2" x:Name="no" Content="{x:Static lang:Resources.NO}" <Button Grid.Row="2" x:Name="no" Content="{x:Static lang:Resources.NO}"
HorizontalAlignment="Right" Height="35" Margin="0,0,50,20" HorizontalAlignment="Right" Height="35" Margin="0,0,50,5"
VerticalAlignment="Bottom" Width="80" Click="NO_Click"/> VerticalAlignment="Bottom" Width="80" Click="NO_Click"/>
</Grid> </Grid>

78
Windows/ViewStep.xaml.cs

@ -1,5 +1,6 @@
using DyeingComputer.View; using DyeingComputer.View;
using ScottPlot.Palettes; using ScottPlot.Palettes;
using ScottPlot.TickGenerators.TimeUnits;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
@ -49,16 +50,13 @@ namespace DyeingComputer.Windows
P3.Text = DAT.Field<double>("Parameter3").ToString(); P3.Text = DAT.Field<double>("Parameter3").ToString();
P4.Text = DAT.Field<double>("Parameter4").ToString(); P4.Text = DAT.Field<double>("Parameter4").ToString();
P5.Text = DAT.Field<double>("Parameter5").ToString(); P5.Text = DAT.Field<double>("Parameter5").ToString();
/* P1.Visibility = Visibility.Collapsed;
P1N.Visibility = Visibility.Collapsed; dat_P = 1;
P2.Visibility = Visibility.Collapsed; Setp(DAT.Field<string>("StepID_S1"));
P2N.Visibility = Visibility.Collapsed; dat_P = 2;
P3.Visibility = Visibility.Collapsed; Setp(DAT.Field<string>("StepID_S2"));
P3N.Visibility = Visibility.Collapsed; dat_P = 3;
P4.Visibility = Visibility.Collapsed; Setp(DAT.Field<string>("StepID_S3"));
P4N.Visibility = Visibility.Collapsed;
P5.Visibility = Visibility.Collapsed;
P5N.Visibility = Visibility.Collapsed;*/
} }
private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//输入事件 private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//输入事件
@ -112,8 +110,9 @@ namespace DyeingComputer.Windows
P5.Text = P5.Text.Trim(); P5.Text = P5.Text.Trim();
} }
private readonly string[] id_dat = {"001","007","008","013","015" ,"017", "020", "022", "031", "035", "036", "039", "040", "041", "049", "050",
private readonly string[] a = {"001","007","008","013","015" ,"017", "020", "022", "031", "035", "036", "039", "040", "041", "049", "050", "051", "054", "055", "056","064","065","066","067","090","091","093","094" };
private readonly string[] id_datp = {"","001","007","008","013","015" ,"017", "020", "022", "031", "035", "036", "039", "040", "041", "049", "050",
"051", "054", "055", "056","064","065","066","067","090","091","093","094" }; "051", "054", "055", "056","064","065","066","067","090","091","093","094" };
private void Form1_Load() private void Form1_Load()
@ -147,6 +146,8 @@ namespace DyeingComputer.Windows
this.boxID.Items.Add(Properties.Resources.PHDetection);//ph检测093 this.boxID.Items.Add(Properties.Resources.PHDetection);//ph检测093
this.boxID.Items.Add(Properties.Resources.PHControl);//ph控制094 this.boxID.Items.Add(Properties.Resources.PHControl);//ph控制094
this.boxIDp.Items.Add("");//温度控制001
this.boxIDp.Items.Add(Properties.Resources.TemperatureControl);//温度控制001 this.boxIDp.Items.Add(Properties.Resources.TemperatureControl);//温度控制001
this.boxIDp.Items.Add(Properties.Resources.AddWater + "(" + Properties.Resources.WaterLevel + ")");//水位进水007 this.boxIDp.Items.Add(Properties.Resources.AddWater + "(" + Properties.Resources.WaterLevel + ")");//水位进水007
this.boxIDp.Items.Add(Properties.Resources.AddWater + "(" + Properties.Resources.Flowmeter + ")");//流量进水008 this.boxIDp.Items.Add(Properties.Resources.AddWater + "(" + Properties.Resources.Flowmeter + ")");//流量进水008
@ -176,7 +177,7 @@ namespace DyeingComputer.Windows
this.boxIDp.Items.Add(Properties.Resources.PHDetection);//ph检测093 this.boxIDp.Items.Add(Properties.Resources.PHDetection);//ph检测093
this.boxIDp.Items.Add(Properties.Resources.PHControl);//ph控制094 this.boxIDp.Items.Add(Properties.Resources.PHControl);//ph控制094
// boxNAME.Text = datid; // boxNAME.Text = datid;
} }//创建
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)//输入事件 private void TextBox_TextChanged(object sender, TextChangedEventArgs e)//输入事件
{ {
@ -184,11 +185,11 @@ namespace DyeingComputer.Windows
string text = boxNAME.Text.ToString(); string text = boxNAME.Text.ToString();
if (l == 3) if (l == 3)
{ {
int g = Array.IndexOf(a, text);//数组索引 int g = Array.IndexOf(id_dat, text);//数组索引
if (g != -1) if (g != -1)
{ {
boxID.SelectedIndex = g;//有效索引传入 boxID.SelectedIndex = g;//有效索引传入
Set(a[g]); Set(id_dat[g]);
} else } else
{ {
boxID.SelectedIndex =-1; boxID.SelectedIndex =-1;
@ -201,8 +202,8 @@ namespace DyeingComputer.Windows
if (boxID.SelectedIndex !=-1) if (boxID.SelectedIndex !=-1)
{ {
int i = boxID.SelectedIndex; int i = boxID.SelectedIndex;
boxNAME.Text = a.ElementAt(i); boxNAME.Text = id_dat.ElementAt(i);
Set(a[i]); Set(id_dat[i]);
} }
} }
private void boxIDp_SelectionChanged(object sender, SelectionChangedEventArgs e) private void boxIDp_SelectionChanged(object sender, SelectionChangedEventArgs e)
@ -210,15 +211,15 @@ namespace DyeingComputer.Windows
if (boxIDp.SelectedIndex != -1) if (boxIDp.SelectedIndex != -1)
{ {
int i = boxIDp.SelectedIndex; int i = boxIDp.SelectedIndex;
boxNAMEp.Text = a.ElementAt(i); boxNAMEp.Text = id_datp.ElementAt(i);
Setp(a[i]); Setp(id_datp[i]);
} }
} }
private void YES_Click(object sender, RoutedEventArgs e)//确认 private void YES_Click(object sender, RoutedEventArgs e)//确认
{ {
if (string.IsNullOrEmpty(boxID.Text)) if (string.IsNullOrEmpty(boxID.Text))
{ {
var args1 = new AddressUpdateEventArgs(data, "", "", "", "0", "0", "0", "0", "0"); var args1 = new AddressUpdateEventArgs(data, "", "", "", dat_D);
AddressUpdated(this, args1); AddressUpdated(this, args1);
this.Close(); //关闭窗口 this.Close(); //关闭窗口
return; return;
@ -230,14 +231,13 @@ namespace DyeingComputer.Windows
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(data, boxNAME.Text, boxID.Text, name.ToString(), dat_D);
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)//关闭
{ {
var args = new AddressUpdateEventArgs(data, "", "", "","0","0", "0", "0", "0"); var args = new AddressUpdateEventArgs(data, "", "", "", dat_D);
AddressUpdated(this, args); AddressUpdated(this, args);
this.Close(); //关闭窗口 this.Close(); //关闭窗口
} }
@ -1405,28 +1405,20 @@ namespace DyeingComputer.Windows
} }
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(string dStep, string dStepID, string dStepNAME, string dPNAME, DataRow dRow_DAT)
{ {
this.StepID = dStepID; this.StepID = dStepID;
this.Step = dStep; this.Step = dStep;
this.StepNAME = dStepNAME; this.StepNAME = dStepNAME;
this.PNAME = dPNAME; this.PNAME = dPNAME;
this.P1 = dP1; this.Row_DAT = dRow_DAT;
this.P2 = dP2;
this.P3 = dP3;
this.P4 = dP4;
this.P5 = dP5;
} }
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; }
public string PNAME { get; set; } public string PNAME { get; set; }
public string P1 { get; set; } public DataRow Row_DAT { get; set; }
public string P2 { get; set; }
public string P3 { get; set; }
public string P4 { get; set; }
public string P5 { get; set; }
} }
private void imageP1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) private void imageP1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
@ -1449,6 +1441,12 @@ namespace DyeingComputer.Windows
((Image)sender).RenderTransform = Transform.Identity; ((Image)sender).RenderTransform = Transform.Identity;
dat_P = 1; dat_P = 1;
Sub.Text = Properties.Resources.Subroutine + ": "+dat_P.ToString(); Sub.Text = Properties.Resources.Subroutine + ": "+dat_P.ToString();
boxNAMEp.Text = dat_D.Field<string>("StepName_S1");
P1P.Text = dat_D.Field<double>("Parameter1_S1").ToString();
P2P.Text = dat_D.Field<double>("Parameter2_S1").ToString();
P3P.Text = dat_D.Field<double>("Parameter3_S1").ToString();
P4P.Text = dat_D.Field<double>("Parameter4_S1").ToString();
P5P.Text = dat_D.Field<double>("Parameter5_S1").ToString();
} }
private void imageP2_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) private void imageP2_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
@ -1456,6 +1454,12 @@ namespace DyeingComputer.Windows
((Image)sender).RenderTransform = Transform.Identity; ((Image)sender).RenderTransform = Transform.Identity;
dat_P = 2; dat_P = 2;
Sub.Text = Properties.Resources.Subroutine + ": "+ dat_P.ToString(); Sub.Text = Properties.Resources.Subroutine + ": "+ dat_P.ToString();
boxNAMEp.Text = dat_D.Field<string>("StepName_S2");
P1P.Text = dat_D.Field<double>("Parameter1_S2").ToString();
P2P.Text = dat_D.Field<double>("Parameter2_S2").ToString();
P3P.Text = dat_D.Field<double>("Parameter3_S2").ToString();
P4P.Text = dat_D.Field<double>("Parameter4_S2").ToString();
P5P.Text = dat_D.Field<double>("Parameter5_S2").ToString();
} }
private void imageP3_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) private void imageP3_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
@ -1463,6 +1467,12 @@ namespace DyeingComputer.Windows
((Image)sender).RenderTransform = Transform.Identity; ((Image)sender).RenderTransform = Transform.Identity;
dat_P = 3; dat_P = 3;
Sub.Text = Properties.Resources.Subroutine + ": "+ dat_P.ToString(); Sub.Text = Properties.Resources.Subroutine + ": "+ dat_P.ToString();
boxNAMEp.Text = dat_D.Field<string>("StepName_S2");
P1P.Text = dat_D.Field<double>("Parameter1_S3").ToString();
P2P.Text = dat_D.Field<double>("Parameter2_S3").ToString();
P3P.Text = dat_D.Field<double>("Parameter3_S3").ToString();
P4P.Text = dat_D.Field<double>("Parameter4_S3").ToString();
P5P.Text = dat_D.Field<double>("Parameter5_S3").ToString();
} }

Loading…
Cancel
Save