|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using BPASmartClient.FoodStationTest.Model;
- using BPASmartClient.Helper;
- using Microsoft.Toolkit.Mvvm.ComponentModel;
- using Microsoft.Toolkit.Mvvm.Input;
- using System;
- using System.Collections.ObjectModel;
- using System.Linq;
-
- namespace BPASmartClient.FoodStationTest.ViewModel
- {
- public class RecipeInfosViewModel : ObservableObject
- {
- public RecipeInfosViewModel()
- {
-
- ActionManage.GetInstance.CancelRegister("RecipeInfo");
- ActionManage.GetInstance.Register(new Action<object>((o) =>
- {
- if (o != null && o is RemoteRecipeData rm)
- {
- RecipeName = rm.RecipeName;
- RecipeCode = rm.RecipeCode;
- TrayCode = rm.TrayCode;
- foreach (var item in rm.RawMaterial)
- {
- //RawMaterialsInfo.Add(item);
-
- var res = Json<DevicePar>.Data.rawMaterialStockBin.FirstOrDefault(p => p.RawMaterialLocation == item.RawMaterialLocation);
- if (res != null && !string.IsNullOrEmpty(res.RawMaterialName))
- {
- var temp = Json<DevicePar>.Data.BomMaterial.FirstOrDefault(p => p.MaterialCode == res.RawMaterialName);
- if (temp != null && !string.IsNullOrEmpty(temp.MaterialName))
- {
- item.RawMaterialName = temp.MaterialName;
- }
- }
- RawMaterialsInfo.Add(new RemoteRecipeRawMaterial()
- {
- RawMaterialType = item.RawMaterialType,
- RawMaterialName = item.RawMaterialName,
- RawMaterialWeight = item.RawMaterialWeight,
- RawMaterialLocation = item.RawMaterialLocation,
- RawMaterialBarrelNum = item.RawMaterialBarrelNum,
- });
- }
- }
- }), "RecipeInfo");
-
- ReturnPage = new RelayCommand(() =>
- {
- ActionManage.GetInstance.Send("CloseRecipeInfosView");
- });
- }
-
- public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
- private string _mRecipeName;
-
- public string RecipeCode { get { return _mRecipeCode; } set { _mRecipeCode = value; OnPropertyChanged(); } }
- private string _mRecipeCode;
-
- public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } }
- private int _mTrayCode;
-
- public RelayCommand ReturnPage { get; set; }
-
- public ObservableCollection<RemoteRecipeRawMaterial> RawMaterialsInfo { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>();
- }
- }
|