|
@@ -157,7 +157,7 @@ namespace UAS_AutoPass
|
|
|
}
|
|
|
}
|
|
|
//存在工单必须是已下放状态
|
|
|
- if (!dh.CheckExist("make", "ma_statuscode='STARTED' and ma_code='" + ma_code.Text + "'") && ma_code.Text != ""&&Device.Text=="AOI设备")
|
|
|
+ if (!dh.CheckExist("make", "ma_statuscode='STARTED' and ma_code='" + ma_code.Text + "'") && ma_code.Text != "" && Device.Text == "AOI设备")
|
|
|
{
|
|
|
OperateResult.AppendText("工单不存在或者未下放\n");
|
|
|
return;
|
|
@@ -227,15 +227,15 @@ namespace UAS_AutoPass
|
|
|
List<string> badcode = new List<string>();
|
|
|
List<string> badlocation = new List<string>();
|
|
|
List<string> badprod = new List<string>();
|
|
|
- StreamReader sR = File.OpenText(FileName);
|
|
|
-
|
|
|
- string[] data1 = null;
|
|
|
- while ((nextLine = sR.ReadLine()) != null)
|
|
|
- {
|
|
|
- data1 = nextLine.Split(';');
|
|
|
- }
|
|
|
if (Device.Text == "AOI设备")
|
|
|
{
|
|
|
+ StreamReader sR = File.OpenText(FileName);
|
|
|
+
|
|
|
+ string[] data1 = null;
|
|
|
+ while ((nextLine = sR.ReadLine()) != null)
|
|
|
+ {
|
|
|
+ data1 = nextLine.Split(';');
|
|
|
+ }
|
|
|
string SoftVersion = data1[0];
|
|
|
List<string[]> dic = new List<string[]>();
|
|
|
List<string> sndata = new List<string>();
|
|
@@ -407,31 +407,31 @@ namespace UAS_AutoPass
|
|
|
LogicHandler.AutoPassLog(SN, isource, makecode, Day + Time, istepcode, ilinecode, SoftVersion, Result == "NG" ? "-1" : "0", "0", MissTest, TotalPart, NGPart);
|
|
|
FileName = FileName.Substring(FileName.LastIndexOf(@"\") + 1);
|
|
|
FileInfo file = new FileInfo(FolderPath.Text + @"\" + FileName);
|
|
|
- //if (file.Exists)
|
|
|
- //{
|
|
|
- // try
|
|
|
- // {
|
|
|
- // for (int i = 1; i <= 20; i++)
|
|
|
- // {
|
|
|
- // if (!File.Exists(BackUpFolderPath.Text + @"\" + FileName))
|
|
|
- // {
|
|
|
- // file.MoveTo(BackUpFolderPath.Text + @"\" + FileName);
|
|
|
- // OperateResult.AppendText("成功解析文件" + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + " " + FileName + "\n");
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // else if (!File.Exists(BackUpFolderPath.Text + @"\" + FileName.Split('.')[0] + "(" + i + ")" + "." + FileName.Split('.')[1]))
|
|
|
- // {
|
|
|
- // file.MoveTo(BackUpFolderPath.Text + @"\" + FileName.Split('.')[0] + "(" + i + ")" + "." + FileName.Split('.')[1]);
|
|
|
- // OperateResult.AppendText("成功解析文件" + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + " " + FileName + "\n");
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // catch (Exception ex)
|
|
|
- // {
|
|
|
- // OperateResult.AppendText(FileName + ex.Message + "\n");
|
|
|
- // }
|
|
|
- //}
|
|
|
+ if (file.Exists)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ for (int i = 1; i <= 20; i++)
|
|
|
+ {
|
|
|
+ if (!File.Exists(BackUpFolderPath.Text + @"\" + FileName))
|
|
|
+ {
|
|
|
+ file.MoveTo(BackUpFolderPath.Text + @"\" + FileName);
|
|
|
+ OperateResult.AppendText("成功解析文件" + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + " " + FileName + "\n");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ else if (!File.Exists(BackUpFolderPath.Text + @"\" + FileName.Split('.')[0] + "(" + i + ")" + "." + FileName.Split('.')[1]))
|
|
|
+ {
|
|
|
+ file.MoveTo(BackUpFolderPath.Text + @"\" + FileName.Split('.')[0] + "(" + i + ")" + "." + FileName.Split('.')[1]);
|
|
|
+ OperateResult.AppendText("成功解析文件" + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + " " + FileName + "\n");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(FileName + ex.Message + "\n");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -444,21 +444,28 @@ namespace UAS_AutoPass
|
|
|
}
|
|
|
else if (Device.Text == "选焊设备")
|
|
|
{
|
|
|
- Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
- BaseUtil.GetWriteInfo(FileName, out dic);
|
|
|
- string sql = "insert into AOITESTDETAIL(atd_id,atd_makecode,atd_indate,";
|
|
|
- string sql1 = " values(AOITESTDETAIL_seq.nextval,'" + ma_code.Text + "',sysdate,";
|
|
|
- foreach (var item in dic)
|
|
|
+ try
|
|
|
{
|
|
|
- sql += item.Key + ",";
|
|
|
- if (item.Key.Contains("starttime") || item.Key.Contains("endtime"))
|
|
|
- sql1 += "to_date('" + item.Value + "','yyyy/mm/dd hh24:mi:ss'),";
|
|
|
- else
|
|
|
- sql1 += "'" + item.Value + "',";
|
|
|
+ Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
+ BaseUtil.GetWriteInfo(FileName, out dic);
|
|
|
+ string sql = "insert into AOITESTDETAIL(atd_id,atd_makecode,atd_indate,";
|
|
|
+ string sql1 = " values(AOITESTDETAIL_seq.nextval,'" + ma_code.Text + "',sysdate,";
|
|
|
+ foreach (var item in dic)
|
|
|
+ {
|
|
|
+ sql += item.Key + ",";
|
|
|
+ if (item.Key.Contains("starttime") || item.Key.Contains("endtime"))
|
|
|
+ sql1 += "to_date('" + item.Value + "','dd/mm/yyyy hh24:mi:ss'),";
|
|
|
+ else
|
|
|
+ sql1 += "'" + item.Value + "',";
|
|
|
+ }
|
|
|
+ sql = sql.Substring(0, sql.Length - 1) + ")" + sql1.Substring(0, sql1.Length - 1) + ")";
|
|
|
+ dh.ExecuteSql(sql, "insert");
|
|
|
+ OperateResult.AppendText("解析成功:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n" + FileName + "\n");
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText("解析失败:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n" + FileName + "\n" + e.Message + "\n");
|
|
|
}
|
|
|
-
|
|
|
- sql = sql.Substring(0, sql.Length - 1) + ")" + sql1.Substring(0, sql1.Length - 1) + ")";
|
|
|
- dh.ExecuteSql(sql, "insert");
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|