终端一体化运控平台
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

58 Zeilen
2.6 KiB

  1. using BPASmartClient.CustomResource.Pages.Model;
  2. using BPASmartClient.CustomResource.UserControls;
  3. using BPASmartClient.CustomResource.UserControls.MessageShow;
  4. using BPA.Helper;
  5. using BPASmartClient.JXJFoodSmallStation.Model;
  6. using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial;
  7. using BPA.Helper;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Collections.ObjectModel;
  11. using System.ComponentModel;
  12. using System.Linq;
  13. using System.Reflection;
  14. using System.Text;
  15. using System.Threading;
  16. using System.Threading.Tasks;
  17. namespace BPASmartClient.JXJFoodSmallStation.ViewModel
  18. {
  19. public class StockBinRawMaterialViewModel : NotifyBase
  20. {
  21. public StockBinRawMaterialViewModel()
  22. {
  23. RawMaterialInfo = Json<DevicePar>.Data.rawMaterialStockBin;
  24. RemoveCommand = new BPARelayCommand<Object>((loc) =>
  25. {
  26. if (loc is int pos)
  27. {
  28. var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialLocation == pos);
  29. if (res != null) RawMaterialInfo.Remove(res);
  30. MessageNotify.GetInstance.ShowUserLog($"删除一条料仓物料配置信息,原料料仓位置:【{res.RawMaterialLocation}】,原料编号:【{res.RawMaterialName}】");
  31. }
  32. });
  33. SaveRawMaterialPara = new BPARelayCommand(() =>
  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 BPARelayCommand(() =>
  45. {
  46. RawMaterialInfo.Add(new RawMaterialStockBin() { RawMaterialCount = (short)(RawMaterialInfo.Count + 1)});
  47. MessageNotify.GetInstance.ShowUserLog($"新增一条料仓物料配置信息。");
  48. });
  49. }
  50. public ObservableCollection<RawMaterialStockBin> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterialStockBin>();
  51. public BPARelayCommand<Object> RemoveCommand { get; set; }
  52. public BPARelayCommand SaveRawMaterialPara { get; set; }
  53. public BPARelayCommand UpdateRawMaterial { get; set; }
  54. }
  55. }