ProcessRecord.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. using Aitex.Core.RT.Job;
  7. using Aitex.Platform;
  8. using Aitex.Core.Equipment.SusceptorDefine;
  9. using Aitex.Core.RT.DBCore;
  10. using Aitex.Triton160.Common;
  11. namespace Aitex.Triton160.RT.Routine.Process
  12. {
  13. /// <summary>
  14. /// 工艺运行记录类
  15. /// </summary>
  16. public class ProcessRecorder
  17. {
  18. public ProcessRecorder()
  19. {
  20. }
  21. public void BeginNewProcess(JobInfo job)
  22. {
  23. string sql = string.Format("INSERT INTO \"RecipeRunHistory\"(\"RecipeRunGuid\", \"UserDefinedId\", \"ProcessIn\", \"ProcessBeginTime\", \"Description\", \"RecipeName\", \"SusceptorStatus\" , \"SusceptorId\" )VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}');",
  24. job.RecipeRunId,
  25. job.RecipeRunningName,
  26. job.ProcessModuleName,
  27. job.ProcessStartTime.ToString("yyyy/MM/dd HH:mm:ss.fff"),
  28. job.Description,
  29. job.RecipeBaseName,
  30. job.JobResult,
  31. job.LotId);
  32. DB.Insert(sql);
  33. }
  34. /// <summary>
  35. /// update process status
  36. /// </summary>
  37. /// <param name="recipeRunGuid"></param>
  38. /// <param name="newStatus"></param>
  39. public void UpdateProcessStatus(Guid recipeRunGuid, JobStatus newStatus)
  40. {
  41. string sql = string.Format("UPDATE \"RecipeRunHistory\" SET \"SusceptorStatus\"='{0}' WHERE \"RecipeRunGuid\"='{1}';",
  42. newStatus,
  43. recipeRunGuid);
  44. DB.Insert(sql);
  45. }
  46. /// <summary>
  47. /// update process recipe name
  48. /// </summary>
  49. /// <param name="susceptorId"></param>
  50. /// <param name="newRecipeName"></param>
  51. public void UpdateProcessRecipeName(Guid recipeRunGuid, string newRecipeName)
  52. {
  53. string sql = string.Format("UPDATE \"RecipeRunHistory\" SET \"UserDefinedId\"='{0}' WHERE \"RecipeRunGuid\"='{1}';",
  54. newRecipeName,
  55. recipeRunGuid);
  56. DB.Insert(sql);
  57. }
  58. /// <summary>
  59. /// update process status when process ended
  60. /// </summary>
  61. /// <param name="recipeRunGuid"></param>
  62. /// <param name="status"></param>
  63. public void EndRecipeProcess(Guid recipeRunGuid, SusceptorStatus status)
  64. {
  65. string sql = string.Format("UPDATE \"RecipeRunHistory\" SET \"ProcessEndTime\"='{0}', \"SusceptorStatus\"='{1}' WHERE \"RecipeRunGuid\"='{2}';",
  66. DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"),
  67. status,
  68. recipeRunGuid);
  69. DB.Insert(sql);
  70. }
  71. /// <summary>
  72. /// Add susceptor related records into database
  73. /// </summary>
  74. /// <param name="recipeRunGuid"></param>
  75. /// <param name="itemType"></param>
  76. /// <param name="itemData"></param>
  77. /// <param name="description"></param>
  78. public void AddRecord(Guid recipeRunGuid, CarrierDataType itemType, string itemData, string description)
  79. {
  80. string sql = string.Format("INSERT INTO \"SusceptorData\"(\"Time\", \"SusceptorId\", \"ItemType\", \"ItemData\", \"ItemRemark\") VALUES ('{0}','{1}','{2}','{3}','{4}');",
  81. DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff"),
  82. recipeRunGuid,
  83. itemType,
  84. itemData,
  85. description);
  86. DB.Insert(sql);
  87. }
  88. }
  89. }