|
@@ -86,7 +86,7 @@ namespace UAS_AutoPass
|
|
|
stw.StartPosition = FormStartPosition.CenterScreen;
|
|
|
stw.ShowDialog();
|
|
|
List<string> CacheInf = new List<string>();
|
|
|
- DB = (DataTable)dh.ExecuteSql("select ms_pwd,ma_user,ma_address,ma_inneraddress from master", "select");
|
|
|
+ DB = (DataTable)dh.ExecuteSql("select ms_pwd,ma_user,ma_address,ma_inneraddress from master where ma_user='MES'", "select");
|
|
|
Master.DataSource = DB;
|
|
|
Master.DisplayMember = "ma_user";
|
|
|
Master.ValueMember = "ma_user";
|
|
@@ -103,7 +103,7 @@ namespace UAS_AutoPass
|
|
|
{
|
|
|
if (Master.Text == DB.Rows[i]["ma_user"].ToString())
|
|
|
{
|
|
|
- DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=" + DB.Rows[i]["ma_user"].ToString() + ";Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
|
|
|
+ DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=" + DB.Rows[i]["ma_user"].ToString() + ";Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.10)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
|
|
|
dh = new DataHelper();
|
|
|
}
|
|
|
}
|
|
@@ -151,7 +151,7 @@ namespace UAS_AutoPass
|
|
|
{
|
|
|
if (Master.Text == DB.Rows[i]["ma_user"].ToString())
|
|
|
{
|
|
|
- DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=" + DB.Rows[i]["ma_user"].ToString() + ";Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
|
|
|
+ DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=" + DB.Rows[i]["ma_user"].ToString() + ";Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.10)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
|
|
|
dh = new DataHelper();
|
|
|
LogicHandler.dh = new DataHelper();
|
|
|
}
|
|
@@ -193,7 +193,7 @@ namespace UAS_AutoPass
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- using (Stream stream = File.Open(e.FullPath, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
|
|
|
+ using (Stream stream = File.Open(e.FullPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
|
|
{
|
|
|
if (stream != null)
|
|
|
break;
|
|
@@ -219,85 +219,181 @@ namespace UAS_AutoPass
|
|
|
|
|
|
private void TxtHandleProcess(string FileName)
|
|
|
{
|
|
|
- //获取文件夹命名的SN号
|
|
|
- string sncode = FileName.Substring(FileName.LastIndexOf(@"\") + 1).Split('.')[0];
|
|
|
-
|
|
|
- //string makecode = "";
|
|
|
- //string oMSID = "";
|
|
|
- //string status = "";
|
|
|
- //string oErrMessage = "";
|
|
|
- //string test_result = "";
|
|
|
- //string test_date = "";
|
|
|
-
|
|
|
- //if (!LogicHandler.GetMakeInfo(sncode, out makecode, out status, out oErrMessage))
|
|
|
- //{
|
|
|
- // OperateResult.AppendText(oErrMessage + "\n");
|
|
|
- // tipform.startthread(oErrMessage, "NG");
|
|
|
- // return;
|
|
|
- //}
|
|
|
- //if (!LogicHandler.CheckStepSNAndMacode(ma_code.Text == "" ? makecode : ma_code.Text, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
|
|
|
- //{
|
|
|
- // OperateResult.AppendText(oErrMessage + "\n");
|
|
|
- // tipform.startthread(oErrMessage, "NG");
|
|
|
- // return;
|
|
|
- //}
|
|
|
-
|
|
|
- ////获取序列号ID最大的工单
|
|
|
- //dt = (DataTable)dh.ExecuteSql("select ms_makecode,ms_id from makeserial where ms_sncode='" + sncode + "' order by ms_id desc", "select");
|
|
|
- //if (dt.Rows.Count > 0)
|
|
|
- //{
|
|
|
- // ma_code.Text = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
- // makecode = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
- // switch (test_result)
|
|
|
- // {
|
|
|
- // case "OK":
|
|
|
- // if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out oErrMessage))
|
|
|
- // {
|
|
|
- // OperateResult.AppendText(oErrMessage + "\n");
|
|
|
- // tipform.startthread(oErrMessage, test_result);
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // tipform.startthread("序列号 " + sncode + "通过检测", test_result);
|
|
|
- // break;
|
|
|
- // case "NG":
|
|
|
- // //RecordBadInfo(sncode, makecode, FileName, "", badcode.ToArray(), badlocation.ToArray());
|
|
|
- // //所有的序列号均采集为良品
|
|
|
- // if (!LogicHandler.SetTestNGDetail(sncode, makecode, iusercode, isource, test_result, out oErrMessage))
|
|
|
- // {
|
|
|
- // OperateResult.AppendText(oErrMessage + "\n");
|
|
|
- // tipform.startthread(oErrMessage, test_result);
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // tipform.startthread("序列号 " + sncode + "未通过检测", test_result);
|
|
|
- // break;
|
|
|
- // default:
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, FileName, test_result == "NG" ? "1" : "0", "0");
|
|
|
- //}
|
|
|
-
|
|
|
List<string> badcode = new List<string>();
|
|
|
- List<string> location = new List<string>();
|
|
|
+ List<string> badlocation = new List<string>();
|
|
|
+ List<string> badprod = new List<string>();
|
|
|
StreamReader sR = File.OpenText(FileName);
|
|
|
string nextLine;
|
|
|
- int Line = 0;
|
|
|
string[] data = null;
|
|
|
while ((nextLine = sR.ReadLine()) != null)
|
|
|
{
|
|
|
- Line = Line + 1;
|
|
|
- if (Line == 3)
|
|
|
+ data = nextLine.Split(';');
|
|
|
+ }
|
|
|
+ string SoftVersion = "";
|
|
|
+ string SN = "";
|
|
|
+ string Machine = "";
|
|
|
+ string EmName = "";
|
|
|
+ string Day = "";
|
|
|
+ string Time = "";
|
|
|
+ string Result = "";
|
|
|
+ string TotalPart = "";
|
|
|
+ string NGPart = "";
|
|
|
+ int MissTest = 0;
|
|
|
+ for (int i = 0; i < data.Length; i++)
|
|
|
+ {
|
|
|
+ switch (i.ToString())
|
|
|
{
|
|
|
- Console.WriteLine(nextLine);
|
|
|
- data = nextLine.Split(';');
|
|
|
+ case "0":
|
|
|
+ SoftVersion = data[i];
|
|
|
+ break;
|
|
|
+ case "1":
|
|
|
+ SN = data[i];
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ Machine = data[i];
|
|
|
+ break;
|
|
|
+ case "4":
|
|
|
+ EmName = data[i];
|
|
|
+ break;
|
|
|
+ case "6":
|
|
|
+ Day = data[i];
|
|
|
+ break;
|
|
|
+ case "7":
|
|
|
+ Time = data[i];
|
|
|
+ break;
|
|
|
+ case "8":
|
|
|
+ Result += data[i];
|
|
|
+ break;
|
|
|
+ case "9":
|
|
|
+ Result += data[i];
|
|
|
+ break;
|
|
|
+ case "10":
|
|
|
+ Result += data[i];
|
|
|
+ break;
|
|
|
+ case "11":
|
|
|
+ Result += data[i];
|
|
|
+ break;
|
|
|
+ case "13":
|
|
|
+ TotalPart = data[i];
|
|
|
+ break;
|
|
|
+ case "14":
|
|
|
+ NGPart = data[i];
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
- for (int i = 0; i < data.Length; i++)
|
|
|
+ if (data.Length > 15)
|
|
|
{
|
|
|
- Console.WriteLine(data[i]);
|
|
|
+ for (int i = 15; i < data.Length; i++)
|
|
|
+ {
|
|
|
+ switch ((i - 15) % 6)
|
|
|
+ {
|
|
|
+ case 0:
|
|
|
+ badlocation.Add(data[i]);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ badprod.Add(data[i]);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ badcode.Add(data[i].ToUpper());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
sR.Close();
|
|
|
+ //如果没有不良位号等数据则是15个数据
|
|
|
+ if (Result == "0001")
|
|
|
+ {
|
|
|
+ if (data.Length > 16)
|
|
|
+ {
|
|
|
+ MissTest = -1;
|
|
|
+ Result = "NG";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Result = "OK";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Result = "OK";
|
|
|
+ }
|
|
|
+ string makecode = "";
|
|
|
+ string oErrMessage = "";
|
|
|
+ string oMSID = "";
|
|
|
+ if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, isource, SN, iusercode, out makecode, out oMSID, out oErrMessage))
|
|
|
+ {
|
|
|
+ //获取序列号ID最大的工单
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select ms_makecode,ms_id from makeserial where ms_sncode='" + SN + "' order by ms_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ ma_code.Text = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
+ makecode = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
+ switch (Result)
|
|
|
+ {
|
|
|
+ case "OK":
|
|
|
+ if (!LogicHandler.SetStepResult(makecode, isource, SN, "自动过站采集", Result, iusercode, out oErrMessage))
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(oErrMessage + "\n");
|
|
|
+ tipform.startthread(oErrMessage, Result);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ tipform.startthread("序列号 " + SN + "通过检测", Result);
|
|
|
+ break;
|
|
|
+ case "NG":
|
|
|
+ RecordBadInfo(SN, makecode, FileName, "", badcode.ToArray(), badlocation.ToArray(), badprod.ToArray());
|
|
|
+ //所有的序列号均采集为良品
|
|
|
+ if (!LogicHandler.SetTestNGDetail(SN, makecode, iusercode, isource, Result, out oErrMessage))
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(oErrMessage + "\n");
|
|
|
+ tipform.startthread(oErrMessage, Result);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ tipform.startthread("序列号 " + SN + "未通过检测", Result);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ 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("成功解析文件" + 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("成功解析文件" + FileName + "\n");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(FileName + ex.Message + "\n");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ OperateResult.AppendText(oErrMessage + "\n");
|
|
|
+ tipform.startthread(oErrMessage, Result);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 使用进程处理文件,避免界面假死
|
|
|
/// </summary>
|
|
@@ -376,11 +472,11 @@ namespace UAS_AutoPass
|
|
|
if (LogicHandler.CheckStepSNAndMacode(ma_code.Text == "" ? makecode : ma_code.Text, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
|
|
|
{
|
|
|
//插入日志
|
|
|
- LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, FileName, test_result == "NG" ? "-1" : "0", "-1");
|
|
|
+ LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, FileName, test_result == "NG" ? "-1" : "0", "-1", 0, "", "");
|
|
|
//如果是不良品记录日志,用于测试采集判负
|
|
|
if (test_result == "NG")
|
|
|
{
|
|
|
- RecordBadInfo(sncode, makecode, FileName, combinecode, badcode.ToArray(), badlocation.ToArray());
|
|
|
+ RecordBadInfo(sncode, makecode, FileName, combinecode, badcode.ToArray(), badlocation.ToArray(), null);
|
|
|
}
|
|
|
if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", "OK", iusercode, out oErrMessage))
|
|
|
{
|
|
@@ -454,7 +550,7 @@ namespace UAS_AutoPass
|
|
|
tipform.startthread("序列号 " + sncode + "通过检测", test_result);
|
|
|
break;
|
|
|
case "NG":
|
|
|
- RecordBadInfo(sncode, makecode, FileName, "", badcode.ToArray(), badlocation.ToArray());
|
|
|
+ RecordBadInfo(sncode, makecode, FileName, "", badcode.ToArray(), badlocation.ToArray(), null);
|
|
|
//所有的序列号均采集为良品
|
|
|
if (!LogicHandler.SetTestNGDetail(sncode, makecode, iusercode, isource, test_result, out oErrMessage))
|
|
|
{
|
|
@@ -467,7 +563,7 @@ namespace UAS_AutoPass
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, FileName, test_result == "NG" ? "1" : "0", "0");
|
|
|
+ LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, FileName, test_result == "NG" ? "1" : "0", "0", 0, "", "");
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -505,16 +601,16 @@ namespace UAS_AutoPass
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void RecordBadInfo(string sncode, string makecode, string filename, string combine, string[] badcode, string[] badlocation)
|
|
|
+ private void RecordBadInfo(string sncode, string makecode, string filename, string combine, string[] badcode, string[] badlocation, string[] soncode)
|
|
|
{
|
|
|
string[] ID = dh.GetSEQ("makebad_seq", badcode.Length);
|
|
|
sql.Clear();
|
|
|
sql.Append("insert into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,mb_indate,mb_stepcode");
|
|
|
- sql.Append(",mb_sourcecode,mb_badcode,mb_bgcode,mb_badtable,mb_status,mb_badremark) select :ID");
|
|
|
+ sql.Append(",mb_sourcecode,mb_badcode,mb_bgcode,mb_badtable,mb_status,mb_badlocation,mb_soncode) select :ID");
|
|
|
sql.Append(",ma_code,ms_code,ms_sncode,'" + iusercode + "',sysdate,'" + istepcode + "','" + isource + "',");
|
|
|
- sql.Append(":bc_code,'" + ibadgroup + "','','0',:location from make left join makeSerial on ms_makecode=ma_code ");
|
|
|
+ sql.Append(":bc_code,'" + ibadgroup + "','','0',:location,:soncode from make left join makeSerial on ms_makecode=ma_code ");
|
|
|
sql.Append("where ms_sncode='" + sncode + "' and ms_makecode='" + makecode + "'");
|
|
|
- dh.BatchInsert(sql.ToString(), new string[] { "ID", "bc_code", "location" }, ID, badcode, badlocation);
|
|
|
+ dh.BatchInsert(sql.ToString(), new string[] { "ID", "bc_code", "location", "soncode" }, ID, badcode, badlocation, soncode);
|
|
|
sql.Clear();
|
|
|
sql.Append("update makebad set mb_badname=(select DISTINCT bc_name from badcode where bc_code=mb_badcode),mb_bgname=(select DISTINCT bg_name from badgroup where bg_code=mb_bgcode) ");
|
|
|
sql.Append("where mb_id=:ID");
|
|
@@ -604,185 +700,10 @@ namespace UAS_AutoPass
|
|
|
|
|
|
private void BatchAnalysus_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- var AllXmls = Directory.GetFiles(FolderPath.Text, "*.xml");
|
|
|
+ var AllXmls = Directory.GetFiles(FolderPath.Text, "*.txt");
|
|
|
foreach (var Xml in AllXmls)
|
|
|
{
|
|
|
- string fileName = Xml.Substring(Xml.LastIndexOf(@"\") + 1, Xml.Length - Xml.LastIndexOf(@"\") - 1);
|
|
|
- string test_date = "";
|
|
|
- string test_result = "";
|
|
|
- string test_sn = "";
|
|
|
- string imageurl = "";
|
|
|
- string oMSID = "";
|
|
|
- string oErrMessage = "";
|
|
|
- XmlReader myReader = XmlReader.Create(FolderPath.Text + @"\" + fileName);
|
|
|
- OperateResult.AppendText("读取文件" + fileName + "\n");
|
|
|
- //获取采集的项目名称
|
|
|
- List<string> badcode = new List<string>();
|
|
|
- //获取采集项目的结果
|
|
|
- List<string> badlocation = new List<string>();
|
|
|
- while (myReader.Read())
|
|
|
- {
|
|
|
- if (myReader.NodeType == XmlNodeType.Element && myReader.Name == "test" && myReader.IsStartElement())
|
|
|
- {
|
|
|
- test_sn = myReader.GetAttribute("test_sn");
|
|
|
- test_result = myReader.GetAttribute("test_result");
|
|
|
- test_date = myReader.GetAttribute("test_date");
|
|
|
- imageurl = myReader.GetAttribute("imgurl");
|
|
|
- }
|
|
|
- if (myReader.NodeType == XmlNodeType.Element && myReader.Name == "err_reason" && myReader.IsStartElement())
|
|
|
- {
|
|
|
- badcode.Add(myReader.ReadInnerXml() + " ");
|
|
|
- }
|
|
|
- if (myReader.NodeType == XmlNodeType.Element && myReader.Name == "err_location" && myReader.IsStartElement())
|
|
|
- {
|
|
|
- badlocation.Add(myReader.ReadInnerXml() + " ");
|
|
|
- }
|
|
|
- }
|
|
|
- myReader.Close();
|
|
|
- //获取文件名的序列号,如SA123456.xml,如果开头为-表示无条码需要自动获取
|
|
|
- string sncode = fileName.Substring(0, 1) == "-" ? "" : fileName.Split('.')[0];
|
|
|
- string makecode = "";
|
|
|
- //获取序列号ID最大的工单号,所有序列号都测试为良品
|
|
|
- if (sncode == "")
|
|
|
- {
|
|
|
- //获取资源,线别,工序相等,并且状态在线的序列号进行分配
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select ms_sncode,ms_makecode from makeserial left join source on sc_code=ms_sccode where ");
|
|
|
- sql.Append(" sc_linecode='" + ilinecode + "' and ms_nextstepcode='" + istepcode + "' and ms_status=1 order by ms_id");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- makecode = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
- sncode = dt.Rows[0]["ms_sncode"].ToString();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- OperateResult.AppendText("当前线别在" + istepcode + "无可分配序列号");
|
|
|
- continue;
|
|
|
- }
|
|
|
- //-2-NG2017/10/2514:46:29.xml取第二位版号
|
|
|
- string combinecode = fileName.Substring(1, 1);
|
|
|
- if (LogicHandler.CheckStepSNAndMacode(ma_code.Text == "" ? makecode : ma_code.Text, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
|
|
|
- {
|
|
|
- //插入日志
|
|
|
- LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, fileName, test_result == "NG" ? "-1" : "0", "-1");
|
|
|
- //如果是不良品记录日志,用于测试采集判负
|
|
|
- if (test_result == "NG")
|
|
|
- {
|
|
|
- RecordBadInfo(sncode, makecode, fileName, combinecode, badcode.ToArray(), badlocation.ToArray());
|
|
|
- }
|
|
|
- if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", "OK", iusercode, out oErrMessage))
|
|
|
- {
|
|
|
- OperateResult.AppendText(oErrMessage + "\n");
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- OperateResult.AppendText(oErrMessage + "\n");
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- string status = "";
|
|
|
- string errmessage = "";
|
|
|
- bool NoteAlready = false;
|
|
|
- LogicHandler.GetMakeInfo(sncode, out makecode, out status, out errmessage);
|
|
|
- if (ma_code.Text != makecode && makecode != "" && ma_code.Text != "" && status != "2")
|
|
|
- {
|
|
|
- string ChangeMakeCode = MessageBox.Show(this.ParentForm, "序列号" + sncode + "所属工单不同,是否切换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
|
|
|
- //如果选择不切换赋值当前界面工单
|
|
|
- if (ChangeMakeCode != "Yes")
|
|
|
- {
|
|
|
- makecode = ma_code.Text;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- NoteAlready = true;
|
|
|
- }
|
|
|
- }
|
|
|
- if (LogicHandler.CheckStepSNAndMacode(makecode, isource, sncode, iusercode, out makecode, out oMSID, out oErrMessage))
|
|
|
- {
|
|
|
- if (!NoteAlready)
|
|
|
- {
|
|
|
- if (makecode != ma_code.Text && ma_code.Text != "")
|
|
|
- {
|
|
|
- string ChangeMakeCode = MessageBox.Show(this.ParentForm, "序列号所属工单不同,是否切换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
|
|
|
- //如果选择不切换赋值当前界面工单
|
|
|
- if (ChangeMakeCode == "Yes")
|
|
|
- {
|
|
|
- ma_code.Text = makecode;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- OperateResult.AppendText(">>请重新采集序列号\n");
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //获取序列号ID最大的工单
|
|
|
- dt = (DataTable)dh.ExecuteSql("select ms_makecode,ms_id from makeserial where ms_sncode='" + sncode + "' order by ms_id desc", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- ma_code.Text = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
- makecode = dt.Rows[0]["ms_makecode"].ToString();
|
|
|
- switch (test_result)
|
|
|
- {
|
|
|
- case "OK":
|
|
|
- if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", test_result, iusercode, out oErrMessage))
|
|
|
- {
|
|
|
- OperateResult.AppendText(oErrMessage + "\n");
|
|
|
- continue;
|
|
|
- }
|
|
|
- break;
|
|
|
- case "NG":
|
|
|
- RecordBadInfo(sncode, makecode, fileName, "", badcode.ToArray(), badlocation.ToArray());
|
|
|
- //所有的序列号均采集为良品
|
|
|
- if (!LogicHandler.SetTestNGDetail(sncode, makecode, iusercode, isource, test_result, out oErrMessage))
|
|
|
- {
|
|
|
- OperateResult.AppendText(oErrMessage + "\n");
|
|
|
- continue;
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- LogicHandler.AutoPassLog(sncode, isource, makecode, test_date, istepcode, ilinecode, fileName, test_result == "NG" ? "1" : "0", "0");
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- OperateResult.AppendText(oErrMessage + "\n");
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
- 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("成功解析文件" + 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("成功解析文件" + fileName + "\n");
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- OperateResult.AppendText(fileName + ex.Message + "\n");
|
|
|
- }
|
|
|
- }
|
|
|
+ TxtHandleProcess(Xml);
|
|
|
}
|
|
|
}
|
|
|
|