终端一体化运控平台
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

93 строки
4.1 KiB

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