终端一体化运控平台
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

59 linhas
2.1 KiB

  1. using BPASmartClient.CustomResource.Pages.Model;
  2. using BPASmartClient.CustomResource.UserControls;
  3. using BPASmartClient.CustomResource.UserControls.MessageShow;
  4. using BPA.Helper;
  5. using FryPot_DosingSystem.Model;
  6. using BPA.Helper;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace FryPot_DosingSystem.ViewModel
  13. {
  14. internal class NewFryPotMaterialViewModel : NotifyBase
  15. {
  16. public BPARelayCommand ConfimCommand { get; set; }
  17. private string _materialName;
  18. public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } }
  19. private int _id;
  20. public int Id { get { return _id; } set { _id = value; OnPropertyChanged(); } }
  21. public NewFryPotMaterialViewModel()
  22. {
  23. Json<FlowProcessNames>.Read();
  24. ConfimCommand = new BPARelayCommand(() =>
  25. {
  26. if (Id > 0 && MaterialName != String.Empty)
  27. {
  28. if (Json<FlowProcessNames>.Data.NameId.ContainsKey(MaterialName))
  29. {
  30. //已存在相同的炒锅工艺物料
  31. NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"保存失败,已存在相同工艺项");
  32. }
  33. else
  34. {
  35. if (Json<FlowProcessNames>.Data.NameId.TryAdd(MaterialName, Id))
  36. {
  37. Json<FlowProcessNames>.Save();
  38. MessageNotify.GetInstance.ShowUserLog($"用户新增【{MaterialName}】炒锅工艺项");
  39. ActionManage.GetInstance.Send("CloseNewFryPotMaterial");
  40. }
  41. else
  42. {
  43. NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"保存失败,请检查格式是否输入正确");
  44. }
  45. }
  46. }
  47. });
  48. }
  49. }
  50. }