|
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.CustomResource.UserControls;
- using BPASmartClient.CustomResource.UserControls.MessageShow;
- using BPASmartClient.FoodStationTest.Model;
- using BPASmartClient.FoodStationTest.Model.RawMaterial;
- using BPA.Helper;
- using BPA.Helper;
-
- using System;
- using System.Collections.ObjectModel;
- using System.Linq;
-
- namespace BPASmartClient.FoodStationTest.ViewModel
- {
- public class StockBinRawMaterialViewModel : NotifyBase
- {
- public StockBinRawMaterialViewModel()
- {
- RawMaterialInfo = Json<DevicePar>.Data.rawMaterialStockBin;
- RemoveCommand = new BPARelayCommand<Object>((loc) =>
- {
- if (loc is int pos)
- {
- var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialLocation == pos);
- if (res != null)
- RawMaterialInfo.Remove(res);
- }
- });
- SaveRawMaterialPara = new BPARelayCommand(() =>
- {
- 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 BPARelayCommand(() =>
- {
- RawMaterialInfo.Add(new RawMaterialStockBin() { RawMaterialCount = (short)(RawMaterialInfo.Count + 1) });
- });
- }
- public ObservableCollection<RawMaterialStockBin> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterialStockBin>();
- public BPARelayCommand<Object> RemoveCommand { get; set; }
- public BPARelayCommand SaveRawMaterialPara { get; set; }
- public BPARelayCommand UpdateRawMaterial { get; set; }
- }
- }
|