DatabaseTable.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. var 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. };
  27. DB.CreateTableIfNotExisted("lot_data", lot_data, false, "guid");
  28. DB.CreateTableColumn("lot_data", lot_data);
  29. var recipe_step_data = new Dictionary<string, Type>()
  30. {
  31. {"guid", typeof(string)},
  32. {"step_begin_time", typeof(DateTime)},
  33. {"step_end_time", typeof(DateTime)},
  34. {"step_name", typeof(string)},
  35. {"step_time", typeof(float)},
  36. {"process_data_guid", typeof(string)},
  37. {"step_number", typeof(int)},
  38. };
  39. DB.CreateTableIfNotExisted("recipe_step_data", recipe_step_data, false, "guid");
  40. DB.CreateTableIndexIfNotExisted("recipe_step_data", "recipe_step_data_idx1", "CREATE INDEX recipe_step_data_idx1 ON public.recipe_step_data USING btree" +
  41. "(\"process_data_guid\", \"step_number\");");
  42. DB.CreateTableColumn("recipe_step_data", recipe_step_data);
  43. var step_fdc_data = new Dictionary<string, Type>()
  44. {
  45. {"process_data_guid", typeof(string)},
  46. {"step_number", typeof(int)},
  47. {"create_time", typeof(DateTime)},
  48. {"parameter_name", typeof(string)},
  49. {"sample_count", typeof(int)},
  50. {"min_value", typeof(float)},
  51. {"max_value", typeof(float)},
  52. {"setpoint", typeof(float)},
  53. {"std_value", typeof(float)},
  54. {"mean_value", typeof(float)},
  55. };
  56. DB.CreateTableIfNotExisted("step_fdc_data", step_fdc_data, false, "");
  57. DB.CreateTableIndexIfNotExisted("step_fdc_data", "step_fdc_data_idx1", "CREATE INDEX step_fdc_data_idx1 ON public.step_fdc_data USING btree" +
  58. "(\"process_data_guid\", \"step_number\");");
  59. DB.CreateTableColumn("step_fdc_data", step_fdc_data);
  60. var lot_wafer_data = new Dictionary<string, Type>()
  61. {
  62. {"guid", typeof(string)},
  63. {"create_time", typeof(DateTime)},
  64. {"lot_data_guid", typeof(string)},
  65. {"wafer_data_guid", typeof(string)},
  66. };
  67. DB.CreateTableIfNotExisted("lot_wafer_data", lot_wafer_data, false, "guid");
  68. DB.CreateTableIndexIfNotExisted("lot_wafer_data", "lot_wafer_data_idx1", "CREATE INDEX lot_wafer_data_idx1 ON public.lot_wafer_data USING btree" +
  69. "(lot_data_guid COLLATE pg_catalog.\"default\", wafer_data_guid COLLATE pg_catalog.\"default\");");
  70. DB.CreateTableColumn("lot_wafer_data", lot_wafer_data);
  71. DB.CreateTableColumn("wafer_data", new Dictionary<string, Type>()
  72. {
  73. {"lot_id", typeof(string) },
  74. {"notch_angle", typeof(float) },
  75. {"sequence_name", typeof(string) },
  76. {"process_status", typeof(string) },
  77. });
  78. DB.CreateTableColumn("cj_data", new Dictionary<string, Type>()
  79. {
  80. {"total_wafer_count", typeof(int) },
  81. {"abort_wafer_count", typeof(int) },
  82. {"unprocessed_wafer_count", typeof(int) },
  83. });
  84. DB.CreateTableColumn("leak_check_data", new Dictionary<string, Type>()
  85. {
  86. {"module_name", typeof(string) },
  87. {"gasline_selection", typeof(string) },
  88. });
  89. DB.CreateTableColumn("process_data", new Dictionary<string, Type>()
  90. {
  91. {"recipe_setting_time", typeof(float) },
  92. {"lot_id", typeof(string) },
  93. {"slot_id", typeof(string) },
  94. });
  95. }
  96. }
  97. }