|
@@ -55,6 +55,8 @@ namespace UAS_MES_NEW.Make
|
|
|
string upRes = ParseIperfBitrate(currLog);
|
|
string upRes = ParseIperfBitrate(currLog);
|
|
|
|
|
|
|
|
string sn = Path.GetFileName(currLog).Split('_')[0];
|
|
string sn = Path.GetFileName(currLog).Split('_')[0];
|
|
|
|
|
+ UpdateSN("L", sn);
|
|
|
|
|
+
|
|
|
SQL.Clear();
|
|
SQL.Clear();
|
|
|
SQL.Append($@"SELECT ms_sncode,ma_code,pr_code,pr_spec FROM makeserial,make,product WHERE ms_sncode = '{sn}' AND ms_makecode = ma_code AND ms_prodcode = pr_code");
|
|
SQL.Append($@"SELECT ms_sncode,ma_code,pr_code,pr_spec FROM makeserial,make,product WHERE ms_sncode = '{sn}' AND ms_makecode = ma_code AND ms_prodcode = pr_code");
|
|
|
dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
|
|
dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
|
|
@@ -71,6 +73,30 @@ namespace UAS_MES_NEW.Make
|
|
|
string tDetail = $"upRate/{upRes};downRate/{downRes}";
|
|
string tDetail = $"upRate/{upRes};downRate/{downRes}";
|
|
|
|
|
|
|
|
CheckPassStation(wo, sn, "PASS", tDetail);
|
|
CheckPassStation(wo, sn, "PASS", tDetail);
|
|
|
|
|
+
|
|
|
|
|
+ using (StreamReader SR = new StreamReader(currLog, Encoding.GetEncoding("GBK")))
|
|
|
|
|
+ {
|
|
|
|
|
+ string Content = SR.ReadToEnd();
|
|
|
|
|
+ SR.Close();
|
|
|
|
|
+ SR.Dispose();
|
|
|
|
|
+ if (ConsoleLog(Content, currLog, $"{sn}_up.log"))
|
|
|
|
|
+ {
|
|
|
|
|
+ File.WriteAllText(currLog, string.Empty);
|
|
|
|
|
+ File.Delete(currLog);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ using (StreamReader SR = new StreamReader(downLog, Encoding.GetEncoding("GBK")))
|
|
|
|
|
+ {
|
|
|
|
|
+ string Content = SR.ReadToEnd();
|
|
|
|
|
+ SR.Close();
|
|
|
|
|
+ SR.Dispose();
|
|
|
|
|
+ if (ConsoleLog(Content, currLog, $"{sn}_down.log"))
|
|
|
|
|
+ {
|
|
|
|
|
+ File.WriteAllText(currLog, string.Empty);
|
|
|
|
|
+ File.Delete(currLog);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
string[] failFiles = Directory.GetFiles(failPath, $"*up.log");
|
|
string[] failFiles = Directory.GetFiles(failPath, $"*up.log");
|
|
@@ -78,6 +104,8 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
{
|
|
|
string upRes = ParseIperfBitrate(currLog);
|
|
string upRes = ParseIperfBitrate(currLog);
|
|
|
string sn = Path.GetFileName(currLog).Split('_')[0];
|
|
string sn = Path.GetFileName(currLog).Split('_')[0];
|
|
|
|
|
+ UpdateSN("L", sn);
|
|
|
|
|
+
|
|
|
SQL.Clear();
|
|
SQL.Clear();
|
|
|
SQL.Append($@"SELECT ms_sncode,ma_code,pr_code,pr_spec FROM makeserial,make,product WHERE ms_sncode = '{sn}' AND ms_makecode = ma_code AND ms_prodcode = pr_code");
|
|
SQL.Append($@"SELECT ms_sncode,ma_code,pr_code,pr_spec FROM makeserial,make,product WHERE ms_sncode = '{sn}' AND ms_makecode = ma_code AND ms_prodcode = pr_code");
|
|
|
dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
|
|
dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
|
|
@@ -94,6 +122,30 @@ namespace UAS_MES_NEW.Make
|
|
|
string tDetail = $"upRate/{upRes};downRate/{downRes}";
|
|
string tDetail = $"upRate/{upRes};downRate/{downRes}";
|
|
|
|
|
|
|
|
CheckPassStation(wo, sn, "PASS", tDetail);
|
|
CheckPassStation(wo, sn, "PASS", tDetail);
|
|
|
|
|
+
|
|
|
|
|
+ using (StreamReader SR = new StreamReader(currLog, Encoding.GetEncoding("GBK")))
|
|
|
|
|
+ {
|
|
|
|
|
+ string Content = SR.ReadToEnd();
|
|
|
|
|
+ SR.Close();
|
|
|
|
|
+ SR.Dispose();
|
|
|
|
|
+ if (ConsoleLog(Content, currLog, $"{sn}_up.log"))
|
|
|
|
|
+ {
|
|
|
|
|
+ File.WriteAllText(currLog, string.Empty);
|
|
|
|
|
+ File.Delete(currLog);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ using (StreamReader SR = new StreamReader(downLog, Encoding.GetEncoding("GBK")))
|
|
|
|
|
+ {
|
|
|
|
|
+ string Content = SR.ReadToEnd();
|
|
|
|
|
+ SR.Close();
|
|
|
|
|
+ SR.Dispose();
|
|
|
|
|
+ if (ConsoleLog(Content, currLog, $"{sn}_down.log"))
|
|
|
|
|
+ {
|
|
|
|
|
+ File.WriteAllText(currLog, string.Empty);
|
|
|
|
|
+ File.Delete(currLog);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
private void CheckPassStation(string wo,string sn, string testRes, string testDetail)
|
|
private void CheckPassStation(string wo,string sn, string testRes, string testDetail)
|
|
@@ -185,6 +237,11 @@ namespace UAS_MES_NEW.Make
|
|
|
return rVal2;
|
|
return rVal2;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void Clear_Click(object sender, EventArgs e)
|
|
|
|
|
+ {
|
|
|
|
|
+ OperatResult.Clear();
|
|
|
|
|
+ UpdateSN("C", "");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
private void ShowMsg(int type, string msg)
|
|
private void ShowMsg(int type, string msg)
|
|
|
{
|
|
{
|
|
@@ -256,5 +313,33 @@ namespace UAS_MES_NEW.Make
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private bool ConsoleLog(string Content, string PathName, string SN)
|
|
|
|
|
+ {
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ string sourcePaht = Path.GetDirectoryName(PathName);
|
|
|
|
|
+ string changeName = Path.Combine(sourcePaht, SN);
|
|
|
|
|
+
|
|
|
|
|
+ string newFolderName = "Logs";
|
|
|
|
|
+ string newFolderPath = Path.Combine(sourcePaht, newFolderName);
|
|
|
|
|
+
|
|
|
|
|
+ if (!Directory.Exists(newFolderPath))
|
|
|
|
|
+ {
|
|
|
|
|
+ Directory.CreateDirectory(newFolderPath);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ string newFileName = "Log_" + Path.GetFileName(changeName);
|
|
|
|
|
+ string newFilePath = Path.Combine(newFolderPath, newFileName);
|
|
|
|
|
+
|
|
|
|
|
+ File.AppendAllText(newFilePath, Content + Environment.NewLine);
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (Exception ex)
|
|
|
|
|
+ {
|
|
|
|
|
+ MessageBox.Show(this.ParentForm, ex.Message, "警告");
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|