交接柜补药页面选中药箱行则勾选复选框
This commit is contained in:
parent
bf4342a57f
commit
4a3236fc5c
|
@ -10,10 +10,13 @@ using Prism.Regions;
|
|||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Channels;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
|
@ -36,6 +39,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
// 取消消息订阅
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Unsubscribe(DoMyPrismEvent);
|
||||
_eventAggregator.GetEvent<IsSelectedEvent>().Unsubscribe(SetIsSelected);
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,6 +55,7 @@ namespace DM_Weight.ViewModels
|
|||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
_eventAggregator.GetEvent<PortUtilEvent>().Subscribe(DoMyPrismEvent);
|
||||
_eventAggregator.GetEvent<IsSelectedEvent>().Subscribe(SetIsSelected);
|
||||
RequestData();
|
||||
}
|
||||
private PortUtil _portUtil;
|
||||
|
@ -72,6 +77,9 @@ namespace DM_Weight.ViewModels
|
|||
.OrderBy(cs => cs.DrawerNo)
|
||||
.ToList();
|
||||
ChannelStocks.ForEach(cs => cs.AddQuantity = cs.BaseQuantity - cs.Quantity);
|
||||
|
||||
ICollectionView vw = CollectionViewSource.GetDefaultView(ChannelStocks);
|
||||
vw.GroupDescriptions.Add(new PropertyGroupDescription("ChannelLst"));
|
||||
}
|
||||
private int _status = 0;
|
||||
|
||||
|
@ -392,7 +400,8 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
public DelegateCommand RejectReport_Download
|
||||
{
|
||||
get => new DelegateCommand(() => {
|
||||
get => new DelegateCommand(() =>
|
||||
{
|
||||
//GridReportUtil.RejectionReport("");
|
||||
});
|
||||
}
|
||||
|
@ -404,6 +413,7 @@ namespace DM_Weight.ViewModels
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
private List<ChannelStock> csList = new List<ChannelStock>();
|
||||
//取药 弹出出药列表
|
||||
public DelegateCommand TakeDrugCommand
|
||||
|
@ -450,5 +460,29 @@ namespace DM_Weight.ViewModels
|
|||
//}
|
||||
//MessageBox.Show("返回值:" + dialogResult.Result.ToString());
|
||||
}
|
||||
//设置选中药箱的复选框状态
|
||||
private void SetIsSelected(ChannelStock channelStock)
|
||||
{
|
||||
if (channelStock != null)
|
||||
{
|
||||
channelStock.ChannelLst.IsSelected = !channelStock.ChannelLst.IsSelected;
|
||||
if (channelStock != null && ChannelStocks != null)
|
||||
{
|
||||
ChannelStocks = ChannelStocks.Select(x =>
|
||||
{
|
||||
for (int i = 0; i < ChannelStocks.Count; i++)
|
||||
{
|
||||
if (ChannelStocks[i].DrawerNo == channelStock.DrawerNo)
|
||||
{
|
||||
ChannelStocks[i].ChannelLst = channelStock.ChannelLst;
|
||||
}
|
||||
}
|
||||
return x;
|
||||
}).ToList();
|
||||
}
|
||||
ICollectionView vw = CollectionViewSource.GetDefaultView(ChannelStocks);
|
||||
vw.GroupDescriptions.Add(new PropertyGroupDescription("ChannelLst"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<CollectionViewSource x:Key="GroupedDataList" Source="{Binding ChannelStocks}">
|
||||
<!--<CollectionViewSource x:Key="GroupedDataList" Source="{Binding ChannelStocks}">
|
||||
<CollectionViewSource.GroupDescriptions>
|
||||
<PropertyGroupDescription PropertyName="ChannelLst" />
|
||||
</CollectionViewSource.GroupDescriptions>
|
||||
</CollectionViewSource>
|
||||
</CollectionViewSource>-->
|
||||
<convert:GroupSumConverter x:Key="GroupSumConverter" />
|
||||
<convert:TotalCountConverter x:Key="TotalCountConverter" />
|
||||
<convert:StatusConverter x:Key="StatusConverter" />
|
||||
|
@ -94,7 +94,7 @@
|
|||
<DataGrid
|
||||
Grid.Row="1"
|
||||
materialDesign:DataGridAssist.ColumnHeaderPadding="15"
|
||||
ItemsSource="{Binding Source={StaticResource GroupedDataList}}"
|
||||
ItemsSource="{Binding ChannelStocks,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||
materialDesign:DataGridAssist.EnableEditBoxAssist="False"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
materialDesign:DataGridAssist.CellPadding="13"
|
||||
|
@ -144,7 +144,7 @@
|
|||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type GroupItem}">
|
||||
<Expander IsExpanded="True"
|
||||
materialDesign:ExpanderAssist.HeaderBackground="PaleTurquoise">
|
||||
materialDesign:ExpanderAssist.HeaderBackground="PaleTurquoise" Expanded="Expander_Expanded" Collapsed="Expander_Collapsed">
|
||||
<Expander.Header >
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<CheckBox Margin="0 0 3 0" IsChecked="{Binding Path=Name.IsSelected}" FontSize="24" />
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
using System;
|
||||
using DM_Weight.Models;
|
||||
using DM_Weight.msg;
|
||||
using Prism.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -20,9 +23,42 @@ namespace DM_Weight.Views
|
|||
/// </summary>
|
||||
public partial class AddToJiaoJieWindow : UserControl
|
||||
{
|
||||
public AddToJiaoJieWindow()
|
||||
IEventAggregator _eventAggregator;
|
||||
public AddToJiaoJieWindow(IEventAggregator eventAggregator)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_eventAggregator = eventAggregator;
|
||||
}
|
||||
//展开
|
||||
private void Expander_Expanded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//Expander expander = sender as Expander;
|
||||
//if (expander != null)
|
||||
//{
|
||||
// // 假设你的数据在DataContext中
|
||||
// List<ChannelStock> data = expander.DataContext as List<ChannelStock>;
|
||||
// if (data != null&&data.Count>0)
|
||||
// {
|
||||
// // 使用data做你需要的操作
|
||||
// }
|
||||
//}
|
||||
}
|
||||
//收起
|
||||
private void Expander_Collapsed(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Expander expander = sender as Expander;
|
||||
if (expander != null)
|
||||
{
|
||||
// 假设你的数据在DataContext中
|
||||
CollectionViewGroup group = expander.DataContext as CollectionViewGroup;
|
||||
if (group != null)
|
||||
{
|
||||
ChannelStock internalGroup = group.Items[0] as ChannelStock;
|
||||
|
||||
_eventAggregator.GetEvent<IsSelectedEvent>().Publish(internalGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
using DM_Weight.Models;
|
||||
using Prism.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DM_Weight.msg
|
||||
{
|
||||
internal class IsSelectedEvent:PubSubEvent<ChannelStock>
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue