|
|
@@ -15,7 +15,7 @@ namespace FileWatcher
|
|
|
public partial class AutoAnalysisXml : Form
|
|
|
{
|
|
|
|
|
|
- DataHelper dh;
|
|
|
+ DataHelper dh = new DataHelper();
|
|
|
|
|
|
DataTable dt;
|
|
|
|
|
|
@@ -139,21 +139,21 @@ namespace FileWatcher
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- for (int i = 0; i < DB.Rows.Count; i++)
|
|
|
- {
|
|
|
- if (Master.Text == DB.Rows[i]["ma_user"].ToString())
|
|
|
- {
|
|
|
- DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=HUAG;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=113.98.196.181)(PORT=1520)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
|
|
|
- dh = new DataHelper();
|
|
|
- LogicHandler.dh = new DataHelper();
|
|
|
- }
|
|
|
- }
|
|
|
+ //for (int i = 0; i < DB.Rows.Count; i++)
|
|
|
+ //{
|
|
|
+ // if (Master.Text == DB.Rows[i]["ma_user"].ToString())
|
|
|
+ // {
|
|
|
+ // DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=HUAG;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=113.98.196.181)(PORT=1520)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
|
|
|
+ // dh = new DataHelper();
|
|
|
+ // LogicHandler.dh = new DataHelper();
|
|
|
+ // }
|
|
|
+ //}
|
|
|
//存在工单必须是已下放状态
|
|
|
- if ((!dh.CheckExist("make", "ma_statuscode='STARTED' and ma_code='" + ma_code.Text + "'") || ma_code.Text == "") && Device.Text == "AOI设备")
|
|
|
- {
|
|
|
- OperateResult.AppendText("工单不存在或者未下放\n");
|
|
|
- return;
|
|
|
- }
|
|
|
+ //if ((!dh.CheckExist("make", "ma_statuscode='STARTED' and ma_code='" + ma_code.Text + "'") || ma_code.Text == "") && Device.Text == "AOI设备")
|
|
|
+ //{
|
|
|
+ // OperateResult.AppendText("工单不存在或者未下放\n");
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
if (sc_code.Text == "" || em_code.Text == "")
|
|
|
{
|
|
|
OperateResult.AppendText("用户名和岗位资源不能为空\n");
|
|
|
@@ -310,116 +310,97 @@ namespace FileWatcher
|
|
|
{
|
|
|
string Result = "";
|
|
|
string makecode = ma_code.Text;
|
|
|
- string oErrMessage = "";
|
|
|
- string oMSID = "";
|
|
|
- string ms_sncode = dh.getFieldDataByCondition("makeserial", "ms_sncode", "substr(ms_sncode,0,12)='" + SN + "' order by ms_id").ToString();
|
|
|
- isource = sc_code.Text;
|
|
|
- iusercode = em_code.Text;
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select sc_linecode,sc_stepcode,st_badgroupcode from source left join step on sc_stepcode=st_code where sc_code='" + isource + "'", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+
|
|
|
+ string ms_sncode = dh.getFieldDataByCondition("steppassed", "sp_sncode", "substr(sp_sncode,0,12)='" + SN + "' order by sp_id").ToString();
|
|
|
+ if (ms_sncode == "")
|
|
|
{
|
|
|
- ilinecode = dt.Rows[0]["sc_linecode"].ToString();
|
|
|
- istepcode = dt.Rows[0]["sc_stepcode"].ToString();
|
|
|
- ibadgroup = dt.Rows[0]["st_badgroupcode"].ToString();
|
|
|
+ OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
|
|
|
}
|
|
|
- if (LogicHandler.CheckStepSNAndMacode("", isource, ms_sncode, iusercode, out makecode, out oMSID, out oErrMessage))
|
|
|
+ else
|
|
|
{
|
|
|
+ isource = sc_code.Text;
|
|
|
+ iusercode = em_code.Text;
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select sc_linecode,sc_stepcode,st_badgroupcode from source left join step on sc_stepcode=st_code where sc_code='" + isource + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ ilinecode = dt.Rows[0]["sc_linecode"].ToString();
|
|
|
+ istepcode = dt.Rows[0]["sc_stepcode"].ToString();
|
|
|
+ ibadgroup = dt.Rows[0]["st_badgroupcode"].ToString();
|
|
|
+ }
|
|
|
ma_code.Text = makecode;
|
|
|
- if (LogicHandler.SetStepResult(makecode, isource, ms_sncode, "自动过站采集", "OK", iusercode, out oErrMessage))
|
|
|
+ try
|
|
|
{
|
|
|
- try
|
|
|
+ string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
|
|
|
+ ftp.UpLoadFile(folderpath, SN + ".txt", ftppath, "");
|
|
|
+ int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class)select STEPTESTDETAIL_seq.nextval,ms_sncode,ms_makecode,sysdate,'http://113.98.196.181:8099/ftp" + ftppath + SN + ".txt" + "' from makeserial where substr(ms_sncode,0,12)='" + SN + "'", "insert").ToString());
|
|
|
+ if (num > 0)
|
|
|
{
|
|
|
- string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
|
|
|
- ftp.UpLoadFile(folderpath, SN + ".txt", ftppath, "");
|
|
|
- int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class)select STEPTESTDETAIL_seq.nextval,ms_sncode,ms_makecode,sysdate,'http://113.98.196.181:8099/ftp" + ftppath + SN + ".txt" + "' from makeserial where substr(ms_sncode,0,12)='" + SN + "'", "insert").ToString());
|
|
|
- if (num > 0)
|
|
|
- {
|
|
|
- OperateResult.AppendText("序列号:" + SN + "上传成功\n");
|
|
|
- SafeDeleteFile(FileName);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
|
|
|
- MessageBox.Show("序列号: " + ms_sncode + "前工段未扫描", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
|
|
|
- }
|
|
|
+ OperateResult.AppendText("序列号:" + SN + "上传成功\n");
|
|
|
+ if (BackUpFolderPath.Text != "")
|
|
|
+ File.Move(filename, BackUpFolderPath.Text);
|
|
|
+ //SafeDeleteFile(FileName);
|
|
|
}
|
|
|
- catch (Exception ex)
|
|
|
+ else
|
|
|
{
|
|
|
- Console.WriteLine(ex.Message);
|
|
|
+ OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
|
|
|
+ MessageBox.Show("序列号: " + ms_sncode + "前工段未扫描", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
- OperateResult.AppendText(oErrMessage + "\n");
|
|
|
- tipform.startthread(oErrMessage, Result);
|
|
|
-
|
|
|
+ Console.WriteLine(ex.Message);
|
|
|
}
|
|
|
tipform.startthread("序列号 " + ms_sncode + "通过检测", Result);
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- OperateResult.AppendText(oErrMessage + "\n");
|
|
|
- tipform.startthread(oErrMessage, Result);
|
|
|
- }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
string Result = "";
|
|
|
string makecode = ma_code.Text;
|
|
|
- string oErrMessage = "";
|
|
|
- string oMSID = "";
|
|
|
- string ms_sncode = dh.getFieldDataByCondition("makeserial", "ms_sncode", "ms_sncode='" + SN + "' order by ms_id").ToString();
|
|
|
+ string ms_sncode = dh.getFieldDataByCondition("steppassed", "sp_sncode", "sp_sncode='" + SN + "' order by sp_id").ToString();
|
|
|
isource = sc_code.Text;
|
|
|
iusercode = em_code.Text;
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql("select sc_linecode,sc_stepcode,st_badgroupcode from source left join step on sc_stepcode=st_code where sc_code='" + isource + "'", "select");
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ if (ms_sncode == "")
|
|
|
{
|
|
|
- ilinecode = dt.Rows[0]["sc_linecode"].ToString();
|
|
|
- istepcode = dt.Rows[0]["sc_stepcode"].ToString();
|
|
|
- ibadgroup = dt.Rows[0]["st_badgroupcode"].ToString();
|
|
|
+ OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
|
|
|
}
|
|
|
- if (LogicHandler.CheckStepSNAndMacode("", isource, ms_sncode, iusercode, out makecode, out oMSID, out oErrMessage))
|
|
|
+ else
|
|
|
{
|
|
|
+ DataTable dt = (DataTable)dh.ExecuteSql("select sc_linecode,sc_stepcode,st_badgroupcode from source left join step on sc_stepcode=st_code where sc_code='" + isource + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ ilinecode = dt.Rows[0]["sc_linecode"].ToString();
|
|
|
+ istepcode = dt.Rows[0]["sc_stepcode"].ToString();
|
|
|
+ ibadgroup = dt.Rows[0]["st_badgroupcode"].ToString();
|
|
|
+ }
|
|
|
ma_code.Text = makecode;
|
|
|
- if (LogicHandler.SetStepResult(makecode, isource, ms_sncode, "自动过站采集", "OK", iusercode, out oErrMessage))
|
|
|
+ try
|
|
|
{
|
|
|
- try
|
|
|
+ string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
|
|
|
+ OperateResult.AppendText(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff") + "\n");
|
|
|
+ ftp.UpLoadFile(folderpath, SN + ".txt", ftppath, "");
|
|
|
+ OperateResult.AppendText(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff") + "\n");
|
|
|
+ int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class)select STEPTESTDETAIL_seq.nextval,ms_sncode,ms_makecode,sysdate,'http://113.98.196.181:8099/ftp" + ftppath + SN + ".txt" + "' from makeserial where ms_sncode='" + SN + "'", "insert").ToString());
|
|
|
+ if (num > 0)
|
|
|
{
|
|
|
- string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
|
|
|
- OperateResult.AppendText(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff")+"\n");
|
|
|
- ftp.UpLoadFile(folderpath, SN + ".txt", ftppath, "");
|
|
|
- OperateResult.AppendText(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff") + "\n");
|
|
|
- int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class)select STEPTESTDETAIL_seq.nextval,ms_sncode,ms_makecode,sysdate,'http://113.98.196.181:8099/ftp" + ftppath + SN + ".txt" + "' from makeserial where ms_sncode='" + SN + "'", "insert").ToString());
|
|
|
- if (num > 0)
|
|
|
- {
|
|
|
- OperateResult.AppendText("序列号:" + SN + "上传成功\n");
|
|
|
- SafeDeleteFile(FileName);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
|
|
|
- MessageBox.Show("序列号: " + ms_sncode + "前工段未扫描", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
|
|
|
- }
|
|
|
+ OperateResult.AppendText("序列号:" + SN + "上传成功\n");
|
|
|
+ if (BackUpFolderPath.Text != "")
|
|
|
+ File.Move(filename, BackUpFolderPath.Text);
|
|
|
+ //SafeDeleteFile(FileName);
|
|
|
}
|
|
|
- catch (Exception ex)
|
|
|
+ else
|
|
|
{
|
|
|
- Console.WriteLine(ex.Message);
|
|
|
+ OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
|
|
|
+ MessageBox.Show("序列号: " + ms_sncode + "前工段未扫描", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- else
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
- OperateResult.AppendText(oErrMessage + "\n");
|
|
|
- tipform.startthread(oErrMessage, Result);
|
|
|
-
|
|
|
+ Console.WriteLine(ex.Message);
|
|
|
}
|
|
|
+
|
|
|
tipform.startthread("序列号 " + ms_sncode + "通过检测", Result);
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- OperateResult.AppendText(oErrMessage + "\n");
|
|
|
- tipform.startthread(oErrMessage, Result);
|
|
|
- }
|
|
|
}
|
|
|
OperateResult.AppendText("解析成功:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\n" + FileName + "\n");
|
|
|
}
|
|
|
@@ -519,13 +500,7 @@ namespace FileWatcher
|
|
|
|
|
|
private void ChooseBackUpFolder_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- FolderBrowserDialog folder = new FolderBrowserDialog();
|
|
|
- folder.Description = "选择备份文件夹";
|
|
|
- DialogResult result = folder.ShowDialog();
|
|
|
- if (result == DialogResult.OK)
|
|
|
- {
|
|
|
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
@@ -587,5 +562,16 @@ namespace FileWatcher
|
|
|
TxtHandleProcess(Xml);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void button1_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ FolderBrowserDialog folder = new FolderBrowserDialog();
|
|
|
+ folder.Description = "选择备份文件夹";
|
|
|
+ DialogResult result = folder.ShowDialog();
|
|
|
+ if (result == DialogResult.OK)
|
|
|
+ {
|
|
|
+ BackUpFolderPath.Text = folder.SelectedPath;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|