终端一体化运控平台
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

93 linhas
4.2 KiB

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