1)回收箱添加销毁功能

2)返还药品及返还空瓶记录页面按时间倒序排
This commit is contained in:
maqiao 2023-11-27 13:22:41 +08:00
parent cad28e30f1
commit 3e808f3806
16 changed files with 453 additions and 91 deletions

View File

@ -3,7 +3,8 @@
<connectionStrings>
<!-- 数据库连接字符串 -->
<!--<add name="database" connectionString="server=127.0.0.1;database=wpf_dm_program;userid=root;password=qq1223" />-->
<add name="database" connectionString="server=127.0.0.1;port=3306;database=hkcdb;userid=root;password=root" />
<add name="database" connectionString="server=127.0.0.1;port=3306;database=wuhanxianchang_db;userid=root;password=root" />
<!--<add name="database" connectionString="server=127.0.0.1;port=3306;database=wuhan_db;userid=root;password=root" />-->
</connectionStrings>
<!--<runtime>
--><!--配置之后Appdomain.CurrentDomain.UnhandledException 事件的 IsTerminating 就变成了 false 啦!也就是说,程序并不会因为这次的异常而崩溃退出。--><!--
@ -20,7 +21,7 @@
<!-- 登录顺序,指定先登录的人的名称有效值只有在登录模式等于2时才会生效 发药人【operator】审核人【reviewer】 -->
<add key="firstLogin" value="operator" />
<!-- 按处方还药或者按取药记录还药 1:处方ReturnDrugWindow22药品ReturnDrugWindow-->
<add key="returnDrugMode" value="1" />
<add key="returnDrugMode" value="2" />
<!-- 自动退出时间单位秒为0时不自动退出 -->
<add key="autoExit" value="0"/>
@ -36,9 +37,9 @@
<!-- 抽屉串口使用的协议232或者485 -->
<add key="DrawerProtocol" value="485" />
<!-- 抽屉串口的串口号 -->
<add key="DrawerPortPath" value="COM4" />
<add key="DrawerPortPath" value="COM1" />
<!-- can总线串口的串口号 -->
<add key="CanBusPortPath" value="COM13" />
<add key="CanBusPortPath" value="COM6" />
<!-- 条码枪串口的串口号 -->
<add key="ScanCodePortPath" value="COM8" />
<!-- 抽屉串口的串口号 --><!--

View File

@ -204,6 +204,7 @@ namespace DM_Weight
containerRegistry.RegisterForNavigation<MachineRecordWindow, MachineRecordWindowViewModel>();
containerRegistry.RegisterForNavigation<ShowMessageDialog, ShowMessageDialogViewModel>();
containerRegistry.RegisterForNavigation<ConfirmMessageDialog, ConfirmMessageDialogViewModel>();
}
}

View File

@ -88,7 +88,6 @@ namespace DM_Weight.Models
///</summary>
[SugarColumn(ColumnName = "state")]
public int? State { get; set; }
[SugarColumn(IsIgnore = true)]
public bool IsSelected { get; set; }

View File

@ -480,6 +480,7 @@ namespace DM_Weight.Port
byte[] bytes = await CheckRecoverQuantity();
int[] r1 = bytes.Select(it => Convert.ToInt32(it)).ToArray();
logger.Info($"回收箱查数返回{string.Join(",",r1)}");
// 返回消息库位关闭,放入空瓶数量
int[] quantitys = r1.Skip(3).Take(3).ToArray();
int index = ColNos[0] % 3 > 0 ? ColNos[0] % 3 - 1 : 2;
@ -492,8 +493,8 @@ namespace DM_Weight.Port
_eventAggregator.GetEvent<PortUtilEvent>().Publish(new util.DeviceMsg()
{
EventType = util.EventType.DRAWERCLOSE,
//Quantitys = new int[] { InCount },
Quantitys = quantitys,
Quantitys = new int[] { InCount },
//Quantitys = quantitys,
WindowName = _WindowName,
});
//// 重新初始化数据
@ -648,8 +649,8 @@ namespace DM_Weight.Port
private byte[] GetBufferByPort(SerialPort serialPort, int length, int timeout)
{
byte[] buffer = new byte[length];
try
{
//try
//{
int _length = 0;
DateTime start = DateTime.Now;
DateTime end = DateTime.Now;
@ -663,11 +664,11 @@ namespace DM_Weight.Port
throw new TimeoutException($"串口【{serialPort.PortName}】交互超时");
}
serialPort.Read(buffer, 0, length);
}
catch (Exception ex)
{
logger.Error($"GetBufferByPort{ex.Message}");
}
//}
//catch (Exception ex)
//{
// logger.Error($"GetBufferByPort{ex.Message}");
//}
return buffer;
}
private Task<byte[]> GetBufferByPort(SerialPort serialPort, int length)
@ -1150,10 +1151,10 @@ namespace DM_Weight.Port
try
{
canBusSerial.DiscardInBuffer();
//byte[] buffer = new byte[] { 0xAA, 0x9A, (byte)(ColNos[0] > 3 ? 2 : 1), 0x00, 0x00, 0x00, 0x00, 0xEE };
byte[] buffer = new byte[] { 0xAA, 0x9A, 01,(byte)(ColNos[0] > 3 ? 2 : 1), 0x00, 0x00, 0x00,0xEE };
byte[] buffer = new byte[] { 0xAA, 0x9A, (byte)(ColNos[0] > 3 ? 2 : 1), 0x00, 0x00, 0x00, 0x00, 0xEE };
//byte[] buffer = new byte[] { 0xAA, 0x9A, 01,(byte)(ColNos[0] > 3 ? 2 : 1), 0x00, 0x00, 0x00,0xEE };
canBusSerial.Write(buffer, 0, 8);
logger.Info($"回收箱数量查询发{string.Join(",",buffer)}");
return await GetBufferByPort(canBusSerial, 8);
}

View File

@ -0,0 +1,51 @@
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.DirectoryServices.Protocols;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Interop;
namespace DM_Weight.ViewModels
{
internal class ConfirmMessageDialogViewModel :BindableBase, IDialogAware
{
public string Title => "确认";
private string _msg;
public string Msg { get => _msg; set { SetProperty(ref _msg, value); } }
public event Action<IDialogResult> RequestClose;
public bool CanCloseDialog()
{
return true;
}
public void OnDialogClosed()
{
}
public void OnDialogOpened(IDialogParameters parameters)
{
if (parameters.ContainsKey("msgInfo"))
{
List<string> strPara = parameters.GetValue<List<string>>("msgInfo");
Msg = strPara[0];
}
}
public DelegateCommand NoCommand { get => new DelegateCommand(NoAction);}
public DelegateCommand YesCommand { get => new DelegateCommand(YesAction); }
private void NoAction()
{
RequestClose?.Invoke(new DialogResult(ButtonResult.No));
}
private void YesAction()
{
RequestClose?.Invoke(new DialogResult(ButtonResult.Yes));
}
}
}

View File

@ -145,8 +145,7 @@ namespace DM_Weight.ViewModels
_portUtil.BoardType = singleChannels.Count > 0 ? singleChannels[0].BoardType : 1;
_portUtil.ColNos = singleChannels.Select(it => it.ColNo).ToArray();
_portUtil.DrawerNo = DrawerNo;
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Normal, () => _portUtil.Start())
;
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Normal, () => _portUtil.Start());
}
});

View File

@ -127,20 +127,20 @@ namespace DM_Weight.ViewModels
get { return _selectedMenu; }
set
{
if (value != null)
{
if (value.PremissionName == "退出")
{
logger.Info($"用户【{Operator?.Nickname}】退出登录");
Operator = null;
Reviewer = null;
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
}
else
{
SelectedChildMenu = value.Children[0];
}
}
//if (value != null)
//{
// if (value.PremissionName == "退出")
// {
// logger.Info($"用户【{Operator?.Nickname}】退出登录");
// Operator = null;
// Reviewer = null;
// _regionManager.RequestNavigate("MainRegion", "LoginWindow");
// }
// else
// {
// SelectedChildMenu = value.Children[0];
// }
//}
SetProperty(ref _selectedMenu, value);
}
}
@ -162,7 +162,7 @@ namespace DM_Weight.ViewModels
}
else
{
SelectedMenu.Children = SelectedMenu.Children;
//SelectedMenu.Children = SelectedMenu.Children;
SelectedChildMenu = SelectedMenu.Children[0];
}
}
@ -275,6 +275,7 @@ namespace DM_Weight.ViewModels
//.ToTree(pd => pd.Children, pd => pd.ParentId, 0);
PremissionDmList = premissions;
SelectedMenu = premissions[0];
SelectedChildMenu = SelectedMenu.Children[0];
FindDrawerCount();
int autoExit = Convert.ToInt32(ConfigurationManager.AppSettings["autoExit"] ?? "0");

View File

@ -51,7 +51,7 @@ namespace DM_Weight.ViewModels
//get => loginMode == 2;
get => ReadAppSetting("loginMode") == "2";
}
private FingerprintUtil _fingerprintUtil;
//private FingerprintUtil _fingerprintUtil;
private PortUtil _portUtil;
@ -105,7 +105,7 @@ _exitCommand ??= new DelegateCommand(Exit);
public bool KeepAlive => false;
void Login()
void Login()
{
LoginBtnEnable = false;
if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
@ -278,7 +278,7 @@ _exitCommand ??= new DelegateCommand(Exit);
RaisePropertyChanged("Reviewer");
}
Username = string.Empty;
Password =string.Empty;
Password = string.Empty;
}
}
}

View File

@ -183,9 +183,10 @@ namespace DM_Weight.ViewModels
.Includes<DrugInfo>(mr => mr.DrugInfo)
.Includes<UserList>(mr => mr.User)
.WhereIF(Type == 3, (mr) => new int[] { 31, 32 }.Contains(mr.Type))
.WhereIF(Type != 3, (mr) => mr.Type == Type )
.WhereIF(StartDate !=null, (mr) => mr.OperationTime > StartDate)
.WhereIF(EndDate!=null, (mr) => mr.OperationTime < EndDate)
.WhereIF(Type != 3, (mr) => mr.Type == Type)
.WhereIF(StartDate != null, (mr) => mr.OperationTime > StartDate)
.WhereIF(EndDate != null, (mr) => mr.OperationTime < EndDate)
.OrderBy(mr => mr.OperationTime, OrderByType.Desc)
//.Select(mr => mr)
.ToPageList(PageNum, PageSize, ref totalCount);
//.ToList();

View File

@ -11,6 +11,7 @@ using System.Threading.Tasks;
using DM_Weight.Models;
using DM_Weight.select;
using DM_Weight.util;
using SqlSugar;
namespace DM_Weight.ViewModels
{
@ -190,7 +191,7 @@ namespace DM_Weight.ViewModels
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugName"), (mr) => mr.DrugInfo.DrugName.Contains(SearchValue))
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("PyCode"), (mr) => mr.DrugInfo.PyCode.Contains(SearchValue))
.WhereIF(!String.IsNullOrEmpty(SearchValue) && SelectedItem.Code.Equals("DrugBarcode"), (mr) => mr.DrugInfo.DrugBarcode.Contains(SearchValue))
.OrderBy(mr => mr.OperationTime)
.OrderBy(mr => mr.OperationTime,OrderByType.Desc)
.ToList();
MachineRecords = queryData;
}

View File

@ -18,6 +18,8 @@ using DM_Weight.msg;
using DM_Weight.Port;
using DM_Weight.util;
using DM_Weight.Views;
using SqlSugar;
using System.Threading.Channels;
namespace DM_Weight.ViewModels
{
@ -67,11 +69,11 @@ namespace DM_Weight.ViewModels
Status = 3;
if(ChannelStock.DrawerType == 3)
{
for (int i = 0; i < msg.Quantitys.Length; i++)
{
ReturnQuantity += msg.Quantitys[i];
}
//ReturnQuantity = msg.Quantitys[0];
//for (int i = 0; i < msg.Quantitys.Length; i++)
//{
// ReturnQuantity += msg.Quantitys[i];
//}
ReturnQuantity = msg.Quantitys[0];
logger.Info($"抽屉【{ChannelStock.DrawerNo}】回收库位药品数量增加【{msg.Quantitys[0]}】");
}
}
@ -136,7 +138,13 @@ namespace DM_Weight.ViewModels
SetProperty(ref _machineRecords, value);
}
}
private MachineRecord _machineRecord;
public MachineRecord MachineRecordStock
{
get { return _machineRecord; }
set { SetProperty(ref _machineRecord, value); }
}
private ChannelStock _channelStock;
public ChannelStock ChannelStock
@ -176,7 +184,7 @@ namespace DM_Weight.ViewModels
.Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
.Where(mr => mr.Type == 2)
.Where(mr => mr.Status != 2)
.OrderBy(mr => mr.OperationTime)
.OrderBy(mr => mr.OperationTime,OrderByType.Desc)
.OrderBy(mr => mr.Id)
.ToList();
MachineRecords = queryData;
@ -219,7 +227,25 @@ namespace DM_Weight.ViewModels
});
}
public DelegateCommand RowSelected
{
get => new DelegateCommand(() =>
{
if (MachineRecords != null)
{
MachineRecords = MachineRecords.Select(x =>
{
if (x.Id == MachineRecordStock.Id)
{
x.IsSelected = !x.IsSelected;
}
return x;
}).ToList();
}
});
}
private bool _isFinishClick = false;
public bool IsFinishClick { get => _isFinishClick; set => SetProperty(ref _isFinishClick, value); }
@ -259,7 +285,7 @@ namespace DM_Weight.ViewModels
ReturnQuantity2 = _MachineRecord.Quantity - _MachineRecord.ReturnQuantity1,
Id = _MachineRecord.Id,
Status = 2,
}).UpdateColumns(it => new { it.ReturnQuantity1, it.Status }).ExecuteCommand();
}).UpdateColumns(it => new { it.ReturnQuantity2, it.Status }).ExecuteCommand();
// 保存数据 还药空瓶记录
SqlSugarHelper.Db.Insertable(new MachineRecord()
@ -268,7 +294,8 @@ namespace DM_Weight.ViewModels
DrawerNo = ChannelStock.DrawerNo,
ColNo = ChannelStock.ColNo,
DrugId = ChannelStock.DrugId,
ManuNo = ChannelStock.ManuNo,
//ManuNo = ChannelStock.ManuNo,
ManuNo = _MachineRecord.ManuNo,
EffDate = !String.IsNullOrEmpty(ChannelStock.EffDate) ? DateTime.ParseExact(ChannelStock.EffDate, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture) : null,
Operator = HomeWindowViewModel.Operator?.Id,
Reviewer = HomeWindowViewModel.Reviewer?.Id,

View File

@ -12,13 +12,17 @@ using DM_Weight.Models;
using DM_Weight.util;
using System.Reflection.PortableExecutable;
using System.Configuration;
using DM_Weight.msg;
using Prism.Events;
using DM_Weight.Port;
using System.Threading.Channels;
namespace DM_Weight.ViewModels
{
public class ReturnEmptyWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
{
private List<ChannelStock>? _channelStocks;
@ -35,34 +39,225 @@ namespace DM_Weight.ViewModels
get { return _channelStock; }
set { SetProperty(ref _channelStock, value); }
}
public event Action<IDialogResult> RequestClose;
IDialogService _dialogService;
public ReturnEmptyWindowViewModel(IDialogService dialogService)
IEventAggregator _eventAggregator;
public ReturnEmptyWindowViewModel(IDialogService dialogService, IEventAggregator eventAggregator)
{
_dialogService = dialogService;
_eventAggregator = eventAggregator;
}
public DelegateCommand RowSelected
{
get => new DelegateCommand(() =>
{
if (Channel != null && Channel.DrugId == null)
if (Channel != null && Channel.DrugId != null)
{
Channels = Channels.Select(x =>
{
if (x.Id == Channel.Id)
{
x.IsSelected = !x.IsSelected;
}
return x;
}).ToList();
}
else if(Channel != null && Channel.DrugId == null)
{
DialogParameters dialogParameters = new DialogParameters();
dialogParameters.Add("DrawerNo", Channel.DrawerNo);
DialogServiceExtensions.ShowDialogHost(_dialogService, "BindingChannelDialog", dialogParameters, DoDialogResult, "RootDialog");
}
else if(Channel != null && Channel.CanReturnQuantity > 0)
//if (Channel != null && Channel.DrugId == null)
//{
// DialogParameters dialogParameters = new DialogParameters();
// dialogParameters.Add("DrawerNo", Channel.DrawerNo);
// DialogServiceExtensions.ShowDialogHost(_dialogService, "BindingChannelDialog", dialogParameters, DoDialogResult, "RootDialog");
//}
//else if (Channel != null && Channel.CanReturnQuantity > 0)
//{
// DialogParameters dialogParameters = new DialogParameters();
// dialogParameters.Add("channel", Channel);
// DialogServiceExtensions.ShowDialogHost(_dialogService, "ReturnEmptyDialog", dialogParameters, DoDialogResult, "RootDialog");
//}
});
}
//还空瓶
public DelegateCommand ReturnEmptyCommand
{
get => new DelegateCommand(() =>
{
List<ChannelStock> records = Channels.FindAll(it => it.IsSelected).ToList();
if (records.Count > 0)
{
DialogParameters dialogParameters = new DialogParameters();
dialogParameters.Add("channel", Channel);
DialogServiceExtensions.ShowDialogHost(_dialogService, "ReturnEmptyDialog", dialogParameters, DoDialogResult, "RootDialog");
if(records.Count > 1&&records.FindAll(rs=>rs.CanReturnQuantity>0).Count>1)
{
//还空瓶只能选择一条进行归还
AlertMsg alertMsg = new AlertMsg
{
Message = "请选择一条可归还数量不为0的数据进行归还",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
else
{
DialogParameters dialogParameters = new DialogParameters();
dialogParameters.Add("channel", records.Single(rs => rs.CanReturnQuantity > 0));
DialogServiceExtensions.ShowDialogHost(_dialogService, "ReturnEmptyDialog", dialogParameters, DoDialogResult, "RootDialog");
}
}
else
{
AlertMsg alertMsg = new AlertMsg
{
Message = "请选择要还的空瓶",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
});
}
private List<ChannelStock> csList=new List<ChannelStock>();
//销毁
public DelegateCommand DestoryCommand
{
get => new DelegateCommand(() =>
{
if (Channels != null && Channels.Count > 0)
{
csList = Channels.FindAll(it => it.IsSelected && it.Quantity > 0).ToList();
if (csList != null && csList.Count > 0)
{
//RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
//DialogParameters dialogParameters = new DialogParameters();
//List<string> msg = new List<string>();
//msg.Add("确认");
//msg.Add("确认要销毁吗?");
//dialogParameters.Add("msgInfo", msg);
//DialogServiceExtensions.ShowDialogHost(_dialogService, "ConfirmMessageDialog", dialogParameters, DestoryDialogResult, "RootDialog");
csList.ForEach(it => it.Quantity = 0);
var f = SqlSugarHelper.Db.UseTran(() =>
{
SqlSugarHelper.Db.Updateable(csList).ExecuteCommand();
string[] str=new string[csList.Count];
str=csList.Select(t=>t.DrugId).ToArray();
List<MachineRecord> machines = SqlSugarHelper.Db.Queryable<MachineRecord>()
//.InnerJoin<ChannelStock>((mr, cs) => mr.DrugId == cs.DrugId)
//.Where(mr => mr.DrugId.Contains(csList.Select(it => it.DrugId).ToList()) && mr.Type = 32)
.Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
.In(mr=>mr.DrugId, str)
.Where(mr => mr.Type == 32)
.ToList();
SqlSugarHelper.Db.Updateable(machines).ReSetValue(mr =>
{
mr.IsDestroy = 1;
}).ExecuteCommand();
return true;
});
if (f.Data)
{
RequestData();
AlertMsg alertMsg = new AlertMsg
{
Message = "销毁完成",
Type = MsgType.SUCCESS,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
if (!f.IsSuccess)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "销毁失败!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
}
else
{
AlertMsg alertMsg = new AlertMsg
{
Message = "未勾选要销毁的数据或勾选的数据库存为0",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
}
else
{
AlertMsg alertMsg = new AlertMsg
{
Message = "没有要操作销毁的数据",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
});
}
private void DestoryDialogResult(IDialogResult dialogResult)
{
if(dialogResult.Result==ButtonResult.Yes)
{
DestoryAction();
}
}
//执行销毁操作
private void DestoryAction()
{
if (csList != null && csList.Count > 0)
{
csList.ForEach(it => it.Quantity = 0);
var f = SqlSugarHelper.Db.UseTran(() =>
{
SqlSugarHelper.Db.Updateable(csList).ExecuteCommand();
List<MachineRecord> machines = SqlSugarHelper.Db.Queryable<MachineRecord>()
.InnerJoin<ChannelStock>((mr, cs) => mr.DrugId == cs.DrugId)
//.Where(mr => mr.DrugId.Contains(csList.Select(it => it.DrugId).ToList()) && mr.Type = 32)
.Where(mr => mr.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
.Where(mr => mr.Type == 32)
.ToList();
SqlSugarHelper.Db.Updateable(machines).ReSetValue(mr =>
{
mr.IsDestroy = 1;
}).ExecuteCommand();
return true;
});
if (f.Data)
{
RequestData();
AlertMsg alertMsg = new AlertMsg
{
Message = "销毁完成",
Type = MsgType.SUCCESS,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
if (!f.IsSuccess)
{
AlertMsg alertMsg = new AlertMsg
{
Message = "销毁失败!",
Type = MsgType.ERROR,
};
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
}
}
}
private void DoDialogResult(IDialogResult dialogResult)
{
// 委托 被动执行 被子窗口执行
@ -100,10 +295,11 @@ namespace DM_Weight.ViewModels
{
Channels = SqlSugarHelper.Db.Queryable<ChannelStock>()
.LeftJoin<DrugInfo>((cs,di) => cs.DrugId == di.DrugId.ToString())
.Where((cs) => cs.DrawerType != 1&& cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
.Select((cs, di) => new ChannelStock{
CanReturnQuantity = SqlFunc.Subqueryable<MachineRecord>().Where(mr => mr.DrugId == cs.DrugId).Where(mr => mr.Type == 2).Where(mr => mr.Status != 2).Select(mr => SqlFunc.IsNull(SqlFunc.AggregateSumNoNull(mr.Quantity - mr.ReturnQuantity1 - mr.ReturnQuantity2), 0)) ,
.LeftJoin<DrugInfo>((cs, di) => cs.DrugId == di.DrugId.ToString())
.Where((cs) => cs.DrawerType != 1 && cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1"))
.Select((cs, di) => new ChannelStock
{
CanReturnQuantity = SqlFunc.Subqueryable<MachineRecord>().Where(mr => mr.DrugId == cs.DrugId).Where(mr => mr.Type == 2).Where(mr => mr.Status != 2).Select(mr => SqlFunc.IsNull(SqlFunc.AggregateSumNoNull(mr.Quantity - mr.ReturnQuantity1 - mr.ReturnQuantity2), 0)),
DrugInfo = new DrugInfo
{
DrugId = di.DrugId,

View File

@ -0,0 +1,25 @@
<UserControl x:Class="DM_Weight.Views.Dialog.ConfirmMessageDialog"
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:local="clr-namespace:DM_Weight.Views.Dialog"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<TextBlock Padding="5" d:Text="确认" FontSize="14"
Text="{Binding Title}" Style="{StaticResource MaterialDesignCaptionTextBlock}"/>
<TextBlock Grid.Row="1" Padding="15,0" HorizontalAlignment="Center" VerticalAlignment="Center"
Text="{Binding Msg}" FontSize="18" Margin="5" FontWeight="Bold"/>
<StackPanel Grid.Row="2" Margin="10" HorizontalAlignment="Center" Orientation="Horizontal">
<Button Command="{Binding YesCommand}" Content="是"/>
<Grid Width="10"></Grid>
<Button Command="{Binding NoCommand}" Content="否"/>
</StackPanel>
</Grid>
</UserControl>

View File

@ -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.Dialog
{
/// <summary>
/// ConfirmMessageDialog.xaml 的交互逻辑
/// </summary>
public partial class ConfirmMessageDialog : UserControl
{
public ConfirmMessageDialog()
{
InitializeComponent();
}
}
}

View File

@ -8,6 +8,7 @@
prism:ViewModelLocator.AutoWireViewModel="True"
xmlns:convert="clr-namespace:DM_Weight.Converter"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
MinWidth="880"
Width="Auto"
Height="Auto"
@ -35,7 +36,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="50" />
<RowDefinition Height="Auto" />
<RowDefinition Height="300" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Background="#03a9f4" Grid.Row="0">
@ -120,45 +121,51 @@
Style="{StaticResource MaterialDesignBody2TextBlock}"
Text="{Binding ChannelStock.CanReturnQuantity}" />
</Grid>
<ListView
Grid.Row="2"
ItemsSource="{Binding MachineRecords}"
<ScrollViewer Grid.Row="2">
<ListView
ItemsSource="{Binding MachineRecords}" SelectedItem="{Binding MachineRecordStock}"
materialDesign:ListViewAssist.HeaderRowBackground="#31ccec"
materialDesign:DataGridAssist.ColumnHeaderPadding="10"
materialDesign:ListViewAssist.ListViewItemPadding="13">
<ListView.Resources>
<Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
<Setter Property="Foreground" Value="White" />
</Style>
</ListView.Resources>
<ListView.View>
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
<GridViewColumn Header="选择" Width="100">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsSelected}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="100"
<ListView.Resources>
<Style TargetType="{x:Type GridViewColumnHeader}" BasedOn="{StaticResource {x:Type GridViewColumnHeader}}">
<Setter Property="Foreground" Value="White" />
</Style>
</ListView.Resources>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding RowSelected}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListView.View>
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
<GridViewColumn Header="选择" Width="100">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsSelected}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="100"
Header="操作人"
DisplayMemberBinding="{Binding User.Nickname}"/>
<GridViewColumn Width="150"
<GridViewColumn Width="150"
Header="时间"
DisplayMemberBinding="{Binding OperationTime, StringFormat='yyyy-MM-dd HH:mm:ss'}" />
<GridViewColumn Width="100"
<GridViewColumn Width="100"
DisplayMemberBinding="{Binding Quantity}"
Header="数量"/>
<GridViewColumn Width="150"
<GridViewColumn Width="150"
DisplayMemberBinding="{Binding ManuNo}"
Header="批次"/>
<GridViewColumn Width="150"
<GridViewColumn Width="150"
DisplayMemberBinding="{Binding EffDate, StringFormat=yyyy-MM-dd}"
Header="效期"/>
</GridView>
</ListView.View>
</ListView>
</GridView>
</ListView.View>
</ListView>
</ScrollViewer>
<Grid Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition />

View File

@ -29,8 +29,19 @@
<RowDefinition />
</Grid.RowDefinitions>
<Grid Margin="0 6 0 6" Grid.Row="0">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button
Margin="0 0 3 0"
VerticalAlignment="Center"
Command="{Binding ReturnEmptyCommand}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
Content="还空瓶" />
<Button
Margin="0 0 3 0"
VerticalAlignment="Center"
Command="{Binding DestoryCommand}"
Style="{StaticResource MaterialDesignOutlinedLightButton}"
Content="销毁" />
<Button
Margin="0 0 6 0"
VerticalAlignment="Center"
@ -44,6 +55,7 @@
</StackPanel>
</Grid>
<ListView
x:Name="ViewList"
Grid.Row="1"
ItemsSource="{Binding Channels}"
SelectedItem="{Binding Channel}"
@ -59,9 +71,21 @@
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding RowSelected}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</i:Interaction.Triggers>
<!--<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:InvokeCommandAction Command="{Binding RowSelected}" />
</i:EventTrigger>
</i:Interaction.Triggers>-->
<ListView.View>
<GridView ColumnHeaderContainerStyle="{StaticResource st}">
<GridViewColumn Header="选择" Width="100">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsSelected}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="140"
Header="库位"
DisplayMemberBinding="{Binding Location}"/>