You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
3.4 KiB
C#
80 lines
3.4 KiB
C#
using NPOI.OpenXmlFormats.Dml.Chart;
|
|
using Rs.Framework;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Rs.MotionPlat.Commom
|
|
{
|
|
public static class DevLog
|
|
{
|
|
private static string fileDir = "D:\\Break_Event_Summary_Unit";
|
|
public static void EventTracker(string keyword,int errorcode,string errormsg,string message)
|
|
{
|
|
string filename = $"{fileDir}\\{DateTime.Now.ToString("yyyyMMdd")}\\EventTracker_{DateTime.Now.ToString("yyyyMMdd")}.csv";
|
|
string csvTitle = "VERSION,SITEID,PROJECTID,MACHINEID,DATE,TIME,LOT NAME,LOGIN MODE,KEYWORD,ERROR CODE,ERROR MESSAGE,MESSAGE\r\n";
|
|
if(!Directory.Exists(Path.GetDirectoryName(filename)))
|
|
{
|
|
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
|
}
|
|
if(!File.Exists(filename))
|
|
{
|
|
File.AppendAllText(filename, csvTitle);
|
|
}
|
|
string v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
|
string content = $"{v},{GlobalVar.SiteID},{GlobalVar.ProjectID},{GlobalVar.MachineID},{DateTime.Now.ToString("yyyy-MM-dd")},{DateTime.Now.ToString("HH:mm:ss")},{GlobalVar.LotName.Replace("\r\n","")},OP,{keyword},{errorcode},{errormsg},{message}\r\n";
|
|
File.AppendAllText(filename, content);
|
|
}
|
|
|
|
public static void Breakdown(string category,string detail)
|
|
{
|
|
string filename = $"{fileDir}\\{DateTime.Now.ToString("yyyyMMdd")}\\EventTracker_{DateTime.Now.ToString("yyyyMMdd")}.csv";
|
|
string csvTitle = "Machin,Tester Category,Tester_Sequence_Item Detail,TimeStamp,Time(ms)\r\n";
|
|
if (!Directory.Exists(Path.GetDirectoryName(filename)))
|
|
{
|
|
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
|
}
|
|
if (!File.Exists(filename))
|
|
{
|
|
File.AppendAllText(filename, csvTitle);
|
|
}
|
|
string v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
|
string content = $"{GlobalVar.MachineID},{category},{detail},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")},0\r\n";
|
|
File.AppendAllText(filename, content);
|
|
}
|
|
|
|
public static void UnitTracker()
|
|
{
|
|
string filename = "";
|
|
string csvTitle = "SiteID,ProjectID,MachineID,Date,Time,LotName,LoginMode,Serial Number,Socker ID,Test Result,Trial,Socket Usage";
|
|
if (!File.Exists(filename))
|
|
{
|
|
File.AppendAllText(filename, csvTitle);
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
public static void Summary(string csvTitle,string content)
|
|
{
|
|
string filename = $"{fileDir}\\{DateTime.Now.ToString("yyyyMMdd")}\\Summary_{DateTime.Now.ToString("yyyyMMdd")}.csv";
|
|
if (!Directory.Exists(Path.GetDirectoryName(filename)))
|
|
{
|
|
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
|
}
|
|
if (!File.Exists(filename))
|
|
{
|
|
File.AppendAllText(filename, csvTitle);
|
|
}
|
|
string v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
|
File.AppendAllText(filename, content);
|
|
}
|
|
}
|
|
}
|