|
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.CustomResource.UserControls;
- using BPASmartClient.CustomResource.UserControls.MessageShow;
- using BPASmartClient.FoodStationTest.Model;
- using BPASmartClient.FoodStationTest.Model.RawMaterial;
- 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 StockBinRawMaterialViewModel : ObservableObject
- {
- public StockBinRawMaterialViewModel()
- {
- RawMaterialInfo = Json<DevicePar>.Data.rawMaterialStockBin;
- RemoveCommand = new RelayCommand<Object>((loc) =>
- {
- if (loc is int pos)
- {
- var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialLocation == pos);
- if (res != null)
- RawMaterialInfo.Remove(res);
- }
- });
- SaveRawMaterialPara = new RelayCommand(() =>
- {
- Json<DevicePar>.Save();
- ProcessControl.GetInstance.StockBinNameWithPos();
- foreach (var item in Json<DevicePar>.Data.rawMaterialStockBin)
- {
- MessageNotify.GetInstance.ShowUserLog($"料仓位置:" + item.RawMaterialLocation + ",物料编码:" + item.RawMaterialName);
- }
- MessageNotify.GetInstance.ShowUserLog($"原料与料仓对应关系保存成功");
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功");
- });
- UpdateRawMaterial = new RelayCommand(() =>
- {
- RawMaterialInfo.Add(new RawMaterialStockBin() { RawMaterialCount = (short)(RawMaterialInfo.Count + 1) });
- });
- }
- public ObservableCollection<RawMaterialStockBin> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterialStockBin>();
- public RelayCommand<Object> RemoveCommand { get; set; }
- public RelayCommand SaveRawMaterialPara { get; set; }
- public RelayCommand UpdateRawMaterial { get; set; }
- }
- }
|