|
|
@@ -7,6 +7,8 @@ using System.Threading;
|
|
|
using System.Windows.Forms;
|
|
|
using System.Xml;
|
|
|
using System.Text;
|
|
|
+using System.Media;
|
|
|
+using NPOI.SS.Formula.Functions;
|
|
|
|
|
|
namespace FileWatcher
|
|
|
{
|
|
|
@@ -103,7 +105,7 @@ namespace FileWatcher
|
|
|
{
|
|
|
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)));";
|
|
|
+ DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=GHKJ;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();
|
|
|
}
|
|
|
}
|
|
|
@@ -308,116 +310,100 @@ 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") + "/";
|
|
|
+ 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 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");
|
|
|
- if (BackUpFolderPath.Text != "")
|
|
|
- File.Move(filename, BackUpFolderPath.Text + "/" + SN + ".txt");
|
|
|
- }
|
|
|
- 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 + "/" + SN + ".txt");
|
|
|
+ //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)
|
|
|
- {
|
|
|
- OperateResult.AppendText("序列号:" + SN + "上传成功\n");
|
|
|
- if (BackUpFolderPath.Text != "")
|
|
|
- File.Move(filename, BackUpFolderPath.Text + "/" + SN + ".txt");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
|
|
|
- MessageBox.Show("序列号: " + ms_sncode + "前工段未扫描", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- Console.WriteLine(ex.Message);
|
|
|
- }
|
|
|
+ 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());
|
|
|
+ OperateResult.AppendText("序列号:" + SN + "上传成功\n");
|
|
|
+ if (BackUpFolderPath.Text != "")
|
|
|
+ File.Move(filename, BackUpFolderPath.Text + "/" + SN + ".txt");
|
|
|
+ //if (num > 0)
|
|
|
+ //{
|
|
|
+
|
|
|
+ // //SafeDeleteFile(FileName);
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // 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");
|
|
|
}
|