VpwRecipeViewModel.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  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. PropertyValidResultDic["VacuumPrewetFlowSetPoint"] = false;
  204. PropertyValidResultDic["VacuumPrewetFlowWarningPercent"] = false;
  205. PropertyValidResultDic["VacuumPrewetFlowErrorPercent"] = false;
  206. PropertyValidResultDic["VentPrewetFlowSetPoint"] = false;
  207. PropertyValidResultDic["VentPrewetFlowWarningPercent"] = false;
  208. PropertyValidResultDic["VentPrewetFlowErrorPercent"] = false;
  209. PropertyValidResultDic["ExtendCleanFlowSetPoint"] = false;
  210. PropertyValidResultDic["ExtendCleanFlowWarningPercent"] = false;
  211. PropertyValidResultDic["ExtendCleanFlowErrorPercent"] = false;
  212. }
  213. public void LoadRecipeData()
  214. {
  215. RecipeNodes = _uiRecipeManager.GetRecipesByType("vpw");
  216. _recipeNodeDic.Clear();
  217. InitializeDictionary(RecipeNodes);
  218. }
  219. private void InitializeDictionary(ObservableCollection<RecipeNode> nodes)
  220. {
  221. if (nodes != null)
  222. {
  223. foreach (var node in nodes)
  224. {
  225. if (node.NodeType == RecipeNodeType.File)
  226. {
  227. _recipeNodeDic[node.Name] = node;
  228. }
  229. InitializeDictionary(node.Children);
  230. }
  231. }
  232. }
  233. private void SelectionChangedAction(object param)
  234. {
  235. if (_recipeNodeDic.ContainsKey(param.ToString()))
  236. {
  237. CurrentNode = _recipeNodeDic[param.ToString()];
  238. if (CurrentNode.NodeType == RecipeNodeType.File)
  239. {
  240. if (CurrentNode.RecipeLocation == ENGINEERING)
  241. {
  242. EditEnable = true;
  243. CreateEnable = true;
  244. }
  245. else
  246. {
  247. EditEnable = false;
  248. CreateEnable = false;
  249. }
  250. }
  251. Recipe = _uiRecipeManager.LoadRecipe<VpwRecipe>(CurrentNode.RecipeFullFileName);
  252. if (Recipe == null)
  253. {
  254. MessageBox.Show("Invalid Recipe", "Load Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  255. EditEnable = false;
  256. CreateEnable = false;
  257. }
  258. Enable = false;
  259. }
  260. else
  261. {
  262. if (param.ToString() == ENGINEERING)
  263. {
  264. CreateEnable = true;
  265. }
  266. else
  267. {
  268. CreateEnable = false;
  269. }
  270. CurrentNode = null;
  271. Recipe = null;
  272. EditEnable = false;
  273. Enable = false;
  274. }
  275. }
  276. private void CreateAction(object param)
  277. {
  278. RecipeNameDialog recipeNameDialog = new RecipeNameDialog();
  279. if (recipeNameDialog.ShowDialog().Value)
  280. {
  281. if (!CheckNameExist(recipeNameDialog.RecipeName))
  282. {
  283. Recipe = new VpwRecipe();
  284. Recipe.CreateDate = DateTime.Now;
  285. Recipe.Ppid = recipeNameDialog.RecipeName;
  286. Recipe.Description = recipeNameDialog.RecipeDescription;
  287. Recipe.VacuumRinseStep = new ObservableCollection<VpwRinseStep>();
  288. Recipe.VentRinseStep = new ObservableCollection<VpwRinseStep>();
  289. Recipe.ExtendCleanRinseStep = new ObservableCollection<VpwRinseStep>();
  290. Enable = true;
  291. _isEdit = false;
  292. }
  293. }
  294. }
  295. private void EditAction(object param)
  296. {
  297. Enable = true;
  298. _isEdit = false;
  299. }
  300. private void SaveAction(object param)
  301. {
  302. if (CheckValid(_isEdit))
  303. {
  304. Recipe.SaveDate = DateTime.Now;
  305. try
  306. {
  307. _uiRecipeManager.SaveRecipe<VpwRecipe>(ENGINEERING, Recipe.Ppid, "vpw", Recipe);
  308. LoadRecipeData();
  309. MessageBox.Show("Save Recipe Success", "Save Recipe", MessageBoxButton.OK, MessageBoxImage.Information);
  310. Enable = false;
  311. }
  312. catch (Exception ex)
  313. {
  314. MessageBox.Show(ex.Message, "Save Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  315. }
  316. }
  317. }
  318. /// <summary>
  319. /// 另存为
  320. /// </summary>
  321. /// <param name="param"></param>
  322. private void SaveAsAction(object param)
  323. {
  324. if (Recipe == null)
  325. {
  326. MessageBox.Show("Select a Recipe first", "SaveAs Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  327. return;
  328. }
  329. VpwRecipe recipe = new VpwRecipe();
  330. if (CheckValid(_isEdit))
  331. {
  332. RecipeNameDialog recipeNameDialog = new RecipeNameDialog();
  333. if (recipeNameDialog.ShowDialog().Value)
  334. {
  335. if (!CheckNameExist(recipeNameDialog.RecipeName))
  336. {
  337. recipe = new VpwRecipe();
  338. recipe = (VpwRecipe)PropertyUtil.Clone(Recipe);
  339. recipe.CreateDate = DateTime.Now;
  340. recipe.Ppid = recipeNameDialog.RecipeName;
  341. recipe.Description = recipeNameDialog.RecipeDescription;
  342. }
  343. else if (recipeNameDialog.RecipeName != null)
  344. {
  345. MessageBox.Show("Name can not be Null", "Create Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  346. return;
  347. }
  348. else
  349. {
  350. return;
  351. }
  352. }
  353. try
  354. {
  355. _uiRecipeManager.SaveRecipe<VpwRecipe>(ENGINEERING, recipe.Ppid, "vpw", recipe);
  356. LoadRecipeData();
  357. MessageBox.Show("Save As Recipe Success", "SaveAs Recipe", MessageBoxButton.OK, MessageBoxImage.Information);
  358. Enable = false;
  359. }
  360. catch (Exception ex)
  361. {
  362. MessageBox.Show(ex.Message, "Save As Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  363. }
  364. }
  365. }
  366. private bool CheckNameExist(string name)
  367. {
  368. foreach (string item in _recipeNodeDic.Keys)
  369. {
  370. if (item == name)
  371. {
  372. MessageBox.Show($"{name} is exsit", "Save Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  373. return true;
  374. }
  375. }
  376. return false;
  377. }
  378. private bool CheckValid(bool editType)
  379. {
  380. foreach (string key in _propertyValidResultDic.Keys)
  381. {
  382. bool valid = _propertyValidResultDic[key];
  383. if (!valid)
  384. {
  385. MessageBox.Show($"{key} data invalid", "Save Recipe", MessageBoxButton.OK, MessageBoxImage.Error);
  386. return false;
  387. }
  388. }
  389. return true;
  390. }
  391. private void IsSprayBarRetractFalseAction(object param)
  392. {
  393. Recipe.IsSprayBarRetract = false;
  394. }
  395. #region Vacuum prewet按钮
  396. /// <summary>
  397. /// 增加
  398. /// </summary>
  399. /// <param name="param"></param>
  400. private void AddBelowAction(object param)
  401. {
  402. if (Recipe != null)
  403. {
  404. VpwRinseStep currentRinseSteps = new VpwRinseStep();
  405. currentRinseSteps.Index = SelectedVacuumPrewetIndex + 1;
  406. for(int i = currentRinseSteps.Index; i<=Recipe.VacuumRinseStep.Count-1; i++)
  407. {
  408. Recipe.VacuumRinseStep[i].Index++;
  409. }
  410. Recipe.VacuumRinseStep.Insert(SelectedVacuumPrewetIndex + 1, currentRinseSteps);
  411. SelectedVacuumPrewetIndex++;
  412. }
  413. }
  414. /// <summary>
  415. /// 增加
  416. /// </summary>
  417. /// <param name="param"></param>
  418. private void AddAboveAction(object param)
  419. {
  420. if (Recipe != null)
  421. {
  422. VpwRinseStep currentRinseSteps = new VpwRinseStep();
  423. if (SelectedVacuumPrewetIndex == -1)
  424. {
  425. Recipe.VacuumRinseStep.Add(currentRinseSteps);
  426. SelectedVacuumPrewetIndex = 0;
  427. }
  428. else
  429. {
  430. currentRinseSteps.Index = SelectedVacuumPrewetIndex;
  431. for (int i = currentRinseSteps.Index; i <= Recipe.VacuumRinseStep.Count-1; i++)
  432. {
  433. Recipe.VacuumRinseStep[i].Index++;
  434. }
  435. Recipe.VacuumRinseStep.Insert(SelectedVacuumPrewetIndex, currentRinseSteps);
  436. SelectedVacuumPrewetIndex--;
  437. }
  438. }
  439. }
  440. /// <summary>
  441. /// 上移
  442. /// </summary>
  443. /// <param name="param"></param>
  444. private void MoveUpAction(object param)
  445. {
  446. if (Recipe != null)
  447. {
  448. if (SelectedVacuumPrewetIndex > 0)
  449. {
  450. int currentIndex = SelectedVacuumPrewetIndex;
  451. VpwRinseStep currentRinseSteps = Recipe.VacuumRinseStep[SelectedVacuumPrewetIndex];
  452. currentRinseSteps.Index -= 1;
  453. Recipe.VacuumRinseStep[SelectedVacuumPrewetIndex-1].Index += 1;
  454. Recipe.VacuumRinseStep.RemoveAt(SelectedVacuumPrewetIndex);
  455. Recipe.VacuumRinseStep.Insert(currentIndex - 1, currentRinseSteps);
  456. SelectedVacuumPrewetIndex = currentIndex - 1;
  457. }
  458. }
  459. }
  460. /// <summary>
  461. /// 下移
  462. /// </summary>
  463. /// <param name="param"></param>
  464. private void MoveDownAction(object param)
  465. {
  466. if (Recipe != null)
  467. {
  468. if (SelectedVacuumPrewetIndex >= 0 && SelectedVacuumPrewetIndex < Recipe.VacuumRinseStep.Count - 1 && Recipe.VacuumRinseStep.Count > 1)
  469. {
  470. int currentIndex = SelectedVacuumPrewetIndex;
  471. VpwRinseStep currentRinseSteps = Recipe.VacuumRinseStep[SelectedVacuumPrewetIndex];
  472. currentRinseSteps.Index += 1;
  473. Recipe.VacuumRinseStep[SelectedVacuumPrewetIndex + 1].Index -= 1;
  474. Recipe.VacuumRinseStep.RemoveAt(SelectedVacuumPrewetIndex);
  475. Recipe.VacuumRinseStep.Insert(currentIndex + 1, currentRinseSteps);
  476. SelectedVacuumPrewetIndex = currentIndex + 1;
  477. }
  478. }
  479. }
  480. /// <summary>
  481. /// 删除
  482. /// </summary>
  483. /// <param name="param"></param>
  484. private void DeleteAction(object param)
  485. {
  486. if (SelectedVacuumPrewetIndex != -1)
  487. {
  488. if (Recipe != null && Recipe.VacuumRinseStep.Count > SelectedVacuumPrewetIndex)
  489. {
  490. for (int i = SelectedVacuumPrewetIndex + 1; i <= Recipe.VacuumRinseStep.Count - 1; i++)
  491. {
  492. Recipe.VacuumRinseStep[i].Index -= 1;
  493. }
  494. Recipe.VacuumRinseStep.RemoveAt(SelectedVacuumPrewetIndex);
  495. }
  496. }
  497. }
  498. #endregion
  499. #region Vent prewet按钮
  500. /// <summary>
  501. /// 增加
  502. /// </summary>
  503. /// <param name="param"></param>
  504. private void VentPrewetAddBelowAction(object param)
  505. {
  506. if (Recipe != null)
  507. {
  508. VpwRinseStep currentRinseSteps = new VpwRinseStep();
  509. currentRinseSteps.Index = SelectedVentPrewetIndex + 1;
  510. for (int i = currentRinseSteps.Index; i <= Recipe.VentRinseStep.Count - 1; i++)
  511. {
  512. Recipe.VentRinseStep[i].Index++;
  513. }
  514. Recipe.VentRinseStep.Insert(SelectedVentPrewetIndex + 1, currentRinseSteps);
  515. SelectedVentPrewetIndex++;
  516. }
  517. }
  518. /// <summary>
  519. /// 增加
  520. /// </summary>
  521. /// <param name="param"></param>
  522. private void VentPrewetAddAboveAction(object param)
  523. {
  524. if (Recipe != null)
  525. {
  526. VpwRinseStep currentRinseSteps = new VpwRinseStep();
  527. if (SelectedVentPrewetIndex == -1)
  528. {
  529. Recipe.VentRinseStep.Add(currentRinseSteps);
  530. SelectedVentPrewetIndex = 0;
  531. }
  532. else
  533. {
  534. currentRinseSteps.Index = SelectedVentPrewetIndex;
  535. for (int i = currentRinseSteps.Index; i <= Recipe.VentRinseStep.Count - 1; i++)
  536. {
  537. Recipe.VentRinseStep[i].Index++;
  538. }
  539. Recipe.VentRinseStep.Insert(SelectedVentPrewetIndex, currentRinseSteps);
  540. SelectedVentPrewetIndex--;
  541. }
  542. }
  543. }
  544. /// <summary>
  545. /// 上移
  546. /// </summary>
  547. /// <param name="param"></param>
  548. private void VentPrewetMoveUpAction(object param)
  549. {
  550. if (Recipe != null)
  551. {
  552. if (SelectedVentPrewetIndex > 0)
  553. {
  554. int currentIndex = SelectedVentPrewetIndex;
  555. VpwRinseStep currentRinseSteps = Recipe.VentRinseStep[SelectedVentPrewetIndex];
  556. currentRinseSteps.Index -= 1;
  557. Recipe.VentRinseStep[SelectedVentPrewetIndex - 1].Index += 1;
  558. Recipe.VentRinseStep.RemoveAt(SelectedVentPrewetIndex);
  559. Recipe.VentRinseStep.Insert(currentIndex - 1, currentRinseSteps);
  560. SelectedVentPrewetIndex = currentIndex - 1;
  561. }
  562. }
  563. }
  564. /// <summary>
  565. /// 下移
  566. /// </summary>
  567. /// <param name="param"></param>
  568. private void VentPrewetMoveDownAction(object param)
  569. {
  570. if (Recipe != null)
  571. {
  572. if (SelectedVentPrewetIndex >= 0 && SelectedVentPrewetIndex < Recipe.VentRinseStep.Count - 1 && Recipe.VentRinseStep.Count > 1)
  573. {
  574. int currentIndex = SelectedVentPrewetIndex;
  575. VpwRinseStep currentRinseSteps = Recipe.VentRinseStep[SelectedVentPrewetIndex];
  576. currentRinseSteps.Index += 1;
  577. Recipe.VentRinseStep[SelectedVentPrewetIndex + 1].Index -= 1;
  578. Recipe.VentRinseStep.RemoveAt(SelectedVentPrewetIndex);
  579. Recipe.VentRinseStep.Insert(currentIndex + 1, currentRinseSteps);
  580. SelectedVentPrewetIndex = currentIndex + 1;
  581. }
  582. }
  583. }
  584. /// <summary>
  585. /// 删除
  586. /// </summary>
  587. /// <param name="param"></param>
  588. private void VentPrewetDeleteAction(object param)
  589. {
  590. if (SelectedVentPrewetIndex != -1)
  591. {
  592. if (Recipe != null && Recipe.VentRinseStep.Count > SelectedVentPrewetIndex)
  593. {
  594. for (int i = SelectedVentPrewetIndex + 1; i <= Recipe.VentRinseStep.Count - 1; i++)
  595. {
  596. Recipe.VentRinseStep[i].Index -= 1;
  597. }
  598. Recipe.VentRinseStep.RemoveAt(SelectedVentPrewetIndex);
  599. }
  600. }
  601. }
  602. #endregion
  603. #region Extend Clean按钮
  604. /// <summary>
  605. /// 增加
  606. /// </summary>
  607. /// <param name="param"></param>
  608. private void ExtendCleanAddBelowAction(object param)
  609. {
  610. if (Recipe != null)
  611. {
  612. VpwRinseStep currentRinseSteps = new VpwRinseStep();
  613. currentRinseSteps.Index = SelectedExtendCleanIndex + 1;
  614. for (int i = currentRinseSteps.Index; i <= Recipe.ExtendCleanRinseStep.Count - 1; i++)
  615. {
  616. Recipe.ExtendCleanRinseStep[i].Index++;
  617. }
  618. Recipe.ExtendCleanRinseStep.Insert(SelectedExtendCleanIndex + 1, currentRinseSteps);
  619. SelectedExtendCleanIndex++;
  620. }
  621. }
  622. /// <summary>
  623. /// 增加
  624. /// </summary>
  625. /// <param name="param"></param>
  626. private void ExtendCleanAddAboveAction(object param)
  627. {
  628. if (Recipe != null)
  629. {
  630. VpwRinseStep currentRinseSteps = new VpwRinseStep();
  631. if (SelectedExtendCleanIndex == -1)
  632. {
  633. Recipe.ExtendCleanRinseStep.Add(currentRinseSteps);
  634. SelectedExtendCleanIndex = 0;
  635. }
  636. else
  637. {
  638. currentRinseSteps.Index = SelectedExtendCleanIndex;
  639. for (int i = currentRinseSteps.Index; i <= Recipe.ExtendCleanRinseStep.Count - 1; i++)
  640. {
  641. Recipe.ExtendCleanRinseStep[i].Index++;
  642. }
  643. Recipe.ExtendCleanRinseStep.Insert(SelectedExtendCleanIndex, currentRinseSteps);
  644. SelectedExtendCleanIndex--;
  645. }
  646. }
  647. }
  648. /// <summary>
  649. /// 上移
  650. /// </summary>
  651. /// <param name="param"></param>
  652. private void ExtendCleanMoveUpAction(object param)
  653. {
  654. if (Recipe != null)
  655. {
  656. if (SelectedExtendCleanIndex > 0)
  657. {
  658. int currentIndex = SelectedExtendCleanIndex;
  659. VpwRinseStep currentRinseSteps = Recipe.ExtendCleanRinseStep[SelectedExtendCleanIndex];
  660. currentRinseSteps.Index -= 1;
  661. Recipe.ExtendCleanRinseStep[SelectedExtendCleanIndex - 1].Index += 1;
  662. Recipe.ExtendCleanRinseStep.RemoveAt(SelectedExtendCleanIndex);
  663. Recipe.ExtendCleanRinseStep.Insert(currentIndex - 1, currentRinseSteps);
  664. SelectedExtendCleanIndex = currentIndex - 1;
  665. }
  666. }
  667. }
  668. /// <summary>
  669. /// 下移
  670. /// </summary>
  671. /// <param name="param"></param>
  672. private void ExtendCleanMoveDownAction(object param)
  673. {
  674. if (Recipe != null)
  675. {
  676. if (SelectedExtendCleanIndex >= 0 && SelectedExtendCleanIndex < Recipe.ExtendCleanRinseStep.Count - 1 && Recipe.ExtendCleanRinseStep.Count > 1)
  677. {
  678. int currentIndex = SelectedExtendCleanIndex;
  679. VpwRinseStep currentRinseSteps = Recipe.ExtendCleanRinseStep[SelectedExtendCleanIndex];
  680. currentRinseSteps.Index += 1;
  681. Recipe.ExtendCleanRinseStep[SelectedExtendCleanIndex + 1].Index -= 1;
  682. Recipe.ExtendCleanRinseStep.RemoveAt(SelectedExtendCleanIndex);
  683. Recipe.ExtendCleanRinseStep.Insert(currentIndex + 1, currentRinseSteps);
  684. SelectedExtendCleanIndex = currentIndex + 1;
  685. }
  686. }
  687. }
  688. /// <summary>
  689. /// 删除
  690. /// </summary>
  691. /// <param name="param"></param>
  692. private void ExtendCleanDeleteAction(object param)
  693. {
  694. if (SelectedExtendCleanIndex != -1)
  695. {
  696. if (Recipe != null && Recipe.ExtendCleanRinseStep.Count > SelectedExtendCleanIndex)
  697. {
  698. for (int i = SelectedExtendCleanIndex + 1; i <= Recipe.ExtendCleanRinseStep.Count - 1; i++)
  699. {
  700. Recipe.ExtendCleanRinseStep[i].Index -= 1;
  701. }
  702. Recipe.ExtendCleanRinseStep.RemoveAt(SelectedExtendCleanIndex);
  703. }
  704. }
  705. }
  706. #endregion
  707. }
  708. }