VpwRecipeViewModel.cs 28 KB

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