终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

62 line
2.3 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using BPA.Helper;
  8. using BPASmartClient.CustomResource.Pages.Model;
  9. using BPASmartClient.SmallBatchingSystem.Views;
  10. using Microsoft.Toolkit.Mvvm.ComponentModel;
  11. using Microsoft.Toolkit.Mvvm.Input;
  12. namespace BPASmartClient.SmallBatchingSystem.ViewModels
  13. {
  14. public class OutletManagementViewModel : BaseModel
  15. {
  16. public OutletManagementViewModel()
  17. {
  18. AddCommand = new RelayCommand(() =>
  19. {
  20. NewOutletView newOutletView = new NewOutletView();
  21. newOutletView.ShowDialog();
  22. });
  23. SaveCommand = new RelayCommand(() => { Json<ConfigInfoModel>.Save(); });
  24. OutletInfoModels = Json<ConfigInfoModel>.Data.OutletInfoModels;
  25. RemoveCommand = new RelayCommand<object>((o) =>
  26. {
  27. if (!string.IsNullOrEmpty(o?.ToString()))
  28. {
  29. var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString());
  30. if (res != null)
  31. {
  32. if (MessageNotify.GetInstance.ShowDialog($"是否删除【{res.OutletName}】出料口,删除后数据将永久丢失!无法找回", DialogType.Warning))
  33. {
  34. Json<ConfigInfoModel>.Data.OutletInfoModels.Remove(res);
  35. Control.GetInstance.OperationLog($"{res.OutletName} 删除成功");
  36. }
  37. }
  38. }
  39. });
  40. DetailsCommand = new RelayCommand<object>((o) =>
  41. {
  42. if (!string.IsNullOrEmpty(o?.ToString()))
  43. {
  44. var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString());
  45. if (res != null)
  46. {
  47. NewOutletView newOutletView = new NewOutletView();
  48. ActionManage.GetInstance.Send("OpenNewOutlet", res);
  49. newOutletView.ShowDialog();
  50. }
  51. }
  52. });
  53. }
  54. public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; }
  55. }
  56. }