|
- 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; }
-
- }
- }
|