VpwRecipeViewModel.cs 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815
  1. using Aitex.Core.UI.MVVM;
  2. using Aitex.Core.Utilities;
  3. using MECF.Framework.Common.RecipeCenter;
  4. using MECF.Framework.Common.Utilities;
  5. using Prism.Mvvm;
  6. using PunkHPX8_Core;
  7. using PunkHPX8_MainPages.PMs;
  8. using PunkHPX8_Themes.UserControls;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Collections.ObjectModel;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading.Tasks;
  15. using System.Windows;
  16. using System.Windows.Input;
  17. namespace PunkHPX8_MainPages.ViewModels
  18. {
  19. public class VpwRecipeViewModel : BindableBase
  20. {
  21. private const string ENGINEERING = "Engineering";
  22. #region 内部变量
  23. private Dictionary<string, RecipeNode> _recipeNodeDic = new Dictionary<string, RecipeNode>();
  24. private ObservableCollection<RecipeNode> _recipeNodes;
  25. private UiRecipeManager _uiRecipeManager = new UiRecipeManager();
  26. private Dictionary<string, bool> _propertyValidResultDic = new Dictionary<string, bool>();
  27. private VpwRecipe _recipe;
  28. private bool _editEnable;
  29. private bool _createEnable;
  30. private RecipeNode _currentNode;
  31. private bool _enable = false;
  32. private bool _isEdit = false;
  33. private string _recipeErrorReason;
  34. /// <summary>
  35. /// Wafer尺寸集合
  36. /// </summary>
  37. private List<int> _waferSizeLst = null;
  38. /// <summary>
  39. /// Vacuum Prewet step选择索引
  40. /// </summary>
  41. private int _selectedVacuumPrewetIndex = -1;
  42. /// <summary>
  43. /// Extend Clean step选择索引
  44. /// </summary>
  45. private int _selectedExtendCleanIndex = -1;
  46. /// <summary>
  47. /// Vent Prewet step选择索引
  48. /// </summary>
  49. private int _selectedVentPrewetIndex = -1;
  50. #endregion
  51. #region 属性
  52. public ObservableCollection<RecipeNode> RecipeNodes
  53. {
  54. get { return _recipeNodes; }
  55. set { SetProperty(ref _recipeNodes, value); }
  56. }
  57. public Dictionary<string, bool> PropertyValidResultDic
  58. {
  59. get { return _propertyValidResultDic; }
  60. set { SetProperty(ref _propertyValidResultDic, value); }
  61. }
  62. public RecipeNode CurrentNode
  63. {
  64. get { return _currentNode; }
  65. set { SetProperty(ref _currentNode, value); }
  66. }
  67. public bool Enable
  68. {
  69. get { return _enable; }
  70. set { SetProperty(ref _enable, value); }
  71. }
  72. public bool EditEnable
  73. {
  74. get { return _editEnable; }
  75. set { SetProperty(ref _editEnable, value); }
  76. }
  77. public bool CreateEnable
  78. {
  79. get { return _createEnable; }
  80. set { SetProperty(ref _createEnable, value); }
  81. }
  82. public VpwRecipe Recipe
  83. {
  84. get { return _recipe; }
  85. set { SetProperty(ref _recipe, value); }
  86. }
  87. /// <summary>
  88. /// Wafer 尺寸集合
  89. /// </summary>
  90. public List<int> WaferSizeLst
  91. {
  92. get { return _waferSizeLst; }
  93. set { SetProperty(ref _waferSizeLst, value); }
  94. }
  95. /// <summary>
  96. /// Vacuum Prewet step选择索引
  97. /// </summary>
  98. public int SelectedVacuumPrewetIndex
  99. {
  100. get { return _selectedVacuumPrewetIndex; }
  101. set { SetProperty(ref _selectedVacuumPrewetIndex, value); }
  102. }
  103. /// <summary>
  104. /// SelectedExtendCleanIndex选择索引
  105. /// </summary>
  106. public int SelectedExtendCleanIndex
  107. {
  108. get { return _selectedExtendCleanIndex; }
  109. set { SetProperty(ref _selectedExtendCleanIndex, value); }
  110. }
  111. /// <summary>
  112. /// SelectedVentPrewetIndex选择索引
  113. /// </summary>
  114. public int SelectedVentPrewetIndex
  115. {
  116. get { return _selectedVentPrewetIndex; }
  117. set { SetProperty(ref _selectedVentPrewetIndex, value); }
  118. }
  119. #region 指令
  120. public ICommand OperationCommand
  121. {
  122. get;
  123. private set;
  124. }
  125. [IgnorePropertyChange]
  126. public ICommand CreateCommand { get; private set; }
  127. [IgnorePropertyChange]
  128. public ICommand EditCommand { get; private set; }
  129. [IgnorePropertyChange]
  130. public ICommand SaveRecipeCommand { get; private set; }
  131. [IgnorePropertyChange]
  132. public ICommand SaveAsRecipeCommand { get; private set; }
  133. [IgnorePropertyChange]
  134. public ICommand IsSprayBarRetractFalseCommand { get; private set; }
  135. [IgnorePropertyChange]
  136. public ICommand AddBelowCommand { get; private set; }
  137. [IgnorePropertyChange]
  138. public ICommand AddAboveCommand { get; private set; }
  139. [IgnorePropertyChange]
  140. public ICommand MoveUpCommand { get; private set; }
  141. [IgnorePropertyChange]
  142. public ICommand MoveDownCommand { get; private set; }
  143. [IgnorePropertyChange]
  144. public ICommand DeleteCommand { get; private set; }
  145. public ICommand VentPrewetAddBelowCommand { get; private set; }
  146. [IgnorePropertyChange]
  147. public ICommand VentPrewetAddAboveCommand { get; private set; }
  148. [IgnorePropertyChange]
  149. public ICommand VentPrewetMoveUpCommand { get; private set; }
  150. [IgnorePropertyChange]
  151. public ICommand VentPrewetMoveDownCommand { get; private set; }
  152. [IgnorePropertyChange]
  153. public ICommand VentPrewetDeleteCommand { get; private set; }
  154. public ICommand ExtendCleanAddBelowCommand { get; private set; }
  155. [IgnorePropertyChange]
  156. public ICommand ExtendCleanAddAboveCommand { get; private set; }
  157. [IgnorePropertyChange]
  158. public ICommand ExtendCleanMoveUpCommand { get; private set; }
  159. [IgnorePropertyChange]
  160. public ICommand ExtendCleanMoveDownCommand { get; private set; }
  161. [IgnorePropertyChange]
  162. public ICommand ExtendCleanDeleteCommand { get; private set; }
  163. #endregion
  164. public VpwRecipeViewModel()
  165. {
  166. OperationCommand = new DelegateCommand<object>(SelectionChangedAction);
  167. CreateCommand = new DelegateCommand<object>(CreateAction);
  168. EditCommand = new DelegateCommand<object>(EditAction);
  169. SaveRecipeCommand = new DelegateCommand<object>(SaveAction);
  170. SaveAsRecipeCommand = new DelegateCommand<object>(SaveAsAction);
  171. IsSprayBarRetractFalseCommand = new DelegateCommand<object>(IsSprayBarRetractFalseAction);
  172. AddBelowCommand = new DelegateCommand<object>(AddBelowAction);
  173. AddAboveCommand = new DelegateCommand<object>(AddAboveAction);
  174. MoveUpCommand = new DelegateCommand<object>(MoveUpAction);
  175. MoveDownCommand = new DelegateCommand<object>(MoveDownAction);
  176. DeleteCommand = new DelegateCommand<object>(DeleteAction);
  177. VentPrewetAddBelowCommand = new DelegateCommand<object>(VentPrewetAddBelowAction);
  178. VentPrewetAddAboveCommand = new DelegateCommand<object>(VentPrewetAddAboveAction);
  179. VentPrewetMoveUpCommand = new DelegateCommand<object>(VentPrewetMoveUpAction);
  180. VentPrewetMoveDownCommand = new DelegateCommand<object>(VentPrewetMoveDownAction);
  181. VentPrewetDeleteCommand = new DelegateCommand<object>(VentPrewetDeleteAction);
  182. ExtendCleanAddBelowCommand = new DelegateCommand<object>(ExtendCleanAddBelowAction);
  183. ExtendCleanAddAboveCommand = new DelegateCommand<object>(ExtendCleanAddAboveAction);
  184. ExtendCleanMoveUpCommand = new DelegateCommand<object>(ExtendCleanMoveUpAction);
  185. ExtendCleanMoveDownCommand = new DelegateCommand<object>(ExtendCleanMoveDownAction);
  186. ExtendCleanDeleteCommand = new DelegateCommand<object>(ExtendCleanDeleteAction);
  187. //Wafer尺寸集合
  188. WaferSizeLst = new List<int>();
  189. WaferSizeLst.Add(100);
  190. WaferSizeLst.Add(150);
  191. WaferSizeLst.Add(200);
  192. WaferSizeLst.Add(300);
  193. InitializeProprtyValidResultDictionary();
  194. }
  195. #endregion
  196. private void InitializeProprtyValidResultDictionary()
  197. {
  198. //需要检验的参数
  199. PropertyValidResultDic["VacuumTarget"] = false;
  200. PropertyValidResultDic["DryHoldTime"] = false;
  201. PropertyValidResultDic["DiwLoopDoSet"] = false;
  202. PropertyValidResultDic["SpinSpeed"] = false;
  203. PropertyValidResultDic["SpinTime"] = false;
  204. PropertyValidResultDic["VacuumPrewetFlowSetPoint"] = false;
  205. PropertyValidResultDic["VacuumPrewetFlowWarningPercent"] = false;
  206. PropertyValidResultDic["VacuumPrewetFlowErrorPercent"] = false;
  207. PropertyValidResultDic["VentPrewetFlowSetPoint"] = false;
  208. PropertyValidResultDic["VentPrewetFlowWarningPercent"] = false;
  209. PropertyValidResultDic["VentPrewetFlowErrorPercent"] = false;
  210. PropertyValidResultDic["ExtendCleanFlowSetPoint"] = false;
  211. PropertyValidResultDic["ExtendCleanFlowWarningPercent"] = false;
  212. PropertyValidResultDic["ExtendCleanFlowErrorPercent"] = false;
  213. }
  214. public void LoadRecipeData()
  215. {
  216. RecipeNodes = _uiRecipeManager.GetRecipesByType("vpw");
  217. _recipeNodeDic.Clear();
  218. InitializeDictionary(RecipeNodes);
  219. }
  220. private void InitializeDictionary(ObservableCollection<RecipeNode> nodes)
  221. {
  222. if (nodes != null)
  223. {
  224. foreach (var node in nodes)
  225. {
  226. if (node.NodeType == RecipeNodeType.File)
  227. {
  228. _recipeNodeDic[node.Name] = node;
  229. }
  230. InitializeDictionary(node.Children);
  231. }
  232. }
  233. }
  234. private void SelectionChangedAction(object param)
  235. {
  236. if (_recipeNodeDic.ContainsKey(param.ToString()))
  237. {
  238. CurrentNode = _recipeNodeDic[param.ToString()];
  239. if (CurrentNode.NodeType == RecipeNodeType.File)
  240. {
  241. if (CurrentNode.RecipeLocation == ENGINEERING)
  242. {
  243. EditEnable = true;
  244. CreateEnable = true;
  245. }
  246. else
  247. {
  248. EditEnable = false;
  249. CreateEnable = false;
  250. }
  251. }
  252. Recipe = _uiRecipeManager.LoadRecipe<VpwRecipe>(CurrentNode.RecipeFullFileName);
  253. if (Recipe == null)
  254. {
  255. MessageBox.Show("Invalid Recipe", "Load Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  256. EditEnable = false;
  257. CreateEnable = false;
  258. }
  259. Enable = false;
  260. }
  261. else
  262. {
  263. if (param.ToString() == ENGINEERING)
  264. {
  265. CreateEnable = true;
  266. }
  267. else
  268. {
  269. CreateEnable = false;
  270. }
  271. CurrentNode = null;
  272. Recipe = null;
  273. EditEnable = false;
  274. Enable = false;
  275. }
  276. }
  277. private void CreateAction(object param)
  278. {
  279. RecipeNameDialog recipeNameDialog = new RecipeNameDialog();
  280. if (recipeNameDialog.ShowDialog().Value)
  281. {
  282. if (!CheckNameExist(recipeNameDialog.RecipeName))
  283. {
  284. Recipe = new VpwRecipe();
  285. Recipe.CreateDate = DateTime.Now;
  286. Recipe.Ppid = recipeNameDialog.RecipeName;
  287. Recipe.Description = recipeNameDialog.RecipeDescription;
  288. Recipe.VacuumRinseStep = new ObservableCollection<VpwRinseStep>();
  289. Recipe.VentRinseStep = new ObservableCollection<VpwRinseStep>();
  290. Recipe.ExtendCleanRinseStep = new ObservableCollection<VpwRinseStep>();
  291. Enable = true;
  292. _isEdit = false;
  293. }
  294. }
  295. }
  296. private void EditAction(object param)
  297. {
  298. Enable = true;
  299. _isEdit = false;
  300. }
  301. private bool CheckVpwRecipeRinseStepValueValid(VpwRecipe vpwRecipe,out string errorReason)
  302. {
  303. errorReason = "";
  304. foreach (var item in vpwRecipe.VacuumRinseStep)
  305. {
  306. if (item.DurationSeconds <= 0 || item.DurationSeconds > 200)
  307. {
  308. errorReason = "VacuumPrewet Rinse Step Time value is not in 0~200";
  309. return false;
  310. }
  311. if (item.RotationSpeed <= 0 || item.RotationSpeed > 800)
  312. {
  313. errorReason = "VacuumPrewet Rinse Step Speed value is not in 0~800";
  314. return false;
  315. }
  316. }
  317. foreach (var item in vpwRecipe.VentRinseStep)
  318. {
  319. if (item.DurationSeconds <= 0 || item.DurationSeconds > 200)
  320. {
  321. errorReason = "VentPrewet Rinse Step Rinse Step Time value is not in 0~200";
  322. return false;
  323. }
  324. if (item.RotationSpeed <= 0 || item.RotationSpeed > 800)
  325. {
  326. errorReason = "VentPrewet Rinse Step Speed value is not in 0~800";
  327. return false;
  328. }
  329. }
  330. foreach (var item in vpwRecipe.ExtendCleanRinseStep)
  331. {
  332. if (item.DurationSeconds <= 0 || item.DurationSeconds > 200)
  333. {
  334. errorReason = "ExtendClean Rinse Step Rinse Step Time value is not in 0~200";
  335. return false;
  336. }
  337. if (item.RotationSpeed <= 0 || item.RotationSpeed > 800)
  338. {
  339. errorReason = "ExtendClean Rinse Step Rinse Step Speed value is not in 0~800";
  340. return false;
  341. }
  342. }
  343. return true;
  344. }
  345. private void SaveAction(object param)
  346. {
  347. if (CheckValid(_isEdit))
  348. {
  349. if (!CheckVpwRecipeRinseStepValueValid(Recipe, out _recipeErrorReason))
  350. {
  351. MessageBox.Show($"{_recipeErrorReason}", "Save Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  352. return;
  353. }
  354. Recipe.SaveDate = DateTime.Now;
  355. try
  356. {
  357. _uiRecipeManager.SaveRecipe<VpwRecipe>(ENGINEERING, Recipe.Ppid, "vpw", Recipe);
  358. LoadRecipeData();
  359. MessageBox.Show("Save Recipe Success", "Save Recipe", MessageBoxButton.OK, MessageBoxImage.Information);
  360. Enable = false;
  361. }
  362. catch (Exception ex)
  363. {
  364. MessageBox.Show(ex.Message, "Save Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  365. }
  366. }
  367. }
  368. /// <summary>
  369. /// 另存为
  370. /// </summary>
  371. /// <param name="param"></param>
  372. private void SaveAsAction(object param)
  373. {
  374. if (Recipe == null)
  375. {
  376. MessageBox.Show("Select a Recipe first", "SaveAs Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  377. return;
  378. }
  379. VpwRecipe recipe = new VpwRecipe();
  380. if (CheckValid(_isEdit))
  381. {
  382. RecipeNameDialog recipeNameDialog = new RecipeNameDialog();
  383. if (recipeNameDialog.ShowDialog().Value)
  384. {
  385. if (!CheckNameExist(recipeNameDialog.RecipeName))
  386. {
  387. recipe = new VpwRecipe();
  388. recipe = (VpwRecipe)PropertyUtil.Clone(Recipe);
  389. recipe.CreateDate = DateTime.Now;
  390. recipe.Ppid = recipeNameDialog.RecipeName;
  391. recipe.Description = recipeNameDialog.RecipeDescription;
  392. }
  393. else if (recipeNameDialog.RecipeName != null)
  394. {
  395. MessageBox.Show("Name can not be Null", "Create Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  396. return;
  397. }
  398. else
  399. {
  400. return;
  401. }
  402. }
  403. try
  404. {
  405. _uiRecipeManager.SaveRecipe<VpwRecipe>(ENGINEERING, recipe.Ppid, "vpw", recipe);
  406. LoadRecipeData();
  407. MessageBox.Show("Save As Recipe Success", "SaveAs Recipe", MessageBoxButton.OK, MessageBoxImage.Information);
  408. Enable = false;
  409. }
  410. catch (Exception ex)
  411. {
  412. MessageBox.Show(ex.Message, "Save As Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  413. }
  414. }
  415. }
  416. private bool CheckNameExist(string name)
  417. {
  418. foreach (string item in _recipeNodeDic.Keys)
  419. {
  420. if (item == name)
  421. {
  422. MessageBox.Show($"{name} is exsit", "Save Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  423. return true;
  424. }
  425. }
  426. return false;
  427. }
  428. private bool CheckValid(bool editType)
  429. {
  430. foreach (string key in _propertyValidResultDic.Keys)
  431. {
  432. bool valid = _propertyValidResultDic[key];
  433. if (!valid)
  434. {
  435. MessageBox.Show($"{key} data invalid", "Save Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  436. return false;
  437. }
  438. }
  439. return true;
  440. }
  441. private void IsSprayBarRetractFalseAction(object param)
  442. {
  443. Recipe.IsSprayBarRetract = false;
  444. }
  445. #region Vacuum prewet按钮
  446. /// <summary>
  447. /// 增加
  448. /// </summary>
  449. /// <param name="param"></param>
  450. private void AddBelowAction(object param)
  451. {
  452. if (Recipe != null)
  453. {
  454. VpwRinseStep currentRinseSteps = new VpwRinseStep();
  455. currentRinseSteps.Index = SelectedVacuumPrewetIndex + 1;
  456. for(int i = currentRinseSteps.Index; i<=Recipe.VacuumRinseStep.Count-1; i++)
  457. {
  458. Recipe.VacuumRinseStep[i].Index++;
  459. }
  460. Recipe.VacuumRinseStep.Insert(SelectedVacuumPrewetIndex + 1, currentRinseSteps);
  461. SelectedVacuumPrewetIndex++;
  462. }
  463. }
  464. /// <summary>
  465. /// 增加
  466. /// </summary>
  467. /// <param name="param"></param>
  468. private void AddAboveAction(object param)
  469. {
  470. if (Recipe != null)
  471. {
  472. VpwRinseStep currentRinseSteps = new VpwRinseStep();
  473. if (SelectedVacuumPrewetIndex == -1)
  474. {
  475. Recipe.VacuumRinseStep.Add(currentRinseSteps);
  476. SelectedVacuumPrewetIndex = 0;
  477. }
  478. else
  479. {
  480. currentRinseSteps.Index = SelectedVacuumPrewetIndex;
  481. for (int i = currentRinseSteps.Index; i <= Recipe.VacuumRinseStep.Count-1; i++)
  482. {
  483. Recipe.VacuumRinseStep[i].Index++;
  484. }
  485. Recipe.VacuumRinseStep.Insert(SelectedVacuumPrewetIndex, currentRinseSteps);
  486. SelectedVacuumPrewetIndex--;
  487. }
  488. }
  489. }
  490. /// <summary>
  491. /// 上移
  492. /// </summary>
  493. /// <param name="param"></param>
  494. private void MoveUpAction(object param)
  495. {
  496. if (Recipe != null)
  497. {
  498. if (SelectedVacuumPrewetIndex > 0)
  499. {
  500. int currentIndex = SelectedVacuumPrewetIndex;
  501. VpwRinseStep currentRinseSteps = Recipe.VacuumRinseStep[SelectedVacuumPrewetIndex];
  502. currentRinseSteps.Index -= 1;
  503. Recipe.VacuumRinseStep[SelectedVacuumPrewetIndex-1].Index += 1;
  504. Recipe.VacuumRinseStep.RemoveAt(SelectedVacuumPrewetIndex);
  505. Recipe.VacuumRinseStep.Insert(currentIndex - 1, currentRinseSteps);
  506. SelectedVacuumPrewetIndex = currentIndex - 1;
  507. }
  508. }
  509. }
  510. /// <summary>
  511. /// 下移
  512. /// </summary>
  513. /// <param name="param"></param>
  514. private void MoveDownAction(object param)
  515. {
  516. if (Recipe != null)
  517. {
  518. if (SelectedVacuumPrewetIndex >= 0 && SelectedVacuumPrewetIndex < Recipe.VacuumRinseStep.Count - 1 && Recipe.VacuumRinseStep.Count > 1)
  519. {
  520. int currentIndex = SelectedVacuumPrewetIndex;
  521. VpwRinseStep currentRinseSteps = Recipe.VacuumRinseStep[SelectedVacuumPrewetIndex];
  522. currentRinseSteps.Index += 1;
  523. Recipe.VacuumRinseStep[SelectedVacuumPrewetIndex + 1].Index -= 1;
  524. Recipe.VacuumRinseStep.RemoveAt(SelectedVacuumPrewetIndex);
  525. Recipe.VacuumRinseStep.Insert(currentIndex + 1, currentRinseSteps);
  526. SelectedVacuumPrewetIndex = currentIndex + 1;
  527. }
  528. }
  529. }
  530. /// <summary>
  531. /// 删除
  532. /// </summary>
  533. /// <param name="param"></param>
  534. private void DeleteAction(object param)
  535. {
  536. if (SelectedVacuumPrewetIndex != -1)
  537. {
  538. if (Recipe != null && Recipe.VacuumRinseStep.Count > SelectedVacuumPrewetIndex)
  539. {
  540. for (int i = SelectedVacuumPrewetIndex + 1; i <= Recipe.VacuumRinseStep.Count - 1; i++)
  541. {
  542. Recipe.VacuumRinseStep[i].Index -= 1;
  543. }
  544. Recipe.VacuumRinseStep.RemoveAt(SelectedVacuumPrewetIndex);
  545. }
  546. }
  547. }
  548. #endregion
  549. #region Vent prewet按钮
  550. /// <summary>
  551. /// 增加
  552. /// </summary>
  553. /// <param name="param"></param>
  554. private void VentPrewetAddBelowAction(object param)
  555. {
  556. if (Recipe != null)
  557. {
  558. VpwRinseStep currentRinseSteps = new VpwRinseStep();
  559. currentRinseSteps.Index = SelectedVentPrewetIndex + 1;
  560. for (int i = currentRinseSteps.Index; i <= Recipe.VentRinseStep.Count - 1; i++)
  561. {
  562. Recipe.VentRinseStep[i].Index++;
  563. }
  564. Recipe.VentRinseStep.Insert(SelectedVentPrewetIndex + 1, currentRinseSteps);
  565. SelectedVentPrewetIndex++;
  566. }
  567. }
  568. /// <summary>
  569. /// 增加
  570. /// </summary>
  571. /// <param name="param"></param>
  572. private void VentPrewetAddAboveAction(object param)
  573. {
  574. if (Recipe != null)
  575. {
  576. VpwRinseStep currentRinseSteps = new VpwRinseStep();
  577. if (SelectedVentPrewetIndex == -1)
  578. {
  579. Recipe.VentRinseStep.Add(currentRinseSteps);
  580. SelectedVentPrewetIndex = 0;
  581. }
  582. else
  583. {
  584. currentRinseSteps.Index = SelectedVentPrewetIndex;
  585. for (int i = currentRinseSteps.Index; i <= Recipe.VentRinseStep.Count - 1; i++)
  586. {
  587. Recipe.VentRinseStep[i].Index++;
  588. }
  589. Recipe.VentRinseStep.Insert(SelectedVentPrewetIndex, currentRinseSteps);
  590. SelectedVentPrewetIndex--;
  591. }
  592. }
  593. }
  594. /// <summary>
  595. /// 上移
  596. /// </summary>
  597. /// <param name="param"></param>
  598. private void VentPrewetMoveUpAction(object param)
  599. {
  600. if (Recipe != null)
  601. {
  602. if (SelectedVentPrewetIndex > 0)
  603. {
  604. int currentIndex = SelectedVentPrewetIndex;
  605. VpwRinseStep currentRinseSteps = Recipe.VentRinseStep[SelectedVentPrewetIndex];
  606. currentRinseSteps.Index -= 1;
  607. Recipe.VentRinseStep[SelectedVentPrewetIndex - 1].Index += 1;
  608. Recipe.VentRinseStep.RemoveAt(SelectedVentPrewetIndex);
  609. Recipe.VentRinseStep.Insert(currentIndex - 1, currentRinseSteps);
  610. SelectedVentPrewetIndex = currentIndex - 1;
  611. }
  612. }
  613. }
  614. /// <summary>
  615. /// 下移
  616. /// </summary>
  617. /// <param name="param"></param>
  618. private void VentPrewetMoveDownAction(object param)
  619. {
  620. if (Recipe != null)
  621. {
  622. if (SelectedVentPrewetIndex >= 0 && SelectedVentPrewetIndex < Recipe.VentRinseStep.Count - 1 && Recipe.VentRinseStep.Count > 1)
  623. {
  624. int currentIndex = SelectedVentPrewetIndex;
  625. VpwRinseStep currentRinseSteps = Recipe.VentRinseStep[SelectedVentPrewetIndex];
  626. currentRinseSteps.Index += 1;
  627. Recipe.VentRinseStep[SelectedVentPrewetIndex + 1].Index -= 1;
  628. Recipe.VentRinseStep.RemoveAt(SelectedVentPrewetIndex);
  629. Recipe.VentRinseStep.Insert(currentIndex + 1, currentRinseSteps);
  630. SelectedVentPrewetIndex = currentIndex + 1;
  631. }
  632. }
  633. }
  634. /// <summary>
  635. /// 删除
  636. /// </summary>
  637. /// <param name="param"></param>
  638. private void VentPrewetDeleteAction(object param)
  639. {
  640. if (SelectedVentPrewetIndex != -1)
  641. {
  642. if (Recipe != null && Recipe.VentRinseStep.Count > SelectedVentPrewetIndex)
  643. {
  644. for (int i = SelectedVentPrewetIndex + 1; i <= Recipe.VentRinseStep.Count - 1; i++)
  645. {
  646. Recipe.VentRinseStep[i].Index -= 1;
  647. }
  648. Recipe.VentRinseStep.RemoveAt(SelectedVentPrewetIndex);
  649. }
  650. }
  651. }
  652. #endregion
  653. #region Extend Clean按钮
  654. /// <summary>
  655. /// 增加
  656. /// </summary>
  657. /// <param name="param"></param>
  658. private void ExtendCleanAddBelowAction(object param)
  659. {
  660. if (Recipe != null)
  661. {
  662. VpwRinseStep currentRinseSteps = new VpwRinseStep();
  663. currentRinseSteps.Index = SelectedExtendCleanIndex + 1;
  664. for (int i = currentRinseSteps.Index; i <= Recipe.ExtendCleanRinseStep.Count - 1; i++)
  665. {
  666. Recipe.ExtendCleanRinseStep[i].Index++;
  667. }
  668. Recipe.ExtendCleanRinseStep.Insert(SelectedExtendCleanIndex + 1, currentRinseSteps);
  669. SelectedExtendCleanIndex++;
  670. }
  671. }
  672. /// <summary>
  673. /// 增加
  674. /// </summary>
  675. /// <param name="param"></param>
  676. private void ExtendCleanAddAboveAction(object param)
  677. {
  678. if (Recipe != null)
  679. {
  680. VpwRinseStep currentRinseSteps = new VpwRinseStep();
  681. if (SelectedExtendCleanIndex == -1)
  682. {
  683. Recipe.ExtendCleanRinseStep.Add(currentRinseSteps);
  684. SelectedExtendCleanIndex = 0;
  685. }
  686. else
  687. {
  688. currentRinseSteps.Index = SelectedExtendCleanIndex;
  689. for (int i = currentRinseSteps.Index; i <= Recipe.ExtendCleanRinseStep.Count - 1; i++)
  690. {
  691. Recipe.ExtendCleanRinseStep[i].Index++;
  692. }
  693. Recipe.ExtendCleanRinseStep.Insert(SelectedExtendCleanIndex, currentRinseSteps);
  694. SelectedExtendCleanIndex--;
  695. }
  696. }
  697. }
  698. /// <summary>
  699. /// 上移
  700. /// </summary>
  701. /// <param name="param"></param>
  702. private void ExtendCleanMoveUpAction(object param)
  703. {
  704. if (Recipe != null)
  705. {
  706. if (SelectedExtendCleanIndex > 0)
  707. {
  708. int currentIndex = SelectedExtendCleanIndex;
  709. VpwRinseStep currentRinseSteps = Recipe.ExtendCleanRinseStep[SelectedExtendCleanIndex];
  710. currentRinseSteps.Index -= 1;
  711. Recipe.ExtendCleanRinseStep[SelectedExtendCleanIndex - 1].Index += 1;
  712. Recipe.ExtendCleanRinseStep.RemoveAt(SelectedExtendCleanIndex);
  713. Recipe.ExtendCleanRinseStep.Insert(currentIndex - 1, currentRinseSteps);
  714. SelectedExtendCleanIndex = currentIndex - 1;
  715. }
  716. }
  717. }
  718. /// <summary>
  719. /// 下移
  720. /// </summary>
  721. /// <param name="param"></param>
  722. private void ExtendCleanMoveDownAction(object param)
  723. {
  724. if (Recipe != null)
  725. {
  726. if (SelectedExtendCleanIndex >= 0 && SelectedExtendCleanIndex < Recipe.ExtendCleanRinseStep.Count - 1 && Recipe.ExtendCleanRinseStep.Count > 1)
  727. {
  728. int currentIndex = SelectedExtendCleanIndex;
  729. VpwRinseStep currentRinseSteps = Recipe.ExtendCleanRinseStep[SelectedExtendCleanIndex];
  730. currentRinseSteps.Index += 1;
  731. Recipe.ExtendCleanRinseStep[SelectedExtendCleanIndex + 1].Index -= 1;
  732. Recipe.ExtendCleanRinseStep.RemoveAt(SelectedExtendCleanIndex);
  733. Recipe.ExtendCleanRinseStep.Insert(currentIndex + 1, currentRinseSteps);
  734. SelectedExtendCleanIndex = currentIndex + 1;
  735. }
  736. }
  737. }
  738. /// <summary>
  739. /// 删除
  740. /// </summary>
  741. /// <param name="param"></param>
  742. private void ExtendCleanDeleteAction(object param)
  743. {
  744. if (SelectedExtendCleanIndex != -1)
  745. {
  746. if (Recipe != null && Recipe.ExtendCleanRinseStep.Count > SelectedExtendCleanIndex)
  747. {
  748. for (int i = SelectedExtendCleanIndex + 1; i <= Recipe.ExtendCleanRinseStep.Count - 1; i++)
  749. {
  750. Recipe.ExtendCleanRinseStep[i].Index -= 1;
  751. }
  752. Recipe.ExtendCleanRinseStep.RemoveAt(SelectedExtendCleanIndex);
  753. }
  754. }
  755. }
  756. #endregion
  757. }
  758. }