| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- using Aitex.Common.Util;
- using Aitex.Core.RT.Log;
- using MECF.Framework.Common.CommonData;
- using MECF.Framework.Common.CommonData.PlatingCell;
- using MECF.Framework.Common.RecipeCenter;
- using MECF.Framework.Common.SubstrateTrackings;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PunkHPX8_RT.Modules.PlatingCell
- {
- public class PlatingCellLotTrackUtil
- {
- /// <summary>
- /// CSV文件分隔符
- /// </summary>
- private const char CVS_SPLIT_CHAR = ',';
- public static async void ExportPlatingCellLotTrack(string moduleName, List<PlatingcellLotTrackData> datas, LotTrackFileHeaderCommonData headerData, bool isAuto, DepRecipe recipe)
- {
- await Task.Run(() =>
- {
- try
- {
- if (datas == null || datas.Count == 0) return;
- string strPath=" ";
- FileInfo fi;
- if (isAuto)
- {
- fi = new FileInfo(PathManager.GetLotTrackFilePath() + strPath);
- }
- else
- {
- strPath = $"{moduleName}_M{DateTime.Now.ToString("MM")}_D{DateTime.Now.ToString("dd")}_H{DateTime.Now.ToString("HH")}_M{DateTime.Now.ToString("mm")}_S{DateTime.Now.ToString("ss")}.csv";
- fi = new FileInfo(PathManager.GetLotTrackFilePath() + $"Manual\\{DateTime.Now.Year}\\{DateTime.Now.Month}\\" + strPath);
- }
- //目录不存在则创建
- if (!fi.Directory.Exists)
- {
- fi.Directory.Create();
- }
- FileStream fs = new FileStream(fi.FullName, System.IO.FileMode.Append, System.IO.FileAccess.Write);
- StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.UTF8);
- if (!isAuto)
- {
- sw.WriteLine(fi.FullName);
- sw.WriteLine($"Date:{DateTime.Now.ToShortDateString()}");
- sw.WriteLine($"ToolID:{headerData.ToolID}");
- sw.WriteLine($"SW Version:{headerData.SoftWareVersion}");
- sw.WriteLine($"Sequence Recipe:{headerData.SequenceRecipe}");
- }
- if (headerData.ProcessTransferList != null)
- {
- foreach (var item in headerData.ProcessTransferList)
- {
- sw.WriteLine(item);
- }
- }
- sw.WriteLine(moduleName);
- sw.WriteLine($"Recipe:{headerData.Recipe}");
- sw.WriteLine($"ProcessTime:{headerData.ProcessTime}");
- sw.WriteLine($"PlatingDelay:{recipe.PlatingDelay}");
- sw.Write(CVS_SPLIT_CHAR);
- string resStr = $"ANLevel{CVS_SPLIT_CHAR}CAPumpSpeed";
- string str = $"TimeStamp{CVS_SPLIT_CHAR}" + resStr;
-
- sw.WriteLine(str);
- for (int i = 0; i < datas.Count; i++)
- {
- PlatingcellLotTrackData data = datas[i];
- string resDatas = $"{data.ANLevel}{CVS_SPLIT_CHAR}{data.CAPumpSpeed}{CVS_SPLIT_CHAR}";
- string tmp = $"{CVS_SPLIT_CHAR}{data.TimeStamp.ToString("HH:mm:ss")}{CVS_SPLIT_CHAR}" + resDatas;
- sw.WriteLine(tmp);
- }
- sw.WriteLine("");
- sw.Close();
- fs.Close();
- }
- catch
- {
- LOG.WriteLog(eEvent.WARN_METAL, moduleName, $"{moduleName} LotTrack file writing is failed!");
- }
- });
- }
- }
- }
|