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

69 regels
2.8 KiB

  1. using BPASmartClient.FoodStationTest.Model;
  2. using BPA.Helper;
  3. using BPA.Helper;
  4. using System;
  5. using System.Collections.ObjectModel;
  6. using System.Linq;
  7. namespace BPASmartClient.FoodStationTest.ViewModel
  8. {
  9. public class RecipeInfosViewModel : NotifyBase
  10. {
  11. public RecipeInfosViewModel()
  12. {
  13. ActionManage.GetInstance.CancelRegister("RecipeInfo");
  14. ActionManage.GetInstance.Register(new Action<object>((o) =>
  15. {
  16. if (o != null && o is RemoteRecipeData rm)
  17. {
  18. RecipeName = rm.RecipeName;
  19. RecipeCode = rm.RecipeCode;
  20. TrayCode = rm.TrayCode;
  21. foreach (var item in rm.RawMaterial)
  22. {
  23. //RawMaterialsInfo.Add(item);
  24. var res = Json<DevicePar>.Data.rawMaterialStockBin.FirstOrDefault(p => p.RawMaterialLocation == item.RawMaterialLocation);
  25. if (res != null && !string.IsNullOrEmpty(res.RawMaterialName))
  26. {
  27. var temp = Json<DevicePar>.Data.BomMaterial.FirstOrDefault(p => p.MaterialCode == res.RawMaterialName);
  28. if (temp != null && !string.IsNullOrEmpty(temp.MaterialName))
  29. {
  30. item.RawMaterialName = temp.MaterialName;
  31. }
  32. }
  33. RawMaterialsInfo.Add(new RemoteRecipeRawMaterial()
  34. {
  35. RawMaterialType = item.RawMaterialType,
  36. RawMaterialName = item.RawMaterialName,
  37. RawMaterialWeight = item.RawMaterialWeight,
  38. RawMaterialLocation = item.RawMaterialLocation,
  39. RawMaterialBarrelNum = item.RawMaterialBarrelNum,
  40. });
  41. }
  42. }
  43. }), "RecipeInfo");
  44. ReturnPage = new BPARelayCommand(() =>
  45. {
  46. ActionManage.GetInstance.Send("CloseRecipeInfosView");
  47. });
  48. }
  49. public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
  50. private string _mRecipeName;
  51. public string RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value; OnPropertyChanged(); } }
  52. private string _mRecipeCode;
  53. public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } }
  54. private int _mTrayCode;
  55. public BPARelayCommand ReturnPage { get; set; }
  56. public ObservableCollection<RemoteRecipeRawMaterial> RawMaterialsInfo { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>();
  57. }
  58. }