|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using BPA.Helper;
-
- using BPASmartClient.SmallBatchingSystem.Views;
- using System.Collections.ObjectModel;
- using BPA.Helper;
- using BPASmartClient.CustomResource.Pages.Model;
-
- namespace BPASmartClient.SmallBatchingSystem.ViewModels
- {
- public class SiloManagementViewModel : BaseModel
- {
- public SiloManagementViewModel()
- {
- AddCommand = new BPARelayCommand(() =>
- {
- NewSiloView newSiloView = new NewSiloView();
- newSiloView.ShowDialog();
- });
- SaveCommand = new BPARelayCommand(() => { Json<ConfigInfoModel>.Save(); });
- SiloInfoModels = Json<ConfigInfoModel>.Data.SiloInfoModels;
- RemoveCommand = new BPARelayCommand<object>((o) =>
- {
- if (!string.IsNullOrEmpty(o?.ToString()))
- {
- var res = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == o.ToString());
- if (res != null)
- {
- if (MessageNotify.GetInstance.ShowDialog($"是否删除【{res.SiloName}】原料,删除后数据将永久丢失!无法找回", DialogType.Warning))
- {
- Json<ConfigInfoModel>.Data.SiloInfoModels.Remove(res);
- Control.GetInstance.NotifyPrompt($"{res.SiloName} 删除成功");
- Control.GetInstance.OperationLog($"{res.SiloName} 删除成功");
- }
- }
- }
- });
-
- DetailsCommand = new BPARelayCommand<object>((o) =>
- {
- if (!string.IsNullOrEmpty(o?.ToString()))
- {
- var res = Json<ConfigInfoModel>.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == o.ToString());
- if (res != null)
- {
- NewSiloView newSiloView = new NewSiloView();
- ActionManage.GetInstance.Send("OpenNewSilo", res);
- newSiloView.ShowDialog();
- Control.GetInstance.OperationLog($"{res.SiloName} 编辑完成");
- }
- }
- });
- }
-
- public ObservableCollection<SiloInfoModel> SiloInfoModels { get; set; }
-
- }
- }
|