log信息添加
This commit is contained in:
commit
3bdeeb028d
4 files changed
+67
No files matched your search
@@ -17,6 +17,7 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Security.Policy;
|
using System.Security.Policy;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace formula_manage
|
namespace formula_manage
|
||||||
{
|
{
|
||||||
@@ -25,10 +26,31 @@ namespace formula_manage
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Login : Window
|
public partial class Login : Window
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录
|
||||||
|
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\Log.txt";//日志文件
|
||||||
|
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
|
||||||
|
|
||||||
public Login()
|
public Login()
|
||||||
{
|
{
|
||||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录
|
||||||
|
if (!File.Exists(logPath))//检查日志文件并写入启动日志
|
||||||
|
{
|
||||||
|
FileStream fs = new FileStream(logPath, FileMode.CreateNew, FileAccess.Write);//创建写入文件
|
||||||
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
|
wr.WriteLine(Log_time + "FORMULA_start");
|
||||||
|
wr.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
|
||||||
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
|
wr.WriteLine(Log_time + "FORMULA_start");
|
||||||
|
wr.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e) //退出按钮事件
|
private void Button_Click(object sender, RoutedEventArgs e) //退出按钮事件
|
||||||
|
|||||||
@@ -41,6 +41,10 @@
|
|||||||
<MenuItem Header="_统计" FontSize="16"/>
|
<MenuItem Header="_统计" FontSize="16"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|
||||||
|
<TextBox x:Name="USERTIME" HorizontalAlignment="Right" Height="30" Margin="0,0,5,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="14"
|
||||||
|
Background="{x:Null}" BorderBrush="{x:Null}" SelectionBrush="{x:Null}" IsReadOnly="True" IsUndoEnabled="False" MaxLines="1" IsEnabled="False"/>
|
||||||
|
|
||||||
<Button Content="新工单" HorizontalAlignment="Left" Margin="335,35,0,0" Height="30" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" FontSize="20" Click="Button_NewOrder" Focusable ="False"/>
|
<Button Content="新工单" HorizontalAlignment="Left" Margin="335,35,0,0" Height="30" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" FontSize="20" Click="Button_NewOrder" Focusable ="False"/>
|
||||||
<Button Content="归属订单" HorizontalAlignment="Left" Margin="300,70,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Technology"/>
|
<Button Content="归属订单" HorizontalAlignment="Left" Margin="300,70,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Technology"/>
|
||||||
<Button Content="预设工艺" HorizontalAlignment="Left" Margin="300,105,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Technology"/>
|
<Button Content="预设工艺" HorizontalAlignment="Left" Margin="300,105,0,0" Height="30" VerticalAlignment="Top" Width="105" Background="#FFF9F9F9" FontSize="20" Focusable ="False" Click="Button_Technology"/>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -31,6 +32,9 @@ namespace formula_manage
|
|||||||
|
|
||||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this.Closing += Window_Closing; //添加窗口关闭事件
|
||||||
|
|
||||||
|
CountDown();//执行循环方法
|
||||||
|
|
||||||
DataTable dataTable = new DataTable();
|
DataTable dataTable = new DataTable();
|
||||||
dataTable.Columns.Add("ID", typeof(int));
|
dataTable.Columns.Add("ID", typeof(int));
|
||||||
@@ -56,6 +60,33 @@ namespace formula_manage
|
|||||||
DetailedGrid.ItemsSource = dataTable.DefaultView;
|
DetailedGrid.ItemsSource = dataTable.DefaultView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) //窗口关闭事件
|
||||||
|
{
|
||||||
|
string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录
|
||||||
|
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\Log.txt";//日志文件
|
||||||
|
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
|
||||||
|
|
||||||
|
System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录
|
||||||
|
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
|
||||||
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
|
wr.WriteLine(Log_time + "FORMULA_STOP");
|
||||||
|
wr.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private DispatcherTimer disTimer = new DispatcherTimer();//循环功能
|
||||||
|
|
||||||
|
public void DisTimer_Tick(object sender, EventArgs e)//循环事件
|
||||||
|
{
|
||||||
|
USERTIME.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
public void CountDown()
|
||||||
|
{
|
||||||
|
//设置定时器
|
||||||
|
disTimer.Tick += new EventHandler(DisTimer_Tick);//每一秒执行的方法
|
||||||
|
disTimer.Interval = new TimeSpan(10000000); //时间间隔为一秒。
|
||||||
|
disTimer.Start();//计时开始
|
||||||
|
}
|
||||||
|
|
||||||
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能
|
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能
|
||||||
{
|
{
|
||||||
if (e.Key == Key.Enter)
|
if (e.Key == Key.Enter)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -27,6 +28,9 @@ namespace formula_manage.Windows
|
|||||||
}
|
}
|
||||||
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini";
|
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini";
|
||||||
|
|
||||||
|
string logpath = System.Environment.CurrentDirectory + "\\Log";//日志文件目录
|
||||||
|
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\Log.txt";//日志文件
|
||||||
|
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
|
||||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) //窗口关闭事件
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) //窗口关闭事件
|
||||||
{
|
{
|
||||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||||
@@ -37,6 +41,12 @@ namespace formula_manage.Windows
|
|||||||
Configini.IniWritevalue("SOFTWARE_SET", " T1", Prepose.Text);
|
Configini.IniWritevalue("SOFTWARE_SET", " T1", Prepose.Text);
|
||||||
Configini.IniWritevalue("SOFTWARE_SET", " T2", TimeFormat.Text);
|
Configini.IniWritevalue("SOFTWARE_SET", " T2", TimeFormat.Text);
|
||||||
Configini.IniWritevalue("SOFTWARE_SET", " T3", Order.Text);
|
Configini.IniWritevalue("SOFTWARE_SET", " T3", Order.Text);
|
||||||
|
|
||||||
|
System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录
|
||||||
|
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
|
||||||
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
|
wr.WriteLine(Log_time + "FORMULA_SET:INIFile_Write");
|
||||||
|
wr.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Loginlink;
|
bool Loginlink;
|
||||||
|
|||||||
Reference in new issue
Block a user