diff --git a/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs b/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs index 9ac9304..411ae0a 100644 --- a/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs +++ b/DM_Weight/ViewModels/ReturnEmptyDialogViewModel.cs @@ -136,6 +136,13 @@ namespace DM_Weight.ViewModels SetProperty(ref _machineRecords, value); } } + private MachineRecord _machineRecord = new(); + + public MachineRecord _MachineRecord + { + get => _machineRecord; + set => SetProperty(ref _machineRecord, value); + } private ChannelStock _channelStock; @@ -170,13 +177,13 @@ namespace DM_Weight.ViewModels { // 取消消息订阅 _eventAggregator.GetEvent().Unsubscribe(DoMyPrismEvent); - _eventAggregator.GetEvent().Unsubscribe(CheckboxChecked); + //_eventAggregator.GetEvent().Unsubscribe(CheckboxChecked); } public void OnDialogOpened(IDialogParameters parameters) { _eventAggregator.GetEvent().Subscribe(DoMyPrismEvent); - _eventAggregator.GetEvent().Subscribe(CheckboxChecked); + //_eventAggregator.GetEvent().Subscribe(CheckboxChecked); ChannelStock _record = parameters.GetValue("channel"); ChannelStock = _record; @@ -205,6 +212,27 @@ namespace DM_Weight.ViewModels .ToList(); MachineRecords = queryData; } + public DelegateCommand RowSelected + { + get => new DelegateCommand(() => + { + if (MachineRecords != null && MachineRecords.Count > 0) + { + MachineRecords = MachineRecords.Select(x => + { + if (x.Id == _MachineRecord.Id) + { + x.IsSelected = !x.IsSelected; + CheckboxChecked(); + } + return x; + }).ToList(); + //DialogParameters dialogParameters = new DialogParameters(); + //dialogParameters.Add("channel", Channel); + //DialogServiceExtensions.ShowDialogHost(_dialogService, "ReturnEmptyDialog", dialogParameters, DoDialogResult, "RootDialog"); + } + }); + } //选中药品将要返还的数量添加到文本框 private void CheckboxChecked() { diff --git a/DM_Weight/ViewModels/ReturnEmptyWindowViewModel.cs b/DM_Weight/ViewModels/ReturnEmptyWindowViewModel.cs index cd658ff..3e52dec 100644 --- a/DM_Weight/ViewModels/ReturnEmptyWindowViewModel.cs +++ b/DM_Weight/ViewModels/ReturnEmptyWindowViewModel.cs @@ -46,9 +46,11 @@ namespace DM_Weight.ViewModels public DelegateCommand RowSelected { - get => new DelegateCommand(() => - { - + get => new DelegateCommand(async () => + { + // 此处延时1毫秒,等待页面渲染(规避工控机上手指点击弹出的页面上的按钮无效问题) + await Task.Delay(TimeSpan.FromMilliseconds(1)); + if (Channel != null &&string.IsNullOrEmpty(Channel.DrugId)) { DialogParameters dialogParameters = new DialogParameters(); diff --git a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs index c7f60cf..173f655 100644 --- a/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs +++ b/DM_Weight/ViewModels/SelfTakeDialogViewModel.cs @@ -26,9 +26,9 @@ namespace DM_Weight.ViewModels { public static List SelectUseList = new() { + new UseFor { UseId = 96, UseName = "不入账册" }, - new UseFor{UseId=0,UseName="入账册"}, - new UseFor { UseId = 96, UseName = "不入账册" } + new UseFor{UseId=0,UseName="入账册"} }; private List _selects = SelectUseList; diff --git a/DM_Weight/Views/Dialog/ReturnEmptyDialog.xaml b/DM_Weight/Views/Dialog/ReturnEmptyDialog.xaml index 845b54b..7fe5c5a 100644 --- a/DM_Weight/Views/Dialog/ReturnEmptyDialog.xaml +++ b/DM_Weight/Views/Dialog/ReturnEmptyDialog.xaml @@ -140,6 +140,7 @@ @@ -152,12 +153,17 @@ + + + + + - + diff --git a/DM_Weight/Views/Dialog/ReturnEmptyDialog.xaml.cs b/DM_Weight/Views/Dialog/ReturnEmptyDialog.xaml.cs index 1395a14..48e3cb6 100644 --- a/DM_Weight/Views/Dialog/ReturnEmptyDialog.xaml.cs +++ b/DM_Weight/Views/Dialog/ReturnEmptyDialog.xaml.cs @@ -22,16 +22,16 @@ namespace DM_Weight.Views.Dialog /// public partial class ReturnEmptyDialog : UserControl { - IEventAggregator _eventAggregator; + //IEventAggregator _eventAggregator; public ReturnEmptyDialog(IEventAggregator eventAggregator) { InitializeComponent(); - this._eventAggregator= eventAggregator; + //this._eventAggregator= eventAggregator; } private void CheckBox_Click(object sender, RoutedEventArgs e) { - _eventAggregator.GetEvent().Publish(); + //_eventAggregator.GetEvent().Publish(); } } }