|
|
@@ -35,6 +35,9 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
}
|
|
|
+
|
|
|
+ FileSystemWatcher watcher = new FileSystemWatcher();
|
|
|
+
|
|
|
LogStringBuilder sql = new LogStringBuilder();
|
|
|
DataTable Dbfind;
|
|
|
DataTable dt;
|
|
|
@@ -44,10 +47,18 @@ namespace UAS_MES_NEW.Make
|
|
|
|
|
|
string SN, omakeCode, oMsid, oErrorMessage = "";
|
|
|
string equiType = "";
|
|
|
+ List<string> fileList = new List<string>();
|
|
|
private void Make_ParseLog_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
dh = SystemInf.dh;
|
|
|
|
|
|
+ fileList.Add("D:\\MES"); // 劲拓SPI
|
|
|
+ fileList.Add("D:\\EYSPI\\DataExport\\Res"); // 思泰克SPI
|
|
|
+ fileList.Add("E:\\MES_TEXT_PATH"); // AOI
|
|
|
+ fileList.Add("C:\\GKGPrintTemp"); // GKG印刷机
|
|
|
+ fileList.Add("");
|
|
|
+
|
|
|
+
|
|
|
//设置锁定工单
|
|
|
LockMakeCode.GetMakeCodeCtl(ma_code);
|
|
|
ma_code.SetLockCheckBox(LockMakeCode);
|
|
|
@@ -78,7 +89,7 @@ namespace UAS_MES_NEW.Make
|
|
|
|
|
|
private void Device_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
- if (Device.SelectedIndex == 3)
|
|
|
+ if (Device.SelectedIndex == 4 || Device.SelectedIndex == 2)
|
|
|
{
|
|
|
ma_code.Enabled = false;
|
|
|
txtPath.Focus();
|
|
|
@@ -91,15 +102,57 @@ namespace UAS_MES_NEW.Make
|
|
|
MessageBox.Show(this.ParentForm, "请选择工单", "提示");
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ txtPath.Text = fileList[Device.SelectedIndex];
|
|
|
txtPath.Focus();
|
|
|
txtPath.SelectAll();
|
|
|
+ ma_code.Enabled = true;
|
|
|
+ txtPath.Enabled = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Choose_Click(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ FolderBrowserDialog dialog = new FolderBrowserDialog();
|
|
|
+ switch (Device.SelectedIndex)
|
|
|
+ {
|
|
|
+ case 0:
|
|
|
+ dialog.Description = "请选择读取劲拓SPI设备文件夹";
|
|
|
+ currFileType = "txt";
|
|
|
+ equiType = "SPI";
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ dialog.Description = "请选择读取思泰克SPI设备文件夹";
|
|
|
+ currFileType = "csv";
|
|
|
+ equiType = "SPI";
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ dialog.Description = "请选择读取AOI设备文本文件";
|
|
|
+ currFileType = "txt";
|
|
|
+ equiType = "AOI";
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ dialog.Description = "请选择读取印刷机设备的文本文件夹";
|
|
|
+ currFileType = "csv";
|
|
|
+ equiType = "印刷机";
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ dialog.Description = "请选择读取贴片机的文本文件夹";
|
|
|
+ currFileType = "xml";
|
|
|
+ equiType = "贴片机";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (dialog.ShowDialog() == DialogResult.OK)
|
|
|
+ {
|
|
|
+ txtPath.Text = dialog.SelectedPath;
|
|
|
+ txtPath.Enabled = false;
|
|
|
+ Device.Enabled = false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void claerBtn_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
lstFiles.Items.Clear();
|
|
|
}
|
|
|
-
|
|
|
private void allParse_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
if (string.IsNullOrEmpty(ma_code.Text))
|
|
|
@@ -123,13 +176,13 @@ namespace UAS_MES_NEW.Make
|
|
|
string[] txtFiles = Directory.GetFiles(txtPath.Text, $"*.{currFileType}");
|
|
|
if (txtFiles.Length == 0)
|
|
|
{
|
|
|
- LogMessage($"当前没有{currFileType.ToUpper()}文件");
|
|
|
+ LogMessage($"当前{txtPath.Text},没有{currFileType.ToUpper()}格式文件");
|
|
|
return;
|
|
|
}
|
|
|
RefreshFileList();
|
|
|
}
|
|
|
|
|
|
- private void Choose_Click(object sender, EventArgs e)
|
|
|
+ private void onWatch_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
if (string.IsNullOrEmpty(ma_code.Text))
|
|
|
{
|
|
|
@@ -143,115 +196,48 @@ namespace UAS_MES_NEW.Make
|
|
|
MessageBox.Show(this.ParentForm, "请选择设备", "提示");
|
|
|
return;
|
|
|
}
|
|
|
- if (!String.IsNullOrEmpty(txtPath.Text))
|
|
|
+ if (String.IsNullOrEmpty(txtPath.Text))
|
|
|
{
|
|
|
txtPath.Focus();
|
|
|
txtPath.SelectAll();
|
|
|
+ return;
|
|
|
}
|
|
|
try
|
|
|
{
|
|
|
- FolderBrowserDialog dialog = new FolderBrowserDialog();
|
|
|
- switch (Device.SelectedIndex)
|
|
|
- {
|
|
|
- case 0:
|
|
|
- dialog.Description = "请选择读取SPI设备文件夹";
|
|
|
- currFileType = "txt";
|
|
|
- equiType = "SPI";
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- dialog.Description = "请选择读取AOI设备文本文件";
|
|
|
- currFileType = "txt";
|
|
|
- equiType = "AOI";
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- dialog.Description = "请选择读取印刷机设备的文本文件夹";
|
|
|
- currFileType = "csv";
|
|
|
- equiType = "印刷机";
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- dialog.Description = "请选择读取贴片机的文本文件夹";
|
|
|
- currFileType = "xml";
|
|
|
- equiType = "贴片机";
|
|
|
- break;
|
|
|
- }
|
|
|
- if (dialog.ShowDialog() == DialogResult.OK)
|
|
|
- {
|
|
|
- txtPath.Text = dialog.SelectedPath;
|
|
|
- txtPath.Enabled = false;
|
|
|
- Device.Enabled = false;
|
|
|
- var watcher = new FileSystemWatcher(txtPath.Text);
|
|
|
- if (equiType == "SPI")
|
|
|
- {
|
|
|
- var txtFiles = Directory.GetFiles(txtPath.Text, "*.txt");
|
|
|
- var csvFiles = Directory.GetFiles(txtPath.Text, "*.csv");
|
|
|
- currFileType = txtFiles.Length > csvFiles.Length ? "txt" : "csv";
|
|
|
- watcher.Filter = $"*.{currFileType}";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- watcher.Filter = $"*.{currFileType}";
|
|
|
- }
|
|
|
-
|
|
|
- watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;
|
|
|
- watcher.Created += OnFileCreated;
|
|
|
- /*watcher.Changed += OnFileChanged;
|
|
|
- watcher.Deleted += OnFileChanged;
|
|
|
- watcher.Renamed += OnFileChanged;*/
|
|
|
- watcher.EnableRaisingEvents = true;
|
|
|
- }
|
|
|
#region
|
|
|
- /*OpenFileDialog dialog = new OpenFileDialog();
|
|
|
- dialog.Multiselect = true;//该值确定是否可以选择多个文件
|
|
|
- dialog.Filter = "文本文件 (*.txt)|*.txt|All files (*.*)|*.*";
|
|
|
- switch (Device.SelectedIndex)
|
|
|
- {
|
|
|
- case 0:
|
|
|
- dialog.Title = "请选择读取SPI设备文件夹";
|
|
|
- dialog.Filter = "All files (*.*)|*.*";
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- dialog.Title = "请选择读取AOI设备文本文件";
|
|
|
- dialog.Filter = "All files (*.*)|*.*";
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- dialog.Title = "请选择读取印刷机设备的文本文件夹";
|
|
|
- dialog.Filter = "文本文件 (*.xml)|*.xml|All files (*.*)|*.*";
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
|
- {
|
|
|
- txtPath.Text = dialog.FileName;
|
|
|
- dialog.Dispose();
|
|
|
- ListViewItem item = new ListViewItem();
|
|
|
- int count = logList.Items.Count;
|
|
|
- item.Text = (++count).ToString();
|
|
|
- item.SubItems.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
- item.SubItems.Add(txtPath.Text);
|
|
|
- logList.Items.Add(item);
|
|
|
- }
|
|
|
+ /* 识别文件类型
|
|
|
+ var txtFiles = Directory.GetFiles(txtPath.Text, "*.txt");
|
|
|
+ var csvFiles = Directory.GetFiles(txtPath.Text, "*.csv");
|
|
|
+ currFileType = txtFiles.Length > csvFiles.Length ? "txt" : "csv";
|
|
|
+ watcher.Filter = $"*.{currFileType}";*/
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ watcher.Path = txtPath.Text;
|
|
|
+ watcher.Filter = $"*.{currFileType}";
|
|
|
+ watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;
|
|
|
+ watcher.Created += OnFileCreated;
|
|
|
+ /*watcher.Changed += OnFileChanged;
|
|
|
+ watcher.Deleted += OnFileChanged;
|
|
|
+ watcher.Renamed += OnFileChanged;*/
|
|
|
|
|
|
- if (Device.SelectedIndex == 0) // SPI
|
|
|
+ if (onWatch.Text == "开启解析")
|
|
|
{
|
|
|
- ParseLogInsert(txtPath.Text);
|
|
|
- Console.WriteLine();
|
|
|
+ watcher.EnableRaisingEvents = true;
|
|
|
+ onWatch.Text = "关闭解析";
|
|
|
}
|
|
|
- else if (Device.SelectedIndex == 1) // AOI
|
|
|
+ else
|
|
|
{
|
|
|
-
|
|
|
+ watcher.EnableRaisingEvents = false;
|
|
|
+ watcher.Dispose();
|
|
|
+ onWatch.Text = "开启解析";
|
|
|
}
|
|
|
- else if (Device.SelectedIndex == 2) // 印刷机
|
|
|
- {
|
|
|
- PrinterData xmlData = ReadWithXmlReader(txtPath.Text);
|
|
|
- Console.WriteLine();
|
|
|
- }*/
|
|
|
- #endregion
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
MessageBox.Show(this.ParentForm, ex.Message, "警告");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
|
|
|
private void OnFileCreated(object sender, FileSystemEventArgs e)
|
|
|
{
|
|
|
@@ -270,7 +256,7 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
if (lstFiles.InvokeRequired)
|
|
|
{
|
|
|
- //lstFiles.Invoke(new Action(RefreshFileList));
|
|
|
+ lstFiles.Invoke(new Action(RefreshFileList));
|
|
|
lstFiles.BeginInvoke(new Action(RefreshFileList));
|
|
|
return;
|
|
|
}
|
|
|
@@ -292,53 +278,58 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
foreach (string file in txtFiles)
|
|
|
{
|
|
|
- if (Device.SelectedIndex == 0) // SPI
|
|
|
+ if (Device.SelectedIndex == 0) // 劲拓SPI
|
|
|
{
|
|
|
string fileType = Path.GetExtension(file).ToLower();
|
|
|
+ ParseLogInsert(file);
|
|
|
+ }
|
|
|
+ else if (Device.SelectedIndex == 1) // 思泰克SPI
|
|
|
+ {
|
|
|
List<SpiData> csvData;
|
|
|
- if (fileType == ".txt") // 劲拓
|
|
|
+ //csvData = ParseCsvFile(file);
|
|
|
+ csvData = ParseCsvFile<SpiData>(file, MapToSpiData);
|
|
|
+
|
|
|
+ List<string> Barcode = new List<string>();
|
|
|
+ List<string> Date = new List<string>();
|
|
|
+
|
|
|
+ List<string> AreaPercent = new List<string>();
|
|
|
+ List<string> Height = new List<string>();
|
|
|
+ List<string> VolumePercent = new List<string>();
|
|
|
+ List<string> XOffset = new List<string>();
|
|
|
+ List<string> YOffset = new List<string>();
|
|
|
+ List<string> PadSizeX = new List<string>();
|
|
|
+ List<string> PadSizeY = new List<string>();
|
|
|
+ List<string> Area = new List<string>();
|
|
|
+ List<string> HeightPercent = new List<string>();
|
|
|
+ List<string> Volume = new List<string>();
|
|
|
+ List<string> Result = new List<string>();
|
|
|
+
|
|
|
+ foreach (var item in csvData)
|
|
|
{
|
|
|
- ParseLogInsert(file);
|
|
|
+ Barcode.Add(item.Barcode);
|
|
|
+ Date.Add(item.Date);
|
|
|
+ Result.Add(item.Result);
|
|
|
+
|
|
|
+ AreaPercent.Add(item.AreaPercent);
|
|
|
+ Height.Add(item.Height);
|
|
|
+ VolumePercent.Add(item.VolumePercent);
|
|
|
+ XOffset.Add(item.XOffset);
|
|
|
+ YOffset.Add(item.YOffset);
|
|
|
+ PadSizeX.Add(item.PadSizeX);
|
|
|
+ PadSizeY.Add(item.PadSizeY);
|
|
|
+ Area.Add(item.Area);
|
|
|
+ HeightPercent.Add(item.HeightPercent);
|
|
|
+ Volume.Add(item.Volume);
|
|
|
}
|
|
|
- else if (fileType == ".csv") // 思泰克 ?
|
|
|
+
|
|
|
+ if (csvData.Count == 0)
|
|
|
{
|
|
|
- //csvData = ParseCsvFile(file);
|
|
|
- csvData = ParseCsvFile<SpiData>(file, MapToSpiData);
|
|
|
-
|
|
|
- List<string> Barcode = new List<string>();
|
|
|
- List<string> Date = new List<string>();
|
|
|
-
|
|
|
- List<string> AreaPercent = new List<string>();
|
|
|
- List<string> Height = new List<string>();
|
|
|
- List<string> VolumePercent = new List<string>();
|
|
|
- List<string> XOffset = new List<string>();
|
|
|
- List<string> YOffset = new List<string>();
|
|
|
- List<string> PadSizeX = new List<string>();
|
|
|
- List<string> PadSizeY = new List<string>();
|
|
|
- List<string> Area = new List<string>();
|
|
|
- List<string> HeightPercent = new List<string>();
|
|
|
- List<string> Volume = new List<string>();
|
|
|
- List<string> Result = new List<string>();
|
|
|
-
|
|
|
- foreach (var item in csvData)
|
|
|
- {
|
|
|
- Barcode.Add(item.Barcode);
|
|
|
- Date.Add(item.Date);
|
|
|
- Result.Add(item.Result);
|
|
|
-
|
|
|
- AreaPercent.Add(item.AreaPercent);
|
|
|
- Height.Add(item.Height);
|
|
|
- VolumePercent.Add(item.VolumePercent);
|
|
|
- XOffset.Add(item.XOffset);
|
|
|
- YOffset.Add(item.YOffset);
|
|
|
- PadSizeX.Add(item.PadSizeX);
|
|
|
- PadSizeY.Add(item.PadSizeY);
|
|
|
- Area.Add(item.Area);
|
|
|
- HeightPercent.Add(item.HeightPercent);
|
|
|
- Volume.Add(item.Volume);
|
|
|
- }
|
|
|
- sql.Clear();
|
|
|
- sql.Append($@"INSERT INTO steptestdetail (std_id,std_sn,std_makecode,
|
|
|
+ LogMessage($"文件: {file},读取记录 {csvData.Count} 条");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append($@"INSERT INTO steptestdetail (std_id,std_sn,std_makecode,
|
|
|
std_testresult,std_class,std_actualvalue,
|
|
|
std_rescode,STD_SUBCLASS1,STD_VALUE1,
|
|
|
STD_VALUE2,STD_VALUE3,STD_VALUE4,
|
|
|
@@ -351,29 +342,30 @@ namespace UAS_MES_NEW.Make
|
|
|
:YOffset,:PadSizeX,:PadSizeY,
|
|
|
:Area,:HeightPercent,:Volume from dual)");
|
|
|
|
|
|
- dh.BatchInsert(sql.GetString(),
|
|
|
- new string[] { "Barcode", "Result", "AreaPercent",
|
|
|
+ dh.BatchInsert(sql.GetString(),
|
|
|
+ new string[] { "Barcode", "Result", "AreaPercent",
|
|
|
"Height" ,"VolumePercent","XOffset",
|
|
|
"YOffset","PadSizeX","PadSizeY",
|
|
|
"Area","HeightPercent","Volume"},
|
|
|
- Barcode.ToArray(), Result.ToArray(), AreaPercent.ToArray(),
|
|
|
- Height.ToArray(), VolumePercent.ToArray(), XOffset.ToArray(),
|
|
|
- YOffset.ToArray(), PadSizeX.ToArray(), PadSizeY.ToArray(),
|
|
|
- Area.ToArray(), HeightPercent.ToArray(), Volume.ToArray());
|
|
|
+ Barcode.ToArray(), Result.ToArray(), AreaPercent.ToArray(),
|
|
|
+ Height.ToArray(), VolumePercent.ToArray(), XOffset.ToArray(),
|
|
|
+ YOffset.ToArray(), PadSizeX.ToArray(), PadSizeY.ToArray(),
|
|
|
+ Area.ToArray(), HeightPercent.ToArray(), Volume.ToArray());
|
|
|
+
|
|
|
|
|
|
+ LogMessage($"文件: {file},共{csvData.Count}条记录,已解析");
|
|
|
|
|
|
- string xmlContent = File.ReadAllText(file);
|
|
|
- if (ConsoleLog(xmlContent, file))
|
|
|
- {
|
|
|
- File.Delete(file);
|
|
|
- }
|
|
|
+ string xmlContent = File.ReadAllText(file);
|
|
|
+ if (ConsoleLog(xmlContent, file))
|
|
|
+ {
|
|
|
+ File.Delete(file);
|
|
|
}
|
|
|
}
|
|
|
- else if (Device.SelectedIndex == 1) // AOI
|
|
|
+ else if (Device.SelectedIndex == 2) // AOI
|
|
|
{
|
|
|
ParseLogInsert(file);
|
|
|
}
|
|
|
- else if (Device.SelectedIndex == 2) // 印刷机 ?
|
|
|
+ else if (Device.SelectedIndex == 3) // 印刷机 ?
|
|
|
{
|
|
|
List<PrintData> priMacData;
|
|
|
priMacData = ParseCsvFile<PrintData>(file, MapToPriMacData);
|
|
|
@@ -444,6 +436,11 @@ namespace UAS_MES_NEW.Make
|
|
|
TableUpY1.Add(item.TableUpY1);
|
|
|
TableUpY2.Add(item.TableUpY2);
|
|
|
}
|
|
|
+ if (priMacData.Count == 0)
|
|
|
+ {
|
|
|
+ LogMessage($"文件: {file},读取记录 {priMacData.Count} 条");
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
sql.Clear();
|
|
|
sql.Append($@"INSERT INTO steptestdetail (std_id,std_sn,std_makecode,STD_TESTTIME,STD_CLASS,STD_SUBCLASS1,
|
|
|
@@ -475,13 +472,14 @@ namespace UAS_MES_NEW.Make
|
|
|
CleaningType.ToArray(), AddSPMode.ToArray(),
|
|
|
PrintDirection.ToArray(), PCBSize.ToArray(), TableUpX.ToArray(), TableUpY1.ToArray(), TableUpY2.ToArray());
|
|
|
|
|
|
+ LogMessage($"文件: {file},共{priMacData.Count}条记录,已解析");
|
|
|
string xmlContent = File.ReadAllText(file);
|
|
|
if (ConsoleLog(xmlContent, file))
|
|
|
{
|
|
|
File.Delete(file);
|
|
|
}
|
|
|
}
|
|
|
- else if (Device.SelectedIndex == 3) // 贴片机
|
|
|
+ else if (Device.SelectedIndex == 4) // 贴片机
|
|
|
{
|
|
|
if (!File.Exists(file))
|
|
|
{
|
|
|
@@ -489,10 +487,12 @@ namespace UAS_MES_NEW.Make
|
|
|
}
|
|
|
string xmlContent = File.ReadAllText(file);
|
|
|
var xmlList = ParseXml(xmlContent);
|
|
|
- if (ConsoleLog(xmlContent, file))
|
|
|
+ if (xmlList.Count == 0)
|
|
|
{
|
|
|
- File.Delete(file);
|
|
|
+ LogMessage($"文件: {file},读取记录 {xmlList.Count} 条");
|
|
|
+ return;
|
|
|
}
|
|
|
+
|
|
|
List<string> param = new List<string>() { };
|
|
|
string PS_CODE = "";
|
|
|
LogicHandler.GetSerialNumByCaller("Make!ParseLog", out PS_CODE);
|
|
|
@@ -520,11 +520,11 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
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");
|
|
|
+ "values('" + ps_id + "','" + Part_ + "','在录入','ENTERING','" + lineId + "','" + PS_CODE + "')", "insert");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ps_id = dh.getFieldDataByCondition("productsmt", "ps_id", "ps_prodcode='"+Part_+"'").ToString();
|
|
|
+ ps_id = dh.getFieldDataByCondition("productsmt", "ps_id", "ps_prodcode='" + Part_ + "'").ToString();
|
|
|
}
|
|
|
if (dh.getRowCount("productsmtlocation", "PSL_PSID=" + ps_id) > 0)
|
|
|
{
|
|
|
@@ -534,16 +534,22 @@ namespace UAS_MES_NEW.Make
|
|
|
sql.Append("insert into productsmtlocation(PSL_ID, PSL_PSID, PSL_DETNO, PSL_PRODCODE, PSL_REPCODE, PSL_LOCATION, PSL_BASEQTY, PSL_TABLE)" +
|
|
|
"select productsmtlocation_seq.nextval," + ps_id + ",:letArr, :ReelNo,:ReelNo,:Station,BD_BASEQTY,'' from bom@ERP " +
|
|
|
"left join bomdetail@ERP on bo_id=bd_bomid where bo_mothercode='" + Part_ + "' and BD_SONCODE=:ReelNo");
|
|
|
- dh.BatchInsert(sql.GetString(), new string[] {"letArr", "ReelNo", "ReelNo", "Station", "ReelNo" },
|
|
|
- letNo.ToArray(),ReelNo.ToArray(), ReelNo.ToArray(), Station.ToArray(), ReelNo.ToArray());
|
|
|
- Console.WriteLine();
|
|
|
+ dh.BatchInsert(sql.GetString(), new string[] { "letArr", "ReelNo", "ReelNo", "Station", "ReelNo" },
|
|
|
+ letNo.ToArray(), ReelNo.ToArray(), ReelNo.ToArray(), Station.ToArray(), ReelNo.ToArray());
|
|
|
+
|
|
|
+ LogMessage($"文件: {file},已解析生成站位表");
|
|
|
+
|
|
|
+ if (ConsoleLog(xmlContent, file))
|
|
|
+ {
|
|
|
+ File.Delete(file);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- LogMessage($"刷新文件列表时出错: {ex.Message}");
|
|
|
+ LogMessage($"Error: 解析文件列表失败: {ex.Message}");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -559,46 +565,18 @@ namespace UAS_MES_NEW.Make
|
|
|
List<Log> logArr = new List<Log>() { };
|
|
|
string[] lines = restOfStream.Split(new string[] { "\r\n" }, StringSplitOptions.None);
|
|
|
int fileNum = string.IsNullOrEmpty(lines[lines.Length - 1]) ? lines.Length - 1 : lines.Length;
|
|
|
- LogMessage($"文件夹{PathName},共{fileNum}条记录");
|
|
|
foreach (var item in lines)
|
|
|
{
|
|
|
if (string.IsNullOrEmpty(item)) continue;
|
|
|
string[] currItem = item.Split(',');
|
|
|
string res = "";
|
|
|
- /*List<NgData> data = new List<NgData>();*/
|
|
|
if(equiType == "SPI")
|
|
|
{
|
|
|
- if (currItem[1] != "PASS")
|
|
|
- {
|
|
|
- res = "NG";
|
|
|
- #region
|
|
|
- /*string[] NgArr = currItem[1].Split(';');
|
|
|
- foreach (var ngItem in NgArr)
|
|
|
- {
|
|
|
- string[] ngItemArr = ngItem.Split('*');
|
|
|
- List<string> ngItemLocal = ngItemArr[1].Split('&').ToList();
|
|
|
- NgData ngData = new NgData {
|
|
|
- Code = ngItemArr[0],
|
|
|
- Local = ngItemLocal
|
|
|
- };
|
|
|
- data.Add(ngData);
|
|
|
- }*/
|
|
|
- #endregion
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- res = "PASS";
|
|
|
- }
|
|
|
- }else if (equiType == "AOI")
|
|
|
+ res = currItem[1];
|
|
|
+ }
|
|
|
+ else if (equiType == "AOI")
|
|
|
{
|
|
|
- if (currItem[3] != "PASS")
|
|
|
- {
|
|
|
- res = "NG";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- res = "PASS";
|
|
|
- }
|
|
|
+ res = currItem[3];
|
|
|
}
|
|
|
Log itemLog = new Log()
|
|
|
{
|
|
|
@@ -608,8 +586,8 @@ namespace UAS_MES_NEW.Make
|
|
|
};
|
|
|
logArr.Add(itemLog);
|
|
|
|
|
|
- LogMessage($"已解析: {currItem[0]}");
|
|
|
}
|
|
|
+ LogMessage($"文件: {PathName},共{fileNum}条记录,已解析");
|
|
|
InsertDb(logArr, PathName);
|
|
|
|
|
|
File.WriteAllText(PathName, string.Empty);
|
|
|
@@ -620,7 +598,7 @@ namespace UAS_MES_NEW.Make
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- MessageBox.Show(this.ParentForm, ex.Message, "警告");
|
|
|
+ LogMessage($"Error: 文件 {PathName}, {ex.Message}");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -628,32 +606,10 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- int type = Device.SelectedIndex;
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
List<string> param = new List<string>() { };
|
|
|
foreach (var item in logs)
|
|
|
{
|
|
|
- param.Add(item.SN);
|
|
|
- param.Add(ma_code.Text);
|
|
|
- if (item.Result == "PASS")
|
|
|
- {
|
|
|
- param.Add(item.Result);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- param.Add(item.Result);
|
|
|
- }
|
|
|
- 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();
|
|
|
-
|
|
|
if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, item.SN, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
|
|
|
{
|
|
|
if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, item.SN, "日志解析", "OK", User.UserCode, out oErrorMessage))
|
|
|
@@ -678,6 +634,27 @@ namespace UAS_MES_NEW.Make
|
|
|
{
|
|
|
LogMessage(">>" + oErrorMessage + "\n");
|
|
|
}
|
|
|
+
|
|
|
+ param.Add(item.SN);
|
|
|
+ param.Add(ma_code.Text ?? omakeCode);
|
|
|
+ if (item.Result == "PASS")
|
|
|
+ {
|
|
|
+ param.Add(item.Result);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ param.Add(item.Result);
|
|
|
+ }
|
|
|
+ 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();
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
@@ -831,14 +808,14 @@ namespace UAS_MES_NEW.Make
|
|
|
/*Encoding fileEncoding = DetectFileEncoding(filePath);*/
|
|
|
string[] lines = File.ReadAllLines(filePath, Encoding.GetEncoding("GB2312"));
|
|
|
|
|
|
- if (lines.Length < 4) return dataList;
|
|
|
-
|
|
|
for (int i = 1; i < lines.Length; i++)
|
|
|
{
|
|
|
if (string.IsNullOrWhiteSpace(lines[i])) continue;
|
|
|
|
|
|
if (equiType == "SPI")
|
|
|
{
|
|
|
+ if (lines.Length < 4) return dataList;
|
|
|
+
|
|
|
string modelName = lines[1].Split(',')[0];
|
|
|
string lineNumber = lines[1].Split(',')[1];
|
|
|
string boardStatus = lines[2].Split(',')[1];
|
|
|
@@ -1152,6 +1129,8 @@ namespace UAS_MES_NEW.Make
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
private class PrinterData
|
|
|
{
|
|
|
public string SN { get; set; }
|