Browse Source

工艺页面及按钮操作记录

master
sc 7 months ago
parent
commit
2c75e8b0f9
  1. 9
      Properties/Resources.Designer.cs
  2. 3
      Properties/Resources.en-US.resx
  3. 3
      Properties/Resources.resx
  4. 3
      Properties/Resources.zh-CN.resx
  5. 3
      Properties/Resources.zh-TW.resx
  6. 18
      UserClass/APILog.cs
  7. 2
      View/TechnologicalProcessView.xaml
  8. 46
      View/TechnologicalProcessView.xaml.cs
  9. 2
      ViewModel/MainWindowViewModel.cs

9
Properties/Resources.Designer.cs

@ -546,6 +546,15 @@ namespace DyeingComputer.Properties {
}
}
/// <summary>
/// 查找类似 Jump 的本地化字符串。
/// </summary>
public static string Jump {
get {
return ResourceManager.GetString("Jump", resourceCulture);
}
}
/// <summary>
/// 查找类似 Language 的本地化字符串。
/// </summary>

3
Properties/Resources.en-US.resx

@ -507,4 +507,7 @@
<data name="CylinderBottom" xml:space="preserve">
<value />
</data>
<data name="Jump" xml:space="preserve">
<value>Jump</value>
</data>
</root>

3
Properties/Resources.resx

@ -507,4 +507,7 @@
<data name="CylinderBottom" xml:space="preserve">
<value>CylinderBottom</value>
</data>
<data name="Jump" xml:space="preserve">
<value>Jump</value>
</data>
</root>

3
Properties/Resources.zh-CN.resx

@ -507,4 +507,7 @@
<data name="CylinderBottom" xml:space="preserve">
<value>缸底</value>
</data>
<data name="Jump" xml:space="preserve">
<value>跳步</value>
</data>
</root>

3
Properties/Resources.zh-TW.resx

@ -507,4 +507,7 @@
<data name="CylinderBottom" xml:space="preserve">
<value />
</data>
<data name="Jump" xml:space="preserve">
<value />
</data>
</root>

18
UserClass/APILog.cs

@ -17,6 +17,7 @@ namespace DyeingComputer.UserClass
{
private static SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly static string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
private readonly static string LOGAddress = Environment.CurrentDirectory + "\\DataBase\\LOG.db"; //数据库路径
public async static void DBlog(string Name ,string ID ,string Api,string MESSAGE)
{
@ -36,7 +37,24 @@ namespace DyeingComputer.UserClass
API_LOG.Clear();
});
}
public async static void LOGlog(string WorkOrder, string TYPE, string Command, string MESSAGE)
{
await Task.Run(() =>
{
Dictionary<string, object> API_LOG = new Dictionary<string, object>();//缓存函数
API_LOG.Add("WorkOrder", WorkOrder);
API_LOG.Add("TYPE", TYPE);
API_LOG.Add("Command", Command);
API_LOG.Add("MESSAGE", MESSAGE);
API_LOG.Add("TIME", MainWindowViewModel.SYSTime);
SQLiteHelpers = new SQLiteHelper(LOGAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
SQLiteHelpers.InsertData("OperationLog", API_LOG);//行插入
SQLiteHelpers.Close(); //关闭连接
API_LOG.Clear();
});
}
}
}

2
View/TechnologicalProcessView.xaml

@ -194,6 +194,8 @@
Click="ProgramgroupView_del_Click" IsEnabled="{Binding UserButton}"/>
<Button Content="{x:Static lang:Resources.Insert}" x:Name="ProgramgroupView_Insert" FontSize="20" HorizontalAlignment="Left" Height="40" VerticalAlignment="Top" Width="200" Background="White"
Click="ProgramgroupView_Insert_Click" IsEnabled="{Binding UserButton}"/>
<Button Content="{x:Static lang:Resources.Jump}" x:Name="ProgramgroupView_Jump" FontSize="20" HorizontalAlignment="Left" Height="40" VerticalAlignment="Top" Width="200" Background="White"
Click="ProgramgroupView_Jump_Click" IsEnabled="{Binding UserButton}"/>
<Button Content="{x:Static lang:Resources.R_P}" x:Name="ProgramgroupView_run" FontSize="20" HorizontalAlignment="Left" Height="40" VerticalAlignment="Top" Width="200" Background="White"
Click="ProgramgroupView_run_Click" Command="{Binding ProgramgroupView_run}"/>
<Button Content="{x:Static lang:Resources.StopProcess}" x:Name="ProgramgroupView_stop" FontSize="20" HorizontalAlignment="Left" Height="40" VerticalAlignment="Top" Width="200" Background="White"

46
View/TechnologicalProcessView.xaml.cs

@ -202,16 +202,17 @@ namespace DyeingComputer.View
private void Parameter_set_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
string ID;
string VID;
string newValue = (e.EditingElement as TextBox).Text;//获得输入单元格信息
int rownum = Parameter_set.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
ID = (Parameter_set.Columns[2].GetCellContent(Parameter_set.Items[rownum]) as TextBlock).Text;//定位第0列,
string Vname = (Parameter_set.Columns[0].GetCellContent(Parameter_set.Items[rownum]) as TextBlock).Text;//定位第0列,
VID = (Parameter_set.Columns[2].GetCellContent(Parameter_set.Items[rownum]) as TextBlock).Text;//定位第列,
try
{
if (ID == "ClothWheel")
if (VID == "ClothWheel")
{
MainWindowViewModel.Updata_dtm("1025", Convert.ToDouble(newValue));
MainWindowViewModel.Updata_dtm("1026", Convert.ToDouble(newValue));
@ -230,12 +231,16 @@ namespace DyeingComputer.View
{
int i = Convert.ToInt16(newValue);
if (i > 999) i = 999;
if ((ID == "1020") || (ID == "1021") || (ID == "1041"))
if ((VID == "1020") || (VID == "1021") || (VID == "1041"))
{
if (i > 100) i = 100;
}
MainWindowViewModel.Updata_dtm(ID, i);
MainWindowViewModel.Updata_dtm(VID, i);
}
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Parameter",
"ID=" + VID + ";Name=" + Vname + ";Value="+newValue);
}
catch { }
ParameterSet_d();
@ -347,6 +352,7 @@ namespace DyeingComputer.View
{
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();
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Edit", "STEP = " + ID);
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5);
viewstop.data = ID;
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
@ -390,6 +396,10 @@ namespace DyeingComputer.View
SQLiteHelpers.InsertData("RUN", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
}
SQLiteHelpers.Close(); //关闭连接
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "STEP = " + n,
"StepID="+ e.StepID + ";StepName="+ e.StepNAME+";P1="+ e.P1+
";P2="+ e.P2+";P3="+ e.P3+";P4="+ e.P4+";P5="+ e.P5);
}
public static void Dat()//行号刷新
{
@ -434,6 +444,7 @@ namespace DyeingComputer.View
}
SQLiteHelpers.Close(); //关闭连接
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Delete", "STEP = " + ID);
}
private void ProgramgroupView_Insert_Click(object sender, RoutedEventArgs e)//插入
@ -454,9 +465,9 @@ namespace DyeingComputer.View
sql.Tables[0].Rows.InsertAt(dr, d - 1);
// ID = null;
Dat();
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Insert", "STEP = "+ID);
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(null, "0", "0", "0", "0", "0");
@ -496,20 +507,37 @@ namespace DyeingComputer.View
if (MainWindowViewModel.WORK_RUN == 2)
{
MainWindowViewModel.WORK_RUN = 1;// 运行时停止键为暂停
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "WORK_RUN = Pause", MainWindowViewModel.WORK_RUN.ToString());
}
else
{
MainWindowViewModel.WORK_RUN = 2;// 运行时停止键为
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "WORK_RUN = RUN", MainWindowViewModel.WORK_RUN.ToString());
}
}
private void ProgramgroupView_Jump_Click(object sender, RoutedEventArgs e)
{
MainWindowViewModel.RUN_STEPID = Convert.ToInt16(ID);//插入步骤号
MainWindowViewModel.STEP_START(Numder, Convert.ToDouble(P1),Convert.ToDouble(P2), Convert.ToDouble(P3),
Convert.ToDouble(P4), Convert.ToDouble(P5));
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "Jump", "STEP = " + ID+
";StepID=" + Numder + ";P1=" + P1 + ";P2=" + P2 + ";P3=" + P3 + ";P4=" + P4 + ";P5=" + P5);
}//跳步
private void ProgramgroupView_stop_Click(object sender, RoutedEventArgs e)//结束工艺
{
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "WORK_RUN = STOP", MainWindowViewModel.WORK_RUN.ToString());
MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(Properties.Resources.StopProcess, "800", MessageBoxButton.OKCancel);
if (messageBoxResult == MessageBoxResult.OK)
{
MainWindowViewModel.WORK_RUN = 0;// 运行时停止键为
MainWindowViewModel.DIDETime = 0;
APILog.LOGlog(MainWindowViewModel.WorkNumder.ToString(), "UserActions", "PROCESS_END", MainWindowViewModel.WORK_RUN.ToString());
MainWindowViewModel.dt_TP.Rows.Clear();
ProgramgroupView_stop.IsEnabled = false;
@ -521,7 +549,7 @@ namespace DyeingComputer.View
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (MainWindowViewModel.WORK_RUN == 2) GridSTEP.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
// if (MainWindowViewModel.WORK_RUN == 2) GridSTEP.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
int rownum = GridSTEP.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
@ -533,9 +561,7 @@ namespace DyeingComputer.View
P4 = (GridSTEP.Columns[9].GetCellContent(GridSTEP.Items[rownum]) as TextBlock).Text;//定位第9列,
P5 = (GridSTEP.Columns[10].GetCellContent(GridSTEP.Items[rownum]) as TextBlock).Text;//定位第10列,
ProgramgroupView_edit.IsEnabled = true;
ProgramgroupView_del.IsEnabled = true;
ProgramgroupView_Insert.IsEnabled = true;
}
}

2
ViewModel/MainWindowViewModel.cs

@ -1728,7 +1728,7 @@ namespace DyeingComputer.ViewModel
}
public async void TechnologicalProcess_view()//显示
{
if (ViewID == 1)
if (ViewID == 1 && !UserButton)
{
await Task.Run(() =>
{

Loading…
Cancel
Save