Exchanget添加记录
This commit is contained in:
commit
ba202dcd61
2 files changed
+38
No files matched your search
@@ -82,5 +82,39 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
|
||||
directoryInfo.Create();
|
||||
}
|
||||
}
|
||||
public static void ExchangeDATA(string dat)
|
||||
{
|
||||
string Log_time = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
string logpath = System.Environment.CurrentDirectory + "\\Exchange";//日志文件目录
|
||||
// string logPathtxt = "" + System.Environment.CurrentDirectory + "\\Log\\"+ Log_time + "Log.txt";//日志文件
|
||||
// System.IO.DirectoryInfo log = new System.IO.DirectoryInfo();//生成日志文件目录
|
||||
string log_path = logpath + "\\Exchange" + Log_time + ".txt";
|
||||
string Log_timehms = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
if (Directory.Exists(logpath))//检查日志路径
|
||||
{
|
||||
if (!File.Exists(log_path))//检查文件并写入
|
||||
{
|
||||
// FileStream fs = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建文件
|
||||
// StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||
// wr.Close();
|
||||
FileStream fil = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建写入文件
|
||||
StreamWriter wfil = new StreamWriter(fil);//创建文件
|
||||
wfil.WriteLine("[" + Log_timehms + "];[Exchange] ||" + dat);
|
||||
wfil.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
FileStream fs = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件
|
||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||
wr.WriteLine("[" + Log_timehms + "];[Exchange] ||" + dat);
|
||||
wr.Close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DirectoryInfo directoryInfo = new DirectoryInfo(logpath);
|
||||
directoryInfo.Create();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,6 +213,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
}
|
||||
SQLiteHelpers.Close(); //关闭连接
|
||||
|
||||
LogGing.ExchangeDATA("Dyelot=" + comboBoxWorkOrder.Text + ";Machine=" + comboBoxMachine.Text +
|
||||
";Program=" + comboBoxProgram.Text + ";User=" + TEXTUSER.Text + ";");
|
||||
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
ProductionPlanningView.UI = true;
|
||||
}
|
||||
@@ -511,6 +514,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
color.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(
|
||||
"#FF" + colorValue.Substring(4, 2) + colorValue.Substring(2, 2) + colorValue.Substring(0, 2)));
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user