终端一体化运控平台
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 lines
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 BPA.Helper;
  11. namespace BPASmartClient.SmallBatchingSystem.ViewModels
  12. {
  13. public class OutletManagementViewModel : BaseModel
  14. {
  15. public OutletManagementViewModel()
  16. {
  17. AddCommand = new BPARelayCommand(() =>
  18. {
  19. NewOutletView newOutletView = new NewOutletView();
  20. newOutletView.ShowDialog();
  21. });
  22. SaveCommand = new BPARelayCommand(() => { Json<ConfigInfoModel>.Save(); });
  23. OutletInfoModels = Json<ConfigInfoModel>.Data.OutletInfoModels;
  24. RemoveCommand = new BPARelayCommand<object>((o) =>
  25. {
  26. if (!string.IsNullOrEmpty(o?.ToString()))
  27. {
  28. var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString());
  29. if (res != null)
  30. {
  31. if (MessageNotify.GetInstance.ShowDialog($"是否删除【{res.OutletName}】出料口,删除后数据将永久丢失!无法找回", DialogType.Warning))
  32. {
  33. Json<ConfigInfoModel>.Data.OutletInfoModels.Remove(res);
  34. Control.GetInstance.OperationLog($"{res.OutletName} 删除成功");
  35. }
  36. }
  37. }
  38. });
  39. DetailsCommand = new BPARelayCommand<object>((o) =>
  40. {
  41. if (!string.IsNullOrEmpty(o?.ToString()))
  42. {
  43. var res = Json<ConfigInfoModel>.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString());
  44. if (res != null)
  45. {
  46. NewOutletView newOutletView = new NewOutletView();
  47. ActionManage.GetInstance.Send("OpenNewOutlet", res);
  48. newOutletView.ShowDialog();
  49. }
  50. }
  51. });
  52. }
  53. public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; }
  54. }
  55. }