|
|
@@ -44,14 +44,15 @@ namespace UAS_MES_NEW.Make
|
|
|
DataTable dt;
|
|
|
|
|
|
DataHelper dh;
|
|
|
- string currFileType = "";
|
|
|
+ string currFileType = "",equiType = "";
|
|
|
|
|
|
string SN, omakeCode, oMsid, oErrorMessage = "";
|
|
|
- string equiType = "";
|
|
|
List<string> fileList = new List<string>();
|
|
|
|
|
|
Timer formsTimer;
|
|
|
string outXmlFilePath;
|
|
|
+
|
|
|
+ BgFtpOperater ftp;
|
|
|
private void Make_ParseLog_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
dh = SystemInf.dh;
|
|
|
@@ -76,6 +77,7 @@ namespace UAS_MES_NEW.Make
|
|
|
watcher.Deleted += OnFileChanged;
|
|
|
watcher.Renamed += OnFileChanged;*/
|
|
|
|
|
|
+ ftp = new BgFtpOperater();
|
|
|
//设置锁定工单
|
|
|
LockMakeCode.GetMakeCodeCtl(ma_code);
|
|
|
ma_code.SetLockCheckBox(LockMakeCode);
|
|
|
@@ -108,22 +110,6 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
if (Device.SelectedIndex == -1) return;
|
|
|
|
|
|
- if (Device.SelectedIndex == 4 || Device.SelectedIndex == 2 || Device.SelectedIndex == 5)
|
|
|
- {
|
|
|
- txtPath.Text = fileList[Device.SelectedIndex];
|
|
|
- ma_code.Text = "";
|
|
|
- ma_code.Enabled = false;
|
|
|
- txtPath.Focus();
|
|
|
- txtPath.SelectAll();
|
|
|
- return;
|
|
|
- }
|
|
|
- if (string.IsNullOrEmpty(ma_code.Text))
|
|
|
- {
|
|
|
- Device.SelectedIndex = -1;
|
|
|
- txtPath.Text = "";
|
|
|
- MessageBox.Show(this.ParentForm, "请选择工单", "提示");
|
|
|
- return;
|
|
|
- }
|
|
|
switch (Device.SelectedIndex)
|
|
|
{
|
|
|
case 0:
|
|
|
@@ -152,6 +138,23 @@ namespace UAS_MES_NEW.Make
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
+ if (Device.SelectedIndex == 4 || Device.SelectedIndex == 2 || Device.SelectedIndex == 5)
|
|
|
+ {
|
|
|
+ txtPath.Text = fileList[Device.SelectedIndex];
|
|
|
+ ma_code.Text = "";
|
|
|
+ ma_code.Enabled = false;
|
|
|
+ txtPath.Focus();
|
|
|
+ txtPath.SelectAll();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (string.IsNullOrEmpty(ma_code.Text))
|
|
|
+ {
|
|
|
+ Device.SelectedIndex = -1;
|
|
|
+ txtPath.Text = "";
|
|
|
+ MessageBox.Show(this.ParentForm, "请选择工单", "提示");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
txtPath.Text = fileList[Device.SelectedIndex];
|
|
|
txtPath.Focus();
|
|
|
txtPath.SelectAll();
|
|
|
@@ -234,7 +237,7 @@ namespace UAS_MES_NEW.Make
|
|
|
string[] txtFiles = Directory.GetFiles(txtPath.Text, $"*.{currFileType}");
|
|
|
if (txtFiles.Length == 0)
|
|
|
{
|
|
|
- LogMessage($"当前{txtPath.Text},没有{currFileType.ToUpper()}格式文件");
|
|
|
+ LogMessage($"当前{txtPath.Text},没有{equiType}设备{currFileType.ToUpper()}文件");
|
|
|
return;
|
|
|
}
|
|
|
RefreshFileList();
|
|
|
@@ -405,10 +408,57 @@ namespace UAS_MES_NEW.Make
|
|
|
}
|
|
|
else if (Device.SelectedIndex == 1) // 思泰克SPI
|
|
|
{
|
|
|
- return; // 20250630 M 调整对接方式
|
|
|
+ if (!File.Exists(file))
|
|
|
+ {
|
|
|
+ LogMessage($"文件不存在: {file}");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ string fileName = Path.GetFileName(file);
|
|
|
+ string[] lines = File.ReadAllLines(file, Encoding.GetEncoding("GB2312"));
|
|
|
|
|
|
- #region
|
|
|
- List<SpiData> csvData;
|
|
|
+ string modelName = lines[1].Split(',')[0];
|
|
|
+ string lineNumber = lines[1].Split(',')[1];
|
|
|
+ string boardStatus = lines[2].Split(',')[1];
|
|
|
+ if (string.IsNullOrEmpty(boardStatus))
|
|
|
+ {
|
|
|
+ LogMessage($"文件: {file},无SN信息");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, boardStatus, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
|
|
|
+ {
|
|
|
+ if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, boardStatus, "日志解析", "OK", User.UserCode, out oErrorMessage))
|
|
|
+ {
|
|
|
+
|
|
|
+ string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
|
|
|
+ ftp.UpLoadFile(file, boardStatus + ".xml", 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://112.48.67.154:8088/ftp" + ftppath + boardStatus + ".xml" + "' from makeserial where ms_sncode='" + boardStatus + "'", "insert").ToString());
|
|
|
+ if (num > 0)
|
|
|
+ {
|
|
|
+ LogMessage($"文件: {file},上传成功");
|
|
|
+ string xmlContent = File.ReadAllText(file);
|
|
|
+ if (ConsoleLog(xmlContent, file))
|
|
|
+ {
|
|
|
+ File.Delete(file);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogMessage($"文件: {file},SN: {boardStatus}前工段未扫描");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogMessage(">>" + oErrorMessage + "\n");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogMessage(">>" + oErrorMessage + "\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ #region // 20250630 M 调整对接方式
|
|
|
+ /*List<SpiData> csvData;
|
|
|
//csvData = ParseCsvFile(file);
|
|
|
csvData = ParseCsvFile<SpiData>(file, MapToSpiData);
|
|
|
|
|
|
@@ -482,7 +532,7 @@ namespace UAS_MES_NEW.Make
|
|
|
if (ConsoleLog(xmlContent, file))
|
|
|
{
|
|
|
File.Delete(file);
|
|
|
- }
|
|
|
+ }*/
|
|
|
#endregion
|
|
|
}
|
|
|
else if (Device.SelectedIndex == 2) // AOI
|
|
|
@@ -563,7 +613,7 @@ namespace UAS_MES_NEW.Make
|
|
|
if (priMacData.Count == 0)
|
|
|
{
|
|
|
LogMessage($"文件: {file},读取记录 {priMacData.Count} 条");
|
|
|
- return;
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
sql.Clear();
|
|
|
@@ -618,7 +668,7 @@ namespace UAS_MES_NEW.Make
|
|
|
if (xmlList.Count == 0)
|
|
|
{
|
|
|
LogMessage($"文件: {file},读取记录 {xmlList.Count} 条");
|
|
|
- return;
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
List<string> param = new List<string>() { };
|