WaferHistoryDBView.xaml.cs 3.7 KB

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