终端一体化运控平台
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.
 
 
 

51 regels
2.0 KiB

  1. using BPASmartClient.CustomResource.Pages.Model;
  2. using BPASmartClient.CustomResource.UserControls;
  3. using BPASmartClient.CustomResource.UserControls.MessageShow;
  4. using BPASmartClient.Helper;
  5. using BPASmartClient.JXJFoodBigStation.Model;
  6. using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
  7. using Microsoft.Toolkit.Mvvm.ComponentModel;
  8. using Microsoft.Toolkit.Mvvm.Input;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Collections.ObjectModel;
  12. using System.ComponentModel;
  13. using System.Linq;
  14. using System.Reflection;
  15. using System.Text;
  16. using System.Threading;
  17. using System.Threading.Tasks;
  18. namespace BPASmartClient.JXJFoodBigStation.ViewModel
  19. {
  20. public class StockBinRawMaterialViewModel : ObservableObject
  21. {
  22. public StockBinRawMaterialViewModel()
  23. {
  24. RawMaterialInfo = Json<RawMaterialData>.Data.RawMaterial;
  25. RemoveCommand = new RelayCommand<Object>((loc) =>
  26. {
  27. if (loc is int pos)
  28. {
  29. var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialLocation == pos);
  30. if (res != null) RawMaterialInfo.Remove(res);
  31. }
  32. });
  33. SaveRawMaterialPara = new RelayCommand(() =>
  34. {
  35. Json<RawMaterialData>.Save();
  36. MessageNotify.GetInstance.ShowUserLog($"原料与料仓对应关系保存成功");
  37. NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功");
  38. });
  39. UpdateRawMaterial = new RelayCommand(() =>
  40. {
  41. RawMaterialInfo.Add(new RawMaterial() { RawMaterialCount = (short)(RawMaterialInfo.Count + 1)});
  42. });
  43. }
  44. public ObservableCollection<RawMaterial> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterial>();
  45. public RelayCommand<Object> RemoveCommand { get; set; }
  46. public RelayCommand SaveRawMaterialPara { get; set; }
  47. public RelayCommand UpdateRawMaterial { get; set; }
  48. }
  49. }