|
@@ -13,6 +13,9 @@ namespace MaterialPrint
|
|
|
{
|
|
|
public partial class ReadTestInfo : Form
|
|
|
{
|
|
|
+
|
|
|
+ DataHelper dh = new DataHelper();
|
|
|
+
|
|
|
public ReadTestInfo()
|
|
|
{
|
|
|
InitializeComponent();
|
|
@@ -25,6 +28,7 @@ namespace MaterialPrint
|
|
|
TestItem.Add("Keypad", "按键测试");
|
|
|
TestItem.Add("Battery", "电池测试");
|
|
|
TestItem.Add("FrontCameraRec", "前摄像头摄像");
|
|
|
+ TestItem.Add("FrontCamera", "前摄像头拍照");
|
|
|
TestItem.Add("Brightness", "背光测试");
|
|
|
TestItem.Add("Display", "显示屏测试");
|
|
|
TestItem.Add("ExtDisplay", "外接显示器");
|
|
@@ -47,30 +51,91 @@ namespace MaterialPrint
|
|
|
TestItem.Add("Gyrometer", "陀螺仪测试");
|
|
|
TestItem.Add("Light", "光感测试");
|
|
|
TestItem.Add("Compass", "指南针");
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static void GetWriteInfo(string FilePath, out Dictionary<string, string> Dic)
|
|
|
+ public void GetWriteInfo(string FilePath)
|
|
|
{
|
|
|
- Dic = new Dictionary<string, string>();
|
|
|
- string txt = "";
|
|
|
+ Dictionary<string, string> Dic = new Dictionary<string, string>();
|
|
|
StreamReader sr = new StreamReader(FilePath);
|
|
|
+ DataTable dt = new DataTable();
|
|
|
+ dt.Columns.Add("itemname");
|
|
|
+ dt.Columns.Add("testresult");
|
|
|
while (!sr.EndOfStream)
|
|
|
{
|
|
|
string str = sr.ReadLine();
|
|
|
- txt += str + "\n";
|
|
|
+ string Value = Regex.Match(str, @"\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}.\d{3}\t\[Info] - (PASS|FAIL)\t\S+").Value;
|
|
|
+ if (Value != "")
|
|
|
+ {
|
|
|
+ if (Dic.ContainsKey(Value.Split('\t')[2]))
|
|
|
+ Dic.Remove(Value.Split('\t')[2]);
|
|
|
+ Dic.Add(Value.Split('\t')[2], Value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ResultView.DataSource = dt;
|
|
|
+
|
|
|
+ foreach (var item in Dic)
|
|
|
+ {
|
|
|
+ string time = item.Value.Split('\t')[0];
|
|
|
+ string result = item.Value.Split('\t')[1].Contains("PASS") ? "PASS" : "FAIL";
|
|
|
+ string itemname = TestItem.ContainsKey(item.Key) ? TestItem[item.Key] : item.Key;
|
|
|
+ DataRow dr = dt.NewRow();
|
|
|
+ dr["itemname"] = itemname;
|
|
|
+ dr["testresult"] = item.Value;
|
|
|
+ dt.Rows.Add(dr);
|
|
|
+ string sql = "insert into steptestdetail (std_id,std_sn,std_date,std_class,std_testresult,std_itemname)values";
|
|
|
+ sql += "(steptestdetail_seq.nextval,'" + SN.Text + "',to_timestamp('" + item.Value.Split('\t')[0] + "',";
|
|
|
+ sql += "'yyyy-mm-dd hh24:mi:ss.ff6'),'" + item.Key + "','" + result + "','" + itemname + "')";
|
|
|
+ dh.ExecuteSql(sql, "insert");
|
|
|
}
|
|
|
- Dic.Add("atd_sncode", FilePath.Substring(FilePath.LastIndexOf("\\") + 1).Replace(".txt", ""));
|
|
|
- Dic.Add("atd_software", Regex.Match(txt, "Program Name,\\S+").Value.Replace("Program Name,", ""));
|
|
|
- Dic.Add("atd_pot", Regex.Match(txt, "Board Segment,\\S+").Value.Replace("Board Segment,", ""));
|
|
|
- Dic.Add("atd_size", Regex.Match(txt, "Baord Size \\(L x W\\) \\[mm\\],\\S+").Value.Replace("Baord Size (L x W) [mm],", ""));
|
|
|
- Dic.Add("atd_pot1set", Regex.Match(txt, "Pot-1 Set Temp. \\[deg],\\S+").Value.Replace("Pot-1 Set Temp. [deg],", ""));
|
|
|
- Dic.Add("atd_pot2set", Regex.Match(txt, "Pot-2 Set Temp. \\[deg],\\S+").Value.Replace("Pot-2 Set Temp. [deg],", ""));
|
|
|
- Dic.Add("atd_pot1avgtemp", Regex.Match(txt, "Pot-1 Avg. Temp. \\[deg],\\S+").Value.Replace("Pot-1 Avg. Temp. [deg],", ""));
|
|
|
- Dic.Add("atd_pot2avgtemp", Regex.Match(txt, "Pot-2 Avg. Temp. \\[deg],\\S+").Value.Replace("Pot-2 Avg. Temp. [deg],", ""));
|
|
|
- Dic.Add("atd_boardtime", Regex.Match(txt, "Machine Duration \\[s],\\S+").Value.Replace("Machine Duration [s],", ""));
|
|
|
+ MessageBox.Show("测试记录保存成功");
|
|
|
+ }
|
|
|
|
|
|
- //开始时间
|
|
|
+ private void SN_KeyDown(object sender, KeyEventArgs e)
|
|
|
+ {
|
|
|
+ if (e.KeyData == Keys.Enter)
|
|
|
+ {
|
|
|
+ if (dh.CheckExist("makeserial", "ms_sncode='" + SN.Text + "' or ms_firstsn='" + SN.Text + "'"))
|
|
|
+ {
|
|
|
+ GetWriteInfo(@"C:\TEST_TOOL\SFTClassicLog.txt");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MessageBox.Show("序列号" + SN.Text + "不存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ResultView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
|
|
|
+ {
|
|
|
+ if (e.ColumnIndex >= 0)
|
|
|
+ {
|
|
|
+ if (ResultView.Columns[e.ColumnIndex].Name == "testresult")
|
|
|
+ {
|
|
|
+ if (e.RowIndex >= 0)
|
|
|
+ {
|
|
|
+ if (ResultView.Rows[e.RowIndex].Cells["testresult"].Value != null && (ResultView.Rows[e.RowIndex].Cells["testresult"].Value.ToString().Contains("PASS")))
|
|
|
+ {
|
|
|
+ e.Graphics.FillRectangle(Brushes.ForestGreen, e.CellBounds);
|
|
|
+ Rectangle border = e.CellBounds;
|
|
|
+ border.Width -= 1;
|
|
|
+ e.Graphics.DrawRectangle(Pens.Black, border);
|
|
|
+ e.PaintContent(e.CellBounds);
|
|
|
+ e.Handled = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ e.Graphics.FillRectangle(Brushes.OrangeRed, e.CellBounds);
|
|
|
+ Rectangle border = e.CellBounds;
|
|
|
+ border.Width -= 1;
|
|
|
+ e.Graphics.DrawRectangle(Pens.Black, border);
|
|
|
+ e.PaintContent(e.CellBounds);
|
|
|
+ e.Handled = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|