更新提交
This commit is contained in:
parent
430ae69abe
commit
811c4a5a99
|
@ -16,7 +16,7 @@
|
|||
<!--2023/7/13 药房代码 有则写无则空 -->
|
||||
<add key="storage" value="" />
|
||||
<!-- 登录模式 1单人登录2双人登录 -->
|
||||
<add key="loginMode" value="2" />
|
||||
<add key="loginMode" value="1" />
|
||||
<!-- 登录顺序,指定先登录的人的名称有效值,只有在登录模式等于2时才会生效; 发药人:【operator】审核人:【reviewer】 -->
|
||||
<add key="firstLogin" value="operator" />
|
||||
<!-- 按处方还药或者按取药记录还药 1:处方2:药品-->
|
||||
|
|
|
@ -247,6 +247,9 @@ namespace DM_Weight
|
|||
//交接班
|
||||
containerRegistry.RegisterForNavigation<ChangeShiftsDialog, ChangeShiftsDialogViewModel>();
|
||||
|
||||
//手术取药
|
||||
containerRegistry.RegisterForNavigation<OperationTakeWindow, OperationTakeWindowViewModel>();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,21 +176,5 @@ namespace DM_Weight.Models
|
|||
[Navigate(NavigateType.OneToMany, nameof(ChannelStock.Chnguid))]
|
||||
public List<ChannelStock> channelStocks { get => _channelStocks; set => SetProperty(ref _channelStocks, value); }
|
||||
|
||||
private DelegateCommand<ChannelList> _addManunoCommand;
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public DelegateCommand<ChannelList> AddManunoCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_addManunoCommand == null)
|
||||
_addManunoCommand = new DelegateCommand<ChannelList>(o => DoDelete(o));
|
||||
return _addManunoCommand;
|
||||
}
|
||||
}
|
||||
|
||||
private void DoDelete(ChannelList parameter)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,5 +85,7 @@ namespace DM_Weight.Models
|
|||
public string drug_name_spec { get; set; }
|
||||
//[SugarColumn(ColumnName = "drug_name_spec")]
|
||||
//public string Name { get; set; }
|
||||
[Navigate(NavigateType.OneToMany, nameof(DrugManuNo.DrugId))]//BookA表中的studenId
|
||||
public DrugManuNo? drugManuNo { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,5 +127,14 @@ namespace DM_Weight.Models
|
|||
///</summary>
|
||||
[SugarColumn(ColumnName = "use_dosage")]
|
||||
public string UseDosage { get; set; }
|
||||
|
||||
[Navigate(NavigateType.ManyToOne, nameof(DrugId))]
|
||||
public List<DrugInfo> DrugInfos { get; set; }
|
||||
|
||||
[Navigate(NavigateType.OneToMany, nameof(DrugId))]
|
||||
public DrugManuNo drugManuNo { get; set; }
|
||||
|
||||
[Navigate(NavigateType.ManyToMany, nameof(DrugId))]
|
||||
public List<DrugManuNo> DrugManuNos { get; set; }
|
||||
}
|
||||
}
|
|
@ -340,9 +340,28 @@ namespace DM_Weight.ViewModels
|
|||
msg = "抽屉加药完成,库存已更新";
|
||||
}
|
||||
// 更新屏显库存
|
||||
List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||
//List<ChannelStock> singleChannels = record.FindAll(it => it.BoardType != 1);
|
||||
List<ChannelStock> singleChannels = record.Where(it => it.BoardType != 1)
|
||||
.GroupBy(it => it.ColNo)
|
||||
.Select(it =>
|
||||
{
|
||||
var ret = it.First();
|
||||
ret.Quantity = it.Sum(itx => itx.Quantity);
|
||||
ret.AddQuantity = it.Sum(itx => itx.AddQuantity);
|
||||
return ret;
|
||||
}).ToList();
|
||||
//var s = singleChannels.GroupBy(x=>x.ColNo)
|
||||
// .Select(x => {
|
||||
// var ret = x.First();
|
||||
// ret.Quantity = x.Sum(xt => xt.Quantity);
|
||||
// ret.AddQuantity = x.Sum(xt => xt.AddQuantity);
|
||||
// return ret;
|
||||
// }).ToList();
|
||||
if ((singleChannels.Count > 0 ? singleChannels[0].BoardType : 1) == 5)
|
||||
{
|
||||
//将库位多批次的总库存数更新标签
|
||||
//_portUtil.WriteQuantity(singleChannels[0].DrawerNo, singleChannels[0].ColNo, singleChannels.Sum(it => it.Quantity) + singleChannels.Sum(it => it.AddQuantity));
|
||||
|
||||
singleChannels.ForEach(it =>
|
||||
{
|
||||
_portUtil.WriteQuantity(it.DrawerNo, it.ColNo, it.Quantity + it.AddQuantity);
|
||||
|
|
|
@ -346,14 +346,14 @@ namespace DM_Weight.ViewModels
|
|||
_portUtil.WindowName = "BindingChannelDialog";
|
||||
// 向显示屏写入库位信息
|
||||
_portUtil.WriteChannelInfo(1, DrugInfo.DrugName, item.DrawerNo, item.ColNo);
|
||||
//await Task.Delay(200);
|
||||
Thread.Sleep(200);
|
||||
await Task.Delay(200);
|
||||
//Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(2, DrugInfo.DrugSpec, item.DrawerNo, item.ColNo);
|
||||
//await Task.Delay(200);
|
||||
Thread.Sleep(200);
|
||||
await Task.Delay(200);
|
||||
//Thread.Sleep(200);
|
||||
_portUtil.WriteChannelInfo(8, DrugInfo.Manufactory, item.DrawerNo, item.ColNo);
|
||||
//await Task.Delay(200);
|
||||
Thread.Sleep(200);
|
||||
await Task.Delay(200);
|
||||
//Thread.Sleep(200);
|
||||
//_portUtil.WriteChannelInfo(6, DrugManuNo.ManuNo, item.DrawerNo, item.ColNo);
|
||||
//await Task.Delay(200);
|
||||
//Thread.Sleep(200);
|
||||
|
|
|
@ -310,7 +310,7 @@ _exitCommand ??= new DelegateCommand(Exit);
|
|||
|
||||
void LoginEvent(FingerprintMsg msg)
|
||||
{
|
||||
logger.Info(msg.ToString());
|
||||
logger.Info(msg.ToString()+ ";LoginBtnEnable:"+ LoginBtnEnable);
|
||||
if (msg.Message.Equals("CONNECT"))
|
||||
{
|
||||
FingerMsg = !msg.Result;
|
||||
|
|
|
@ -108,7 +108,14 @@ namespace DM_Weight.ViewModels
|
|||
async Task BindStock()
|
||||
{
|
||||
List<ChannelStock> singleChannels = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.BoardType == 5).Where(cs => cs.DrugId !=null).ToList();
|
||||
|
||||
singleChannels= singleChannels.GroupBy(cs =>new { cs.DrawerNo,cs.ColNo })
|
||||
.Select(cs => {
|
||||
var ret = cs.First();
|
||||
ret.Quantity = cs.Sum(xt => xt.Quantity);
|
||||
return ret;
|
||||
}).ToList();
|
||||
|
||||
|
||||
for (int i = 0; i < singleChannels.Count; i++)
|
||||
{
|
||||
_portUtil.WriteQuantity(singleChannels[i].DrawerNo, singleChannels[i].ColNo, singleChannels[i].Quantity);
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
using DM_Weight.Models;
|
||||
using DM_Weight.util;
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
public class OperationTakeWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
||||
{
|
||||
/// <summary>
|
||||
/// 处方明细
|
||||
/// </summary>
|
||||
private ObservableCollection<OrderDetail> _orderDetails = new ObservableCollection<OrderDetail>();
|
||||
public ObservableCollection<OrderDetail> OrderDetails
|
||||
{
|
||||
get { return _orderDetails; }
|
||||
set { SetProperty(ref _orderDetails, value); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 药品集合
|
||||
/// </summary>
|
||||
private ObservableCollection<DrugInfo> _drugInfos=new ObservableCollection<DrugInfo>();
|
||||
public ObservableCollection<DrugInfo> DrugInfos
|
||||
{
|
||||
get { return _drugInfos; }
|
||||
set { SetProperty(ref _drugInfos, value); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 加药按钮操作
|
||||
/// </summary>
|
||||
public DelegateCommand AddBtnCommand => new DelegateCommand(AddBtnAction);
|
||||
|
||||
public bool KeepAlive => false;
|
||||
|
||||
private void AddBtnAction()
|
||||
{
|
||||
OrderDetail orderDetail = new OrderDetail();
|
||||
orderDetail.PatientId = "123";
|
||||
orderDetail.OrderNo = "123";
|
||||
List<DrugInfo> dgs= DrugInfos.ToList();
|
||||
orderDetail.DrugInfos = dgs;
|
||||
orderDetail.DrugInfo = dgs?[0];
|
||||
OrderDetails.Add(orderDetail);
|
||||
|
||||
}
|
||||
public void RequestData()
|
||||
{
|
||||
//List<OrderDetail> queryData = SqlSugarHelper.Db.Queryable<OrderDetail>()
|
||||
// .Includes(cl => cl.DrugInfo, di => di.DrugManuNos)
|
||||
// .Where(cl => cl.DrawerNo == DrawerNo)
|
||||
// .Where(cl => cl.DrawerType == 1)
|
||||
// .Where(cl => cl.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
|
||||
// .Where(cl => cl.DrugId != null)
|
||||
// .OrderBy(cl => cl.ColNo)
|
||||
// .ToList();
|
||||
//ChannelLsts = queryData.Select(cl =>
|
||||
//{
|
||||
// cl.channelStocks = cl.channelStocks.Select(cs =>
|
||||
// {
|
||||
// cs.drugManuNo = cl.Drug.DrugManuNos.Find(it => it.ManuNo.Equals(cs.ManuNo));
|
||||
// return cs;
|
||||
// }).ToList();
|
||||
// return cl;
|
||||
//}).ToList();
|
||||
////ChannelLsts = new ObservableCollection<ChannelList>(queryData);
|
||||
//ChannelLsts.ForEach(cl => cl.channelStocks.ForEach(cs => cs.DrugInfo = cl.Drug));
|
||||
|
||||
DrugInfos=new ObservableCollection<DrugInfo>(SqlSugarHelper.Db.Queryable<DrugInfo>()
|
||||
.Includes(di=>di.DrugManuNos)
|
||||
.OrderBy(cl=>cl.DrugId).ToList());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
|
||||
{
|
||||
continuationCallback(true);
|
||||
}
|
||||
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
RequestData();
|
||||
}
|
||||
|
||||
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -149,11 +149,18 @@ namespace DM_Weight.ViewModels
|
|||
PremissionName = "取药记录",
|
||||
PremissionPath = "TakeRecordWindow",
|
||||
};
|
||||
PremissionDm quyao6 = new PremissionDm
|
||||
{
|
||||
Id = 16,
|
||||
PremissionName = "手术取药",
|
||||
PremissionPath = "OperationTakeWindow",
|
||||
};
|
||||
quyaoChild.Add(quyao1);
|
||||
quyaoChild.Add(quyao2);
|
||||
quyaoChild.Add(quyao3);
|
||||
quyaoChild.Add(quyao4);
|
||||
quyaoChild.Add(quyao5);
|
||||
quyaoChild.Add(quyao6);
|
||||
quyao.Children = quyaoChild;
|
||||
defaultAll.Add(quyao);
|
||||
#endregion
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
IsEditable="True"
|
||||
ItemsSource="{Binding DrugInfos}"
|
||||
SelectedItem="{Binding DrugInfo}"
|
||||
DisplayMemberPath="DrugName"
|
||||
DisplayMemberPath="DrugName" IsTextSearchEnabled="False"
|
||||
/>
|
||||
<ComboBox
|
||||
Grid.Column="2"
|
||||
|
|
|
@ -0,0 +1,165 @@
|
|||
<UserControl x:Class="DM_Weight.Views.OperationTakeWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:local="clr-namespace:DM_Weight.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollViewer Grid.Row="1" Margin="6">
|
||||
<!--<ItemsControl
|
||||
ItemsSource="{Binding ChannelLsts}"
|
||||
Grid.IsSharedSizeScope="True">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>-->
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Border BorderBrush="White" BorderThickness="1">
|
||||
<StackPanel Orientation="Horizontal" Background="#31ccec" Grid.Column="0">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock TextWrapping="Wrap" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="0 10 0 0 " />
|
||||
|
||||
<TextBlock TextWrapping="Wrap" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="0 0 0 1 " />
|
||||
<Button Grid.Row="2" Padding="0 0 0 1 " Style="{x:Null}" BorderBrush="{x:Null}" Background="{x:Null}" Command="{Binding AddBtnCommand}" >
|
||||
|
||||
<Button.Content>
|
||||
<Border Width="32" Height="32" CornerRadius="16" Background="CornflowerBlue" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Path Data="M0 11L22 11M11 0L11 22" Stroke="WhiteSmoke" StrokeThickness="4" VerticalAlignment="Center" HorizontalAlignment="Center"></Path>
|
||||
</Border>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<DataGrid
|
||||
Margin="0"
|
||||
Grid.Column="1"
|
||||
materialDesign:DataGridAssist.ColumnHeaderPadding="15"
|
||||
ItemsSource="{Binding OrderDetails}"
|
||||
materialDesign:DataGridAssist.EnableEditBoxAssist="False"
|
||||
materialDesign:DataGridAssist.CellPadding="13"
|
||||
SelectionUnit="Cell"
|
||||
CanUserAddRows="False"
|
||||
AutoGenerateColumns="False">
|
||||
<DataGrid.Resources>
|
||||
<Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}">
|
||||
<Setter Property="Background" Value="#31ccec" />
|
||||
<Setter Property="Foreground" Value="white" />
|
||||
<Setter Property="Height" Value="56" />
|
||||
<Setter Property="BorderBrush" Value="white"/>
|
||||
<Setter Property="BorderThickness" Value="0.6"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
|
||||
</Style>
|
||||
<Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource MaterialDesignDataGridCell}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsReadOnly" Value="True">
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<!--<DataGridTextColumn Width="80"
|
||||
Binding="{Binding ColNo}"
|
||||
Header="库位"
|
||||
IsReadOnly="True"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
||||
<DataGridTextColumn Width="180"
|
||||
Binding="{Binding DrugInfo.DrugName}"
|
||||
Header="药品名称"
|
||||
IsReadOnly="True"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>-->
|
||||
|
||||
<DataGridTemplateColumn Width="180" IsReadOnly="True" Header="药品名称">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox Style="{StaticResource MaterialDesignDataGridComboBox}"
|
||||
ItemsSource="{Binding DrugInfos}" SelectedItem="{Binding DrugInfo,UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="DrugName">
|
||||
</ComboBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTextColumn Width="100"
|
||||
Binding="{Binding DrugInfo.DrugSpec}"
|
||||
Header="规格"
|
||||
IsReadOnly="True"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
||||
<DataGridTemplateColumn Width="200" IsReadOnly="True"
|
||||
Header="批次">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox
|
||||
Style="{StaticResource MaterialDesignDataGridComboBox}"
|
||||
ItemsSource="{Binding DrugInfo.DrugManuNos}"
|
||||
SelectedItem="{Binding drugManuNo,UpdateSourceTrigger=PropertyChanged}"
|
||||
DisplayMemberPath="ManuNo">
|
||||
</ComboBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Width="100"
|
||||
Binding="{Binding drugManuNo.EffDate}"
|
||||
Header="效期"
|
||||
IsReadOnly="True"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>
|
||||
<!--<DataGridTextColumn Width="100"
|
||||
Binding="{Binding Quantity}"
|
||||
Header="库存"
|
||||
IsReadOnly="True"
|
||||
ElementStyle="{StaticResource MaterialDesignDataGridTextColumnStyle}"/>-->
|
||||
<DataGridTemplateColumn Width="100"
|
||||
Header="添加数量">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Style="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}">
|
||||
<TextBox.Text>
|
||||
<Binding Path="Quantity" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
|
||||
<Binding.ValidationRules>
|
||||
<ExceptionValidationRule />
|
||||
</Binding.ValidationRules>
|
||||
</Binding>
|
||||
</TextBox.Text>
|
||||
</TextBox>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
<!--</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>-->
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace DM_Weight.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// OperationTakeWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class OperationTakeWindow : UserControl
|
||||
{
|
||||
public OperationTakeWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue