|
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.CustomResource.UserControls;
- using BPASmartClient.CustomResource.UserControls.MessageShow;
- using BPASmartClient.Helper;
- using BPASmartClient.JXJFoodSmallStation.Model;
- using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial;
- using Microsoft.Toolkit.Mvvm.ComponentModel;
- using Microsoft.Toolkit.Mvvm.Input;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
-
- namespace BPASmartClient.JXJFoodSmallStation.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; }
- }
- }
|