DatabaseTable.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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("lot_wafer_data", new Dictionary<string, Type>()
  55. {
  56. {"guid", typeof(string) },
  57. {"create_time", typeof(DateTime) },
  58. {"lot_data_guid", typeof(string) },
  59. {"wafer_data_guid", typeof(string) },
  60. }, false, "guid");
  61. DB.CreateTableIndexIfNotExisted("lot_wafer_data", "lot_wafer_data_idx1", "CREATE INDEX lot_wafer_data_idx1 ON public.lot_wafer_data USING btree"+
  62. "(lot_data_guid COLLATE pg_catalog.\"default\", wafer_data_guid COLLATE pg_catalog.\"default\");");
  63. DB.CreateTableColumn("wafer_data", new Dictionary<string, Type>()
  64. {
  65. {"lot_id", typeof(string) },
  66. {"notch_angle", typeof(float) },
  67. {"sequence_name", typeof(string) },
  68. {"process_status", typeof(string) },
  69. });
  70. DB.CreateTableColumn("cj_data", new Dictionary<string, Type>()
  71. {
  72. {"total_wafer_count", typeof(int) },
  73. {"abort_wafer_count", typeof(int) },
  74. {"unprocessed_wafer_count", typeof(int) },
  75. });
  76. DB.CreateTableColumn("leak_check_data", new Dictionary<string, Type>()
  77. {
  78. {"module_name", typeof(string) },
  79. {"gasline_selection", typeof(string) },
  80. });
  81. DB.CreateTableColumn("process_data", new Dictionary<string, Type>()
  82. {
  83. {"recipe_setting_time", typeof(float) },
  84. });
  85. DB.CreateTableColumn("event_data", new Dictionary<string, Type>()
  86. {
  87. {"role_id", typeof(string) },
  88. {"user_name", typeof(string) },
  89. });
  90. DB.CreateTableColumn("wafer_data", new Dictionary<string, Type>()
  91. {
  92. {"use_count", typeof(float) },
  93. {"use_time", typeof(float) },
  94. {"use_thick", typeof(float) },
  95. });
  96. }
  97. }
  98. }