DatabaseTable.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Aitex.Core.RT.DBCore;
  7. namespace MECF.Framework.Common.DBCore
  8. {
  9. internal class DatabaseTable
  10. {
  11. public static void UpgradeDataTable()
  12. {
  13. DB.CreateTableIfNotExisted("lot_data", new Dictionary<string, Type>()
  14. {
  15. {"guid", typeof(string) },
  16. {"start_time", typeof(DateTime) },
  17. {"end_time", typeof(DateTime) },
  18. {"carrier_data_guid", typeof(string) },
  19. {"cj_data_guid", typeof(string) },
  20. {"name", typeof(string) },
  21. {"input_port", typeof(string) },
  22. {"output_port", typeof(string) },
  23. {"total_wafer_count", typeof(int) },
  24. {"abort_wafer_count", typeof(int) },
  25. {"unprocessed_wafer_count", typeof(int) },
  26. }, false, "guid");
  27. DB.CreateTableIfNotExisted("recipe_step_data", new Dictionary<string, Type>()
  28. {
  29. {"guid", typeof(string) },
  30. {"step_begin_time", typeof(DateTime) },
  31. {"step_end_time", typeof(DateTime) },
  32. {"step_name", typeof(string) },
  33. {"step_time", typeof(float) },
  34. {"process_data_guid", typeof(string) },
  35. {"step_number", typeof(int) },
  36. }, false, "guid");
  37. DB.CreateTableIndexIfNotExisted("recipe_step_data", "recipe_step_data_idx1", "CREATE INDEX recipe_step_data_idx1 ON public.recipe_step_data USING btree" +
  38. "(\"process_data_guid\", \"step_number\");");
  39. DB.CreateTableIfNotExisted("step_fdc_data", new Dictionary<string, Type>()
  40. {
  41. {"process_data_guid", typeof(string) },
  42. {"step_number", typeof(int) },
  43. {"create_time", typeof(DateTime) },
  44. {"parameter_name", typeof(string) },
  45. {"sample_count", typeof(int) },
  46. {"min_value", typeof(float) },
  47. {"max_value", typeof(float) },
  48. {"setpoint", typeof(float) },
  49. {"std_value", typeof(float) },
  50. {"mean_value", typeof(float) },
  51. }, false, "");
  52. DB.CreateTableIndexIfNotExisted("step_fdc_data", "step_fdc_data_idx1", "CREATE INDEX step_fdc_data_idx1 ON public.step_fdc_data USING btree" +
  53. "(\"process_data_guid\", \"step_number\");");
  54. DB.CreateTableIfNotExisted("event_data", new Dictionary<string, Type>()
  55. {
  56. {"gid", typeof(string) },
  57. {"event_id", typeof(int) },
  58. {"role_id", typeof(int) },
  59. {"user_name", typeof(string) },
  60. {"event_enum", typeof(string) },
  61. {"type", typeof(string) },
  62. {"source", typeof(string) },
  63. {"description", typeof(string) },
  64. {"level", typeof(string) },
  65. {"occur_time", typeof(DateTime) },
  66. }, false, "");
  67. DB.CreateTableIndexIfNotExisted("event_data", "event_data_occur_time_event_id_idx", "CREATE INDEX event_data_occur_time_event_id_idx ON public.event_data USING btree" +
  68. "(\"occur_time\", \"event_id\");");
  69. DB.CreateTableIfNotExisted("lot_wafer_data", new Dictionary<string, Type>()
  70. {
  71. {"guid", typeof(string) },
  72. {"create_time", typeof(DateTime) },
  73. {"lot_data_guid", typeof(string) },
  74. {"wafer_data_guid", typeof(string) },
  75. }, false, "guid");
  76. DB.CreateTableIndexIfNotExisted("lot_wafer_data", "lot_wafer_data_idx1", "CREATE INDEX lot_wafer_data_idx1 ON public.lot_wafer_data USING btree"+
  77. "(lot_data_guid COLLATE pg_catalog.\"default\", wafer_data_guid COLLATE pg_catalog.\"default\");");
  78. DB.CreateTableColumn("wafer_data", new Dictionary<string, Type>()
  79. {
  80. {"lot_id", typeof(string) },
  81. {"notch_angle", typeof(float) },
  82. {"sequence_name", typeof(string) },
  83. {"process_status", typeof(string) },
  84. {"use_count", typeof(float) },
  85. {"use_time", typeof(float) },
  86. {"use_thick", typeof(float) },
  87. });
  88. DB.CreateTableColumn("cj_data", new Dictionary<string, Type>()
  89. {
  90. {"total_wafer_count", typeof(int) },
  91. {"abort_wafer_count", typeof(int) },
  92. {"unprocessed_wafer_count", typeof(int) },
  93. });
  94. DB.CreateTableColumn("leak_check_data", new Dictionary<string, Type>()
  95. {
  96. {"module_name", typeof(string) },
  97. {"gasline_selection", typeof(string) },
  98. });
  99. DB.CreateTableColumn("process_data", new Dictionary<string, Type>()
  100. {
  101. {"recipe_setting_time", typeof(float) },
  102. {"pj_id", typeof(string) },
  103. });
  104. DB.CreateTableColumn("stats_data", new Dictionary<string, Type>()
  105. {
  106. {"warning_value", typeof(float) },
  107. });
  108. DB.CreateTableColumn("pj_data", new Dictionary<string, Type>()
  109. {
  110. {"lot_data_guid", typeof(string) },
  111. {"job_name", typeof(string) },
  112. {"batch_id", typeof(string) },
  113. {"recipe_name", typeof(string) },
  114. {"layout_name", typeof(string) },
  115. {"layout_data", typeof(string) },
  116. {"wafer_data", typeof(string) },
  117. {"form", typeof(string) },
  118. {"sequence_name", typeof(string) },
  119. });
  120. DB.CreateTableColumn("wafer_move_history", new Dictionary<string, Type>()
  121. {
  122. {"recipe_name", typeof(string) },
  123. });
  124. DB.CreateTableColumn("cj_data_history", new Dictionary<string, Type>()
  125. {
  126. {"guid", typeof(string) },
  127. {"cj_name", typeof(string) },
  128. {"pj_name", typeof(string) },
  129. {"recipe_name", typeof(string) },
  130. {"wafer_data", typeof(string) },
  131. {"start_time", typeof(DateTime) },
  132. });
  133. }
  134. }
  135. }