| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 | 
							- using MECF.Framework.Common.CommonData;
 
- using System;
 
- using System.Collections.Generic;
 
- using Aitex.Core.Common;
 
- using System.Threading.Tasks;
 
- using MECF.Framework.Common.CommonData.Loader;
 
- using static CyberX8_RT.Modules.Loader.LoaderEntity;
 
- using System.IO;
 
- using Aitex.Common.Util;
 
- using CyberX8_RT.Dispatch;
 
- using MECF.Framework.Common.WaferHolder;
 
- using Aitex.Core.RT.Log;
 
- using MECF.Framework.Common.Equipment;
 
- using MECF.Framework.Common.SubstrateTrackings;
 
- namespace CyberX8_RT.Modules.Loader
 
- {
 
-     public class LoaderLotTrackUtil
 
-     {
 
-         /// <summary>
 
-         /// CSV文件分隔符
 
-         /// </summary>
 
-         private const char CVS_SPLIT_CHAR = ',';
 
-         /// <summary>
 
-         /// 首次写入
 
-         /// </summary>
 
-         private static bool _firstWriteFlag;
 
-         /// <summary>
 
-         /// 导出至csv
 
-         /// </summary>
 
-         /// <param name="moduleName"></param>
 
-         /// <param name="datas"></param>
 
-         public static async void ExportLoaderLotTrack(string moduleName, LotTrackFileHeaderCommonData headerData, List<LoaderLotTrackData> loaderDatas,
 
-             LotTrackDatasStatus datasStatus, List<DateTime> timeList, WaferInfo waferInfo, string waferGroup, bool isLoad, DateTime startTime,
 
-             List<LoaderFlowLotTrackData> flowDatas = null, LotTrackDatasStatus flowDatasStatus = LotTrackDatasStatus.Complete)
 
-         {
 
-             await Task.Run(() =>
 
-             {
 
-                 try{
 
-                     //文件流处理
 
-                     string strPath = "";
 
-                     FileInfo fi;
 
-                     if (waferInfo != null && waferInfo.WaferType == WaferType.Production && !string.IsNullOrEmpty(waferInfo.LotId))
 
-                     {
 
-                         if (!string.IsNullOrEmpty(waferInfo.LotTrackPath))
 
-                         {
 
-                             strPath = waferInfo.LotTrackPath;
 
-                         }
 
-                         else 
 
-                         {
 
-                             strPath = $"Auto\\{startTime.Year}\\{startTime.Month}\\{waferGroup}" +
 
-                             $"_M{startTime.ToString("MM")}_D{startTime.ToString("dd")}_H{startTime.ToString("HH")}_M{startTime.ToString("mm")}_S{startTime.ToString("ss")}.csv"; ;
 
-                             WaferManager.Instance.UpdateWaferLotTrackPath((ModuleName)waferInfo.Station, waferInfo.Slot, strPath);
 
-                         }          
 
-                         fi = new FileInfo(PathManager.GetLotTrackFilePath() + strPath);                        
 
-                     }
 
-                     else
 
-                     {
 
-                         strPath = $"{moduleName}_M{timeList[0].ToString("MM")}_D{timeList[0].ToString("dd")}_H{timeList[0].ToString("HH")}_M{timeList[0].ToString("mm")}_S{timeList[0].ToString("ss")}.csv";
 
-                         fi = new FileInfo(PathManager.GetLotTrackFilePath() + $"Manual\\{timeList[0].Year}\\{timeList[0].Month}\\" + strPath);
 
-                     }
 
-                     _firstWriteFlag = false;
 
-                     //目录不存在则创建
 
-                     if (!fi.Directory.Exists)
 
-                     {
 
-                         fi.Directory.Create();
 
-                     }
 
-                     if (!File.Exists(fi.FullName))
 
-                     {
 
-                         _firstWriteFlag = true;
 
-                     }
 
-                     FileStream fs = new FileStream(fi.FullName, System.IO.FileMode.Append, System.IO.FileAccess.Write);
 
-                     StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.UTF8);
 
-                     //Header Data
 
-                     if (_firstWriteFlag && headerData != null)
 
-                     {
 
-                         sw.WriteLine(fi.FullName);
 
-                         sw.WriteLine($"Date:{DateTime.Now.ToShortDateString()}");
 
-                         sw.WriteLine($"Tool ID:{headerData.ToolID}");
 
-                         sw.WriteLine($"SW Version:{headerData.SoftWareVersion}");
 
-                         sw.WriteLine($"Sequence Recipe:{headerData.SequenceRecipe}");
 
-                         WaferHolderInfo whInfo = WaferHolderManager.Instance.GetWaferHolder(moduleName);
 
-                         sw.WriteLine($"WaferShuttle ID:{(whInfo != null ? whInfo.Id : "")}");
 
-                         sw.WriteLine($"LS-A ID:{(whInfo != null ? whInfo.CrsAId : "")}");
 
-                         sw.WriteLine($"LS-B ID:{(whInfo != null ? whInfo.CrsBId : "")}");
 
-                         sw.WriteLine("");
 
-                     }
 
-                     //Loader Datas
 
-                     if (loaderDatas != null && loaderDatas.Count != 0 && datasStatus != LotTrackDatasStatus.Complete)
 
-                     {
 
-                         //数据头 
 
-                         if (datasStatus == LotTrackDatasStatus.None)
 
-                         {
 
-                             sw.WriteLine($"Wafer ID:{waferInfo.WaferID}");
 
-                             if (headerData.ProcessTransferList != null)
 
-                             {
 
-                                 foreach (var item in headerData.ProcessTransferList)
 
-                                 {
 
-                                     sw.WriteLine(item);
 
-                                 }
 
-                             }
 
-                             sw.WriteLine("Start" + (isLoad ? "Load" : "Unload") + $"WaferShuttle:{(timeList.Count >= 1 ? timeList[0].ToString() : "")}");
 
-                             sw.WriteLine(moduleName);
 
-                             sw.Write(CVS_SPLIT_CHAR);
 
-                             string str = $"TimeStamp{CVS_SPLIT_CHAR}LoaderABernoulliBladderEnable{CVS_SPLIT_CHAR}LoaderABernoulliBladderPressure{CVS_SPLIT_CHAR}" +
 
-                                 $"LoaderABernoulliN2Pressure{CVS_SPLIT_CHAR}LoaderALSVacuum{CVS_SPLIT_CHAR}LoaderALSVacuumAnlg{CVS_SPLIT_CHAR}LoaderAWSPressure" +
 
-                                 $"{CVS_SPLIT_CHAR}LoaderBBernoulliBladderEnable{CVS_SPLIT_CHAR}LoaderBBernoulliBladderPressure{CVS_SPLIT_CHAR}" +
 
-                                 $"LoaderBBernoulliN2Pressure{CVS_SPLIT_CHAR}LoaderBLSVacuum{CVS_SPLIT_CHAR}LoaderBLSVacuumAnlg{CVS_SPLIT_CHAR}LoaderBWSPressure" +
 
-                                 $"{CVS_SPLIT_CHAR}LoaderWSClamped{CVS_SPLIT_CHAR}";
 
-                             sw.WriteLine(str);
 
-                         }
 
-                         //数据内容
 
-                         
 
-                         for (int i = 0; i < loaderDatas.Count; i++)
 
-                         {
 
-                             LoaderLotTrackData data = loaderDatas[i];
 
-                             string tmp = $"{CVS_SPLIT_CHAR}{data.TimeStamp.ToString("HH:mm:ss")}{CVS_SPLIT_CHAR}{data.LoaderABernoulliBladderEnable}{CVS_SPLIT_CHAR}{data.LoaderABernoulliBladderPressure}{CVS_SPLIT_CHAR}" +
 
-                             $"{data.LoaderABernoulliN2Pressure}{CVS_SPLIT_CHAR}{data.LoaderACRSVacuum}{CVS_SPLIT_CHAR}{data.LoaderACRSVacuumAnlg}{CVS_SPLIT_CHAR}{data.LoaderAWHPressure}" +
 
-                             $"{CVS_SPLIT_CHAR}{data.LoaderBBernoulliBladderEnable}{CVS_SPLIT_CHAR}{data.LoaderBBernoulliBladderPressure}{CVS_SPLIT_CHAR}" +
 
-                             $"{data.LoaderBBernoulliN2Pressure}{CVS_SPLIT_CHAR}{data.LoaderBCRSVacuum}{CVS_SPLIT_CHAR}{data.LoaderBCRSVacuumAnlg}{CVS_SPLIT_CHAR}{data.LoaderBWHPressure}" +
 
-                             $"{CVS_SPLIT_CHAR}{data.LoaderWHClamped}{CVS_SPLIT_CHAR}";
 
-                             sw.WriteLine(tmp);
 
-                         }
 
-                         
 
-                         if (timeList.Count >= 2)
 
-                         {
 
-                             sw.WriteLine("Finish" + (isLoad ? "Load" : "Unload") + $"WaferShuttle:{timeList[1].ToString()}");
 
-                             if (!isLoad) sw.WriteLine("");
 
-                         }
 
-                     }                               
 
-                     //Flow Datas           
 
-                     if (flowDatas != null && flowDatas.Count != 0 && flowDatasStatus != LotTrackDatasStatus.Complete)
 
-                     {
 
-                         if(flowDatasStatus == LotTrackDatasStatus.None && timeList.Count >= 2)
 
-                         {
 
-                             sw.WriteLine(moduleName);
 
-                             sw.Write(CVS_SPLIT_CHAR);
 
-                             string str = $"TimeStamp{CVS_SPLIT_CHAR}LoaderWSClamped{CVS_SPLIT_CHAR}LoaderALSVacuum{CVS_SPLIT_CHAR}" +
 
-                                 $"LoaderALSVacuumAnlg{CVS_SPLIT_CHAR}LoaderBLSVacuum{CVS_SPLIT_CHAR}LoaderBLSVacuumAnlg{CVS_SPLIT_CHAR}" +
 
-                                 $"EnableVacuum{CVS_SPLIT_CHAR}EnableFlowClamp{CVS_SPLIT_CHAR}Flow{CVS_SPLIT_CHAR}";
 
-                             sw.WriteLine(str);
 
-                         }                         
 
-                         for (int i = 0; i < flowDatas.Count; i++)
 
-                         {
 
-                             LoaderFlowLotTrackData data = flowDatas[i];
 
-                             string tmp = $"{CVS_SPLIT_CHAR}{data.TimeStamp.ToString("HH:mm:ss")}{CVS_SPLIT_CHAR}{data.LoaderWHClamped}{CVS_SPLIT_CHAR}{data.LoaderACRSVacuum}{CVS_SPLIT_CHAR}" +
 
-                             $"{data.LoaderACRSVacuumAnlg}{CVS_SPLIT_CHAR}{data.LoaderBCRSVacuum}{CVS_SPLIT_CHAR}{data.LoaderBCRSVacuumAnlg}{CVS_SPLIT_CHAR}" +
 
-                             $"{data.EnableVacuum}{CVS_SPLIT_CHAR}{data.EnableFlowClamp}{CVS_SPLIT_CHAR}{data.FlowValue}{CVS_SPLIT_CHAR}";
 
-                             sw.WriteLine(tmp);
 
-                         }
 
-                         sw.WriteLine("");
 
-                     }                   
 
-                     
 
-                     sw.Close();
 
-                     fs.Close();
 
-                 }
 
-                 catch
 
-                 {
 
-                     LOG.WriteLog(eEvent.ERR_LOADER, moduleName, $"{moduleName} LotTrack file writing is failed!");
 
-                 };
 
-             });
 
-         }
 
-     }
 
- }
 
 
  |