WaferHistoryDBView.xaml.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. using Aitex.Sorter.Common;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Globalization;
  5. using System.Windows.Controls;
  6. using System.Windows.Data;
  7. namespace MECF.Framework.UI.Client.CenterViews.DataLogs.WaferHistory
  8. {
  9. /// <summary>
  10. /// WaferHistoryDB.xaml 的交互逻辑
  11. /// </summary>
  12. public partial class WaferHistoryDBView : UserControl
  13. {
  14. public WaferHistoryDBView()
  15. {
  16. InitializeComponent();
  17. }
  18. }
  19. public class HistoryLayoutSelectorConverter : IValueConverter
  20. {
  21. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  22. {
  23. if (value != null)
  24. {
  25. var type = ((WaferHistoryItem)value).Type;
  26. switch (type)
  27. {
  28. case WaferHistoryItemType.None:
  29. return LotsLayout;
  30. case WaferHistoryItemType.Lot:
  31. return WaferLayout;
  32. case WaferHistoryItemType.Wafer:
  33. return MovementLayout;
  34. case WaferHistoryItemType.Recipe:
  35. return RecipeLayout;
  36. default:
  37. break;
  38. }
  39. }
  40. return null;
  41. }
  42. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  43. {
  44. return null;
  45. }
  46. public object WaferLayout { get; set; }
  47. public object MovementLayout { get; set; }
  48. public object RecipeLayout { get; set; }
  49. public object LotsLayout { get; set; }
  50. }
  51. public class HistoryLotSelectorConverter : IValueConverter
  52. {
  53. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  54. {
  55. if (value != null)
  56. {
  57. var type = ((WaferHistoryItem)value).Type;
  58. switch (type)
  59. {
  60. case WaferHistoryItemType.Lot:
  61. return LotsLayout;
  62. case WaferHistoryItemType.Cj:
  63. return CjLayout;
  64. case WaferHistoryItemType.Pj:
  65. return PjLayout;
  66. case WaferHistoryItemType.Wafer:
  67. return MovementLayout;
  68. default:
  69. break;
  70. }
  71. }
  72. return null;
  73. }
  74. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  75. {
  76. return null;
  77. }
  78. public object LotsLayout { get; set; }
  79. public object CjLayout { get; set; }
  80. public object PjLayout { get; set; }
  81. public object MovementLayout { get; set; }
  82. }
  83. public class HideMinTimeConverters : IValueConverter
  84. {
  85. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  86. {
  87. if (value is DateTime)
  88. return (DateTime)value == DateTime.MinValue ? "" : ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss");
  89. if (DateTime.TryParse((string)value, out DateTime dateTime))
  90. return dateTime == DateTime.MinValue ? "" : dateTime.ToString("yyyy-MM-dd HH:mm:ss");
  91. return "";
  92. }
  93. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  94. {
  95. return null;
  96. }
  97. }
  98. public class MinTime2BoolConverters : IValueConverter
  99. {
  100. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  101. {
  102. if (value is DateTime)
  103. return (DateTime)value != DateTime.MinValue;
  104. if (DateTime.TryParse((string)value, out DateTime dateTime))
  105. return dateTime != DateTime.MinValue;
  106. return false;
  107. }
  108. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  109. {
  110. return null;
  111. }
  112. }
  113. public class RecipeStepNull2Empty : IValueConverter
  114. {
  115. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  116. {
  117. if (value != null && (value is List<RecipeStep>) && ((List<RecipeStep>)value).Count > 0)
  118. {
  119. return value;
  120. }
  121. return new List<RecipeStep>() { new RecipeStep() { Name = "", StartTime = DateTime.MinValue, EndTime = DateTime.MinValue, ActualTime = "", SettingTime = "" } };
  122. }
  123. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  124. {
  125. return null;
  126. }
  127. }
  128. }