|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using BPA.Helper;
- using System.Collections.ObjectModel;
-
- using BPA.Helper;
- using BPASmartClient.JXJFoodSmallStation.Model;
- using BPASmartClient.CustomResource.Pages.Model;
-
- namespace BPASmartClient.JXJFoodSmallStation.ViewModel
- {
- public class RecipeInfosViewModel : NotifyBase
- {
- public RecipeInfosViewModel()
- {
-
- ActionManage.GetInstance.CancelRegister("RecipeInfo");
- ActionManage.GetInstance.Register(new Action<object>((o) =>
- {
- if (o != null && o is RecipeData 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,
- });
- }
- foreach (var item1 in rm.WindSend)
- {
- // RawMaterialsInfo.Add(new RemoteRecipeRawMaterial() { RawMaterialName= item1.RawMaterialName, RawMaterialLocation= item1.Location,RawMaterialBarrelNum= item1.RawMaterialBarrelNum,RawMaterialWeight= item1.RawMaterialWeight,RawMaterialType=item1.RawMaterialType});
-
- var res = Json<DevicePar>.Data.windSendRawMaterial.FirstOrDefault(p => p.Location == item1.Location);
- if (res != null)
- {
- item1.RawMaterialName = res.RawMaterialChineseName;
- }
-
- RawMaterialsInfo.Add(new RemoteRecipeRawMaterial()
- {
- RawMaterialType = item1.RawMaterialType,
- RawMaterialName = item1.RawMaterialName,
- RawMaterialWeight = item1.RawMaterialWeight,
- RawMaterialLocation = item1.Location,
- RawMaterialBarrelNum = item1.RawMaterialBarrelNum,
- });
-
- }
- }
- }), "RecipeInfo");
-
- ReturnPage = new BPARelayCommand(() =>
- {
- 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 BPARelayCommand ReturnPage { get; set; }
-
- public ObservableCollection<RemoteRecipeRawMaterial> RawMaterialsInfo { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>();
- }
- }
|