|
|
@@ -431,38 +431,45 @@ namespace UAS_MES_NEW.Make
|
|
|
LogMessage($"文件: {file},无SN信息");
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
+ if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, SN, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
|
|
|
+ {
|
|
|
+ if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, SN, "日志解析", "OK", User.UserCode, out oErrorMessage))
|
|
|
+ {
|
|
|
+ string sqlStr = $@"select ma_code,nvl(mcd_okqty,0) mcd_okqty,ma_prodcode,pr_detail,ma_qty - nvl(mcd_okqty, 0) remain_qty
|
|
|
+ from make left join makecraftdetail on mcd_maid=ma_id left join product on pr_code = ma_prodcode
|
|
|
+ where ma_code='" + omakeCode + "' and mcd_stepcode='" + User.CurrentStepCode + "'";
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sqlStr, "select");
|
|
|
+ BaseUtil.SetFormValue(Controls, dt);
|
|
|
+ //记录操作日志
|
|
|
+ LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "日志解析", "日志解析成功", SN, "");
|
|
|
+ LogMessage($"处理过站成功");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogMessage($"处理过站error:{oErrorMessage}");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogMessage($"处理过站核对error:{oErrorMessage}");
|
|
|
+ }
|
|
|
+
|
|
|
LogMessage($"文件: {file},开始上传");
|
|
|
if (UploadFileToFtp(file))
|
|
|
{
|
|
|
/*dh.ExecuteSql($@"insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class,std_testresult)
|
|
|
select STEPTESTDETAIL_seq.nextval,'{SN}','{ma_code.Text}',sysdate,'思泰克SPI',
|
|
|
- 'http://112.48.67.154:8088/ftp/mes/TestData/{DateTime.Now.ToString("yyyyMMdd")}/{Path.GetFileName(file)}.xml' from dual", "insert");*/
|
|
|
+ 'http://112.48.67.154:8088/ftp/mes/TestData/{DateTime.Now.ToString("yyyyMMdd")}/{Path.GetFileName(file)}' from dual", "insert");*/
|
|
|
dh.ExecuteSql($@"insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class,std_testresult)
|
|
|
select STEPTESTDETAIL_seq.nextval,'{SN}','{ma_code.Text}',sysdate,'思泰克SPI',
|
|
|
- 'http://192.168.1.92:8088/ftp/mes/TestData/{DateTime.Now.ToString("yyyyMMdd")}/{Path.GetFileName(file)}.xml' from dual", "insert");
|
|
|
+ 'http://192.168.1.92:8088/ftp/mes/TestData/{DateTime.Now.ToString("yyyyMMdd")}/{Path.GetFileName(file)}' from dual", "insert");
|
|
|
string xmlContent = File.ReadAllText(file);
|
|
|
if (ConsoleLog(xmlContent, file))
|
|
|
{
|
|
|
File.Delete(file);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- /*if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, SN, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
|
|
|
- {
|
|
|
- if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, SN, "日志解析", "OK", User.UserCode, out oErrorMessage))
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LogMessage(">>" + oErrorMessage + "\n");
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LogMessage(">>" + oErrorMessage + "\n");
|
|
|
- }*/
|
|
|
-
|
|
|
#region // 20250630 M 调整对接方式
|
|
|
/*List<SpiData> csvData;
|
|
|
//csvData = ParseCsvFile(file);
|
|
|
@@ -699,8 +706,11 @@ namespace UAS_MES_NEW.Make
|
|
|
if (!dh.CheckExist("productsmt", "ps_prodcode='" + Part_ + "'"))
|
|
|
{
|
|
|
ps_id = dh.GetSEQ("productsmt_seq");
|
|
|
- dh.ExecuteSql("insert into productsmt(ps_id,ps_prodcode,ps_status,ps_statuscode,PS_LINECODE,PS_CODE)" +
|
|
|
- "values('" + ps_id + "','" + Part_ + "','在录入','ENTERING','" + lineId + "','" + PS_CODE + "')", "insert");
|
|
|
+ /*dh.ExecuteSql("insert into productsmt(ps_id,ps_prodcode,ps_status,ps_statuscode,PS_LINECODE,PS_CODE,PS_TABLE,PS_INDATE,PS_AUDITDATE)" +
|
|
|
+ "values('" + ps_id + "','" + Part_ + "','在录入','ENTERING','" + lineId + "','" + PS_CODE + "','A',SYSDATE,SYSDATE)", "insert");*/
|
|
|
+
|
|
|
+ dh.ExecuteSql("insert into productsmt(ps_id,ps_prodcode,ps_status,ps_statuscode,PS_LINECODE,PS_CODE,PS_TABLE,PS_INDATE,PS_AUDITDATE,PS_AUDITMAN)" +
|
|
|
+ "values('" + ps_id + "','" + Part_ + "','已审核','AUDITED','" + lineId + "','" + PS_CODE + "','A',SYSDATE,SYSDATE,'"+ User.UserName +"')", "insert");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -844,22 +854,26 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
if (string.IsNullOrEmpty(item)) continue;
|
|
|
string[] currItem = item.Split(',');
|
|
|
- string res = "",wo = "";
|
|
|
+ string res = "",wo = "",lineName = "",source = "";
|
|
|
if(equiType == "SPI")
|
|
|
{
|
|
|
res = currItem[1];
|
|
|
wo = ma_code.Text;
|
|
|
+ source = User.UserSourceCode;
|
|
|
}
|
|
|
else if (equiType == "AOI")
|
|
|
{
|
|
|
res = currItem[3];
|
|
|
|
|
|
sql.Clear();
|
|
|
- sql.Append($"SELECT a.li_code,b.dl_macode FROM line_ipaoi a, deviceline b WHERE a.ipaddress = '{currItem[2]}' AND a.li_code = b.dl_linecode");
|
|
|
+ //sql.Append($"SELECT a.li_code,b.dl_macode FROM line_ipaoi a, deviceline b WHERE a.ipaddress = '{currItem[2]}' AND a.li_code = b.dl_linecode");
|
|
|
+ sql.Append($"SELECT a.li_code,b.dl_macode,c.sc_name FROM line_ipaoi a,deviceline b,source c WHERE a.ipaddress = '{currItem[2]}' AND a.li_code = b.dl_linecode AND a.li_code = c.sc_linecode AND c.sc_wccode = 'SMT' AND instr(c.sc_name, 'AOI') > 0");
|
|
|
dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
|
|
|
if (dt.Rows.Count > 0 && !String.IsNullOrEmpty(dt.Rows[0]["dl_macode"].ToString()))
|
|
|
{
|
|
|
wo = dt.Rows[0]["dl_macode"].ToString();
|
|
|
+ lineName = dt.Rows[0]["li_code"].ToString();
|
|
|
+ source = dt.Rows[0]["sc_name"].ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -870,20 +884,22 @@ namespace UAS_MES_NEW.Make
|
|
|
Log itemLog = new Log()
|
|
|
{
|
|
|
SN = currItem[0],
|
|
|
- work_order = wo,
|
|
|
+ Work_order = wo,
|
|
|
+ Line = lineName,
|
|
|
+ Source = source,
|
|
|
Result = res,
|
|
|
Details = equiType == "SPI" ? currItem[1] : currItem[3]
|
|
|
};
|
|
|
logArr.Add(itemLog);
|
|
|
|
|
|
}
|
|
|
- LogMessage($"文件: {PathName},共{fileNum}条记录,已解析");
|
|
|
- InsertDb(logArr, PathName);
|
|
|
-
|
|
|
- File.WriteAllText(PathName, string.Empty);
|
|
|
- if (ConsoleLog(restOfStream, PathName))
|
|
|
+ if (InsertDb(logArr, PathName, fileNum))
|
|
|
{
|
|
|
- File.Delete(PathName);
|
|
|
+ if (ConsoleLog(restOfStream, PathName))
|
|
|
+ {
|
|
|
+ File.WriteAllText(PathName, string.Empty);
|
|
|
+ File.Delete(PathName);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
@@ -892,7 +908,7 @@ namespace UAS_MES_NEW.Make
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void InsertDb(List<Log> logs, string PathName)
|
|
|
+ private bool InsertDb(List<Log> logs, string PathName,int fileNum)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
@@ -904,45 +920,70 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, item.SN, "日志解析", "OK", User.UserCode, out oErrorMessage))
|
|
|
{
|
|
|
- if (oErrorMessage.Contains("AFTERSUCCESS")) LogMessage(">>" + oErrorMessage + "\n");
|
|
|
- sql.Clear();
|
|
|
- sql.Append("select ma_code,nvl(mcd_okqty,0) mcd_okqty,ma_prodcode,pr_detail,");
|
|
|
- sql.Append("ma_qty - nvl(mcd_okqty, 0) remain_qty from make left join makecraftdetail on ");
|
|
|
- sql.Append("mcd_maid=ma_id left join product on pr_code=ma_prodcode where ma_code='" + omakeCode + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
+ string sqlStr = $@"select ma_code,nvl(mcd_okqty,0) mcd_okqty,ma_prodcode,pr_detail,ma_qty - nvl(mcd_okqty, 0) remain_qty
|
|
|
+ from make left join makecraftdetail on mcd_maid=ma_id left join product on pr_code = ma_prodcode
|
|
|
+ where ma_code='" + omakeCode + "' and mcd_stepcode='" + User.CurrentStepCode + "'";
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sqlStr, "select");
|
|
|
BaseUtil.SetFormValue(Controls, dt);
|
|
|
- //记录日志
|
|
|
+ //记录操作日志
|
|
|
LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "日志解析", "日志解析成功", item.SN, "");
|
|
|
- LogMessage("<<解析成功\n");
|
|
|
+
|
|
|
+ param.Add(item.SN);
|
|
|
+ param.Add(item.Work_order);
|
|
|
+ param.Add(item.Result == "PASS" ? "OK" : "NG");
|
|
|
+ param.Add(equiType);
|
|
|
+ param.Add(item.Details);
|
|
|
+ param.Add(User.UserCode);
|
|
|
+ param.Add(item.Source);
|
|
|
+ param.Add(item.Line);
|
|
|
+ string res = "";
|
|
|
+ param.Add(res);
|
|
|
+ string[] paramList = param.ToArray();
|
|
|
+ dh.CallProcedure("cs_insert_testrejects", ref paramList);
|
|
|
+ param.Clear();
|
|
|
+ LogMessage($"文件: {PathName},共{fileNum}条记录已过站解析");
|
|
|
+
|
|
|
+ if (logs.IndexOf(item) == logs.Count - 1)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- LogMessage(">>" + oErrorMessage + "\n");
|
|
|
+ LogMessage($"处理过站NG:{oErrorMessage}");
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- LogMessage(">>" + oErrorMessage + "\n");
|
|
|
+ LogMessage($"过站核对NG:{oErrorMessage}");
|
|
|
+ param.Add(item.SN);
|
|
|
+ param.Add(item.Work_order);
|
|
|
+ param.Add(item.Result == "PASS" ? "OK" : "NG");
|
|
|
+ param.Add(equiType);
|
|
|
+ param.Add(item.Details);
|
|
|
+ param.Add(User.UserCode);
|
|
|
+ param.Add(item.Source);
|
|
|
+ param.Add(item.Line);
|
|
|
+ string res = "";
|
|
|
+ param.Add(res);
|
|
|
+ string[] paramList = param.ToArray();
|
|
|
+ dh.CallProcedure("cs_insert_testrejects", ref paramList);
|
|
|
+ param.Clear();
|
|
|
+ LogMessage($"文件: {PathName},共{fileNum}条记录已解析");
|
|
|
+
|
|
|
+ if (logs.IndexOf(item) == logs.Count - 1)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- param.Add(item.SN);
|
|
|
- param.Add(item.work_order);
|
|
|
- param.Add(item.Result == "PASS" ? "OK" :"NG");
|
|
|
- param.Add(equiType);
|
|
|
- param.Add(item.Details);
|
|
|
- param.Add(User.UserCode);
|
|
|
- param.Add(User.UserSourceCode);
|
|
|
- param.Add(User.UserLineCode);
|
|
|
- string res = "";
|
|
|
- param.Add(res);
|
|
|
- string[] paramList = param.ToArray();
|
|
|
- dh.CallProcedure("cs_insert_testrejects", ref paramList);
|
|
|
- param.Clear();
|
|
|
}
|
|
|
+ return false;
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- MessageBox.Show(this.ParentForm, ex.Message, "警告");
|
|
|
+ LogMessage($"处理解析写入error:{ex.Message}");
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1260,7 +1301,9 @@ namespace UAS_MES_NEW.Make
|
|
|
|
|
|
private class Log
|
|
|
{
|
|
|
- public string work_order { get; set; }
|
|
|
+ public string Work_order { get; set; }
|
|
|
+ public string Line { get; set; }
|
|
|
+ public string Source { get; set; }
|
|
|
public string SN { set; get; }
|
|
|
public string Result { set; get; }
|
|
|
/*public List<NgData> Details { set; get; }*/
|