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

58 lines
2.7 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. MessageNotify.GetInstance.ShowUserLog($"删除一条料仓物料配置信息,原料料仓位置:【{res.RawMaterialLocation}】,原料编号:【{res.RawMaterialName}】");
  32. }
  33. });
  34. SaveRawMaterialPara = new RelayCommand(() =>
  35. {
  36. Json<DevicePar>.Save();
  37. ProcessControl.GetInstance.StockBinNameWithPos();
  38. foreach (var item in Json<DevicePar>.Data.rawMaterialStockBin)
  39. {
  40. MessageNotify.GetInstance.ShowUserLog($"料仓位置:"+ item.RawMaterialLocation+ ",物料编码:" + item.RawMaterialName);
  41. }
  42. MessageNotify.GetInstance.ShowUserLog($"原料与料仓对应关系保存成功");
  43. NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功");
  44. });
  45. UpdateRawMaterial = new RelayCommand(() =>
  46. {
  47. RawMaterialInfo.Add(new RawMaterialStockBin() { RawMaterialCount = (short)(RawMaterialInfo.Count + 1)});
  48. MessageNotify.GetInstance.ShowUserLog($"新增一条料仓物料配置信息。");
  49. });
  50. }
  51. public ObservableCollection<RawMaterialStockBin> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterialStockBin>();
  52. public RelayCommand<Object> RemoveCommand { get; set; }
  53. public RelayCommand SaveRawMaterialPara { get; set; }
  54. public RelayCommand UpdateRawMaterial { get; set; }
  55. }
  56. }