RecipeWaferChargeRuleViewModel.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  2. using MECF.Framework.UI.Client.ClientBase;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using FurnaceUI.Models;
  10. using FurnaceUI.Views.Recipes;
  11. namespace FurnaceUI.Views.Editors
  12. {
  13. public class RecipeWaferChargeRuleViewModel : FurnaceUIViewModelBase
  14. {
  15. public RecipeDataLayout CurrentRecipe { get; set; } = new RecipeDataLayout();
  16. public RecipeLayoutEntityNormal NormalEntity { get; set; }
  17. public bool IsLeaveAsChecked { get; set; }
  18. public bool IsPackWholeChecked { get; set; }
  19. public bool IsMoveChecked { get; set; }
  20. public bool IsDoNotMoveChecked { get; set; }
  21. public bool IsWhenCassetteLeaveAsChecked { get; set; }
  22. public bool IsWhenCassetteSupplyEDChecked { get; set; }
  23. public bool IsWhenCassetteAbortWhenShortChecked { get; set; }
  24. public bool IsWhenWaferLeaveAsChecked { get; set; }
  25. public bool IsWhenWaferSupplyEDChecked { get; set; }
  26. public bool IsWhenWaferAbortWhenShortChecked { get; set; }
  27. public bool IsWhenEDLeaveAsChecked { get; set; }
  28. public bool IsWhenEDAbortWhenErrorChecked { get; set; }
  29. public bool IsWhenEDWarningAndContinueChecked { get; set; }
  30. public bool IsRuleOfSpaceLeaveAsChecked { get; set; }
  31. public bool IsRuleOfSpaceSupplyEDChecked { get; set; }
  32. public bool IsEnable => CGlobal.RecipeLayoutEditViewEnable;//是否是View模式
  33. protected override void OnInitialize()
  34. {
  35. base.OnInitialize();
  36. IsLeaveAsChecked = NormalEntity.WhenPWaferShort == "LeaveAs" || string.IsNullOrEmpty(NormalEntity.WhenPWaferShort);
  37. IsPackWholeChecked = !IsLeaveAsChecked;
  38. IsDoNotMoveChecked = NormalEntity.SDRule == "DonotMove" || string.IsNullOrEmpty(NormalEntity.SDRule);
  39. IsMoveChecked = !IsDoNotMoveChecked;
  40. IsRuleOfSpaceLeaveAsChecked = NormalEntity.RuleOfSpaceInBoat == "LeaveAs" || string.IsNullOrEmpty(NormalEntity.RuleOfSpaceInBoat);
  41. IsRuleOfSpaceSupplyEDChecked = !IsRuleOfSpaceLeaveAsChecked;
  42. this.ThreeChecked();
  43. }
  44. public void EndEdit()
  45. {
  46. NormalEntity.WhenPWaferShort = IsLeaveAsChecked ? "LeaveAs" : "PackWholeP+M";
  47. NormalEntity.SDRule = IsMoveChecked ? "Move" : "DonotMove";
  48. NormalEntity.RuleOfSpaceInBoat = IsRuleOfSpaceLeaveAsChecked ? "LeaveAs" : "SupplyED";
  49. this.ThreeChose();
  50. ((Window)GetView())?.Close();
  51. }
  52. /// <summary>
  53. /// 三个选项选一保存
  54. /// </summary>
  55. public void ThreeChose()
  56. {
  57. if (IsWhenCassetteLeaveAsChecked)
  58. {
  59. NormalEntity.WhenCassetteInBatchAreShort = "LeaveAs";
  60. }
  61. if (IsWhenCassetteSupplyEDChecked)
  62. {
  63. NormalEntity.WhenCassetteInBatchAreShort = "SupplyED";
  64. }
  65. if (IsWhenCassetteAbortWhenShortChecked)
  66. {
  67. NormalEntity.WhenCassetteInBatchAreShort = "AbortWhenShort";
  68. }
  69. if (IsWhenWaferLeaveAsChecked)
  70. {
  71. NormalEntity.WhenWaferInCassetteAreShort = "LeaveAs";
  72. }
  73. if (IsWhenWaferSupplyEDChecked)
  74. {
  75. NormalEntity.WhenWaferInCassetteAreShort = "SupplyED";
  76. }
  77. if (IsWhenWaferAbortWhenShortChecked)
  78. {
  79. NormalEntity.WhenWaferInCassetteAreShort = "AbortWhenShort";
  80. }
  81. if (IsWhenEDLeaveAsChecked)
  82. {
  83. NormalEntity.WhenEDAreShort = "LeaveAs";
  84. }
  85. if (IsWhenEDAbortWhenErrorChecked)
  86. {
  87. NormalEntity.WhenEDAreShort = "AbortWhenError";
  88. }
  89. if (IsWhenEDWarningAndContinueChecked)
  90. {
  91. NormalEntity.WhenEDAreShort = "WarningAndContinue";
  92. }
  93. }
  94. /// <summary>
  95. /// 显示之前选中的值
  96. /// </summary>
  97. public void ThreeChecked()
  98. {
  99. IsWhenCassetteLeaveAsChecked = NormalEntity.WhenCassetteInBatchAreShort == "LeaveAs" || string.IsNullOrEmpty(NormalEntity.WhenCassetteInBatchAreShort);
  100. IsWhenCassetteSupplyEDChecked = NormalEntity.WhenCassetteInBatchAreShort == "SupplyED";
  101. IsWhenCassetteAbortWhenShortChecked = NormalEntity.WhenCassetteInBatchAreShort == "AbortWhenShort";
  102. IsWhenWaferLeaveAsChecked = NormalEntity.WhenWaferInCassetteAreShort == "LeaveAs" || string.IsNullOrEmpty(NormalEntity.WhenWaferInCassetteAreShort);
  103. IsWhenWaferSupplyEDChecked = NormalEntity.WhenWaferInCassetteAreShort == "SupplyED";
  104. IsWhenWaferAbortWhenShortChecked = NormalEntity.WhenWaferInCassetteAreShort == "AbortWhenShort";
  105. IsWhenEDLeaveAsChecked = NormalEntity.WhenEDAreShort == "LeaveAs" || string.IsNullOrEmpty(NormalEntity.WhenEDAreShort);
  106. IsWhenEDAbortWhenErrorChecked = NormalEntity.WhenEDAreShort == "AbortWhenError";
  107. IsWhenEDWarningAndContinueChecked = NormalEntity.WhenEDAreShort == "WarningAndContinue";
  108. }
  109. public void Close()
  110. {
  111. ((Window)GetView())?.Close();
  112. }
  113. }
  114. }