using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Aitex.Core.RT.Job;
using Aitex.Platform;
using Aitex.Core.Equipment.SusceptorDefine;
using Aitex.Core.RT.DBCore;
using Aitex.Triton160.Common;
namespace Aitex.Triton160.RT.Routine.Process
{
///
/// 工艺运行记录类
///
public class ProcessRecorder
{
public ProcessRecorder()
{
}
public void BeginNewProcess(JobInfo job)
{
string sql = string.Format("INSERT INTO \"RecipeRunHistory\"(\"RecipeRunGuid\", \"UserDefinedId\", \"ProcessIn\", \"ProcessBeginTime\", \"Description\", \"RecipeName\", \"SusceptorStatus\" , \"SusceptorId\" )VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}');",
job.RecipeRunId,
job.RecipeRunningName,
job.ProcessModuleName,
job.ProcessStartTime.ToString("yyyy/MM/dd HH:mm:ss.fff"),
job.Description,
job.RecipeBaseName,
job.JobResult,
job.LotId);
DB.Insert(sql);
}
///
/// update process status
///
///
///
public void UpdateProcessStatus(Guid recipeRunGuid, JobStatus newStatus)
{
string sql = string.Format("UPDATE \"RecipeRunHistory\" SET \"SusceptorStatus\"='{0}' WHERE \"RecipeRunGuid\"='{1}';",
newStatus,
recipeRunGuid);
DB.Insert(sql);
}
///
/// update process recipe name
///
///
///
public void UpdateProcessRecipeName(Guid recipeRunGuid, string newRecipeName)
{
string sql = string.Format("UPDATE \"RecipeRunHistory\" SET \"UserDefinedId\"='{0}' WHERE \"RecipeRunGuid\"='{1}';",
newRecipeName,
recipeRunGuid);
DB.Insert(sql);
}
///
/// update process status when process ended
///
///
///
public void EndRecipeProcess(Guid recipeRunGuid, SusceptorStatus status)
{
string sql = string.Format("UPDATE \"RecipeRunHistory\" SET \"ProcessEndTime\"='{0}', \"SusceptorStatus\"='{1}' WHERE \"RecipeRunGuid\"='{2}';",
DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"),
status,
recipeRunGuid);
DB.Insert(sql);
}
///
/// Add susceptor related records into database
///
///
///
///
///
public void AddRecord(Guid recipeRunGuid, CarrierDataType itemType, string itemData, string description)
{
string sql = string.Format("INSERT INTO \"SusceptorData\"(\"Time\", \"SusceptorId\", \"ItemType\", \"ItemData\", \"ItemRemark\") VALUES ('{0}','{1}','{2}','{3}','{4}');",
DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"),
recipeRunGuid,
itemType,
itemData,
description);
DB.Insert(sql);
}
}
}