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

  1. using BPASmartClient.CustomResource.Pages.Model;
  2. using BPASmartClient.CustomResource.UserControls;
  3. using BPASmartClient.CustomResource.UserControls.MessageShow;
  4. using BPASmartClient.FoodStationTest.Model;
  5. using BPASmartClient.FoodStationTest.Model.RawMaterial;
  6. using BPA.Helper;
  7. using BPA.Helper;
  8. using System;
  9. using System.Collections.ObjectModel;
  10. using System.Linq;
  11. namespace BPASmartClient.FoodStationTest.ViewModel
  12. {
  13. public class StockBinRawMaterialViewModel : NotifyBase
  14. {
  15. public StockBinRawMaterialViewModel()
  16. {
  17. RawMaterialInfo = Json<DevicePar>.Data.rawMaterialStockBin;
  18. RemoveCommand = new BPARelayCommand<Object>((loc) =>
  19. {
  20. if (loc is int pos)
  21. {
  22. var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialLocation == pos);
  23. if (res != null)
  24. RawMaterialInfo.Remove(res);
  25. }
  26. });
  27. SaveRawMaterialPara = new BPARelayCommand(() =>
  28. {
  29. Json<DevicePar>.Save();
  30. ProcessControl.GetInstance.StockBinNameWithPos();
  31. foreach (var item in Json<DevicePar>.Data.rawMaterialStockBin)
  32. {
  33. MessageNotify.GetInstance.ShowUserLog($"料仓位置:" + item.RawMaterialLocation + ",物料编码:" + item.RawMaterialName);
  34. }
  35. MessageNotify.GetInstance.ShowUserLog($"原料与料仓对应关系保存成功");
  36. NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功");
  37. });
  38. UpdateRawMaterial = new BPARelayCommand(() =>
  39. {
  40. RawMaterialInfo.Add(new RawMaterialStockBin() { RawMaterialCount = (short)(RawMaterialInfo.Count + 1) });
  41. });
  42. }
  43. public ObservableCollection<RawMaterialStockBin> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterialStockBin>();
  44. public BPARelayCommand<Object> RemoveCommand { get; set; }
  45. public BPARelayCommand SaveRawMaterialPara { get; set; }
  46. public BPARelayCommand UpdateRawMaterial { get; set; }
  47. }
  48. }