WaferHistoryDBView.xaml.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Windows.Controls;
  5. using System.Windows.Data;
  6. using MECF.Framework.Common.CommonData;
  7. namespace VirgoUI.Client.Models.DataLog.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 HideMinTimeConverters : IValueConverter
  52. {
  53. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  54. {
  55. if (value is DateTime)
  56. return (DateTime)value == DateTime.MinValue ? "" : ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss");
  57. if (DateTime.TryParse((string)value, out DateTime dateTime))
  58. return dateTime == DateTime.MinValue ? "" : dateTime.ToString("yyyy-MM-dd HH:mm:ss");
  59. return "";
  60. }
  61. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  62. {
  63. return null;
  64. }
  65. }
  66. public class MinTime2BoolConverters : IValueConverter
  67. {
  68. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  69. {
  70. if (value is DateTime)
  71. return (DateTime)value != DateTime.MinValue;
  72. if (DateTime.TryParse((string)value, out DateTime dateTime))
  73. return dateTime != DateTime.MinValue;
  74. return false;
  75. }
  76. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  77. {
  78. return null;
  79. }
  80. }
  81. public class RecipeStepNull2Empty : IValueConverter
  82. {
  83. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  84. {
  85. if (value != null && (value is List<RecipeStep>) && ((List<RecipeStep>)value).Count > 0)
  86. {
  87. return value;
  88. }
  89. return new List<RecipeStep>() { new RecipeStep() { Name = "", StartTime = DateTime.MinValue, EndTime = DateTime.MinValue, ActualTime = "", SettingTime = "" } };
  90. }
  91. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  92. {
  93. return null;
  94. }
  95. }
  96. }