Browse Source

子功能保存事件

master
sc 2 months ago
parent
commit
2ed1f7887b
  1. 10
      View/TechnologicalProcessView.xaml.cs
  2. 15
      Windows/ViewStep.xaml
  3. 122
      Windows/ViewStep.xaml.cs

10
View/TechnologicalProcessView.xaml.cs

@ -400,7 +400,7 @@ namespace DyeingComputer.View
}
SQLiteHelpers.Close(); //关闭连接
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "STEP = " + n,
"StepID=" + e.StepID + ";StepName=" + e.StepNAME + ";P=" + e.Row_DAT);
"StepID=" + e.StepID + ";StepName=" + e.StepNAME + ";P=" + string.Join(",", e.Row_DAT.ItemArray));
MainWindowViewModel.User_Button = true;
}
public static void Dat()//行号刷新
@ -485,6 +485,12 @@ namespace DyeingComputer.View
dr["Parameter3_S3"] = 0;
dr["Parameter4_S3"] = 0;
dr["Parameter5_S3"] = 0;
dr["StepName_S1"] = " ";
dr["StepName_S2"] = " ";
dr["StepName_S3"] = " ";
dr["StepID_S1"] = "000";
dr["StepID_S2"] = "000";
dr["StepID_S3"] = "000";
MainWindowViewModel.dt_TP.Rows.InsertAt(dr, d - 1);
// ID = null;
Dat();
@ -563,7 +569,7 @@ namespace DyeingComputer.View
}
SQLiteHelpers.Close(); //关闭连接
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "STEP = " + n,
"StepID=" + e.StepID + ";StepName=" + e.StepNAME + ";P=" + e.Row_DAT);
"StepID=" + e.StepID + ";StepName=" + e.StepNAME + ";P=" + string.Join(",", e.Row_DAT.ItemArray));
MainWindowViewModel.User_Button = true;
}
private void ProgramgroupView_Jump_Click(object sender, RoutedEventArgs e)

15
Windows/ViewStep.xaml

@ -97,41 +97,44 @@
VerticalAlignment="Top" Width="230" FontSize="20" SelectionChanged="boxIDp_SelectionChanged"/>
<TextBox x:Name="boxNAMEp" HorizontalAlignment="Right" Height="30" Margin="0,70,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
IsReadOnly="True" FontSize="20" HorizontalContentAlignment="Right" MaxLength="3"/>
IsReadOnly="True" FontSize="20" HorizontalContentAlignment="Right" MaxLength="3"
TextChanged="TextBoxp_TextChanged" />
<TextBlock x:Name="P1NP" HorizontalAlignment="Left" Height="30" Margin="210,170,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P1P" HorizontalAlignment="Right" Height="30" Margin="0,170,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP1" InputMethod.IsInputMethodEnabled="False"
Text="0" PreviewTextInput="Tb_KeyP1p" TextChanged="P1P_TextChanged"
InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
<TextBlock x:Name="P2NP" HorizontalAlignment="Left" Height="30" Margin="210,205,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P2P" HorizontalAlignment="Right" Height="30" Margin="0,205,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP2" InputMethod.IsInputMethodEnabled="False"
Text="0" PreviewTextInput="Tb_KeyP2p" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
<TextBlock x:Name="P3NP" HorizontalAlignment="Left" Height="30" Margin="210,240,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P3P" HorizontalAlignment="Right" Height="30" Margin="0,240,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP3" InputMethod.IsInputMethodEnabled="False"
Text="0" PreviewTextInput="Tb_KeyP3p" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
<TextBlock x:Name="P4NP" HorizontalAlignment="Left" Height="30" Margin="210,275,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P4P" HorizontalAlignment="Right" Height="30" Margin="0,275,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP4" InputMethod.IsInputMethodEnabled="False"
Text="0" PreviewTextInput="Tb_KeyP4p" InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
<TextBlock x:Name="P5NP" HorizontalAlignment="Left" Height="30" Margin="210,310,0,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20"
Background="#FFEFEEEE" Visibility="Hidden"/>
<TextBox x:Name="P5P" HorizontalAlignment="Right" Height="30" Margin="0,310,10,0"
TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
Text="0" PreviewTextInput="Tb_KeyP5" InputMethod.IsInputMethodEnabled="False"
Text="0" PreviewTextInput="Tb_KeyP5p"
InputMethod.IsInputMethodEnabled="False"
FontSize="20" HorizontalContentAlignment="Right" Visibility="Hidden" />
</Grid>

122
Windows/ViewStep.xaml.cs

@ -109,10 +109,77 @@ namespace DyeingComputer.Windows
P5.SelectionStart, e.Text));
P5.Text = P5.Text.Trim();
}
private void Tb_KeyP1p(object sender, TextCompositionEventArgs e)//输入事件P1
{
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
e.Handled =
!numbeRegex.IsMatch(
P1P.Text.Insert(
P1P.SelectionStart, e.Text));
P1P.Text = P1P.Text.Trim();
}
private void Tb_KeyP2p(object sender, TextCompositionEventArgs e)//输入事件P2
{
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
e.Handled =
!numbeRegex.IsMatch(
P2P.Text.Insert(
P2P.SelectionStart, e.Text));
P2P.Text = P2P.Text.Trim();
}
private void Tb_KeyP3p(object sender, TextCompositionEventArgs e)//输入事件P3
{
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
e.Handled =
!numbeRegex.IsMatch(
P3P.Text.Insert(
P3P.SelectionStart, e.Text));
P3P.Text = P3P.Text.Trim();
}
private void Tb_KeyP4p(object sender, TextCompositionEventArgs e)//输入事件P4
{
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
e.Handled =
!numbeRegex.IsMatch(
P4P.Text.Insert(
P4P.SelectionStart, e.Text));
P4P.Text = P4P.Text.Trim();
}
private void Tb_KeyP5p(object sender, TextCompositionEventArgs e)//输入事件P5
{
Regex numbeRegex = new Regex("^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");
e.Handled =
!numbeRegex.IsMatch(
P5P.Text.Insert(
P5P.SelectionStart, e.Text));
P5P.Text = P5P.Text.Trim();
}
private void P1P_TextChanged(object sender, TextChangedEventArgs e)
{
try
{
dat_D.BeginEdit();
if (dat_P == 1)
{
dat_D["Parameter1_S1"] = Convert.ToDouble(P1P.Text);
}
else if (dat_P == 2)
{
dat_D["Parameter1_S2"] = Convert.ToDouble(P1P.Text);
}
else if (dat_P == 3)
{
dat_D["Parameter1_S3"] = Convert.ToDouble(P1P.Text);
}
dat_D.EndEdit();
}
catch (Exception) { }
}
private readonly string[] id_dat = {"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",
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" };
private void Form1_Load()
@ -197,6 +264,30 @@ namespace DyeingComputer.Windows
}
}
}
private void TextBoxp_TextChanged(object sender, TextChangedEventArgs e)//输入事件
{
int l = boxNAMEp.Text.Length;
string text = boxNAMEp.Text.ToString();
if (l == 3)
{
int g = Array.IndexOf(id_datp, text);//数组索引
if (g != -1)
{
boxIDp.SelectedIndex = g;//有效索引传入
Setp(id_datp[g]);
}
else
{
boxIDp.SelectedIndex = -1;
Setp("-1");
}
}
else
{
boxIDp.SelectedIndex = 0;//空白
Setp(id_datp[0]);
}
}
private void BoxID_SelectionChanged(object sender, SelectionChangedEventArgs e)//下拉框选择事件
{
if (boxID.SelectedIndex !=-1)
@ -213,6 +304,24 @@ namespace DyeingComputer.Windows
int i = boxIDp.SelectedIndex;
boxNAMEp.Text = id_datp.ElementAt(i);
Setp(id_datp[i]);
dat_D.BeginEdit();
if (dat_P == 1)
{
dat_D["StepID_S1"] = boxNAMEp.Text;
dat_D["StepName_S1"] = e.AddedItems[0];
}
else if (dat_P == 2)
{
dat_D["StepID_S2"] = boxNAMEp.Text;
dat_D["StepName_S2"] = e.AddedItems[0];
}
else if (dat_P == 3)
{
dat_D["StepID_S3"] = boxNAMEp.Text;
dat_D["StepName_S3"] = e.AddedItems[0];
}
dat_D.EndEdit();
}
}
private void YES_Click(object sender, RoutedEventArgs e)//确认
@ -1425,49 +1534,44 @@ namespace DyeingComputer.Windows
{
((Image)sender).RenderTransform = new ScaleTransform(0.9, 0.9);
}
private void imageP2_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
((Image)sender).RenderTransform = new ScaleTransform(0.9, 0.9);
}
private void imageP3_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
((Image)sender).RenderTransform = new ScaleTransform(0.9, 0.9);
}
private void imageP1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
((Image)sender).RenderTransform = Transform.Identity;
dat_P = 1;
Sub.Text = Properties.Resources.Subroutine + ": "+dat_P.ToString();
boxNAMEp.Text = dat_D.Field<string>("StepName_S1");
boxNAMEp.Text = dat_D.Field<string>("StepID_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)
{
((Image)sender).RenderTransform = Transform.Identity;
dat_P = 2;
Sub.Text = Properties.Resources.Subroutine + ": "+ dat_P.ToString();
boxNAMEp.Text = dat_D.Field<string>("StepName_S2");
boxNAMEp.Text = dat_D.Field<string>("StepID_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)
{
((Image)sender).RenderTransform = Transform.Identity;
dat_P = 3;
Sub.Text = Properties.Resources.Subroutine + ": "+ dat_P.ToString();
boxNAMEp.Text = dat_D.Field<string>("StepName_S2");
boxNAMEp.Text = dat_D.Field<string>("StepID_S3");
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();

Loading…
Cancel
Save