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

56 lines
2.4 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.JXJFoodSmallStation.Model;
  6. using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial;
  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.JXJFoodSmallStation.ViewModel
  19. {
  20. public class StockBinRawMaterialViewModel : ObservableObject
  21. {
  22. public StockBinRawMaterialViewModel()
  23. {
  24. RawMaterialInfo = Json<DevicePar>.Data.rawMaterialStockBin;
  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<DevicePar>.Save();
  36. ProcessControl.GetInstance.StockBinNameWithPos();
  37. foreach (var item in Json<DevicePar>.Data.rawMaterialStockBin)
  38. {
  39. MessageNotify.GetInstance.ShowUserLog($"料仓位置:"+ item.RawMaterialLocation+ ",物料编码:" + item.RawMaterialName);
  40. }
  41. MessageNotify.GetInstance.ShowUserLog($"原料与料仓对应关系保存成功");
  42. NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功");
  43. });
  44. UpdateRawMaterial = new RelayCommand(() =>
  45. {
  46. RawMaterialInfo.Add(new RawMaterialStockBin() { RawMaterialCount = (short)(RawMaterialInfo.Count + 1)});
  47. });
  48. }
  49. public ObservableCollection<RawMaterialStockBin> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterialStockBin>();
  50. public RelayCommand<Object> RemoveCommand { get; set; }
  51. public RelayCommand SaveRawMaterialPara { get; set; }
  52. public RelayCommand UpdateRawMaterial { get; set; }
  53. }
  54. }